[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.1 16/38] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.1 16/38] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers |
Date: |
Thu, 18 Jan 2024 10:52:43 +0300 |
From: Peter Maydell <peter.maydell@linaro.org>
The hypervisor can deliver (virtual) LPIs to a guest by setting up a
list register to have an intid which is an LPI. The GIC has to treat
these a little differently to standard interrupt IDs, because LPIs
have no Active state, and so the guest will only EOI them, it will
not also deactivate them. So icv_eoir_write() must do two things:
* if the LPI ID is not in any list register, we drop the
priority but do not increment the EOI count
* if the LPI ID is in a list register, we immediately deactivate
it, regardless of the split-drop-and-deactivate control
This can be seen in the VirtualWriteEOIR0() and VirtualWriteEOIR1()
pseudocode in the GICv3 architecture specification.
Without this fix, potentially a hypervisor guest might stall because
LPIs get stuck in a bogus Active+Pending state.
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Miguel Luis <miguel.luis@oracle.com>
(cherry picked from commit 82a65e3188abebb509510b391726711606aca642)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
index ab1a00508e..258dee1b80 100644
--- a/hw/intc/arm_gicv3_cpuif.c
+++ b/hw/intc/arm_gicv3_cpuif.c
@@ -1434,16 +1434,25 @@ static void icv_eoir_write(CPUARMState *env, const
ARMCPRegInfo *ri,
idx = icv_find_active(cs, irq);
if (idx < 0) {
- /* No valid list register corresponding to EOI ID */
- icv_increment_eoicount(cs);
+ /*
+ * No valid list register corresponding to EOI ID; if this is a vLPI
+ * not in the list regs then do nothing; otherwise increment EOI count
+ */
+ if (irq < GICV3_LPI_INTID_START) {
+ icv_increment_eoicount(cs);
+ }
} else {
uint64_t lr = cs->ich_lr_el2[idx];
int thisgrp = (lr & ICH_LR_EL2_GROUP) ? GICV3_G1NS : GICV3_G0;
int lr_gprio = ich_lr_prio(lr) & icv_gprio_mask(cs, grp);
if (thisgrp == grp && lr_gprio == dropprio) {
- if (!icv_eoi_split(env, cs)) {
- /* Priority drop and deactivate not split: deactivate irq now
*/
+ if (!icv_eoi_split(env, cs) || irq >= GICV3_LPI_INTID_START) {
+ /*
+ * Priority drop and deactivate not split: deactivate irq now.
+ * LPIs always get their active state cleared immediately
+ * because no separate deactivate is expected.
+ */
icv_deactivate_irq(cs, idx);
}
}
--
2.39.2
- [Stable-8.2.1 06/38] configure: use a native non-cross compiler for linux-user, (continued)
- [Stable-8.2.1 06/38] configure: use a native non-cross compiler for linux-user, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 07/38] target/i386: the sgx_epc_get_section stub is reachable, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 08/38] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 09/38] target/riscv: Fix mcycle/minstret increment behavior, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 10/38] chardev/char.c: fix "abstract device type" error message, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 11/38] audio/audio.c: remove trailing newline in error_setg, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 12/38] hw/net: cadence_gem: Fix MDIO_OP_xxx values, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 13/38] edu: fix DMA range upper bound check, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 14/38] vfio/container: Replace basename with g_path_get_basename, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 15/38] hw/vfio: fix iteration over global VFIODevice list, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 16/38] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers,
Michael Tokarev <=
- [Stable-8.2.1 17/38] tcg/ppc: Use new registers for LQ destination, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 18/38] util: fix build with musl libc on ppc64le, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 19/38] tests/acpi: allow tests/data/acpi/virt/SSDT.memhp changes, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 20/38] edk2: update to git snapshot, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 21/38] edk2: update build config, set PcdUninstallMemAttrProtocol = TRUE., Michael Tokarev, 2024/01/18
- [Stable-8.2.1 22/38] edk2: update binaries to git snapshot, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 23/38] tests/acpi: update expected data files, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 24/38] tests/acpi: disallow tests/data/acpi/virt/SSDT.memhp changes, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 26/38] target/s390x: Fix LAE setting a wrong access register, Michael Tokarev, 2024/01/18
- [Stable-8.2.1 25/38] tests/qtest/virtio-ccw: Fix device presence checking, Michael Tokarev, 2024/01/18