Port-xen archive

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

Re: XenServer and viridian



On Wed, Mar 26, 2025 at 05:24:39PM +0000, Stephen Borrill wrote:
> On XenServer/XCP-ng VMs can have 'Viridian enlightenments' enabled. This is
> used by Windows VMs to get some features that would otherwise require
> Hyper-V, for instance, VM generation counter as used by Active Directory to
> spot it if is has been rolled back.
> 
> These shouldn't affect any non-Windows VMs, but NetBSD mistakenly thinks it
> is running on Hyper-V rather than Xen, so the PVH code is not enabled.
> 
> I tried the following naive patch:
> 
> --- sys/arch/x86/x86/identcpu.c 2 Feb 2025 14:51:59 -0000       1.123.4.2
> +++ sys/arch/x86/x86/identcpu.c 26 Mar 2025 17:20:44 -0000
> @@ -1132,8 +1132,22 @@
>                                 vm_guest = VM_GUEST_VMWARE;
>                         else if (memcmp(hv_vendor, "Microsoft Hv", 12) == 0) {
>                                 vm_guest = VM_GUEST_HV;
> +                               p = pmf_get_platform("system-vendor");
> +                               if (p != NULL) {
> +                                       if (strncmp(p, "Xen", 3) == 0) {
> +                                               /*
> +                                                * XenServer VMs may have
> +                                                * Viridian enlightenments
> +                                                * enabled which may make
> +                                                * Hyper-V be falsely matched
> +                                                */
> +                                               vm_guest = VM_GUEST_XENHVM;
> +                                       }
> +                               }
>  #if NHYPERV > 0
> -                               hyperv_early_init();
> +                               if (vm_guest == VM_GUEST_HV) {
> +                                       hyperv_early_init();
> +                               }
>  #endif
>                         } else if (memcmp(hv_vendor, "KVMKVMKVM\0\0\0", 12) == 0)
>                                 vm_guest = VM_GUEST_KVM;
> 
> 
> It correctly "Identified Guest XEN in HVM mode" instead of Hyper-C, but
> immediately panicked in xen_hvm_init().
> 
> Is there a less naive patch I could try? :-)

Can you give more details about the panic ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index