OSDN Git Service

hw/intc/arm_gicv3_its: Use address_space_map() to access command queue packets
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 1 Feb 2022 19:31:55 +0000 (19:31 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 8 Feb 2022 10:56:28 +0000 (10:56 +0000)
commitb6f96009acc90a88db7f8913788f989b521eb938
tree1fbc389f27ffef1f800ffaaeec7dbdc3432cf8b3
parent43530095e18fd16dcd51a4b385ad2a22c36f5698
hw/intc/arm_gicv3_its: Use address_space_map() to access command queue packets

Currently the ITS accesses each 8-byte doubleword in a 4-doubleword
command packet with a separate address_space_ldq_le() call.  This is
awkward because the individual command processing functions have
ended up with code to handle "load more doublewords out of the
packet", which is both unwieldy and also a potential source of bugs
because it's not obvious when looking at a line that pulls a field
out of the 'value' variable which of the 4 doublewords that variable
currently holds.

Switch to using address_space_map() to map the whole command packet
at once and fish the four doublewords out of it.  Then each process_*
function can start with a few lines of code that extract the fields
it cares about.

This requires us to split out the guts of process_its_cmd() into a
new do_process_its_cmd(), because we were previously overloading the
value and offset arguments as a backdoor way to directly pass the
devid and eventid from a write to GITS_TRANSLATER.  The new
do_process_its_cmd() takes those arguments directly, and
process_its_cmd() is just a wrapper that does the "read fields from
command packet" part.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220201193207.2771604-2-peter.maydell@linaro.org
hw/intc/arm_gicv3_its.c
hw/intc/gicv3_internal.h