hw/intc/arm_gicv3_cpuif: Fix virtual irq number check in icv_[dir|eoir]_write
authorRicardo Koller <ricarkol@google.com>
Fri, 2 Jul 2021 23:37:01 +0000 (16:37 -0700)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 9 Jul 2021 15:09:12 +0000 (16:09 +0100)
commitf4ec71d07cd2375c9080fbd4e85beffd05d73a11
tree0daf9ee73f7b0525c93d5fee784a463f1db2670b
parent7cb4097f2d559b5ea4ad993653abc1e542deb625
hw/intc/arm_gicv3_cpuif: Fix virtual irq number check in icv_[dir|eoir]_write

icv_eoir_write() and icv_dir_write() ignore invalid virtual IRQ numbers
(like LPIs).  The issue is that these functions check against the number
of implemented IRQs (QEMU's default is num_irq=288) which can be lower
than the maximum virtual IRQ number (1020 - 1).  The consequence is that
if a hypervisor creates an LR for an IRQ between 288 and 1020, then the
guest is unable to deactivate the resulting IRQ. Note that other
functions that deal with large IRQ numbers, like icv_iar_read, check
against 1020 and not against num_irq.

Fix the checks by using GICV3_MAXIRQ (1020) instead of the number of
implemented IRQs.

Signed-off-by: Ricardo Koller <ricarkol@google.com>
Message-id: 20210702233701.3369-1-ricarkol@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/intc/arm_gicv3_cpuif.c