Message ID | 20200203173728.18135-3-roger.pau@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | nvmx: implement support for MSR bitmaps | expand |
On 03.02.2020 18:37, Roger Pau Monne wrote: > @@ -587,6 +588,16 @@ static void update_msrbitmap(struct vcpu *v, uint32_t shadow_ctrl) > v->arch.hvm.vmx.msr_bitmap->write_high, > sizeof(msr_bitmap->write_high) * 8); > > + /* > + * Nested VMX doesn't support any x2APIC hardware virtualization, so > + * make sure all the x2APIC MSRs are trapped. > + */ > + for ( msr = MSR_X2APIC_FIRST; msr <= MSR_X2APIC_FIRST + 0xff; msr++ ) > + { > + __set_bit(msr, msr_bitmap->read_low); > + __set_bit(msr, msr_bitmap->write_low); > + } Pull in bitmap_set() (and then also bitmap_clear()) from Linux for doing this more efficiently? Jan
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index f118f88683..89ba2a80d5 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -567,6 +567,7 @@ static void update_msrbitmap(struct vcpu *v, uint32_t shadow_ctrl) { struct nestedvmx *nvmx = &vcpu_2_nvmx(v); struct vmx_msr_bitmap *msr_bitmap; + unsigned int msr; if ( !(shadow_ctrl & CPU_BASED_ACTIVATE_MSR_BITMAP) || !nvmx->msrbitmap ) @@ -587,6 +588,16 @@ static void update_msrbitmap(struct vcpu *v, uint32_t shadow_ctrl) v->arch.hvm.vmx.msr_bitmap->write_high, sizeof(msr_bitmap->write_high) * 8); + /* + * Nested VMX doesn't support any x2APIC hardware virtualization, so + * make sure all the x2APIC MSRs are trapped. + */ + for ( msr = MSR_X2APIC_FIRST; msr <= MSR_X2APIC_FIRST + 0xff; msr++ ) + { + __set_bit(msr, msr_bitmap->read_low); + __set_bit(msr, msr_bitmap->write_low); + } + unmap_domain_page(msr_bitmap); __vmwrite(MSR_BITMAP, page_to_maddr(nvmx->msr_merged));