]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/guest/xen: only set HVM parameter on BSP
authorWei Liu <wl@xen.org>
Wed, 5 Feb 2020 18:02:24 +0000 (18:02 +0000)
committerWei Liu <wl@xen.org>
Thu, 6 Feb 2020 13:52:24 +0000 (13:52 +0000)
There is no need for every CPU to set a guest property.

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Wei Liu <wl@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/guest/xen/xen.c

index 1f868f2f8d1a506f25393d106a144a85a4eb71b3..3cf8f667a19d7ea54b6a0f1da1ec01b54c4a9491 100644 (file)
@@ -206,11 +206,6 @@ static int init_evtchn(void)
 {
     static uint8_t evtchn_upcall_vector;
     int rc;
-    struct xen_hvm_param a = {
-        .domid = DOMID_SELF,
-        .index = HVM_PARAM_CALLBACK_IRQ,
-        .value = 1,
-    };
 
     if ( !evtchn_upcall_vector )
         alloc_direct_apic_vector(&evtchn_upcall_vector, xen_evtchn_upcall);
@@ -225,10 +220,19 @@ static int init_evtchn(void)
         return rc;
     }
 
-    /* Trick toolstack to think we are enlightened */
-    rc = xen_hypercall_hvm_op(HVMOP_set_param, &a);
-    if ( rc )
-        printk("Unable to set HVM_PARAM_CALLBACK_IRQ\n");
+    if ( smp_processor_id() == 0 )
+    {
+        struct xen_hvm_param a = {
+            .domid = DOMID_SELF,
+            .index = HVM_PARAM_CALLBACK_IRQ,
+            .value = 1,
+        };
+
+        /* Trick toolstack to think we are enlightened */
+        rc = xen_hypercall_hvm_op(HVMOP_set_param, &a);
+        if ( rc )
+            printk("Unable to set HVM_PARAM_CALLBACK_IRQ\n");
+    }
 
     return rc;
 }