hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses
commita2e2d7fc46fd8be875035d9bb5c64788389f65c2
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 23 Mar 2018 18:26:45 +0000 (23 18:26 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 23 Mar 2018 18:26:45 +0000 (23 18:26 +0000)
treeef81cbf5f500423f236fa5bc75533b3be3cc1f7b
parent544156efcf4d807507d223075c26702a1254880e
hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses

If the GIC has the security extension support enabled, then a
non-secure access to ICC_PMR must take account of the non-secure
view of interrupt priorities, where real priorities 0x00..0x7f
are secure-only and not visible to the non-secure guest, and
priorities 0x80..0xff are shown to the guest as if they were
0x00..0xff. We had the logic here wrong:
 * on reads, the priority is in the secure range if bit 7
   is clear, not if it is set
 * on writes, we want to set bit 7, not mask everything else

Our ICC_RPR read code had the same error as ICC_PMR.

(Compare the GICv3 spec pseudocode functions ICC_RPR_EL1
and ICC_PMR_EL1.)

Fixes: https://bugs.launchpad.net/qemu/+bug/1748434
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20180315133441.24149-1-peter.maydell@linaro.org
hw/intc/arm_gicv3_cpuif.c