Message ID | 20210401024152.203896-9-shashi.mallela@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | GICv3 LPI and ITS feature implementation | expand |
On Thu, 1 Apr 2021 at 03:42, Shashi Mallela <shashi.mallela@linaro.org> wrote: > > Included creation of ITS as part of virt platform GIC > initialization.This Emulated ITS model now co-exists with kvm > ITS and is enabled in absence of kvm irq kernel support in a > platform. > > Signed-off-by: Shashi Mallela <shashi.mallela@linaro.org> > --- > hw/arm/virt.c | 10 ++++++++-- > target/arm/kvm_arm.h | 4 ++-- > 2 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index aa2bbd14e0..77cf2db90f 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -622,7 +622,7 @@ static void create_v2m(VirtMachineState *vms) > vms->msi_controller = VIRT_MSI_CTRL_GICV2M; > } > > -static void create_gic(VirtMachineState *vms) > +static void create_gic(VirtMachineState *vms, MemoryRegion *mem) > { > MachineState *ms = MACHINE(vms); > /* We create a standalone GIC */ > @@ -656,6 +656,12 @@ static void create_gic(VirtMachineState *vms) > nb_redist_regions); > qdev_prop_set_uint32(vms->gic, "redist-region-count[0]", redist0_count); > > + if (!kvm_irqchip_in_kernel()) { > + object_property_set_link(OBJECT(vms->gic), "sysmem", OBJECT(mem), > + &error_fatal); > + qdev_prop_set_bit(vms->gic, "has-lpi", true); > + } > + > if (nb_redist_regions == 2) { > uint32_t redist1_capacity = > vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; > @@ -2039,7 +2045,7 @@ static void machvirt_init(MachineState *machine) > > virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem); > > - create_gic(vms); > + create_gic(vms, sysmem); > > virt_cpu_post_init(vms, sysmem); > > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h > index 34f8daa377..0613454975 100644 > --- a/target/arm/kvm_arm.h > +++ b/target/arm/kvm_arm.h > @@ -525,8 +525,8 @@ static inline const char *its_class_name(void) > /* KVM implementation requires this capability */ > return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; > } else { > - /* Software emulation is not implemented yet */ > - return NULL; > + /* Software emulation based model */ > + return "arm-gicv3-its"; > } > } This is OK as far as it goes, but I think we need to add the versioned-machine support so that only "virt-6.1" and later get the new ITS, and "virt-6.0" behave the same way (ie no ITS) as they did in older QEMU versions. thanks -- PMM
On Mon, 2021-04-19 at 13:46 +0100, Peter Maydell wrote: > On Thu, 1 Apr 2021 at 03:42, Shashi Mallela < > shashi.mallela@linaro.org> wrote: > > Included creation of ITS as part of virt platform GIC > > initialization.This Emulated ITS model now co-exists with kvm > > ITS and is enabled in absence of kvm irq kernel support in a > > platform. > > > > Signed-off-by: Shashi Mallela <shashi.mallela@linaro.org> > > --- > > hw/arm/virt.c | 10 ++++++++-- > > target/arm/kvm_arm.h | 4 ++-- > > 2 files changed, 10 insertions(+), 4 deletions(-) > > > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > index aa2bbd14e0..77cf2db90f 100644 > > --- a/hw/arm/virt.c > > +++ b/hw/arm/virt.c > > @@ -622,7 +622,7 @@ static void create_v2m(VirtMachineState *vms) > > vms->msi_controller = VIRT_MSI_CTRL_GICV2M; > > } > > > > -static void create_gic(VirtMachineState *vms) > > +static void create_gic(VirtMachineState *vms, MemoryRegion *mem) > > { > > MachineState *ms = MACHINE(vms); > > /* We create a standalone GIC */ > > @@ -656,6 +656,12 @@ static void create_gic(VirtMachineState *vms) > > nb_redist_regions); > > qdev_prop_set_uint32(vms->gic, "redist-region-count[0]", > > redist0_count); > > > > + if (!kvm_irqchip_in_kernel()) { > > + object_property_set_link(OBJECT(vms->gic), "sysmem", > > OBJECT(mem), > > + &error_fatal); > > + qdev_prop_set_bit(vms->gic, "has-lpi", true); > > + } > > + > > if (nb_redist_regions == 2) { > > uint32_t redist1_capacity = > > vms->memmap[VIRT_HIGH_GIC_REDIST2].size / > > GICV3_REDIST_SIZE; > > @@ -2039,7 +2045,7 @@ static void machvirt_init(MachineState > > *machine) > > > > virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem); > > > > - create_gic(vms); > > + create_gic(vms, sysmem); > > > > virt_cpu_post_init(vms, sysmem); > > > > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h > > index 34f8daa377..0613454975 100644 > > --- a/target/arm/kvm_arm.h > > +++ b/target/arm/kvm_arm.h > > @@ -525,8 +525,8 @@ static inline const char *its_class_name(void) > > /* KVM implementation requires this capability */ > > return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; > > } else { > > - /* Software emulation is not implemented yet */ > > - return NULL; > > + /* Software emulation based model */ > > + return "arm-gicv3-its"; > > } > > } > > This is OK as far as it goes, but I think we need to add the > versioned-machine support so that only "virt-6.1" and later get the > new ITS, and "virt-6.0" behave the same way (ie no ITS) as they did > in older QEMU versions. > > Have added versioned machine support to enable new ITS only for > versions 6.1 and above > thanks > -- PMM
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index aa2bbd14e0..77cf2db90f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -622,7 +622,7 @@ static void create_v2m(VirtMachineState *vms) vms->msi_controller = VIRT_MSI_CTRL_GICV2M; } -static void create_gic(VirtMachineState *vms) +static void create_gic(VirtMachineState *vms, MemoryRegion *mem) { MachineState *ms = MACHINE(vms); /* We create a standalone GIC */ @@ -656,6 +656,12 @@ static void create_gic(VirtMachineState *vms) nb_redist_regions); qdev_prop_set_uint32(vms->gic, "redist-region-count[0]", redist0_count); + if (!kvm_irqchip_in_kernel()) { + object_property_set_link(OBJECT(vms->gic), "sysmem", OBJECT(mem), + &error_fatal); + qdev_prop_set_bit(vms->gic, "has-lpi", true); + } + if (nb_redist_regions == 2) { uint32_t redist1_capacity = vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; @@ -2039,7 +2045,7 @@ static void machvirt_init(MachineState *machine) virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem); - create_gic(vms); + create_gic(vms, sysmem); virt_cpu_post_init(vms, sysmem); diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 34f8daa377..0613454975 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -525,8 +525,8 @@ static inline const char *its_class_name(void) /* KVM implementation requires this capability */ return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; } else { - /* Software emulation is not implemented yet */ - return NULL; + /* Software emulation based model */ + return "arm-gicv3-its"; } }
Included creation of ITS as part of virt platform GIC initialization.This Emulated ITS model now co-exists with kvm ITS and is enabled in absence of kvm irq kernel support in a platform. Signed-off-by: Shashi Mallela <shashi.mallela@linaro.org> --- hw/arm/virt.c | 10 ++++++++-- target/arm/kvm_arm.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-)