On 14/9/26 18:00, Peter Maydell wrote:
In a real hardware GICv5, the IRS knows which CPU is talking to it
because each IRS<->cpuif link is a separate 1:1 connection. In
QEMU's implementation, the cpuif code calls functions like
gicv5_set_priority(), and currently we usually don't pass anything to
tell the IRS which cpuif is making the call, because mostly the IRS
doesn't need to care. There are a few places where it does need to
know, notably in gicv5_get_hppi(). Here we have the cpuif pass its
IAFFID; the IRS then looks that up by doing a linear search of the
cpu_iaffids[] array to get the index of the CPU.
For virtualization, many of the stream commands which don't currently
need to say which cpuif is making the call will have to start doing
so, because changing the state of a virtual interrupt requires the
IRS to look up the VPE which is resident on the calling cpuif. This
makes the IAFFID->cpuidx lookup seem increasingly awkward.
Change gicv5_set_gicv5state() to pass the IRS's CPU index value for
the cpuif as well as the guest-visible IAFFID, and make the stream
functions identify the cpuif by CPU index rather than IAFFID, to
avoid the unnecessary IAFFID->cpuidx lookup.
As this is now three GICv5-related things that we are keeping in the
CPU state struct, we push them into a sub-struct to keep them tidy.
Signed-off-by: Peter Maydell <[email protected]>
---
hw/intc/arm_gicv5_common.c | 2 +-
include/hw/intc/arm_gicv5_stream.h | 6 ++++--
target/arm/cpu.c | 10 ++++++----
target/arm/cpu.h | 10 ++++++----
target/arm/tcg/gicv5-cpuif.c | 6 +++---
5 files changed, 20 insertions(+), 14 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>