On Wed, 7 Aug 2024 at 04:46, Richard Henderson <richard.hender...@linaro.org> wrote: > > On 8/7/24 00:19, Philippe Mathieu-Daudé wrote: > > qmp_query_gic_capabilities() is not specific to the ARM > > architecture but to the GIC device which is modelled in > > hw/intc/, so move the code there for clarity. > > But the GIC is certainly arm architecture specific. > It's built into the CPU, and shares state. > > The fact that it's modeled in hw/intc/ and not in target/arm/ has always been > a needle in > the side, though it seems there are no good options.
In retrospect I wonder if we should have modelled the "GIC stream protocol" described in the GIC architecture spec, which formalises the communication between the CPU (including the GIC CPU interface) and the rest of the GIC (redistributors, distributor). It would probably have been more work and perhaps less efficient but it would have been a cleaner way to split the hw/intc code from the target/arm code. But regardless I don't think it would really be very feasible to move to that design at this point. WRT the commit message, the GIC is definitely Arm architecture specific. There might be boards with both Arm cores and non-Arm cores and a GIC, but the GIC will be connected to the Arm cores, and there won't be boards with a GIC but no Arm cores. The QAPI command which this code is implementing is also (a) target-specific and (b) unfortunately designed so that it doesn't get passed a particular CPU or particular device to query, it's just assumed to be a part of the whole simulation. -- PMM