diff mbox series

[v4,2/8] hw/arm/virt: Simplify logic for setting instance's 'tcg_its' variable

Message ID 20250616131824.425315-3-gustavo.romero@linaro.org
State New
Headers show
Series hw/arm: GIC 'its=off' ACPI table fixes | expand

Commit Message

Gustavo Romero June 16, 2025, 1:18 p.m. UTC
Because 'tcg_its' in the machine instance is set based on the machine
class’s negated variable 'no_tcg_its', 'tcg_its' is the opposite of
'no_tcg_its' and hence the code in question can be simplified as:
tcg_its = !no_tcg_its.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
---
 hw/arm/virt.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Eric Auger June 17, 2025, 9:46 a.m. UTC | #1
Hi Gustavo,

On 6/16/25 3:18 PM, Gustavo Romero wrote:
> Because 'tcg_its' in the machine instance is set based on the machine
> class’s negated variable 'no_tcg_its', 'tcg_its' is the opposite of
> 'no_tcg_its' and hence the code in question can be simplified as:
> tcg_its = !no_tcg_its.
>
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> ---
>  hw/arm/virt.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 9a6cd085a3..42a63a523e 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -3337,12 +3337,8 @@ static void virt_instance_init(Object *obj)
>  
>      /* Default allows ITS instantiation */
>      vms->its = true;
> -
> -    if (vmc->no_tcg_its) {
> -        vms->tcg_its = false;
> -    } else {
> -        vms->tcg_its = true;
> -    }
> +    /* Allow ITS emulation if the machine version supports it. */
remove "."?

besides

Reviewed-by: Eric Auger <eric.auger@redhat.com>
> +    vms->tcg_its = !vmc->no_tcg_its;
>  
>      /* Default disallows iommu instantiation */
>      vms->iommu = VIRT_IOMMU_NONE;
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9a6cd085a3..42a63a523e 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3337,12 +3337,8 @@  static void virt_instance_init(Object *obj)
 
     /* Default allows ITS instantiation */
     vms->its = true;
-
-    if (vmc->no_tcg_its) {
-        vms->tcg_its = false;
-    } else {
-        vms->tcg_its = true;
-    }
+    /* Allow ITS emulation if the machine version supports it. */
+    vms->tcg_its = !vmc->no_tcg_its;
 
     /* Default disallows iommu instantiation */
     vms->iommu = VIRT_IOMMU_NONE;