x86: don't unconditionally touch the hvm_domain union during domain construction
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 20 May 2015 11:25:12 +0000 (13:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 20 May 2015 11:25:12 +0000 (13:25 +0200)
It may not be the appropriate half to touch.

Drop the superfluous mem_sharing_enabled assignment, and move the hap_enabled
assignment to a suitable conditional before it is actually needed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c

index 1f1550eb7788c148d0b0f2770e8d6eafd4787a23..6e9464c77bc5644e5e19c7000e8e74ca78ade5da 100644 (file)
@@ -513,12 +513,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
     int i, paging_initialised = 0;
     int rc = -ENOMEM;
 
-    d->arch.hvm_domain.hap_enabled =
-        has_hvm_container_domain(d) &&
-        hvm_funcs.hap_supported &&
-        (domcr_flags & DOMCRF_hap);
-    d->arch.hvm_domain.mem_sharing_enabled = 0;
-
     d->arch.s3_integrity = !!(domcr_flags & DOMCRF_s3_integrity);
 
     INIT_LIST_HEAD(&d->arch.pdev_list);
@@ -541,7 +535,12 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
     }
 
     if ( has_hvm_container_domain(d) )
+    {
+        d->arch.hvm_domain.hap_enabled =
+            hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
+
         rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
+    }
     else if ( is_idle_domain(d) )
         rc = 0;
     else