Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/percpu: store safe references to HV doorbell page and SVSM VMSA #387

Merged
merged 5 commits into from
Jun 25, 2024

Conversation

00xc
Copy link
Member

@00xc 00xc commented Jun 19, 2024

  • Store a safe reference to the HV doorbell in the PerCpu
  • Cleanups and add some documentation
  • Store a safe reference to the SVSM VMSA in the PerCpu

00xc added 4 commits June 19, 2024 10:57
Mutable references to the HV doorbell page are never given, as its
data is fully atomic. Thus, there is no need to use raw pointers.

Since we need a pointer to the location of the safe reference itself
in the PerCpu for #HV servicing, use a OnceCell, which gives out
references to the inner T under the assumption that the type can only
be set once, which suits our use. With a &T (in this case a &&'static
HVDoorbell), we can obtain a pointer to the inner value.

Signed-off-by: Carlos López <[email protected]>
Document some parts of the PerCpu that might not be straightforward to
understand.

Signed-off-by: Carlos López <[email protected]>
There is no need for the several steps of SVSM VMSA initialization to
be split up, and they only make for a more awkward initialization.
Thus, merge them into a single PerCpu method.

Signed-off-by: Carlos López <[email protected]>
start_cpu() had several calls to expect() on various error conditions.
Clean up the function by returning the error and letting the caller
panic with the specific error.

Signed-off-by: Carlos López <[email protected]>
@00xc 00xc mentioned this pull request Jun 19, 2024
13 tasks
@00xc
Copy link
Member Author

00xc commented Jun 19, 2024

Once this is merged I'll rework #348 to remove the remaining unsafe around page allocations

The SVSM VMSA only needs to me mutated during initialization. Thus
simply encapsulate that step in a PerCpu method and store an
immutable reference to the VMSA, avoiding the possibility of mutably
aliasing it.

This obsoletes the VmsaRef type.

Signed-off-by: Carlos López <[email protected]>
@joergroedel joergroedel merged commit 4e48ccb into coconut-svsm:main Jun 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants