qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Romero <gustavo.romero@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Andrew Jones" <ajones@ventanamicro.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-arm@nongnu.org, "Udo Steinberg" <udo@hypervisor.org>,
	"Shannon Zhao" <shannon.zhaosl@gmail.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Ani Sinha" <anisinha@redhat.com>
Subject: Re: [PATCH-for-10.1 v3 7/9] hw/arm/virt-acpi: Always build IORT table (even with GIC ITS disabled)
Date: Fri, 4 Apr 2025 00:02:01 -0300	[thread overview]
Message-ID: <ecf79fce-9406-4889-91a8-0e0fdf52eb4b@linaro.org> (raw)
In-Reply-To: <20250403204029.47958-8-philmd@linaro.org>

Hi Phil,

On 4/3/25 17:40, Philippe Mathieu-Daudé wrote:
> Citing Gustavo [*]:
> 
>    Gating IORT table generation entirely based on the presence
>    of ITS looks wrong because IORT table has data beyond GIC ITS,
>    like for SMMUv3 etc..
> 
> [*] https://lore.kernel.org/qemu-devel/bae6e29a-7290-47d2-8caf-14702ee091f0@linaro.org/
> 
> Reported-by: Gustavo Romero <gustavo.romero@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Maybe it's worth to cite the "IO Remapping Table Platform Design Document",
in particular page 10, which reads:

"the IORT provides an ACPI description for IO topology, SMMUs, and GIC ITSs"

https://developer.arm.com/documentation/den0049/latest/

Now that the target is 10.1, let me thing a bit more about it.


Cheers,
Gustavo

