summaryrefslogtreecommitdiffstats
path: root/hw/riscv/sifive_gpio.c
diff options
context:
space:
mode:
authorBin Meng2020-06-08 16:17:37 +0200
committerAlistair Francis2020-06-19 17:25:27 +0200
commit621c1006d2d82da9f266f21ad8e887c38769a11b (patch)
treeaa8f0f30f8d1082f9f2a1255568850ead7f49285 /hw/riscv/sifive_gpio.c
parenthw/riscv: sifive_u: Hook a GPIO controller (diff)
downloadqemu-621c1006d2d82da9f266f21ad8e887c38769a11b.tar.gz
qemu-621c1006d2d82da9f266f21ad8e887c38769a11b.tar.xz
qemu-621c1006d2d82da9f266f21ad8e887c38769a11b.zip
hw/riscv: sifive_gpio: Do not blindly trigger output IRQs
At present the GPIO output IRQs are triggered each time any GPIO register is written. However this is not correct. We should only trigger the output IRQ when the pin is configured as output enable. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 1591625864-31494-9-git-send-email-bmeng.cn@gmail.com Message-Id: <1591625864-31494-9-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw/riscv/sifive_gpio.c')
-rw-r--r--hw/riscv/sifive_gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/riscv/sifive_gpio.c b/hw/riscv/sifive_gpio.c
index 0d0fd2ba5e..aac6b44cac 100644
--- a/hw/riscv/sifive_gpio.c
+++ b/hw/riscv/sifive_gpio.c
@@ -76,7 +76,9 @@ static void update_state(SIFIVEGPIOState *s)
actual_value = pull;
}
- qemu_set_irq(s->output[i], actual_value);
+ if (output_en) {
+ qemu_set_irq(s->output[i], actual_value);
+ }
/* Input value */
ival = input_en && actual_value;