]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/intc/arm_gic: Fix handling of NS view of GICC_APR<n>
authorAndrey Shumilin <shum.sdl@nppct.ru>
Thu, 23 May 2024 15:06:20 +0000 (16:06 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 30 May 2024 14:13:29 +0000 (17:13 +0300)
commit3f470980b4933d9e1b4b29683a7e8b425352bc10
treee5f0c898e105df3ee2d5476e0a4097ed1ec051b7
parent0970313b05f3d36e43635757bd0afd63566438a5
hw/intc/arm_gic: Fix handling of NS view of GICC_APR<n>

In gic_cpu_read() and gic_cpu_write(), we delegate the handling of
reading and writing the Non-Secure view of the GICC_APR<n> registers
to functions gic_apr_ns_view() and gic_apr_write_ns_view().
Unfortunately we got the order of the arguments wrong, swapping the
CPU number and the register number (which the compiler doesn't catch
because they're both integers).

Most guests probably didn't notice this bug because directly
accessing the APR registers is typically something only done by
firmware when it is doing state save for going into a sleep mode.

Correct the mismatched call arguments.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Cc: qemu-stable@nongnu.org
Fixes: 51fd06e0ee ("hw/intc/arm_gic: Fix handling of GICC_APR<n>, GICC_NSAPR<n> registers")
Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
[PMM: Rewrote commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée<alex.bennee@linaro.org>
(cherry picked from commit daafa78b297291fea36fb4daeed526705fa7c035)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/intc/arm_gic.c