-
Notifications
You must be signed in to change notification settings - Fork 40
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
platform: extend the way pages are identified for validation/invalidation #461
Open
msft-jlange
wants to merge
4
commits into
coconut-svsm:main
Choose a base branch
from
msft-jlange:page_validate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+283
−102
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@peterfang This should resolve the challenges you had in implementing validation for the TDP platform. |
msft-jlange
force-pushed
the
page_validate
branch
from
September 19, 2024 18:49
89b77ed
to
2ecdbf9
Compare
Thanks! Will update my stage2 PR after this is merged. |
Freax13
reviewed
Sep 23, 2024
In general, page validation should be performed by physical address, which is required on certain platforms; platforms that require validation by virtual address can create a temporary virtual mapping to describe the physical page being validated. However, in certain contexts (like stage2), temporary mapping is not possible, and the pages to be validate already have virtual mapping, so a mechanism to validate by virtual address is retained solely for use in those limited cases where a virtual mapping already exists in such a restricted context. Signed-off-by: Jon Lange <[email protected]>
All processors that support virtualization also support NX. Therefore, there is no reason to detect NX via CPUID, and EFER.NXE can be enabled very early in boot, unconditionally, for simplicity in managing page tables. Signed-off-by: Jon Lange <[email protected]>
msft-jlange
force-pushed
the
page_validate
branch
from
September 23, 2024 15:28
2ecdbf9
to
1751117
Compare
Freax13
reviewed
Sep 23, 2024
msft-jlange
force-pushed
the
page_validate
branch
2 times, most recently
from
September 23, 2024 16:48
37a96b3
to
2b47b08
Compare
It is possible to insert a reference to the current page table into the page table itself, creating a recursive "self-map". This permits access to any PTE in the address space by taking advantage of the hierarchical property of page tables, using the CPU's own page table walker to obtain the PTE contents. This change inserts a self-map entry into every page table, and reimplements `virt_to_phys()` to use the self map so that it is possible to translate any VA to a PA without requiring either the VA or the PA to be within the bounds of any known address range. Signed-off-by: Jon Lange <[email protected]>
Some platforms will require translation from virtual to physical address in order to perform page validation by virtual address. Therefore, on other platforms, force a call to `virt_to_phys()` in debug builds to increas the number of test environments that can detect possible translation failures to add in debugging. Signed-off-by: Jon Lange <[email protected]>
msft-jlange
force-pushed
the
page_validate
branch
from
September 24, 2024 14:09
2b47b08
to
c73c9fb
Compare
Freax13
approved these changes
Sep 24, 2024
These changes break boot for me, I need to investigate before this can be merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SNP validates pages by virtual address while TDX validates pages by physical address. This PR makes it possible for code to request validation changes based on either. This ensures that virtual mappings are not created unnecessarily on platforms that do not require them, and ensures that it can be possible to correctly obtain the physical address for validation in those cases where the caller has only a virtual address.