Skip to contentSkip to conversation

xen/x86: restrict XENFEAT_pae_pgdir_above_4gb setting to PV guests

PATCH In review Roger Pau Monne 2 participants 2 messages Oct 5

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen/x86: restrict XENFEAT_pae_pgdir_above_4gb setting to PV guests

XENFEAT_pae_pgdir_above_4gb is only used by 32bit PV guests, hence limit its setting in XENVER_get_features to the is_pv_domain() guarded section, with the rest of the PV specific features. Add an additional build time guard to short-circuit the setting of XENFEAT_pae_pgdir_above_4gb if the hypervisor has no PV 32bit support.

---
Changes since v2:
- Add IS_ENABLED(CONFIG_PV32).

---
 xen/common/kernel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
xen/common/kernel.c +4 -2
index f4bbd8818fa8..499023fae6fd 100644
@@ -677,8 +677,6 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                         (1U << XENFEAT_vcpu_time_phys_area) |
 #endif
                         (1U << XENFEAT_runstate_phys_area);
-            if ( VM_ASSIST(d, pae_extended_cr3) )
-                fi.submap |= (1U << XENFEAT_pae_pgdir_above_4gb);
             if ( paging_mode_translate(d) )
                 fi.submap |=
                     (1U << XENFEAT_writable_page_tables) |
@@ -690,9 +688,13 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #endif
 #ifdef CONFIG_X86
             if ( is_pv_domain(d) )
+            {
                 fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
+                if ( IS_ENABLED(CONFIG_PV32) && VM_ASSIST(d, pae_extended_cr3) )
+                    fi.submap |= (1U << XENFEAT_pae_pgdir_above_4gb);
+            }
             else
                 fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
                              (1U << XENFEAT_hvm_callback_vector) |
Signature · 1 line
2.55.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 7 lines · Roger Pau Monne

XENFEAT_pae_pgdir_above_4gb is only used by 32bit PV guests, hence limit its setting in XENVER_get_features to the is_pv_domain() guarded section, with the rest of the PV specific features. Add an additional build time guard to short-circuit the setting of XENFEAT_pae_pgdir_above_4gb if the hypervisor has no PV 32bit support.