arm/gic: minor fixes to ITS and GICv2m
cover arm/gic: minor fixes to ITS and GICv2m
Three minor fixes I stumbled upon when hacking around in kvmtool. Not sure how the v2m support actually worked at the moment. We might want to look at some MMIO space allocation algorithm to use for the GIC as well, possibly merging it with the virtio MMIO allocation we already have in place (virtio_mmio_get_io_space_block()). Not sure what the reason was to put the GIC at a different place.
Cheers,
Andre.
Andre Przywara (3):
arm/gic: remove extra 64K from ITS allocation arm/gic: avoid GICv2m MMIO frame overlap arm/gic: move GICv2M gadget size into private header
arm/aarch32/include/asm/kvm.h | 2 -- arm/aarch64/include/asm/kvm.h | 2 -- arm/gic.c | 6 +++--- arm/include/arm-common/gic.h | 2 ++ 4 files changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/3 arm/gic: remove extra 64K from ITS allocation
The KVM_VGIC_V3_ITS_SIZE macro from the Linux API header file already covers the doorbell page, so we don't need to add that extra page size in our code.
--- arm/gic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arm/gic.c +2 -2
@@ -229,8 +229,8 @@ int gic__create(struct kvm *kvm, enum irqchip_type type)case IRQCHIP_GICV2 :break ;case IRQCHIP_GICV3_ITS : -/* We reserve the 64K page with the doorbell as well. */ - gic_msi_size =KVM_VGIC_V3_ITS_SIZE +SZ_64K ; +/* The 64K page with the doorbell is included. */ + gic_msi_size =KVM_VGIC_V3_ITS_SIZE ;/* fall through */ case IRQCHIP_GICV3 : gic_redists_size = kvm->cfg.nrcpus *ARM_GIC_REDIST_SIZE ;
Signature · 1 line
2.14.1
PATCH 2/3 arm/gic: avoid GICv2m MMIO frame overlap
In reply to Andre PrzywaraCurrently we accidentally overlap the GICv2m MMIO frame with the CPU interface region. Fix this by moving the v2m frame below the CPUI region.
--- arm/gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arm/gic.c +1 -1
@@ -224,7 +224,7 @@ int gic__create(struct kvm *kvm, enum irqchip_type type)switch (type) {case IRQCHIP_GICV2M : gic_msi_size =KVM_VGIC_V2M_SIZE ; - gic_msi_base =ARM_GIC_DIST_BASE - gic_msi_size; + gic_msi_base =ARM_GIC_CPUI_BASE - gic_msi_size;break ;case IRQCHIP_GICV2 :break ;
Signature · 1 line
2.14.1
PATCH 3/3 arm/gic: move GICv2M gadget size into private header
In reply to Andre PrzywaraThe header files in arm/aarch*/include/asm/ are directly copied from Linux, so we can't just put our own definitions in there. Move the GICv2M MMIO frame size into a more private header, to avoid breaking the build once the header files are synced from Linux.
--- arm/aarch32/include/asm/kvm.h | 2 -- arm/aarch64/include/asm/kvm.h | 2 -- arm/include/arm-common/gic.h | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)
arm/aarch32/include/asm/kvm.h +0 -2
@@ -84,8 +84,6 @@ struct kvm_regs {#define KVM_VGIC_V2_DIST_SIZE 0x1000#define KVM_VGIC_V2_CPU_SIZE 0x2000 -#define KVM_VGIC_V2M_SIZE 0x1000 -/* Supported VGICv3 address types */ #define KVM_VGIC_V3_ADDR_TYPE_DIST 2#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3
arm/aarch64/include/asm/kvm.h +0 -2
@@ -84,8 +84,6 @@ struct kvm_regs {#define KVM_VGIC_V2_DIST_SIZE 0x1000#define KVM_VGIC_V2_CPU_SIZE 0x2000 -#define KVM_VGIC_V2M_SIZE 0x1000 -/* Supported VGICv3 address types */ #define KVM_VGIC_V3_ADDR_TYPE_DIST 2#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3
arm/include/arm-common/gic.h +2 -0
@@ -21,6 +21,8 @@#define GIC_MAX_CPUS 8#define GIC_MAX_IRQ 255 +#define KVM_VGIC_V2M_SIZE 0x1000 +enum irqchip_type {IRQCHIP_GICV2 ,IRQCHIP_GICV2M ,
Signature · 1 line
2.14.1