Re: [PATCH v11 2/3] x86, apicv: add virtual x2apic support

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

 



On Tue, Jan 22, 2013 at 12:21:47PM +0000, Zhang, Yang Z wrote:
> >> +static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu)
> >> +{
> >> +	unsigned long *msr_bitmap;
> >> +
> >> +	if (apic_x2apic_mode(vcpu->arch.apic))
> > 
> > vcpu->arch.apic can be NULL.
> Actually, call apic_x2apic_mode to check whether use x2apic msr bitmap is wrong.
> VCPU uses x2apic but it may not set virtual x2apic mode bit due to TPR shadow not enabled or irqchip not in kernel. Check the virtual x2apic mode bit in vmcs directly should be a better choice. How about the follow code:
> 
If TPR shadow it not enabled vmx_msr_bitmap_.*x2apic bitmap will have x2apic MSRs intercepted.

> static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu)
> {
>         unsigned long *msr_bitmap;
> 
>         if (vmcs_read32(SECONDARY_VM_EXEC_CONTROL) & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
>                 if (is_long_mode(vcpu))
>                         msr_bitmap = vmx_msr_bitmap_longmode_x2apic;
>                 else
>                         msr_bitmap = vmx_msr_bitmap_legacy_x2apic;
>         else
>                 if (is_long_mode(vcpu))
>                         msr_bitmap = vmx_msr_bitmap_longmode;
>                 else
>                         msr_bitmap = vmx_msr_bitmap_legacy;
> 
>         vmcs_write64(MSR_BITMAP, __pa(msr_bitmap));
> }
> 
> Best regards,
> Yang
> 

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux