From patchwork Thu Apr 3 15:18:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 877933 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp3322017wrs; Thu, 3 Apr 2025 08:23:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwJdFsXLn/xgjfZ38RhoTPUD6mpGvRBSfegYD+6vaOpkiBAlM6YWqJzliilS/pRbxZ/AP0Kw==@linaro.org X-Google-Smtp-Source: AGHT+IEzXlaLXArGN4fUFbQLF7IzBUkp9qkNgb7YuZifgZwmcgmBTiARsUw+peOFizuJbw45kaCu X-Received: by 2002:a05:622a:1116:b0:476:89d2:8243 with SMTP id d75a77b69052e-4791961be65mr40582541cf.37.1743693790399; Thu, 03 Apr 2025 08:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743693790; cv=none; d=google.com; s=arc-20240605; b=YDfh7X4vqDRmIWQ8HqygYanP6is8iOfs23K6Fy86Qa2iRgE8SYbltmU22OD1JE4Wxf fVUCCyrxkQU/M6NoqqYqdPCO/KqSW3F595VKlpiJN/KtZ62mRvkUBocqweZK5MTAcOl1 Gf8JbX19nOtnIXKply72xaejDKjY0kReRLazjMqrjQ/YkdCmyZz1gm0xeLm3jznJOJ1Q DyAU1T1GKy2BY/KCD6wNmm067HI76Lzg3jbOKqd0wqd47D9AlavBHWDBi8Pfl7uUsaWt BP1GjAuSSwDPc92sm76vUPRT49tKbkT8zK5QVizF6izYvH7TC7exNq7fDGbnpoNOdPuX FilA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AzIe1y6exrD0xJczT8npcuq1OBfi7eudR1jNiJ2MiPM=; fh=uZabDrQmZm0L+6w9TkaKSHx4mVelHvsyKGr5umV4YlI=; b=AniGfA0M3QwilSUfv7Cscul0CP0poMUZIc3GWZqghmMk8aMjKJ1QJ53/0hekYNrgSY iqigyhViB4Xj5LIqDZ2HaEqpKpsftNON50rzTUi0y9P0/Zkmf4pKvQwwa0rBWx3D4+gU Yn+DxYcgdRkBMxJxtGMAhD1FkQGIHKi4D3q9jzrc9WuHIstQndQxfptg0xyY/k604FoR KTAtRjnivXPlSZvQim9ofVw5btNIPGVc2CPtfNPr2/xG2pFp18DKlQgreFNPIEWapCxy kPRhhflP0IsJbsq+R/B3SERRHBzkgDhc/sqKa8uZN7M2ZWyj6BxBM23qcGEX/vpEchJb wBvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rtMFTxNa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4791b173d86si12214531cf.207.2025.04.03.08.23.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Apr 2025 08:23:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rtMFTxNa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u0MNG-0001HC-JD; Thu, 03 Apr 2025 11:21:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0MMJ-0008LU-5r for qemu-devel@nongnu.org; Thu, 03 Apr 2025 11:20:01 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u0MMB-0000dg-QE for qemu-devel@nongnu.org; Thu, 03 Apr 2025 11:19:58 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-39c2688619bso693161f8f.1 for ; Thu, 03 Apr 2025 08:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743693590; x=1744298390; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AzIe1y6exrD0xJczT8npcuq1OBfi7eudR1jNiJ2MiPM=; b=rtMFTxNa1LIUZ2J0UWGRPixJPRQR3DbW3YZS1f1oYSCIPEJw7m1IKSfNicXrMCKe9d 8zgfNWkrP3qxx8wYlJNXNTEKe1wFrrJuvR10d8src82G91EHDUtlyMkKZraeNWeqoiFF PrvjBYF53ySSPJclhmIqoBcGRtO3+/VWOKaoZxBEPg9TsnwIuinKKWAtkyVhAbDxgzhu xQhQeEhBp58avjZLQyMUBDxom3Q8lU298JfhirncKaCLSHNXDX1YdDeZ76kIx0Y19gUB xgrZSwkW4b9ogZdCJ/HX3ms2Xf7y//W2HzoaKa/CeXTiYLR8MzcpedX9UutsN6wML6Ty 6/Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743693590; x=1744298390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AzIe1y6exrD0xJczT8npcuq1OBfi7eudR1jNiJ2MiPM=; b=uT46UBnJc+GvcxiKV6OGfqmVZ2dklge31lNOgb0ze0xHR28uiW1Kv/pCvH44SmsNC1 Gb6THOrDPlsANxakxyB5ics5IHIczKw/Air/aYAXpsjuLLny+zNvZSkXI9TurWdUzwUC Zi00pybcfUsE7Kh4SmBWDdaPbrvUo7rc6z2VubiHdnyqafGgZfWlvcw67JsfEae1fsYD JR7ykedFlo+lej3lpIBk6Tw/zuJ4vBmF6xVFzo0R0i1A+oImn6FNvnAxtuWWb1MOxEPB Y5jy7/pPUo2Dqdfbx58hqWsdBMuBMHymaOjAj9U7USOixM9OanK3QxfRyD3RzCJYOKsi D3Mw== X-Gm-Message-State: AOJu0YzCz1NKwUY4hIjI+U/oM8kAeVOZRvDo8ineCornmhucRqhNwsrh H8srqRMfc4nkcsRDUsIFR8XaOeXTrKA/dgxfRxaCWBqzQLqmBd8EyMf4BFAjsMbupB90xo5zx37 G X-Gm-Gg: ASbGncuC9+6E85O7MsN+5J6L0dSvhaNlY5/fud2YoPlNe2pszlTWzyUuFMF6TWGBHgZ L21bvayCCa64dTSYna52jxpGUYfJ9YOQ1vbdPOC0YQCrBF5UBosBmTAgjavF+C5qwUsXlPk4Y8I GpWJlvL6cujP2TZ5sEtDno5+fKtGBtv9+nPzk25N7TzFLdYHnHZxxNoOtZ509JbL1zt+f9vWVnF s6SfxVTLlco8xlbLf6mgkxwMPvA3/KGNAC7Ul8m70B7ZPdRNB3ulFp2PDR4YP9qqKm1DFtuyWow 3h09HoLeTx3XXccVvyAP0fVguMFZpjI+7ig1LTip+/GLyOynZFWPUssy4zWqfDQZd8ib7PpZQ6C IdJyuOlIkNTOL9kFIBCE= X-Received: by 2002:a05:6000:420b:b0:391:47d8:de3a with SMTP id ffacd0b85a97d-39c303af783mr2389195f8f.53.1743693589894; Thu, 03 Apr 2025 08:19:49 -0700 (PDT) Received: from localhost.localdomain (145.171.88.92.rev.sfr.net. [92.88.171.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c30226acfsm2003872f8f.88.2025.04.03.08.19.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Apr 2025 08:19:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gustavo Romero , Peter Maydell , Laurent Vivier , Ani Sinha , Udo Steinberg , "Michael S. Tsirkin" , qemu-arm@nongnu.org, Paolo Bonzini , Igor Mammedov , Andrew Jones , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Fabiano Rosas , =?utf-8?q?Alex_Benn=C3=A9e?= , Shannon Zhao Subject: [PATCH-for-10.0? v2 12/14] hw/arm/virt-acpi: Always build IORT table (even with GIC ITS disabled) Date: Thu, 3 Apr 2025 17:18:27 +0200 Message-ID: <20250403151829.44858-13-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250403151829.44858-1-philmd@linaro.org> References: <20250403151829.44858-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 Signed-off-by: Philippe Mathieu-Daudé --- 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) {