-
Notifications
You must be signed in to change notification settings - Fork 17
Pkvm v6.18 helpers #54
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
Merged
cxdong
merged 8 commits into
intel-staging:pkvm-v6.18
from
maluka-dmytro:pkvm-v6.18-helpers
Jan 5, 2026
Merged
Pkvm v6.18 helpers #54
cxdong
merged 8 commits into
intel-staging:pkvm-v6.18
from
maluka-dmytro:pkvm-v6.18-helpers
Jan 5, 2026
Conversation
This file contains hidden or 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
cxdong
reviewed
Jan 4, 2026
cxdong
reviewed
Jan 4, 2026
We already have several places in the code where we traverse struct pkvm_page structures for all pages in the given memory range. With guest MMU support there will be even more such cases. So introduce a convenient helper macro for_each_pkvm_page() for that, to reduce code duplication and improve code readability. Based on pKVM-ARM's for_each_hyp_page(), although the implementation is not exactly the same. Fixes: 54b3050 ("pKVM: x86: Set initial host memory page state") Signed-off-by: Dmytro Maluka <[email protected]>
…te() Fixes: e5bdafb ("pKVM: x86: Add memory page donation between host and hypervisor") Signed-off-by: Dmytro Maluka <[email protected]>
…are_hyp() Fixes: 168a157 ("pKVM: x86: Add support to share/unshare host memory pages with pKVM") Signed-off-by: Dmytro Maluka <[email protected]>
We already have a couple of places where we calculate the max size of the VA space that can be mapped by the given page table, and with guest MMU there will be more such places. So introduce helper function pkvm_pgtable_max_size() for that. Fixes: ca66f34 ("pKVM: x86: Switch to use buddy allocator for the hyp mmu") Signed-off-by: Dmytro Maluka <[email protected]>
…ate() Fixes: 7666056 ("pKVM: x86: Set the initial page state for host MMIO pages") Signed-off-by: Dmytro Maluka <[email protected]>
We have several places with calc_pte_perm() + calc_pte_memtype() boilerplate code for calculating property bits for host MMU PTEs, and with guest MMU support we will have more such cases. So introduce a convenient helper host_mmu_pte_prot() for that. Fixes: e5bdafb ("pKVM: x86: Add memory page donation between host and hypervisor") Signed-off-by: Dmytro Maluka <[email protected]>
…mmio_locked() Fixes: 1bcae0c ("pKVM: x86: Add MMIO donation from hyp to host") Signed-off-by: Dmytro Maluka <[email protected]>
Fixes: e365103 ("pKVM: x86: Remove pkvm_host_mmu_map/unmap") Signed-off-by: Dmytro Maluka <[email protected]>
72c998a to
1684116
Compare
cxdong
reviewed
Jan 5, 2026
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.
Add a few convenient helpers, to reduce code duplication and improve code readability (especially with upcoming changes for guest MMU support, which will use these helpers too):
for_each_pkvm_page()macro for iterating throughstruct pkvm_pages for all pages in the given memory range (same as pKVM-ARM'sfor_each_hyp_page())pkvm_pgtable_max_size()returning max size of the VA space for the given page tablehost_mmu_pte_prot()returning the needed property bits for host MMU PTEs