[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 29/31] hw/intc/loongarch_pch: fix edge triggered irq handling
From: |
Song Gao |
Subject: |
[PULL 29/31] hw/intc/loongarch_pch: fix edge triggered irq handling |
Date: |
Thu, 24 Aug 2023 17:24:07 +0800 |
From: Bibo Mao <maobibo@loongson.cn>
For edge triggered irq, qemu_irq_pulse is used to inject irq. It will
set irq with high level and low level soon to simluate pulse irq.
For edge triggered irq, irq is injected and set as pending at rising
level, do not clear irq at lowering level. LoongArch pch interrupt will
clear irq for lowering level irq, there will be problem. ACPI ged deivce
is edge-triggered irq, it is used for cpu/memory hotplug.
This patch fixes memory hotplug issue on LoongArch virt machine.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20230707091557.1474790-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/intc/loongarch_pch_pic.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c
index 9208fc4460..6aa4cadfa4 100644
--- a/hw/intc/loongarch_pch_pic.c
+++ b/hw/intc/loongarch_pch_pic.c
@@ -30,7 +30,11 @@ static void pch_pic_update_irq(LoongArchPCHPIC *s, uint64_t
mask, int level)
qemu_set_irq(s->parent_irq[s->htmsi_vector[irq]], 1);
}
} else {
- val = mask & s->intisr;
+ /*
+ * intirr means requested pending irq
+ * do not clear pending irq for edge-triggered on lowering edge
+ */
+ val = mask & s->intisr & ~s->intirr;
if (val) {
irq = ctz64(val);
s->intisr &= ~MAKE_64BIT_MASK(irq, 1);
@@ -51,6 +55,7 @@ static void pch_pic_irq_handler(void *opaque, int irq, int
level)
/* Edge triggered */
if (level) {
if ((s->last_intirr & mask) == 0) {
+ /* marked pending on a rising edge */
s->intirr |= mask;
}
s->last_intirr |= mask;
--
2.39.1
- [PULL 01/31] target/loongarch: Log I/O write accesses to CSR registers, (continued)
- [PULL 01/31] target/loongarch: Log I/O write accesses to CSR registers, Song Gao, 2023/08/24
- [PULL 22/31] hw/loongarch: Remove restriction of la464 cores in the virt machine, Song Gao, 2023/08/24
- [PULL 23/31] target/loongarch: Add avail_FP/FP_SP/FP_DP to check fpu instructions, Song Gao, 2023/08/24
- [PULL 15/31] target/loongarch: Extract make_address_pc() helper, Song Gao, 2023/08/24
- [PULL 18/31] target/loongarch: Sign extend results in VA32 mode, Song Gao, 2023/08/24
- [PULL 27/31] target/loongarch: Add avail_IOCSR to check iocsr instructions, Song Gao, 2023/08/24
- [PULL 12/31] target/loongarch: Add LA64 & VA32 to DisasContext, Song Gao, 2023/08/24
- [PULL 16/31] target/loongarch: Extract set_pc() helper, Song Gao, 2023/08/24
- [PULL 20/31] target/loongarch: Add avail_64 to check la64-only instructions, Song Gao, 2023/08/24
- [PULL 24/31] target/loongarch: Add avail_LSPW to check LSPW instructions, Song Gao, 2023/08/24
- [PULL 29/31] hw/intc/loongarch_pch: fix edge triggered irq handling,
Song Gao <=
- [PULL 25/31] target/loongarch: Add avail_LAM to check atomic instructions, Song Gao, 2023/08/24
- [PULL 17/31] target/loongarch: Truncate high 32 bits of address in VA32 mode, Song Gao, 2023/08/24
- [PULL 21/31] target/loongarch: Add LoongArch32 cpu la132, Song Gao, 2023/08/24
- [PULL 19/31] target/loongarch: Add a check parameter to the TRANS macro, Song Gao, 2023/08/24
- [PULL 11/31] target/loongarch: Support LoongArch32 VPPN, Song Gao, 2023/08/24
- [PULL 26/31] target/loongarch: Add avail_LSX to check LSX instructions, Song Gao, 2023/08/24
- [PULL 31/31] hw/loongarch: Fix ACPI processor id off-by-one error, Song Gao, 2023/08/24
- [PULL 30/31] target/loongarch: Split fcc register to fcc0-7 in gdbstub, Song Gao, 2023/08/24
- [PULL 14/31] target/loongarch: Extract make_address_i() helper, Song Gao, 2023/08/24
- [PULL 28/31] target/loongarch: cpu: Implement get_arch_id callback, Song Gao, 2023/08/24