Skip to contentSkip to conversation

x86: hap_enabled() is HVM-only

PATCH In review Jan Beulich 2 participants 2 messages Sep 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: hap_enabled() is HVM-only

There at least two cases where the field so far got accessed for PV guests as well: One is in iommu_construct(), via iommu_use_hap_pt(), and the other is
arch_domain_create()
-> paging_domain_init()
-> p2m_init()

      -> p2m_init_hostp2m()
         -> p2m_init_one()
            -> p2m_initialise()

It just so happens that the field currently lives in struct hvm_domain at an offset larger than sizeof(struct pv_domain).

xen/include/asm-x86/hvm/domain.h +1 -1
@@ -195,7 +195,7 @@ struct hvm_domain {
 };
 
 #ifdef CONFIG_HVM
-#define hap_enabled(d)  ((d)->arch.hvm.hap_enabled)
+#define hap_enabled(d)  (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled)
 #else
 #define hap_enabled(d)  ({(void)(d); false;})
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Beulich

There at least two cases where the field so far got accessed for PV guests as well: One is in iommu_construct(), via iommu_use_hap_pt(), and the other is
arch_domain_create()
-> paging_domain_init()
-> p2m_init()

Quoted 7 lines
      -> p2m_init_hostp2m()
         -> p2m_init_one()
            -> p2m_initialise()

It just so happens that the field currently lives in struct hvm_domain at an offset larger than sizeof(struct pv_domain).

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel