svn commit: r338626 - head/sys/x86/xen

Roger Pau Monné royger at FreeBSD.org
Thu Sep 13 07:08:32 UTC 2018


Author: royger
Date: Thu Sep 13 07:08:31 2018
New Revision: 338626
URL: https://svnweb.freebsd.org/changeset/base/338626

Log:
   xen: remove xenpv_set_ids
  
  The vcpu_id for legacy PVH mode can be set from the output of cpuid,
  so there's no need to have a special function to set it.
  
  Also note that xenpv_set_ids should have been executed only for PV
  guests, but was executed for all guests types and vcpu_id was later
  fixed up for HVM guests.
  
  Reported by:		cperciva
  Approved by:		re (gjb)
  Sponsored by:		Citrix Systems R&D

Modified:
  head/sys/x86/xen/hvm.c
  head/sys/x86/xen/pvcpu_enum.c

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c	Thu Sep 13 07:07:13 2018	(r338625)
+++ head/sys/x86/xen/hvm.c	Thu Sep 13 07:08:31 2018	(r338626)
@@ -419,6 +419,9 @@ xen_hvm_cpu_init(void)
 	 */
 	KASSERT(cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
 	cpuid_count(cpuid_base + 4, 0, regs);
+	KASSERT((regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ||
+	    !xen_pv_domain(),
+	    ("Xen PV domain without vcpu_id in cpuid"));
 	PCPU_SET(vcpu_id, (regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ?
 	    regs[1] : PCPU_GET(acpi_id));
 

Modified: head/sys/x86/xen/pvcpu_enum.c
==============================================================================
--- head/sys/x86/xen/pvcpu_enum.c	Thu Sep 13 07:07:13 2018	(r338625)
+++ head/sys/x86/xen/pvcpu_enum.c	Thu Sep 13 07:08:31 2018	(r338626)
@@ -249,19 +249,3 @@ xenpv_register(void *dummy __unused)
 	}
 }
 SYSINIT(xenpv_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, xenpv_register, NULL);
-
-/*
- * Setup per-CPU vCPU IDs
- */
-static void
-xenpv_set_ids(void *dummy)
-{
-	struct pcpu *pc;
-	int i;
-
-	CPU_FOREACH(i) {
-		pc = pcpu_find(i);
-		pc->pc_vcpu_id = i;
-	}
-}
-SYSINIT(xenpv_set_ids, SI_SUB_CPU, SI_ORDER_MIDDLE, xenpv_set_ids, NULL);


More information about the svn-src-head mailing list