From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.81]) by mx.groups.io with SMTP id smtpd.web10.21869.1684847092747448149 for ; Tue, 23 May 2023 06:04:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=tobK7KKw; spf=pass (domain: arm.com, ip: 40.107.14.81, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AgTfk0XmxsX9zz+JKu4cKRYQg+A2fY6fr1ZDPecD83o=; b=tobK7KKwIkWCh+upbchkWDlsFoA6UxXLfXfpejSEri4r7Ifm73+NVAIFGpAJiTNorgfgr5ru6pMq3Oa0XSZmVroSB+0yThF2yPpg6MI69qTxLEaHIFv9PSRkCbU5imriTC0LMZ3zgf7BTPqX2naZuAl/wrwmzllzuBqADcNc9oc= Received: from AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) by AS8PR08MB7307.eurprd08.prod.outlook.com (2603:10a6:20b:442::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Tue, 23 May 2023 13:04:48 +0000 Received: from AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:28f:cafe::3d) by AM0PR02CA0224.outlook.office365.com (2603:10a6:20b:28f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29 via Frontend Transport; Tue, 23 May 2023 13:04:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; 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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT011.mail.protection.outlook.com (100.127.140.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14 via Frontend Transport; Tue, 23 May 2023 13:04:48 +0000 Received: ("Tessian outbound 5154e9d36775:v136"); Tue, 23 May 2023 13:04:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f1e12b647088cb12 X-CR-MTA-TID: 64aa7808 Received: from bc4f8fa32982.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 999F69AC-3EF3-42C0-949D-ECB7302634FD.1; Tue, 23 May 2023 13:04:37 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bc4f8fa32982.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 23 May 2023 13:04:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PTReplQAHsdMc79SAmq8h2ipQTy5Bb5/5HbH6Eb72dylTYn1+AKdPXzX0KvBA2JtmAJEZ9gVQflZvQmO6fnLQDi3W3T2BHQdysZkPhJsgwCKsliRrpW9P0bhgV9pLcun4al87fahd8DvAbYGQUN+M/UG7DyKZY7VaJ4MgjFdMz9D9MPgfrrOOi7QIv/IwpgibY+G33r4BotTNPKNASVVBnrZGkqLkGXS/vYmFjFoiyZkrj1cNV64daIhre+ZMAuz78n1wxDzPLSiinYTIgUzZnpQSrq/Xx6N0F0kc/8CB9jiF2/xz9cu9ZqxNc4U1np9G+iX+mqOg03b4xsEFZ+J9Q== 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=AgTfk0XmxsX9zz+JKu4cKRYQg+A2fY6fr1ZDPecD83o=; b=aulTO0EFKVfJCg6H0qRU1T4VG7/o5J3w5aZMn64elS23tauzfQijux/aD2BPhAyRFOK8lsiK9Ce1c3NU4uRk4tW/MAwGqc6ubHMmxgED1aoX1LsD2qrw5a2nT0RMIzY0AlJYhPrsLhqSen5eufbCnD1RLJBtIWiRqIutHHW8DVzAMrWXC7Od1pjJpqjdOMCmswoH7BM1bL1YA7g7A/3lsdASraviqkpw7mz6msERm5xcdZMeHZbwNg1JEr4dgG9yS/WtixpvsKvP0B/Ctpuqi1Dee24CRCiw1dmnAhf0mrmIbupRyhSKmjPfMRejCqiBHMn6E59ZKR2Wr8zHz0+mWg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AgTfk0XmxsX9zz+JKu4cKRYQg+A2fY6fr1ZDPecD83o=; b=tobK7KKwIkWCh+upbchkWDlsFoA6UxXLfXfpejSEri4r7Ifm73+NVAIFGpAJiTNorgfgr5ru6pMq3Oa0XSZmVroSB+0yThF2yPpg6MI69qTxLEaHIFv9PSRkCbU5imriTC0LMZ3zgf7BTPqX2naZuAl/wrwmzllzuBqADcNc9oc= Received: from AM6PR02CA0010.eurprd02.prod.outlook.com (2603:10a6:20b:6e::23) by PA4PR08MB5919.eurprd08.prod.outlook.com (2603:10a6:102:e0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Tue, 23 May 2023 13:04:34 +0000 Received: from AM7EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::ea) by AM6PR02CA0010.outlook.office365.com (2603:10a6:20b:6e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29 via Frontend Transport; Tue, 23 May 2023 13:04:34 +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; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT051.mail.protection.outlook.com (100.127.140.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.14 via Frontend Transport; Tue, 23 May 2023 13:04:33 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.2507.23; Tue, 23 May 2023 13:04:29 +0000 Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Tue, 23 May 2023 13:04:29 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [PATCH v1 12/12] ArmPkg: Fix ArmGicAcknowledgeInterrupt () for GICv3 Date: Tue, 23 May 2023 14:04:21 +0100 Message-ID: <20230523130421.10804-13-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230523130421.10804-1-sami.mujawar@arm.com> References: <20230523130421.10804-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT051:EE_|PA4PR08MB5919:EE_|AM7EUR03FT011:EE_|AS8PR08MB7307:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c791ca6-9609-4284-58cc-08db5b8e49f4 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BETJcFkTvBEwlSXq4YLS+xPpjvDlLTKkQZyqe5hVlTALp7lZlXdE45WvoV8Q/KjLeYMvkp8Iji1IwQB4UA4EJolkQShNY3zpiZ6fW/PukPOpNrSraIxVZC1fTwqCtU6NgirPgiDq35MXxqBz22wzbq73VYOcYS4KkXvZOJcRkijzJohcWXOPeQsUbqge3T0lMzRkV3gwwJMBh3Tj5DiOn1qYQrjkJwk2pM6wWrnl6z/Zd8c6KvFn9t5JgaC1BuDNafTvxPnnz7A1/3hYErl0qD1ZzFRWFIzQzVbpZko6kVtivwRDyoLqtYXCqt96eJEQKbcWMFrBoVv6YRzn97cqQC3Xqu8CWSXEkNWCiMYQJ6wkbnlUMyeVkPqgi4OFt3+YtMy5N2SS0mrVvqvB8n9U5P+yS4ABaJI4xxHyLqNE1My9dfTRRQQxgMKdah2nKeFQpHc4dBoOIX/R3mqIgKfG51Je2ics97e05PW2ALYRpoSeJsl6lj6XrsRnaj2AEsp8kd7LHFy1h4a3ZU65ZGgb1q0tfZ5KFAxFH/vin+C71MzLnkzSYiu3rgjYdoIH8DtNYW5zlWVsNxaNuSUOQZgLHIdWPtGmpHtbKSVy8Okowh2TTBb1wgWfBOaWEGp7u35YIR9DyN8Gum9Trb+0k7vG/q0PgykC5IlbSNxy4twzF4GM7Baiaih7gPVelkpC6uFY82JldeEGt9+Rl5/4diIvZvR+YZn0KxI4CJLPajRyRi7++8JBMbrrDa/wmtaTGm5WUYYlEH0pUub5fWUCN76liw== 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:(13230028)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199021)(46966006)(36840700001)(40470700004)(8676002)(8936002)(478600001)(426003)(336012)(40480700001)(7696005)(54906003)(41300700001)(44832011)(5660300002)(4326008)(6916009)(6666004)(316002)(70586007)(70206006)(19627235002)(186003)(2906002)(1076003)(40460700003)(26005)(2616005)(82740400003)(47076005)(83380400001)(36860700001)(82310400005)(81166007)(356005)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5919 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: aeba318f-c9ae-4b34-abcd-08db5b8e4116 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9MPq+zQWktE9sIzEcODDETxgLuhvZzgpkITUPPbmBvPEik+r+sUIorRG68mN4VRSGTp+cROBdEQTo2tbB4JOed1G3iYSAAx3RARLNOq6yhyXmef9cqw5a3mHdcpkBpwk8+S/xAZuRuASD/ik3YZEocgf4COcJcLFxRrmGvrxRiGReum/QdQPKwbv0t7iTs/uFRV83aM109LeDhxWkcNICTthsq/tTDymN/NEbF+EsxPC9c091fqRMWqdM9STgRxbSOnueFRccn7Bh1VLNoYRBoR95EUn89imw28QyXbMlD2k2yhfy09E5E6wz4JLa5R/c8Wzuv3WVtiNb/PzJXEtQE+HDzJybqXoAG8eSDxbQOR4X3vmSPqnlhTR0ftXgwsWmdbgsfy9dDyp6fOiyzZderrG168ey1mbD2/1h4ZAe2tnVhLzlUOgrprzCdeXGAGI8cs7DhArSLBDHWOarWozjZTeEdZp3nHwxd6crpEbNV6SXpJ/DqKKPGrEKTVbp2q82BYd4vIQdc30PMF76qXC27M0YWeBs6R2+VbxS/NuYqbN8JH+rd/PbkCTzEJO7c87B902Cwrj/1t3wS6lvBZ1Ee7AqxLp6NF7RmI3O/lpUs+aNsNQO1PMF71Xtdp4F9qkqGDIyOCyiLn4UZlkkP939B0jhXFMbeoHiknVUQWNmfANDa/j4e9nHybiaZGaZ3Ay/CFXBMrrrN+BDURtz60WH5aeP3tkEyi7pyXR7mo8tMxKlvRuyxFxX+1kUFH6CMMM X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199021)(40470700004)(36840700001)(46966006)(54906003)(41300700001)(7696005)(82310400005)(316002)(6916009)(4326008)(6666004)(70586007)(81166007)(70206006)(82740400003)(5660300002)(8676002)(8936002)(86362001)(19627235002)(478600001)(44832011)(47076005)(83380400001)(1076003)(26005)(2906002)(40460700003)(186003)(36860700001)(36756003)(2616005)(40480700001)(336012)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 13:04:48.6666 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c791ca6-9609-4284-58cc-08db5b8e49f4 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: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7307 Content-Type: text/plain The ArmGicAcknowledgeInterrupt () returns the value returned by the Interrupt Acknowledge Register and the InterruptID separately in an out parameter. The function documents the following: 'InterruptId is returned separately from the register value because in the GICv2 the register value contains the CpuId and InterruptId while in the GICv3 the register value is only the InterruptId.' This function skips setting the InterruptId in the out parameter for GICv3. Although the return value from the function is the InterruptId for GICv3, this breaks the function usage model as the caller expects the InterruptId in the out parameter for the function. e.g. The caller may end up using the InterruptID which could potentially be an uninitialised variable value. Therefore, set the InterruptID in the function out parameter for GICv3 as well. Signed-off-by: Sami Mujawar --- ArmPkg/Drivers/ArmGic/ArmGicLib.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c index 8f3315d76f6f2b28a551d73400938430ff3e23c7..7f4bb248fc7225bf63f0aea720486092b30ced10 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -176,19 +176,17 @@ ArmGicAcknowledgeInterrupt ( ) { UINTN Value; + UINTN IntId; ARM_GIC_ARCH_REVISION Revision; + ASSERT (InterruptId != NULL); Revision = ArmGicGetSupportedArchRevision (); if (Revision == ARM_GIC_ARCH_REVISION_2) { Value = ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase); - // InterruptId is required for the caller to know if a valid or spurious - // interrupt has been read - ASSERT (InterruptId != NULL); - if (InterruptId != NULL) { - *InterruptId = Value & ARM_GIC_ICCIAR_ACKINTID; - } + IntId = Value & ARM_GIC_ICCIAR_ACKINTID; } else if (Revision == ARM_GIC_ARCH_REVISION_3) { Value = ArmGicV3AcknowledgeInterrupt (); + IntId = Value; } else { ASSERT_EFI_ERROR (EFI_UNSUPPORTED); // Report Spurious interrupt which is what the above controllers would @@ -196,6 +194,12 @@ ArmGicAcknowledgeInterrupt ( Value = 1023; } + if (InterruptId != NULL) { + // InterruptId is required for the caller to know if a valid or spurious + // interrupt has been read + *InterruptId = IntId; + } + return Value; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'