From nobody Thu Oct 31 00:24:10 2024 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+105182+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 1684847094800414.7609478549077; Tue, 23 May 2023 06:04:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iVXSYY1788612xSKdgcjBQ8P; Tue, 23 May 2023 06:04:54 -0700 X-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 X-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 X-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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105182+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; pr=C X-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 X-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 X-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 X-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 X-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 X-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 X-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 X-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 X-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: [edk2-devel] [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> 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 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-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-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 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: 8BmATQzU78vEINNbakqUE1qJx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684847094; bh=s1HY/5mJgkTH9JHD7RGNxxoyNXdHFp+vwo2VjKMV18c=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mNmRA9yjX3SgDw+zmtKZ28UtJpPJCjG/856NonoDqpmaYZmjugXJmdoAQ9dkqqGN28N wwXzpiDy2j/gC/PHX3i4QYR4FAbItPtbbVJFxzNvbKQMB8cfWsv0YZN3I05ICxMRcc3Sx Ji5TWJjYheRmZAv/iCLR0r3PwSHzpNZ+vGk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684847096466100008 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Ard Biesheuvel --- 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/ArmG= icLib.c index 8f3315d76f6f2b28a551d73400938430ff3e23c7..7f4bb248fc7225bf63f0aea7204= 86092b30ced10 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; =20 + ASSERT (InterruptId !=3D NULL); Revision =3D ArmGicGetSupportedArchRevision (); if (Revision =3D=3D ARM_GIC_ARCH_REVISION_2) { Value =3D ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase); - // InterruptId is required for the caller to know if a valid or spurio= us - // interrupt has been read - ASSERT (InterruptId !=3D NULL); - if (InterruptId !=3D NULL) { - *InterruptId =3D Value & ARM_GIC_ICCIAR_ACKINTID; - } + IntId =3D Value & ARM_GIC_ICCIAR_ACKINTID; } else if (Revision =3D=3D ARM_GIC_ARCH_REVISION_3) { Value =3D ArmGicV3AcknowledgeInterrupt (); + IntId =3D Value; } else { ASSERT_EFI_ERROR (EFI_UNSUPPORTED); // Report Spurious interrupt which is what the above controllers would @@ -196,6 +194,12 @@ ArmGicAcknowledgeInterrupt ( Value =3D 1023; } =20 + if (InterruptId !=3D NULL) { + // InterruptId is required for the caller to know if a valid or spurio= us + // interrupt has been read + *InterruptId =3D IntId; + } + return Value; } =20 --=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 (#105182): https://edk2.groups.io/g/devel/message/105182 Mute This Topic: https://groups.io/mt/99086465/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-