[PATCH RESEND 1/1] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts

H. Peter Anvin hpa at zytor.com
Thu Jan 24 19:10:15 UTC 2013


I also have to point out the obvious problem with Xen masquerading as HyperV without implementing the same feature set...

KY Srinivasan <kys at microsoft.com> wrote:

>
>
>> -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich at suse.com]
>> Sent: Thursday, January 24, 2013 11:16 AM
>> To: KY Srinivasan
>> Cc: olaf at aepfle.de; bp at alien8.de; apw at canonical.com; x86 at kernel.org;
>> tglx at linutronix.de; devel at linuxdriverproject.org;
>gregkh at linuxfoundation.org;
>> jasowang at redhat.com; linux-kernel at vger.kernel.org; hpa at zytor.com
>> Subject: RE: [PATCH RESEND 1/1] X86: Handle Hyper-V vmbus interrupts
>as
>> special hypervisor interrupts
>> 
>> >>> On 24.01.13 at 17:07, KY Srinivasan <kys at microsoft.com> wrote:
>> 
>> >
>> >> -----Original Message-----
>> >> From: Jan Beulich [mailto:JBeulich at suse.com]
>> >> Sent: Thursday, January 24, 2013 3:48 AM
>> >> To: KY Srinivasan
>> >> Cc: olaf at aepfle.de; bp at alien8.de; apw at canonical.com;
>x86 at kernel.org;
>> >> tglx at linutronix.de; devel at linuxdriverproject.org;
>> > gregkh at linuxfoundation.org;
>> >> jasowang at redhat.com; linux-kernel at vger.kernel.org; hpa at zytor.com
>> >> Subject: Re: [PATCH RESEND 1/1] X86: Handle Hyper-V vmbus
>interrupts as
>> >> special hypervisor interrupts
>> >>
>> >> >>> On 24.01.13 at 02:17, "K. Y. Srinivasan" <kys at microsoft.com>
>wrote:
>> >> > @@ -69,6 +74,11 @@ static void __init
>ms_hyperv_init_platform(void)
>> >> >  	       ms_hyperv.features, ms_hyperv.hints);
>> >> >
>> >> >  	clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
>> >> > +
>> >> > +	/*
>> >> > +	 * Setup the IDT for hypervisor callback.
>> >> > +	 */
>> >> > +	alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
>> >> hyperv_callback_vector);
>> >>
>> >> Isn't doing this unconditionally here as problematic as the call
>to
>> >> clocksource_register_hz() turned out to be when Xen's Hyper-V
>> >> shim reacts to the CPUID inquiry above?
>> >
>> > I was not sure what to make this conditional on at run-time. To the
>extent
>> > that Xen emulation of Hyper-V is complete, this will be a problem.
>Does Xen
>> > return all the "feature bits" of Hyper-V. I could discriminate on a
>feature
>> > that
>> > Xen does not plan to emulate.
>> 
>> I've no idea what plans there might be, but that's the code
>> there is currently:
>> 
>> int cpuid_viridian_leaves(unsigned int leaf, unsigned int *eax,
>>                           unsigned int *ebx, unsigned int *ecx,
>>                           unsigned int *edx)
>> {
>>     struct domain *d = current->domain;
>> 
>>     if ( !is_viridian_domain(d) )
>>         return 0;
>> 
>>     leaf -= 0x40000000;
>>     if ( leaf > 6 )
>>         return 0;
>> 
>>     *eax = *ebx = *ecx = *edx = 0;
>>     switch ( leaf )
>>     {
>>     case 0:
>>         *eax = 0x40000006; /* Maximum leaf */
>>         *ebx = 0x7263694d; /* Magic numbers  */
>>         *ecx = 0x666F736F;
>>         *edx = 0x76482074;
>>         break;
>>     case 1:
>>         *eax = 0x31237648; /* Version number */
>>         break;
>>     case 2:
>>         /* Hypervisor information, but only if the guest has set its
>>            own version number. */
>>         if ( d->arch.hvm_domain.viridian.guest_os_id.raw == 0 )
>>             break;
>>         *eax = 1; /* Build number */
>>         *ebx = (xen_major_version() << 16) | xen_minor_version();
>>         *ecx = 0; /* SP */
>>         *edx = 0; /* Service branch and number */
>>         break;
>>     case 3:
>>         /* Which hypervisor MSRs are available to the guest */
>>         *eax = (CPUID3A_MSR_APIC_ACCESS |
>>                 CPUID3A_MSR_HYPERCALL   |
>>                 CPUID3A_MSR_VP_INDEX);
>>         break;
>>     case 4:
>>         /* Recommended hypercall usage. */
>>         if ( (d->arch.hvm_domain.viridian.guest_os_id.raw == 0) ||
>>              (d->arch.hvm_domain.viridian.guest_os_id.fields.os < 4)
>)
>>             break;
>>         *eax = (CPUID4A_MSR_BASED_APIC |
>>                 CPUID4A_RELAX_TIMER_INT);
>>         *ebx = 2047; /* long spin count */
>>         break;
>>     }
>> 
>>     return 1;
>> }
>> 
>> Question is - considering you stated that this is supported
>> starting in Win8, doesn't Hyper-V itself announce that
>> capability in some explicit way?
>
>Thanks Jan. Unfortunately I don't think tis interrupt delivery model is
>specified via a "feature" bit (I will check with the Windows guys).
>Perhaps, we
>can have a Hyper-V specific compilation switch to address the Xen
>emulation issue.
>
>Regards,
>
>K. Y  
>> 
>> Jan
>> 
>> 

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.



More information about the devel mailing list