]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/hvm: provide hvm_hap_supported
authorWei Liu <wei.liu2@citrix.com>
Sun, 26 Aug 2018 12:19:37 +0000 (13:19 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 28 Aug 2018 09:48:45 +0000 (10:48 +0100)
And replace direct accesses in non-HVM subsystems to
hvm_funcs.hap_supported with the new function, to avoid accessing an
internal data structure of another subsystem directly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpuid.c
xen/arch/x86/domain.c
xen/arch/x86/setup.c
xen/include/asm-x86/hvm/hvm.h

index 3d504b33283d856a83db94ebdbedd5e488bec3eb..88694ede8ed80fcb157114c5e36dadb4eb91b050 100644 (file)
@@ -475,7 +475,7 @@ static void __init calculate_hvm_max_policy(void)
     *p = host_cpuid_policy;
     cpuid_policy_to_featureset(p, hvm_featureset);
 
-    hvm_featuremask = hvm_funcs.hap_supported ?
+    hvm_featuremask = hvm_hap_supported() ?
         hvm_hap_featuremask : hvm_shadow_featuremask;
 
     for ( i = 0; i < ARRAY_SIZE(hvm_featureset); ++i )
index 5bb900edec37dc2cc4340949b7f151372c54d385..eb1e93fc59de53edd711e2543969b9d635c2432c 100644 (file)
@@ -506,7 +506,7 @@ int arch_domain_create(struct domain *d,
     /* Need to determine if HAP is enabled before initialising paging */
     if ( is_hvm_domain(d) )
         d->arch.hvm_domain.hap_enabled =
-            hvm_funcs.hap_supported && (config->flags & XEN_DOMCTL_CDF_hap);
+            hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap);
 
     if ( (rc = paging_domain_init(d, config->flags)) != 0 )
         goto fail;
index a22256f0cd30b0f68884b9e586c25e169869d5b6..261861e1ed66cefb9689a537eadec6b156ca0dd3 100644 (file)
@@ -1690,7 +1690,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( dom0_pvh )
     {
         dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm_guest |
-                           ((hvm_funcs.hap_supported && !opt_dom0_shadow) ?
+                           ((hvm_hap_supported() && !opt_dom0_shadow) ?
                             XEN_DOMCTL_CDF_hap : 0));
 
         dom0_cfg.arch.emulation_flags |=
index 146720c3566ef9c76030d58e5fbde5d1ab7c510b..5ea507b22b634ccbf3b63ff215d43690ef43d26f 100644 (file)
@@ -621,6 +621,11 @@ static inline bool_t hvm_is_singlestep_supported(void)
             hvm_funcs.is_singlestep_supported());
 }
 
+static inline bool hvm_hap_supported(void)
+{
+    return hvm_funcs.hap_supported;
+}
+
 /* returns true if hardware supports alternate p2m's */
 static inline bool hvm_altp2m_supported(void)
 {