Skip to contentSkip to conversation

x86/vvmx: virtualize x2APIC mode and APIC accesses can't both be enabled

PATCH In review Roger Pau Monne 3 participants 3 messages Dec 24, 2019 – Dec 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vvmx: virtualize x2APIC mode and APIC accesses can't both be enabled

According to the Intel SDM, "virtualize x2APIC mode" and "virtualize APIC accesses" can't be enabled at the same time, or else a vm{launch/entry} failure will happen. This was seen when running Xen nested and with x2APIC enabled:

Dec 23 20:06:54.444025 (XEN) d3v0 VMLAUNCH error: 0x7
[...]
Dec 23 20:08:33.004078 (XEN) *** Control State ***
Dec 23 20:08:33.004086 (XEN) PinBased=0000003f CPUBased=b6a075fe SecondaryExec=000014fb

[...]

Fix this by making sure nvmx_update_secondary_exec_control clears the incompatible bits from the host vmcs before merging it with the nested vmcs.

This fixes a regression reported by osstest in the test-amd64-amd64-qemuu-nested-intel job.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
index 5dd00e11b5..d8ab167d62 100644
@@ -594,6 +594,7 @@ void nvmx_update_secondary_exec_control(struct vcpu *v,
     u32 shadow_cntrl;
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
     u32 apicv_bit = SECONDARY_EXEC_APIC_REGISTER_VIRT |
+                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
                     SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY;
 
     host_cntrl &= ~apicv_bit;
Signature · 7 lines
2.24.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Roger Pau Monne

According to the Intel SDM, "virtualize x2APIC mode" and "virtualize APIC accesses" can't be enabled at the same time, or else a vm{launch/entry} failure will happen. This was seen when running Xen nested and with x2APIC enabled:

Dec 23 20:06:54.444025 (XEN) d3v0 VMLAUNCH error: 0x7
[...]
Dec 23 20:08:33.004078 (XEN) *** Control State ***
Dec 23 20:08:33.004086 (XEN) PinBased=0000003f CPUBased=b6a075fe SecondaryExec=000014fb

[...]

Quoted 8 lines

Fix this by making sure nvmx_update_secondary_exec_control clears the incompatible bits from the host vmcs before merging it with the nested vmcs.

This fixes a regression reported by osstest in the test-amd64-amd64-qemuu-nested-intel job.

Quoted 9 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
index 5dd00e11b5..d8ab167d62 100644

xen/arch/x86/hvm/vmx/vvmx.c void nvmx_update_secondary_exec_control(struct vcpu *v, · line 600

Quoted 7 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
@@ -594,6 +594,7 @@ void nvmx_update_secondary_exec_control(struct vcpu *v,
     u32 shadow_cntrl;
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
     u32 apicv_bit = SECONDARY_EXEC_APIC_REGISTER_VIRT |
+                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
                     SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY;
 
     host_cntrl &= ~apicv_bit;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Roger Pau Monne
Quoted 9 lines · Roger Pau Monne

According to the Intel SDM, "virtualize x2APIC mode" and "virtualize APIC accesses" can't be enabled at the same time, or else a vm{launch/entry} failure will happen. This was seen when running Xen nested and with x2APIC enabled:

Dec 23 20:06:54.444025 (XEN) d3v0 VMLAUNCH error: 0x7
[...]
Dec 23 20:08:33.004078 (XEN) *** Control State ***
Dec 23 20:08:33.004086 (XEN) PinBased=0000003f CPUBased=b6a075fe SecondaryExec=000014fb
Quoted 8 lines

[...]

Fix this by making sure nvmx_update_secondary_exec_control clears the incompatible bits from the host vmcs before merging it with the nested vmcs.

This fixes a regression reported by osstest in the test-amd64-amd64-qemuu-nested-intel job.

It would surely have been nice to include a reference to the offending commit, despite the bug having been latently there before.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel