[PATCH 00/13] hw/intc/arm_gicv3_its: more cleanups, bugfixes

Peter Maydell posted 13 patches 2 years, 3 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220201193207.2771604-1-peter.maydell@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
hw/intc/gicv3_internal.h               |  23 +-
include/hw/intc/arm_gicv3_its_common.h |   2 -
hw/intc/arm_gicv3_its.c                | 696 +++++++++++--------------
3 files changed, 328 insertions(+), 393 deletions(-)
[PATCH 00/13] hw/intc/arm_gicv3_its: more cleanups, bugfixes
Posted by Peter Maydell 2 years, 3 months ago
This is another set of patches to the ITS emulation; mostly
cleanups, but there are two bug fixes.

Cleanups:

(1) Switch away from reading command packets by multiple separate
calls to address_space_ldq_le(), and instead use
address_space_map()/unmap() to get all 4 doublewords in the command
packet at once in the top level queue-processing loop.  This gets all
the handling of loading words out of the individual command-handling
functions and makes them a lot easier to read IMHO. Plus it reduces
the number of lines of code by about a hundred.

(2) Unify all of the get_foo()/update_foo() functions that we use
for reading and writing the various in-guest-memory tables so that
they use a single style of API rather than being confusingly
different about how they indicate failure and how they return
the interesting fields from the table entries.

(3) A handful of less exciting minor tweaks.

Bugfixes:

(1) We were mis-calculating the address to use for the
last 4 bytes in an interrupt table entry, so they overwrote
the middle 4 bytes... The fix for this one is slightly
awkward because we need to handle migration from guests which
have in-memory tables written using the buggy code.

(2) We shouldn't validity-check rdbase in MAPC with V=0

(3) MAPI/MAPTI with intid 1023 should be rejected

thanks
-- PMM

Peter Maydell (13):
  hw/intc/arm_gicv3_its: Use address_space_map() to access command queue
    packets
  hw/intc/arm_gicv3_its: Keep DTEs as a struct, not a raw uint64_t
  hw/intc/arm_gicv3_its: Pass DTEntry to update_dte()
  hw/intc/arm_gicv3_its: Keep CTEs as a struct, not a raw uint64_t
  hw/intc/arm_gicv3_its: Pass CTEntry to update_cte()
  hw/intc/arm_gicv3_its: Fix address calculation in get_ite() and
    update_ite()
  hw/intc/arm_gicv3_its: Avoid nested ifs in get_ite()
  hw/intc/arm_gicv3_its: Pass ITE values back from get_ite() via a
    struct
  hw/intc/arm_gicv3_its: Make update_ite() use ITEntry
  hw/intc/arm_gicv3_its: Drop TableDesc and CmdQDesc valid fields
  hw/intc/arm_gicv3_its: In MAPC with V=0, don't check rdbase field
  hw/intc/arm_gicv3_its: Don't allow intid 1023 in MAPI/MAPTI
  hw/intc/arm_gicv3_its: Split error checks

 hw/intc/gicv3_internal.h               |  23 +-
 include/hw/intc/arm_gicv3_its_common.h |   2 -
 hw/intc/arm_gicv3_its.c                | 696 +++++++++++--------------
 3 files changed, 328 insertions(+), 393 deletions(-)

-- 
2.25.1


Re: [PATCH 00/13] hw/intc/arm_gicv3_its: more cleanups, bugfixes
Posted by Peter Maydell 2 years, 2 months ago
On Tue, 1 Feb 2022 at 19:32, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> This is another set of patches to the ITS emulation; mostly
> cleanups, but there are two bug fixes.

Applied to target-arm.next, thanks.

-- PMM