[RFC PATCH 2/4] hw/arm/virt: Don't use vms->tcg_its in create_gic()

Peter Maydell posted 4 patches 2 weeks, 6 days ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>
[RFC PATCH 2/4] hw/arm/virt: Don't use vms->tcg_its in create_gic()
Posted by Peter Maydell 2 weeks, 6 days ago
The create_gic() function needs to know whether the GIC
has a TCG ITS attached, as it should set the "sysmem" and
"has-lpi" properties of the GICv3 only in that case.
Currently it does this with
 (!kvm_irqchip_in_kernel() && vms->tcg_its)
which implicitly relies on knowing that the only case
where we aren't using a KVM GIC and we don't have an ITS
is where we suppressed the TCG ITS because of the
board-version-compatibility no_tcg_its setting.

We can avoid direct use of vms->tcg_its now that we
can identify what MSI controller we are using from the
vms->msi_controller field.

This means that the only use of vms->tcg_its is in
the logic in finalize_msi_controller().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b55297455f..a231aef268 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -851,7 +851,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
                             redist_region_count);
 
         if (!kvm_irqchip_in_kernel()) {
-            if (vms->tcg_its) {
+            if (vms->msi_controller == VIRT_MSI_CTRL_ITS) {
                 object_property_set_link(OBJECT(vms->gic), "sysmem",
                                          OBJECT(mem), &error_fatal);
                 qdev_prop_set_bit(vms->gic, "has-lpi", true);
-- 
2.47.3
Re: [RFC PATCH 2/4] hw/arm/virt: Don't use vms->tcg_its in create_gic()
Posted by Mohamed Mediouni 2 weeks, 4 days ago

> On 20. Jan 2026, at 19:03, Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> The create_gic() function needs to know whether the GIC
> has a TCG ITS attached, as it should set the "sysmem" and
> "has-lpi" properties of the GICv3 only in that case.
> Currently it does this with
> (!kvm_irqchip_in_kernel() && vms->tcg_its)
> which implicitly relies on knowing that the only case
> where we aren't using a KVM GIC and we don't have an ITS
> is where we suppressed the TCG ITS because of the
> board-version-compatibility no_tcg_its setting.
> 
> We can avoid direct use of vms->tcg_its now that we
> can identify what MSI controller we are using from the
> vms->msi_controller field.
> 
> This means that the only use of vms->tcg_its is in
> the logic in finalize_msi_controller().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/arm/virt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index b55297455f..a231aef268 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -851,7 +851,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
>                             redist_region_count);
> 
>         if (!kvm_irqchip_in_kernel()) {
> -            if (vms->tcg_its) {
> +            if (vms->msi_controller == VIRT_MSI_CTRL_ITS) {
>                 object_property_set_link(OBJECT(vms->gic), "sysmem",
>                                          OBJECT(mem), &error_fatal);
>                 qdev_prop_set_bit(vms->gic, "has-lpi", true);
> -- 
> 2.47.3
> 
> 
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Re: [RFC PATCH 2/4] hw/arm/virt: Don't use vms->tcg_its in create_gic()
Posted by Philippe Mathieu-Daudé 2 weeks, 4 days ago
On 20/1/26 19:03, Peter Maydell wrote:
> The create_gic() function needs to know whether the GIC
> has a TCG ITS attached, as it should set the "sysmem" and
> "has-lpi" properties of the GICv3 only in that case.
> Currently it does this with
>   (!kvm_irqchip_in_kernel() && vms->tcg_its)
> which implicitly relies on knowing that the only case
> where we aren't using a KVM GIC and we don't have an ITS
> is where we suppressed the TCG ITS because of the
> board-version-compatibility no_tcg_its setting.
> 
> We can avoid direct use of vms->tcg_its now that we
> can identify what MSI controller we are using from the
> vms->msi_controller field.
> 
> This means that the only use of vms->tcg_its is in
> the logic in finalize_msi_controller().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/arm/virt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>