From 5773c0494ae8045250288a801417270e0ef5de55 Mon Sep 17 00:00:00 2001 From: Luc Michel Date: Tue, 14 Aug 2018 17:17:20 +0100 Subject: intc/arm_gic: Add the virtualization extensions to the GIC state Add the necessary parts of the virtualization extensions state to the GIC state. We choose to increase the size of the CPU interfaces state to add space for the vCPU interfaces (the GIC_NCPU_VCPU macro). This way, we'll be able to reuse most of the CPU interface code for the vCPUs. The only exception is the APR value, which is stored in h_apr in the virtual interface state for vCPUs. This is due to some complications with the GIC VMState, for which we don't want to break backward compatibility. APRs being stored in 2D arrays, increasing the second dimension would lead to some ugly VMState description. To avoid that, we keep it in h_apr for vCPUs. The vCPUs are numbered from GIC_NCPU to (GIC_NCPU * 2) - 1. The `gic_is_vcpu` function help to determine if a given CPU id correspond to a physical CPU or a virtual one. For the in-kernel KVM VGIC, since the exposed VGIC does not implement the virtualization extensions, we report an error if the corresponding property is set to true. Signed-off-by: Luc Michel Reviewed-by: Peter Maydell Message-id: 20180727095421.386-6-luc.michel@greensocs.com Signed-off-by: Peter Maydell --- hw/intc/gic_internal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hw/intc/gic_internal.h') diff --git a/hw/intc/gic_internal.h b/hw/intc/gic_internal.h index a2075a9..c85427c 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -94,4 +94,9 @@ static inline bool gic_test_pending(GICState *s, int irq, int cm) } } +static inline bool gic_is_vcpu(int cpu) +{ + return cpu >= GIC_NCPU; +} + #endif /* QEMU_ARM_GIC_INTERNAL_H */ -- cgit v1.1