Skip to contentSkip to conversation

xen: disable reporting hw virtualized lapic availability on PVH guests

PATCH In review Roger Pau Monne 2 participants 4 messages Jun 4, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: disable reporting hw virtualized lapic availability on PVH guests

Even if the hardware reports support for virtualized lapic, it should not be exposed to PVH guests, since they don't have a lapic at all.

Cc Jan Beulich <[email protected]>
Cc Boris Ostrovsky <[email protected]>
---
 xen/arch/x86/hvm/vmx/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/arch/x86/hvm/vmx/vmx.c +1 -1
index d45fb7f..ecc010e 100644
@@ -1660,7 +1660,7 @@ void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx,
                                uint32_t *eax, uint32_t *ebx,
                                uint32_t *ecx, uint32_t *edx)
 {
-    if ( sub_idx != 0 )
+    if ( sub_idx != 0 || is_pvh_vcpu(current) )
         return;
     if ( cpu_has_vmx_apic_reg_virt )
         *eax |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

xen/arch/x86/hvm/vmx/vmx.c void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx, · line 1665

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 04.06.14 at 12:12, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -1660,7 +1660,7 @@ void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx,
                                uint32_t *eax, uint32_t *ebx,
                                uint32_t *ecx, uint32_t *edx)
 {
-    if ( sub_idx != 0 )
+    if ( sub_idx != 0 || is_pvh_vcpu(current) )
         return;
     if ( cpu_has_vmx_apic_reg_virt )

The addition would belong on this line imo (in the && !is_pvh form).

Jan

#2 lore raw
Quoted 13 lines · Jan Beulich

xen/arch/x86/hvm/vmx/vmx.c void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx, · line 1665

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 04.06.14 at 12:12, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -1660,7 +1660,7 @@ void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx,
                                uint32_t *eax, uint32_t *ebx,
                                uint32_t *ecx, uint32_t *edx)
 {
-    if ( sub_idx != 0 )
+    if ( sub_idx != 0 || is_pvh_vcpu(current) )
         return;
     if ( cpu_has_vmx_apic_reg_virt )

The addition would belong on this line imo (in the && !is_pvh form).

Then I would also have to add another is_pvh gate on the next if:

    if ( cpu_has_vmx_virtualize_x2apic_mode && cpu_has_vmx_apic_reg_virt &&
         cpu_has_vmx_virtual_intr_delivery && !is_pvh_vcpu(current) )
        *eax |= XEN_HVM_CPUID_X2APIC_VIRT;

IMHO it seems easier to gate it on the first if and just return, although I understand it is more correct to gate it on a feature by feature basis.

Roger.

#3 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 04.06.14 at 12:53, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich

xen/arch/x86/hvm/vmx/vmx.c void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx, · line 1665

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 04.06.14 at 12:12, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -1660,7 +1660,7 @@ void vmx_hypervisor_cpuid_leaf(uint32_t sub_idx,
                                uint32_t *eax, uint32_t *ebx,
                                uint32_t *ecx, uint32_t *edx)
 {
-    if ( sub_idx != 0 )
+    if ( sub_idx != 0 || is_pvh_vcpu(current) )
         return;
     if ( cpu_has_vmx_apic_reg_virt )

The addition would belong on this line imo (in the && !is_pvh form).

Then I would also have to add another is_pvh gate on the next if:

Quoted 7 lines
    if ( cpu_has_vmx_virtualize_x2apic_mode && cpu_has_vmx_apic_reg_virt &&
         cpu_has_vmx_virtual_intr_delivery && !is_pvh_vcpu(current) )
        *eax |= XEN_HVM_CPUID_X2APIC_VIRT;

IMHO it seems easier to gate it on the first if and just return, although I understand it is more correct to gate it on a feature by feature basis.

Right, also to avoid unnecessary future code churn.

Jan