qemu/hw/i386
Vasant Hegde 0f178860df hw/i386/amd_iommu: Fix xtsup when vcpus < 255
If vCPUs > 255 then x86 common code (x86_cpus_init()) call kvm_enable_x2apic().
But if vCPUs <= 255 then the common code won't calls kvm_enable_x2apic().

This is because commit 8c6619f3e6 ("hw/i386/amd_iommu: Simplify non-KVM
checks on XTSup feature") removed the call to kvm_enable_x2apic when xtsup
is "on", which break things when guest is booted with x2apic mode and
there are <= 255 vCPUs.

Fix this by adding back kvm_enable_x2apic() call when xtsup=on.

Fixes: 8c6619f3e6 ("hw/i386/amd_iommu: Simplify non-KVM checks on XTSup feature")
Reported-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Tested-by: Tested-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Message-Id: <20250516100535.4980-3-sarunkod@amd.com>
Fixes: 8c6619f3e6 ("hw/i386/amd_iommu: Simplify non-KVM checks on XTSup feature")
Reported-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Tested-by: Tested-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
2025-06-01 06:38:53 -04:00
..
kvm qapi: make Xen event commands unconditionally available 2025-05-28 18:54:18 +02:00
xen qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
acpi-build.c hw/i386/amd_iommu: Isolate AMDVI-PCI from amd-iommu device to allow full control over the PCI device creation 2025-05-14 07:45:58 -04:00
acpi-build.h hw/i386/acpi-build: Update document reference 2025-05-08 14:22:12 +02:00
acpi-common.c include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
acpi-common.h hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h' 2024-02-20 20:34:21 +03:00
acpi-microvm.c include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
acpi-microvm.h microvm/acpi: add minimal acpi support 2020-09-17 14:16:19 +02:00
amd_iommu-stub.c amd_iommu: report x2APIC support to the operating system 2024-02-14 06:09:32 -05:00
amd_iommu.c hw/i386/amd_iommu: Fix xtsup when vcpus < 255 2025-06-01 06:38:53 -04:00
amd_iommu.h hw/i386/amd_iommu: Allow migration when explicitly create the AMDVI-PCI device 2025-05-14 07:45:58 -04:00
e820_memory_layout.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
e820_memory_layout.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
fw_cfg.c rust: Kconfig: Factor out whether HPET is Rust or C 2025-03-20 09:23:24 +01:00
fw_cfg.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
intel_iommu.c intel_iommu: Take locks when looking for and creating address spaces 2025-05-14 07:45:51 -04:00
intel_iommu_internal.h intel_iommu: Introduce a property x-flts for stage-1 translation 2025-01-15 13:06:35 -05:00
Kconfig hw/acpi: Add vmclock device 2025-01-15 17:43:24 -05:00
meson.build machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
microvm-dt.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
microvm-dt.h microvm: add device tree support. 2021-11-02 17:24:17 +01:00
microvm.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
monitor.c qapi: expose rtc-reset-reinjection command unconditionally 2025-05-28 18:26:23 +02:00
multiboot.c exec/cpu-all: remove exec/target_page include 2025-04-23 15:04:57 -07:00
multiboot.h target/i386: use DMA-enabled multiboot ROM for new-enough QEMU machine types 2021-11-02 15:57:27 +01:00
nitro_enclave.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
pc.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
pc_piix.c include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
pc_q35.c hw: add compat machines for 10.1 2025-04-23 07:51:25 +02:00
pc_sysfw.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
pc_sysfw_ovmf-stubs.c hw/i386: Introduce X86_FW_OVMF Kconfig symbol 2021-07-14 22:28:58 +02:00
pc_sysfw_ovmf.c exec/cpu-all: remove exec/target_page include 2025-04-23 15:04:57 -07:00
port92.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
sgx-epc.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
sgx-stub.c qapi: make SGX commands unconditionally available 2025-05-28 18:54:18 +02:00
sgx.c qapi: make SGX commands unconditionally available 2025-05-28 18:54:18 +02:00
trace-events hw/i386/intel-iommu: Migrate to 3-phase reset 2025-02-21 07:21:25 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vapic.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
vmmouse.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
vmport.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
x86-common.c hw/loader: Pass ELFDATA endian order argument to load_elf() 2025-01-31 19:36:44 +01:00
x86-cpu.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
x86-iommu-stub.c hw/i386/pc: Remove x86_iommu_get_type() 2021-11-01 18:49:10 -04:00
x86-iommu.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
x86.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00