diff mbox series

[v3,1/4] x86/shadow: slightly consolidate sh_unshadow_for_p2m_change() (part I)

Message ID 9c642811-0b63-72e6-3ef0-6d6262b5975c@suse.com (mailing list archive)
State New, archived
Headers show
Series x86/P2M: allow 2M superpage use for shadowed guests | expand

Commit Message

Jan Beulich Aug. 12, 2022, 7:44 a.m. UTC
Replace a p2m_is_ram() check in the 2M case by an explicit _PAGE_PRESENT
one, to make more obvious that the subsequent l1e_get_mfn() actually
retrieves something that really is an MFN. It doesn't really matter
whether it's RAM, as the subsequent comparison with the original MFN is
going to lead to zapping of everything except the "same MFN again" case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Split from previous bigger patch.
diff mbox series

Patch

--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -856,7 +856,7 @@  static void cf_check sh_unshadow_for_p2m
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
                 if ( !npte ||
-                     !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i]))) ||
+                     !(l1e_get_flags(npte[i]) & _PAGE_PRESENT) ||
                      !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
                 {
                     /* This GFN->MFN mapping has gone away */