From nobody Mon Feb 9 20:11:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76538+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1623775061627452.13465713121843; Tue, 15 Jun 2021 09:37:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gDeGYY1788612xLKllzIWgIB; Tue, 15 Jun 2021 09:37:41 -0700 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.83]) by mx.groups.io with SMTP id smtpd.web08.94.1623775024316479191 for ; Tue, 15 Jun 2021 09:37:04 -0700 X-Received: from AM5PR0502CA0005.eurprd05.prod.outlook.com (2603:10a6:203:91::15) by VI1PR08MB2861.eurprd08.prod.outlook.com (2603:10a6:802:19::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.25; Tue, 15 Jun 2021 16:36:58 +0000 X-Received: from AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:91:cafe::97) by AM5PR0502CA0005.outlook.office365.com (2603:10a6:203:91::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Tue, 15 Jun 2021 16:36:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76538+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT052.mail.protection.outlook.com (10.152.17.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Tue, 15 Jun 2021 16:36:58 +0000 X-Received: ("Tessian outbound 94919dbe50f5:v93"); Tue, 15 Jun 2021 16:36:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f14ab648bafc56cf X-CR-MTA-TID: 64aa7808 X-Received: from ed5f106e5125.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7601D713-3022-4BA5-8913-79573EE0E38D.1; Tue, 15 Jun 2021 16:36:48 +0000 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ed5f106e5125.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 15 Jun 2021 16:36:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CQ51cYghWtIIdjJehySr0KoiQuTL5MMHbDtfQOwpqC+bOg73AVmzsQxNfhOvEWGZt3qveBRawOmxnwaxljS69lrfpxvWiXpEq8aroFNde9K7cbdEwkPdsPpkf94AmQakhGsT/wg9PIxtTlhVoMnm6rE7wdbrmkZ9U8Q7fojrokADnyzqQTue6bjLSzGC6fUjXKILqvnQa/91Ja4RfKvMY44lzP9FTCtYFBPL945Ashy/e3S1W4SJYakBcW9ntX5El+nRC95/gSvk7itzAT4UFH15U7uHuQri4s4sDsrEGMj9Py3fT/WgNWiDUEFytBnSe/6lbv/A1bJh5AzSwMsnUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z6qe/VvbYdSButKUgOXgTMKXyUYo/ktKe5R2mKHF1aM=; b=K9dVJ+vicAA7rscZ9ndpLFwMK36fDDbjdXa/xDNII/PVovdXPnNjIJ6LeL6CaFfZT2X2mLNgwsbIiAqp/55djhm0Und4t01NmGFbMqXAXWRmshn/R+a53WqDraoUuNcuOQsO5QyJ3y/++5I4BgHv5tjIuAn1p99DXKl2LHQluM27zJUlmISrA7AWGmg5KzJ+G9R+4D2SIA6D/zDmNqIikTbPbzwMJbQpnXvvWq59s6+394sTG3R1cgFedKyZeQNieWE1KfIU79QjAPaGQBX8WivnesTaiiAABr8UXevA4P88BKEM0tfZ+T4W6ZCH8DvUo1i4Ong1t9bvkf+tU6t2pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM6P192CA0099.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:8d::40) by DB6PR08MB2935.eurprd08.prod.outlook.com (2603:10a6:6:1f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Tue, 15 Jun 2021 16:36:44 +0000 X-Received: from AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8d:cafe::c2) by AM6P192CA0099.outlook.office365.com (2603:10a6:209:8d::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Tue, 15 Jun 2021 16:36:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT010.mail.protection.outlook.com (10.152.16.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4219.21 via Frontend Transport; Tue, 15 Jun 2021 16:36:43 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 15 Jun 2021 16:36:23 +0000 X-Received: from E114225.Arm.com (10.1.196.43) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 15 Jun 2021 16:36:23 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , Subject: [edk2-devel] [PATCH v1 6/8] DynamicTablesPkg: IORT set reference to interrupt array if present Date: Tue, 15 Jun 2021 17:36:16 +0100 Message-ID: <20210615163618.85200-7-sami.mujawar@arm.com> In-Reply-To: <20210615163618.85200-1-sami.mujawar@arm.com> References: <20210615163618.85200-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7c818c3-2082-4919-450e-08d9301bcb52 X-MS-TrafficTypeDiagnostic: DB6PR08MB2935:|VI1PR08MB2861: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4502;OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: DUNA+SIfRWLMBJjPM51TogDQtVqoKznOgYSD9TaMTNzOfzBFOeKzk+hi5Ea72jxeBW3kqjGdUfoXREXec3W14YmLXUGiyJnufJHMT1ati05fuVDQ10AOKAsU7OjpjH/nEa+1yaJwGDz2EdtAk5RHFxBIgBKJs5pdFot+3vahIRx+bSDmHyh7P7uXkAe1iX/R/szS+UhrczlYq6WqTaOBDU23PvoPrE8j3kTgy2hoKECczU6y9TtGupgyv1OFjs20Do5vVeeabGCdP5wlbfXDR9qAiDCIlKsfLEr1y9uFjiaJ7H3lQVAFnMBLp/iEkvmF/EIC6akAvZ5pBj+5dvfR8V4bmo9YQvB+3vfJvlNlrMUigEPCo/Drt+ev7lMriTIpMc9/h0aFEwuqz6ZisAVnNrtBHm6njaQRrtnTBUhl4BZ4bu0ppEVtQiPdrc3i+D1UDiYr1trZamqREvweDjtY7EQNCsCjCxn6vOmmcQb5h/tyk05jDibThRsdSFku68cuZTtJ1BRAqX/Y2BelMj8UGsPR7tjK3/fOp77HqJrqHEXp6MxBIAcYys7ed+N4hEBag72JhXqiswaf09/Ap9QjcUu1RSbJ8t7OPi8KcM+KUAlL4if2OHbMhICfDYMHhdYvpLtNf2mQWiLM5EOOEtgMNK8W+EsoBQvs7AlYkjwSzUzuWrAwEt8yAodqkq9k6QM1 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(39850400004)(376002)(36840700001)(46966006)(7696005)(86362001)(44832011)(478600001)(83380400001)(6916009)(8936002)(5660300002)(70206006)(36756003)(336012)(47076005)(81166007)(70586007)(1076003)(316002)(82740400003)(36860700001)(26005)(8676002)(6666004)(4326008)(356005)(54906003)(2616005)(426003)(2906002)(82310400003)(186003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2935 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 383f1685-e149-4dfd-81b0-08d9301bc294 X-Microsoft-Antispam-Message-Info: XYejtYQ0wpw1oXddTsS/iLZeBZY/lyF/VEwM8faEdR7EbqDeq2uhk4blKx3ADM5FLxNgzflIyYNV1O+yV4xI7AA19IGDp3QFTDmUEGU6V6HkfMjsmQAIU1jnGoQJhlaod3Zv7FcfObnyySvkvibfnTd/aNAK/DFBj/Ir1i3lIL7VbqqzCM4Js7nmkPELEK1JzL6Fs6Xr2dB7+G3S+nJcCQMkooxw3QubYjlgxRrJgCTb8QXqQlgF2ok1BrSRxntWVmSlgkSz0SD0WloTTGa0GAmsgvZpS3pNYH/6f3TdtQQ0fB3Khv0m9c9hF1CXX54UYlp0KTar64ORWa15itzDg8/JkIj134AKCK7wYSFc66S1HTpRfmN13gonR7lkXHzoATwgnftLkeFBp8kNmaJ2S9jOP4WZrvFLe6h98d2qn+vFQJbsDqW+IEgJFPJd98v3r5KknXRc8rmMCNVWB50xKFvAOvCJvUtYTcXLRvD/VoUS2K2yPoCrxZOU2L9ZCt8vAyszeWqqvTM2SMpfWE99fdYQSE6ZBLI2Fgacd74GefBLIgCiHNPZMfbNnta12Gg6w8jzHZbK91kyLF0quC1ogNGSTOS55mH1FMrQAAl1nE30NyijX2so85h+gmi9zR6b7MOSdZkDpbML+yYG3VQ4Vg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 16:36:58.2512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7c818c3-2082-4919-450e-08d9301bcb52 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2861 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com X-Gm-Message-State: 91mvvzdG0ZSgLKkaoLxAiCGmx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623775061; bh=fBDOaY0gFXuiFMOWox1lWMSTZGgCE/ZhopqTUCeSZ+w=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vB1pC0LZTDFaLyKxs34UKogLcnsSNSpzG9yUX4rg4v3+ECnT3+S461P5Do6BsDmuMIx xkhUXusVPqXXcG/qr1gUHRpbRQAqQsuFjT2J27jo7qa/vNyobTvx9Nx93fxuY7WuWhjxU 6MyYL0jeB2xdMgA6kw4uIR9dsfHGMh02d/s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The IORT generator is populating the reference field for Context and PMU interrupts even if their count is zero. Update the IORT generator to set the references only if the interrupt count is not 0. Also add checks to ensure a valid reference token has been provided. Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 82 ++++= +++++++++------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator= .c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index bdf839eab25e2b84b40c50da38f2bf961cdc5f42..9ccf72594db378878d4e3abbafe= 98e749d9963da 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1136,6 +1136,7 @@ AddSmmuV1V2Nodes ( EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * ContextInterruptArray; EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT * PmuInterruptArray; UINT64 NodeLength; + UINT32 Offset; =20 ASSERT (Iort !=3D NULL); =20 @@ -1178,47 +1179,74 @@ AddSmmuV1V2Nodes ( SmmuNode->GlobalInterruptArrayRef =3D OFFSET_OF (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE, SMMU_NSgIrpt); =20 + Offset =3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE); // Context Interrupt SmmuNode->NumContextInterrupts =3D NodeList->ContextInterruptCount; - SmmuNode->ContextInterruptArrayRef =3D - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE); - ContextInterruptArray =3D - (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE)); + if (NodeList->ContextInterruptCount !=3D 0) { + SmmuNode->ContextInterruptArrayRef =3D Offset; + ContextInterruptArray =3D + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + Offset); + Offset +=3D (NodeList->ContextInterruptCount * + sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)); + } =20 // PMU Interrupt SmmuNode->NumPmuInterrupts =3D NodeList->PmuInterruptCount; - SmmuNode->PmuInterruptArrayRef =3D SmmuNode->ContextInterruptArrayRef + - (NodeList->ContextInterruptCount * - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)); - PmuInterruptArray =3D - (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + - SmmuNode->PmuInterruptArrayRef); + if (NodeList->PmuInterruptCount !=3D 0) { + SmmuNode->PmuInterruptArrayRef =3D Offset; + PmuInterruptArray =3D + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT*)((UINT8*)SmmuNode + Offset); + } =20 SmmuNode->SMMU_NSgIrpt =3D NodeList->SMMU_NSgIrpt; SmmuNode->SMMU_NSgIrptFlags =3D NodeList->SMMU_NSgIrptFlags; SmmuNode->SMMU_NSgCfgIrpt =3D NodeList->SMMU_NSgCfgIrpt; SmmuNode->SMMU_NSgCfgIrptFlags =3D NodeList->SMMU_NSgCfgIrptFlags; =20 - // Add Context Interrupt Array - Status =3D AddSmmuInterruptArray ( - CfgMgrProtocol, - ContextInterruptArray, - SmmuNode->NumContextInterrupts, - NodeList->ContextInterruptToken - ); - if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: IORT: Failed to Context Interrupt Array. Status =3D %r\n", - Status - )); - return Status; + if (NodeList->ContextInterruptCount !=3D 0) { + if (NodeList->ContextInterruptToken =3D=3D CM_NULL_TOKEN) { + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Context Interrupt token," + " Token =3D 0x%x, Status =3D%r\n", + NodeList->ContextInterruptToken, + Status + )); + return Status; + } + + // Add Context Interrupt Array + Status =3D AddSmmuInterruptArray ( + CfgMgrProtocol, + ContextInterruptArray, + SmmuNode->NumContextInterrupts, + NodeList->ContextInterruptToken + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Failed to Context Interrupt Array. Status =3D %r\n= ", + Status + )); + return Status; + } } =20 // Add PMU Interrupt Array - if ((SmmuNode->NumPmuInterrupts > 0) && - (NodeList->PmuInterruptToken !=3D CM_NULL_TOKEN)) { + if (SmmuNode->NumPmuInterrupts !=3D 0) { + if (NodeList->PmuInterruptToken =3D=3D CM_NULL_TOKEN) { + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid PMU Interrupt token," + " Token =3D 0x%x, Status =3D%r\n", + NodeList->PmuInterruptToken, + Status + )); + return Status; + } + Status =3D AddSmmuInterruptArray ( CfgMgrProtocol, PmuInterruptArray, --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76538): https://edk2.groups.io/g/devel/message/76538 Mute This Topic: https://groups.io/mt/83560217/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-