aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiaoyao Li <xiaoyao.li@intel.com>2024-04-03 10:59:53 -0400
committerMichael S. Tsirkin <mst@redhat.com>2024-04-15 06:50:58 -0400
commitc44d44d76d443884b77bebef39cba74b89803401 (patch)
tree11e5aed24c32ae53ed4b84ef8d7b1ad5106738e1
parent9fc5d5b3903f6f982801320f376146a2f8b4d0f6 (diff)
downloadqemu-next.tar.gz
hw/i386/acpi: Set PCAT_COMPAT bit only when pic is not disabledpcinext
A value 1 of PCAT_COMPAT (bit 0) of MADT.Flags indicates that the system also has a PC-AT-compatible dual-8259 setup, i.e., the PIC. When PIC is not enabled (pic=off) for x86 machine, the PCAT_COMPAT bit needs to be cleared. Otherwise, the guest thinks there is a present PIC. To detect: When booting a VM with "-machine xx,pic=off", there is supposed to be no PIC for the guest. When guest probes PIC, it should find nothing and log of below should be printed: [ 0.155970] Using NULL legacy PIC However, the fact is that no such log printed in guest kernel, with the VM created with "pic=off". This is because guest think there is a present due to pcat_compat is reporte as 1 in MADT. See Linux code of probe_8259A() in arch/x86/kernel/i8259.c Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Message-Id: <20240403145953.3082491-1-xiaoyao.li@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/i386/acpi-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index 20f19269da4..0cc2919bb85 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -107,7 +107,9 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
acpi_table_begin(&table, table_data);
/* Local APIC Address */
build_append_int_noprefix(table_data, APIC_DEFAULT_ADDRESS, 4);
- build_append_int_noprefix(table_data, 1 /* PCAT_COMPAT */, 4); /* Flags */
+ /* Flags. bit 0: PCAT_COMPAT */
+ build_append_int_noprefix(table_data,
+ x86ms->pic != ON_OFF_AUTO_OFF ? 1 : 0 , 4);
for (i = 0; i < apic_ids->len; i++) {
pc_madt_cpu_entry(i, apic_ids, table_data, false);