hw/intc: apic: stop register accesses for invalid situations
PATCH 1/1 hw/intc: apic: stop register accesses for invalid situations
kvm-unit-tests's apic.c tests for:
!APICBASE_ENABLE + attempting to read xAPIC registers is not an allowed
combination.
And neither is x2APIC enabled + attempting to read xAPIC registers
This was tested on WHPX with kernel-irqchip=off with x2APIC emulation enabled (in a posted series) and TCG.
Signed-off-by Mohamed Mediouni <[email protected]>
--- hw/intc/apic.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/intc/apic.c +9 -0
@@ -875,6 +875,15 @@ static uint64_t apic_mem_read(void *opaque, hwaddr addr, unsigned size)return -1 ; } +/* if the xAPIC is disabled, return early. */ +if (!(s->apicbase &MSR_IA32_APICBASE_ENABLE )) { +return 0xffffffff ; + } + +if (s->apicbase &MSR_IA32_APICBASE_EXTD ) { +return 0xffffffff ; + } + index = (addr >>4 ) &0xff ;apic_register_read (s, index, &val);
Signature · 1 line
2.50.1 (Apple Git-155)