From nobody Mon Feb 9 10:29:32 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+83551+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 1636541812599408.1586388240595; Wed, 10 Nov 2021 02:56:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5ozlYY1788612xfpmwYn6ORJ; Wed, 10 Nov 2021 02:56:52 -0800 X-Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.69]) by mx.groups.io with SMTP id smtpd.web11.10425.1636541811130289305 for ; Wed, 10 Nov 2021 02:56:51 -0800 X-Received: from AS8P251CA0010.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::8) by HE1PR0802MB2523.eurprd08.prod.outlook.com (2603:10a6:3:e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Wed, 10 Nov 2021 10:56:44 +0000 X-Received: from AM5EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::56) by AS8P251CA0010.outlook.office365.com (2603:10a6:20b:2f2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 10:56:44 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=temperror 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+83551+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT039.mail.protection.outlook.com (10.152.17.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Wed, 10 Nov 2021 10:56:42 +0000 X-Received: ("Tessian outbound e7ce0d853b63:v108"); Wed, 10 Nov 2021 10:56:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 792f62d5199df015 X-CR-MTA-TID: 64aa7808 X-Received: from b48aafaeb067.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 27DAEB33-EC31-4B2A-B471-372EC870E0BE.1; Wed, 10 Nov 2021 10:56:35 +0000 X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b48aafaeb067.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 10 Nov 2021 10:56:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aooZ4kKU3Nevh1E5H5Ou/W3S8BdLcf7+AjXyZ2tgAcGLzHvs/DO1Y0HI0IM6yU4oE4t3EYA43C2u3wtPV4rmMIulhnyQRtL4KXvFN0oMneSEGojkHO8tmc1/98+Qk/qqzxTxc6YPJM1P7l6ruyWIZUI1qR2nfnDLnZOcDEh1IVsATL/n1mRfdSiNzTVMO/d1NpOCiOloF+UW118fDw1dv10nkVoXfohZyEre7xensCFjnptaqY64lVI9Lrx0q5dUF8TUtxRyqU3u6ppinPuQEZEnXiOqPagPhMzB2g3Uk50WeQ4tBeYM39TdLl6xuXG5ElGf+1K5OYPlUsKag5M7NA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mLUH+7+JVdhRGBNrP7FstTXNO2wLU2UoQk1IKrc+ic4=; b=PdW7IrJLGyr06elvbOiK6Gzml0cf2Fnf7O0diQwMTDnksioQEnznBhVub9lbjf5rzCrR27WX4O+LklMBHDMnpxJq+kBVWA4ZEXOHzRHJARTWJzNHGcMHnNN8gsnpaqy8Kc2ixyZ7dAV7xOPHs55hcHmfmBcnesDVdk7ITzhaudkZk2Qyy/RuupUnS+BDoMOu/aatAaqBMfPN0be2rWgElTd/RDS8cEl8+bnUShFZKLFX5xbU35sUUrwg9p8UZOK/PMpQIdOZM2Jc2bC5nIsf1d1mXd4/Z1d4kiHnefNwP2oTaCFZTnk+Y/pNF9m2IcExGLWonDUEonj0v9sQYzLXwg== 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 DB7PR05CA0048.eurprd05.prod.outlook.com (2603:10a6:10:2e::25) by PAXPR08MB7368.eurprd08.prod.outlook.com (2603:10a6:102:22a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Wed, 10 Nov 2021 10:56:33 +0000 X-Received: from DB5EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2e:cafe::82) by DB7PR05CA0048.outlook.office365.com (2603:10a6:10:2e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 10:56:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;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 DB5EUR03FT038.mail.protection.outlook.com (10.152.21.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Wed, 10 Nov 2021 10:56:33 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Wed, 10 Nov 2021 10:55:30 +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.2308.14 via Frontend Transport; Wed, 10 Nov 2021 10:55:30 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [edk2-devel] [PATCH v3 6/8] DynamicTablesPkg: IORT set reference to interrupt array if present Date: Wed, 10 Nov 2021 10:55:30 +0000 Message-ID: <20211110105532.38696-7-sami.mujawar@arm.com> In-Reply-To: <20211110105532.38696-1-sami.mujawar@arm.com> References: <20211110105532.38696-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df89d40b-851c-45bd-1a28-08d9a438c7cb X-MS-TrafficTypeDiagnostic: PAXPR08MB7368:|HE1PR0802MB2523: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4941;OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: rqrSrbGkMIUhTPSGYBXscGUC49KqS4kDflbkJJEFkuvuFlRCh6s3KZekA8KQfNCeBxImokWbclKSQNTyTJklyxAylRiGvsLdSXzVGzzoVMQPmoh6eBDzq8QkbD1SbD4QJilzka/F5qnwaWFgSdft/iD4+ns8flSwk6wo82qYKZ1A4gUv3cnsgB8e/HZ+imaRprBnI5VoypXITNc5TDTilkRjVC9LJlVcO3QUYulrittULdU5FxmR1Ag3Qwi3RadH7vRxrZwDDj4BXXfMpA0LFuk+J9orwFg7jG5aqh0NNX/g3aRykpLRRXuGgWN0Tj2JKRZZZ4vl1qPr3tNknEKP76GXHganqTH8z48igsMF6NdfeWFx86C0NjdseRV3F+KasDNKp6PPpvjEz6a8NYfh3I7JlY1sqIjwkM3/ZfqCvvMIyLwecr+e9MuI6b3uaqgne6JCTocGdGkFUOIrjI1Bi8tXmkKHYVEXnuS01I4mQkpoI3xpLfp2XZHBTOVojx9u5K6MXye9OQOzEIg3edvD1F8jnx4iBcgrQkER/Rqobrh40WDE5Ta2eugdVB02RRC+yQff3dyJCXUAqeaXB2PmHuk+diSHL80guuiJIM4LpN1gZzftAAaD5SPi56l8FEQdUuhuL3A76FADKZpnFpBlzA6Byc+tk4Kfe5jJAi9/GOY6Z0X+JMC3+0Im4HbU0vN5JHsP+Nmo9aZPCvP0OqzOIA9vPuI5znQwLii1K2lIvfdY6MCcbQ37vt3AZ3WKgfpEXdnOOnPrxZMTvxAl6D1fNBDhahvbLOno10xMXYAxfgspanlg7qwb4jblp/+HaKgf 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)(36840700001)(46966006)(316002)(966005)(508600001)(2616005)(426003)(1076003)(356005)(81166007)(44832011)(5660300002)(2906002)(8936002)(4326008)(6916009)(82310400003)(36860700001)(47076005)(7696005)(86362001)(70206006)(36756003)(186003)(54906003)(70586007)(336012)(83380400001)(26005)(8676002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7368 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3c0ce140-3dbd-488b-8582-08d9a438c258 X-Microsoft-Antispam-Message-Info: OGbGMQOUOjH3CHSBGqi6TSMoyiT8VmeRLu+dcZAshcdiCplAV447XucKK89i2yw83uVeyh6AwUGoTa6pNgySrJk9zdUiQVr6FcbW3HPQJ3oqb//sqEGvHCxJWpagJqhNzXVoSlnWt9YNDDcTAYIv75y0UoUlA3rCrhYSffrtih467z5H+XUX24ityDCy9CqdhVpTZW+vxftR83TJhP5OAklWO8BEkQuU93tdNMvmufAzi4i/kKHsePmr2VGTDEMd7B9Y9Of+Ho8wW6WlT6La1OIB2KIALhO8rNkSDZhRNW5lItLSle2dC8eQcT6Hggopjdxq5fE/vltswT1YU9pmWtTgdf5a5MCFTBu9P4UUvANHlvRrnzYQnGqPEVqI/lM+StFzy/xje4ydBHgBICweuyjo8ay+RcD5LRasxh+cFtfBMQE2wRNzy5jjbRipEyFJYjaQ8E2lwcDKZMYwfkosXs2ZTOfDP6xOddtSoL+MlG3RNIN+G4wDA4v54zpaVW5J87nTST7QTN0+ztZ9OGpL3vxi/Zq78yICoKPLiAEskJRdFxQFvkf++iW76kMv28wnPcEbTOqu1GKpAODVma5F6OmalVwhc3TT1ZNzVfLy6Bn+QT/ZMk0rAJJxXKKSRy4IBW/qANO43OxAxLVO4HT2Q4CrlEYna6Lk64oeZDJlKiVQoLUowT4kuq7tHTgCd5xan6ByV9/iv339kkzn6K55O6jDJGLHdcfk1WVa59mHXC5DhCYI+AM5USgykWGXYWpec46gmkgq31it2V9RpXxULnp71Le80/qmvuuanqK+NqU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 10:56:42.6066 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df89d40b-851c-45bd-1a28-08d9a438c7cb 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: AM5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2523 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: z755VcJJ4UGxeERxKsTCO4M4x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1636541812; bh=pGjHoVprpEKo/whEf8i3J+hNMEU08hHbpyah9q7XYaw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=C3BUjuItmXS4Ofb0VYuyDimczFmrPYAj0E15OF8DuMq1BGUXW/3wmhr94APlZuCrqTb spSystGIZCTM27YxLVyNMqPD4lB173+qKFBLOmFRysA0DCanNn9E+7RyPWRC3ukFMDgDh rt4PF5QpR92LyL/HaTvJ+QKRfDk4ocLiIfA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1636541812954100005 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 Reviewed-by: Pierre Gondois --- Notes: v2: - No code change since v1. Re-sending with v2 series. [SAMI] =20 v3: - Move error handling for IdMappingToken. [PIERRE] - Moved error handling for IdMappingToken in a separate [SAMI] patch in v3 series. Ref: https://edk2.groups.io/g/devel/topic/83600728#76662 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 46ff1e6d03852daa2058b8bd13f4b18f775aba6e..4c7e99f8c05fdf0a490abb9677e= 54862efa1ddf2 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1158,6 +1158,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 @@ -1200,47 +1201,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 (#83551): https://edk2.groups.io/g/devel/message/83551 Mute This Topic: https://groups.io/mt/86954333/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-