NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/55543: PVHVM fails to attach hypervisor bus on Amazon EC2 t2.micro



On Sat, Sep 05, 2020 at 09:06:20AM -0300, Jared McNeill wrote:
> [...]
> [   1.0000030] ioapic0 at mainbus0 apid 1
> [   1.0000030] cpu0 at mainbus0 apid 0
> [   1.0000030] cpu0: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz, id 0x306f2
> [   1.0000030] cpu0: node 0, package 0, core 0, smt 0
> [   1.0000030] cpu0: Xen HVM: can't get VCPU id

OK, this is the cause of the problem.
Please try the attached patch. It works on Xen 4.13 if I force it to take
the fallback branch, but I'm not sure ci_acpiid is the right index to use
here (linux uses smp_processor_id() but I couldn't find where this number comes
from).

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: xen/xen/hypervisor.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.86
diff -u -p -u -r1.86 hypervisor.c
--- xen/xen/hypervisor.c	26 May 2020 10:37:25 -0000	1.86
+++ xen/xen/hypervisor.c	5 Sep 2020 16:12:04 -0000
@@ -456,13 +460,17 @@ xen_hvm_init_cpu(struct cpu_info *ci)
 
 	descs[0] = 0;
 	x86_cpuid(XEN_CPUID_LEAF(4), descs);
-	if (!(descs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT)) {
-		aprint_error_dev(ci->ci_dev, "Xen HVM: can't get VCPU id\n");
-		vm_guest = VM_GUEST_XENHVM;
-		return 0;
+	if (descs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) {
+		ci->ci_vcpuid = descs[1];
+	} else {
+		aprint_error_dev(ci->ci_dev,
+		    "HVM vid %d cpuid %ld acpid %d/%d\n",
+			descs[1], ci->ci_cpuid, ci->ci_acpiid, ci->ci_initapicid);
+		aprint_debug_dev(ci->ci_dev,
+		    "Xen HVM: can't get VCPU id, falling back to ci_acpiid\n");
+		ci->ci_vcpuid = ci->ci_acpiid;
 	}
 
-	ci->ci_vcpuid = descs[1];
 	ci->ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[ci->ci_vcpuid];
 
 	/* Register event callback handler. */


Home | Main Index | Thread Index | Old Index