> ---
>   hw/arm/virt-acpi-build.c | 38 +++++++++++++++++++++-----------------
>   1 file changed, 21 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 1c389ef5cdb..e7e27951cb9 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -287,6 +287,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>       uint32_t id = 0;
>       GArray *smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
>       GArray *its_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
> +    bool has_its = its_enabled(vms);
>   
>       AcpiTable table = { .sig = "IORT", .rev = 3, .oem_id = vms->oem_id,
>                           .oem_table_id = vms->oem_table_id };
> @@ -325,9 +326,12 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>   
>           nb_nodes = 3; /* RC, ITS, SMMUv3 */
>           rc_mapping_count = smmu_idmaps->len + its_idmaps->len;
> -    } else {
> +    } else if (has_its) {
>           nb_nodes = 2; /* RC, ITS */
>           rc_mapping_count = 1;
> +    } else {
> +        nb_nodes = 1; /* RC */
> +        rc_mapping_count = 1;
>       }
>       /* Number of IORT Nodes */
>       build_append_int_noprefix(table_data, nb_nodes, 4);
> @@ -336,17 +340,19 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>       build_append_int_noprefix(table_data, IORT_NODE_OFFSET, 4);
>       build_append_int_noprefix(table_data, 0, 4); /* Reserved */
>   
> -    /* Table 12 ITS Group Format */
> -    build_append_int_noprefix(table_data, 0 /* ITS Group */, 1); /* Type */
> -    node_size =  20 /* fixed header size */ + 4 /* 1 GIC ITS Identifier */;
> -    build_append_int_noprefix(table_data, node_size, 2); /* Length */
> -    build_append_int_noprefix(table_data, 1, 1); /* Revision */
> -    build_append_int_noprefix(table_data, id++, 4); /* Identifier */
> -    build_append_int_noprefix(table_data, 0, 4); /* Number of ID mappings */
> -    build_append_int_noprefix(table_data, 0, 4); /* Reference to ID Array */
> -    build_append_int_noprefix(table_data, 1, 4); /* Number of ITSs */
> -    /* GIC ITS Identifier Array */
> -    build_append_int_noprefix(table_data, 0 /* MADT translation_id */, 4);
> +    if (has_its) {
> +        /* Table 12 ITS Group Format */
> +        build_append_int_noprefix(table_data, 0 /* ITS Group */, 1); /* Type */ //
> +        node_size =  20 /* fixed header size */ + 4 /* 1 GIC ITS Identifier */;
> +        build_append_int_noprefix(table_data, node_size, 2); /* Length */
> +        build_append_int_noprefix(table_data, 1, 1); /* Revision */
> +        build_append_int_noprefix(table_data, id++, 4); /* Identifier */
> +        build_append_int_noprefix(table_data, 0, 4); /* Number of ID mappings */
> +        build_append_int_noprefix(table_data, 0, 4); /* Reference to ID Array */
> +        build_append_int_noprefix(table_data, 1, 4); /* Number of ITSs */
> +        /* GIC ITS Identifier Array */
> +        build_append_int_noprefix(table_data, 0 /* MADT translation_id */, 4);
> +    }
>   
>       if (vms->iommu == VIRT_IOMMU_SMMUV3) {
>           int irq =  vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE;
> @@ -429,7 +435,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>               build_iort_id_mapping(table_data, range->input_base,
>                                     range->id_count, IORT_NODE_OFFSET);
>           }
> -    } else {
> +    } else if (has_its) {
>           /* output IORT node is the ITS group node (the first node) */
>           build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET);
>       }
> @@ -979,10 +985,8 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
>                             vms->oem_table_id);
>       }
>   
> -    if (its_enabled(vms)) {
> -        acpi_add_table(table_offsets, tables_blob);
> -        build_iort(tables_blob, tables->linker, vms);
> -    }
> +    acpi_add_table(table_offsets, tables_blob);
> +    build_iort(tables_blob, tables->linker, vms);
>   
>   #ifdef CONFIG_TPM
>       if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) {



  reply	other threads:[~2025-04-04  3:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 20:40 [PATCH-for-10.1 v3 0/9] hw/arm: GIC ITS=off ACPI tables fixes Philippe Mathieu-Daudé
2025-04-03 20:40 ` [PATCH-for-10.1 v3 1/9] hw/arm/virt: Remove pointless VirtMachineState::tcg_its field Philippe Mathieu-Daudé
2025-04-07 11:57   ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 2/9] hw/intc/gicv3_its: Do not check its_class_name() for NULL Philippe Mathieu-Daudé
2025-04-07 11:57   ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 3/9] hw/arm/virt: Simplify create_its() Philippe Mathieu-Daudé
2025-04-04  2:59   ` Gustavo Romero
2025-04-07 12:05   ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 4/9] hw/arm/virt-acpi: Factor its_enabled() helper out Philippe Mathieu-Daudé
2025-04-07 12:08   ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 5/9] qtest/bios-tables-test: Add test for -M virt, its=off Philippe Mathieu-Daudé
2025-04-04  3:00   ` [PATCH-for-10.1 v3 5/9] qtest/bios-tables-test: Add test for -M virt,its=off Gustavo Romero
2025-04-07 12:55     ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 6/9] qtest/bios-tables-test: Whitelist aarch64/virt 'its_off' variant blobs Philippe Mathieu-Daudé
2025-04-04  3:01   ` Gustavo Romero
2025-04-09 14:05     ` Igor Mammedov
2025-04-09 15:49       ` Gustavo Romero
2025-04-10  6:50         ` Igor Mammedov
2025-04-10 16:22           ` Gustavo Romero
2025-04-17 21:06             ` Gustavo Romero
2025-04-17 21:21               ` Michael S. Tsirkin
2025-05-06 15:36             ` Igor Mammedov
2025-04-03 20:40 ` [PATCH-for-10.1 v3 7/9] hw/arm/virt-acpi: Always build IORT table (even with GIC ITS disabled) Philippe Mathieu-Daudé
2025-04-04  3:02   ` Gustavo Romero [this message]
2025-04-07 13:30   ` Eric Auger
2025-04-03 20:40 ` [PATCH-for-10.1 v3 8/9] hw/arm/virt-acpi: Do not advertise disabled GIC ITS Philippe Mathieu-Daudé
2025-04-03 20:40 ` [PATCH-for-10.1 v3 9/9] qtest/bios-tables-test: Update aarch64/virt 'its_off' variant blobs Philippe Mathieu-Daudé
2025-04-04  3:04   ` Gustavo Romero
2025-04-15  8:19 ` [PATCH-for-10.1 v3 0/9] hw/arm: GIC ITS=off ACPI tables fixes Philippe Mathieu-Daudé
2025-04-17 21:08   ` Gustavo Romero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecf79fce-9406-4889-91a8-0e0fdf52eb4b@linaro.org \
    --to=gustavo.romero@linaro.org \
    --cc=ajones@ventanamicro.com \
    --cc=alex.bennee@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=udo@hypervisor.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).