summaryrefslogtreecommitdiffstats
path: root/hw/i386/vmport.c
diff options
context:
space:
mode:
authorLiran Alon2020-03-12 17:54:28 +0100
committerPaolo Bonzini2020-06-10 18:09:50 +0200
commit7f9114b77c285016cb5ac28604b9923cbac43ddf (patch)
tree563ac8ae780f2680b80e81fef54d932eb7e3509e /hw/i386/vmport.c
parenthw/i386/vmport: Add support for CMD_GET_VCPU_INFO (diff)
downloadqemu-7f9114b77c285016cb5ac28604b9923cbac43ddf.tar.gz
qemu-7f9114b77c285016cb5ac28604b9923cbac43ddf.tar.xz
qemu-7f9114b77c285016cb5ac28604b9923cbac43ddf.zip
hw/i386/vmport: Allow x2apic without IR
Signal to guest that hypervisor supports x2apic without VT-d/IOMMU Interrupt-Remapping support. This allows guest to use x2apic in case all APIC IDs fits in 8-bit (i.e. Max APIC ID < 255). See Linux kernel commit 4cca6ea04d31 ("x86/apic: Allow x2apic without IR on VMware platform") and Linux try_to_enable_x2apic() function. Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com> Signed-off-by: Liran Alon <liran.alon@oracle.com> Message-Id: <20200312165431.82118-14-liran.alon@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/vmport.c')
-rw-r--r--hw/i386/vmport.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 942a0e94e3..21d4ff048a 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -176,7 +176,14 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
static uint32_t vmport_cmd_get_vcpu_info(void *opaque, uint32_t addr)
{
- return 1 << VCPU_INFO_RESERVED_BIT;
+ X86CPU *cpu = X86_CPU(current_cpu);
+ uint32_t ret = 0;
+
+ if (cpu->env.features[FEAT_1_ECX] & CPUID_EXT_X2APIC) {
+ ret |= 1 << VCPU_INFO_LEGACY_X2APIC_BIT;
+ }
+
+ return ret;
}
static const MemoryRegionOps vmport_ops = {