From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.50]) by mx.groups.io with SMTP id smtpd.web11.10668.1614257463155129747 for ; Thu, 25 Feb 2021 04:51:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=wTCuAQ/T; spf=pass (domain: arm.com, ip: 40.107.20.50, 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=ivXm3GtUcKiar3ZfqJ4VDzfS8N8ALZv99BgSf0emUVc=; b=wTCuAQ/T5a70bk12rNc44pvkrPrpYl9bxQY/kU721Gh+Ahdc+xfhDovcdcPCDRYURARTVS4vEJOCTWCRdjyR+S+/7Cn1swMGKJ+26Dyb1dS4867YVAEwyVtzIaId2W2kbI3xmH5/Ikn7+72u7zq4Pxi6Tcpcr9wjSzNLONrki2k= Received: from AM6PR0502CA0062.eurprd05.prod.outlook.com (2603:10a6:20b:56::39) by AM4PR0802MB2290.eurprd08.prod.outlook.com (2603:10a6:200:5c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Thu, 25 Feb 2021 12:51:00 +0000 Received: from AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::33) by AM6PR0502CA0062.outlook.office365.com (2603:10a6:20b:56::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Thu, 25 Feb 2021 12:51:00 +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 (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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT020.mail.protection.outlook.com (10.152.16.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 12:51:00 +0000 Received: ("Tessian outbound a87bfa165cc0:v71"); Thu, 25 Feb 2021 12:51:00 +0000 X-CR-MTA-TID: 64aa7808 Received: from cf84e4a36d93.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 093CBCBD-5FDF-44B0-B8C3-C40B6E9EAAC0.1; Thu, 25 Feb 2021 12:50:55 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cf84e4a36d93.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 Feb 2021 12:50:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1N1KQuhRalyTRKYNRuVaezzQ8x7ZWEueJympBb1QYAEZVsIvAQtlLus+3ZeCjPSinpP2tF8Iee51hieUPt7vxkHMvQc1VThIwHuG35f/phBfihNugu/IWK6ELdo5NrMj7KjmFIjckBJ7yUDCp5lof6BsWnJjZn6QVam0ti1b6cuvgwS2bSb/artp36uh+GPKMwF0Bqv2XbdtgkOO6kMKowRjhB6C42fznkF47bAhodIm+xSmSXESqzyNr1Ic6AmDYzjMS4aGvN9X9Jw0Jqie+uM1sPQ8DNjaONF7L+LWroFTCGgKRrTqeE8a+mBIj4KCOhD0gpFUCLaXOPqhW4lag== 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=ivXm3GtUcKiar3ZfqJ4VDzfS8N8ALZv99BgSf0emUVc=; b=CoumLvCrEXh23fYC47bGV6/9FFjgR5sLmjj1e063+jQzP0sbywiXhdJ7lkcxgowKSx6lcYLFhNWnZXYrm+aSzY5D0QohbM0CeW08BXc1TXLTuwOwSPq1iA4qQTwOjH1DaoAj1dY1iPXworIKT7/ErbuJIou9h/dXydHgyDrMUUsEDOdla29arJWRAPWKsktX7BXUMWPHE3mFNumaTGwwX8JzOrbjrJLHi9JTRVxruLc3+s7ZgyNikbttSrjj+x3G3qOQx+fOo4CpDto/BtE4pMdiIL5ZcMwNRQJdkMQrXA2u6IJqJHy6VNcivlf3YU3WnTH7oSoog5T8lkYiBEidwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=ivXm3GtUcKiar3ZfqJ4VDzfS8N8ALZv99BgSf0emUVc=; b=wTCuAQ/T5a70bk12rNc44pvkrPrpYl9bxQY/kU721Gh+Ahdc+xfhDovcdcPCDRYURARTVS4vEJOCTWCRdjyR+S+/7Cn1swMGKJ+26Dyb1dS4867YVAEwyVtzIaId2W2kbI3xmH5/Ikn7+72u7zq4Pxi6Tcpcr9wjSzNLONrki2k= Received: from DB7PR08MB3097.eurprd08.prod.outlook.com (2603:10a6:5:1d::27) by DB6PR0801MB1688.eurprd08.prod.outlook.com (2603:10a6:4:3a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 25 Feb 2021 12:50:53 +0000 Received: from DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::8c43:eec3:76be:9001]) by DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::8c43:eec3:76be:9001%4]) with mapi id 15.20.3868.033; Thu, 25 Feb 2021 12:50:53 +0000 From: "Sami Mujawar" To: Leif Lindholm CC: "devel@edk2.groups.io" , "ardb+tianocore@kernel.org" , Matteo Carlini , Ben Adderson , nd Subject: Re: [PATCH v1 1/1] ArmPkg: Fix uninitialised variable in ArmMmuStandaloneMmLib Thread-Topic: [PATCH v1 1/1] ArmPkg: Fix uninitialised variable in ArmMmuStandaloneMmLib Thread-Index: AQHXCuSqZJ4qKZLgbEeLgsrxJhONgapov4CAgAAEBpA= Date: Thu, 25 Feb 2021 12:50:53 +0000 Message-ID: References: <20210224193756.24132-1-sami.mujawar@arm.com> <20210225113749.GO1664@vanye> In-Reply-To: <20210225113749.GO1664@vanye> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: BD03E52714DFE340BEE27EC5F7CB984C.0 x-checkrecipientchecked: true Authentication-Results-Original: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [86.150.156.12] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 66b5a5a8-442b-4f2e-a560-08d8d98c00d5 x-ms-traffictypediagnostic: DB6PR0801MB1688:|AM4PR0802MB2290: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:2958;OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Ouga+Ri+KzcP8eNrzLtjUHU1NUVUU1mAVHh4/s3OFEb868xJaTyAfv0rc3XIqGl79HfHobcNIftUS0vE7o4pxDAQd+vOV1fiXkKtFOeYA5qlbsh21njjo8GUoXuq0JeVi+XnBorkbmfd2MTjRVaNio7iPIzFCTvmY7DTU4V1wf4/MAqdWQ3pURlIs96HZntSTpuLR/gKDZH9D7jDY13f9UR0xM2C3yh4YE/Ngzo/p3ppZv0aZhTpD3Ey6v7pHadTxgEH1xAQCj7u1M9dHbKXCjlKs/ljsASsBxO+0lOAKOihv2uW+0nt2wO02Uir2DgnABBOUZ/1LhwdiXpW/5IXb2D9Fql3k0ZR0IbDkFl0RJaaKa3fKEGAsnTEdIIei7fbeskWnY815SVCg7meQOCw6dvA2T+bSHIq2btDLLy48rPi8GU8qbcSpTt+8jj5itN07JDzPZEpz20ZRXu6jHcOKARK7wxwuod4uAXzifdcsSBPA6ul86xMTuaRT5nfoDJb+cKOaLRqFzyHo2O5YgkKs1GsrQd0L9BZiYBvdkdk7y4vttMrwKCJzl9YQ/JzhoCHO0GbWVWgHKWvan3i2sgsrPBjV+eTfwAelufnMsbuwsw= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3097.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(39860400002)(376002)(136003)(346002)(396003)(366004)(33656002)(86362001)(2906002)(83380400001)(8936002)(64756008)(54906003)(52536014)(316002)(186003)(66446008)(26005)(66556008)(6506007)(4326008)(53546011)(6916009)(7696005)(76116006)(478600001)(66946007)(9686003)(8676002)(55016002)(66476007)(5660300002)(966005)(71200400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?1v1L41aLlglZl/nSQZL5xG5X/DaHe4Faw1m/nszXwFCVIjiYJMqBN4sezhww?= =?us-ascii?Q?GFZcoYSx0YRBEwdMJvFSUXiwpLdSm3xWaYIiNgJ3/CPC1eGc25CQ9QXy8hAx?= =?us-ascii?Q?5Y4AzPjV6h3UNrnfy0xn67r07mx5mTasM0+EG6qAtSIXWNCP8Ky8TNsseKE+?= =?us-ascii?Q?qRjYNzdmhj1IWeEmRRA0KnpUJP/0vC3AyWOBOGzR07gRR7dMZ0CqQ/i823Qi?= =?us-ascii?Q?uxrv5Ksb8Jl61pYjtPYLV/qfrxcMLWH9/kKNSt3jTvV2bKWcYHDck65qClIj?= =?us-ascii?Q?ETbFBQlO9KVTYxLYQlkgKj9Z/LDD1rKLnmjIqHbqLddpPj8WPs6vJfcBhkJd?= =?us-ascii?Q?4otqb96YRAfiHHeYIveiE4ACiD2EvyB2PG3vl602CQDgo1PG2osKBlLGq9et?= =?us-ascii?Q?vCv94UIGgAnZqTZEv6CfU86KgbPJfg/qLAihY3+A186XdXMNaxpVmluYQyog?= =?us-ascii?Q?ncWSidoeijLlbQIyIRMcngQYX/UyymfrIZv7H++tlSCdizLlqCSMaq3IyFDQ?= =?us-ascii?Q?+MuF8iRE4EeOKp7AkrakZk5ZN8DyL5aa1AVy/WQL/jEUnmiD/xf+MmiM8kCv?= =?us-ascii?Q?UB0PXLN4BEewIKlz3i+wUiBcdT16Ia+LK9B5nDYPu6KGqjmdLe5zRWGO1SRS?= =?us-ascii?Q?+W/2oI74DqHkPIQCI9BHHUkeCzrtTOtoXTfaEcazSXbSQPBw2DEZypEzRT/8?= =?us-ascii?Q?ReZjRztXZ/DHFjleU733CXjwbN7i65TFMnaY5kSGvzGReZHVJ4kUXuIU2Hn8?= =?us-ascii?Q?pm5H3iORwi3dK+qwSBBKA5oYHXYUQa9wD1gQ7hF/ScA1Q4MGnxHjTyPo0W41?= =?us-ascii?Q?K7FtG7V5DjJvivUuJVL4kebWAKCQ0V5Eh8U1aN5RxB7zK15heDtoBVEsWHLf?= =?us-ascii?Q?60Cm11Maro2KUWzrdGs8e2eWvgZaHhUJ21loyWRBveIWM8ciU2eL36yyRL8S?= =?us-ascii?Q?pzColpIKFst1SwwQxAIb/MUGtpqPP03gqh4RMrAHG3SMXMsszH0AOeHWJlwD?= =?us-ascii?Q?Q6mbjaW5IeKYR2LG7JsXaPtW/98Yfb6ZVhiTCM32TUZB9tAk9TphVvisq+d+?= =?us-ascii?Q?+J4wUl+9oseCEOPzfJydY2j0Xsq5TQaxRqvxLzBftB/dcOrRD6dgbI+rQMZC?= =?us-ascii?Q?X2tdfb8aVaNsMLqCCQWxWh0u8XYqx3Wt5jYq3/JEUgM5QhazMjeuY7wn3M4u?= =?us-ascii?Q?Zd7rrR8gLlsFDAX12RgfQ+j+oF4Kozo0Q5on8dRu+kyiWZT6zSwT2ZOUmGCg?= =?us-ascii?Q?OWpi/mPOkliB5pwRZiN+4BoX5r61bkK+wue94gQQKnFluvkfnAtJ9sfxEpYk?= =?us-ascii?Q?E1XZSFVArL1qEF7rrbxPcEJa?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1688 Original-Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: aca55097-de38-4789-f70a-08d8d98bfcc9 X-MS-Exchange-MinimumUrlDomainAge: github.com#4888 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MG8Ql2t47XY1f+mwOrSYCw7fJ8NP96HHDYT/FREImZU3AUSn8i4rXYoKxAzIrHZwXG9jRBdgkKeIKh/EyhYsd2Y2qtSiic9RsD07W9sRYQ+teITaGrL7Ax6byRlBHvlF+L4jSBhGwEkNjfoeUefhBA9oTv4CR81fePoZRaPZSMG4iKK0BkDEciNx+3xIx81oREUTunr9pvhIvFAbEjow5o8vgMMB5sqhYN0OIzc+oNagyH5H5RCRyieRzIeTiVtQXf4ADN63rQp68A1VXj9ebyWHAxPV2qhFKUSufKXGRKVFQrJuxvA8wkpbPmoG95eLkAZ0qdYe9U6FikijpfTJ23E8KJuf73Ltfx5tqZgJ2CHKmO1eaZT5SIdO6jySJGbc1U5o7cAorlk5wrwTRPAN7VZLGdbJVuR0hNXyuv5URl6U7b+PUKyuIAVvzyfHflFogCQ5eYIOzWQmf8QGAV7IPqb9X8LVdVG1qKtIXODfvNjdistJSajbIBC6NLwPzmx0EA5+T6gGSTbnBQCx9qrWTucIv84k1M+RQHIg5LSWHSMENFOesbraVJEeJ8tEn4H3d4FgDvkDayy5NRMgfz8MW5MqJEbADTWDyJyux3mF6heqWpROVA8lL9AnF1ZOyh2jxl+Ddp+VPoccGgG84+2AMripBs+uFHIRxcM/atLj4tw9vsvjEmd/PYqfrKVxBDk2Z42zZyVTXKim+nU+6CZNq7dRFaHuUrwAh0Vqb4DgnLw= 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:(6029001)(4636009)(136003)(376002)(346002)(39860400002)(396003)(46966006)(36840700001)(966005)(54906003)(53546011)(8936002)(478600001)(83380400001)(6506007)(86362001)(8676002)(81166007)(316002)(4326008)(82310400003)(47076005)(186003)(7696005)(9686003)(6862004)(36860700001)(2906002)(26005)(70586007)(5660300002)(70206006)(356005)(336012)(33656002)(82740400003)(52536014)(55016002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 12:51:00.4835 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66b5a5a8-442b-4f2e-a560-08d8d98c00d5 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: AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2290 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, Please find my response inline marked [SAMI]. Regards, Sami Mujawar -----Original Message----- From: Leif Lindholm =20 Sent: 25 February 2021 11:38 AM To: Sami Mujawar Cc: devel@edk2.groups.io; ardb+tianocore@kernel.org; Matteo Carlini ; Ben Adderson ; nd Subject: Re: [PATCH v1 1/1] ArmPkg: Fix uninitialised variable in ArmMmuSta= ndaloneMmLib Hi Sami, On Wed, Feb 24, 2021 at 19:37:56 +0000, Sami Mujawar wrote: > The following patches added support for StandaloneMM using FF-A: > 9da5ee116a28 ArmPkg: Allow FF-A calls to set memory region's attributes > 0e43e02b9bd8 ArmPkg: Allow FF-A calls to get memory region's attributes >=20 > However, the error handling logic for the Get/Set Memory attributes > introduced an issue wherein a status variable could be used without > initialisation. This issue is reported by CLANG compiler and is not > seen with GCC. >=20 > The Get/Set Memory attributes operation is atomic and therefore an > FFA_INTERRUPT or FFA_SUCCESS response is not expected in response > to FFA_MSG_SEND_DIRECT_REQ. So the remaining cases that could occur > are: > - the target sends FFA_MSG_SEND_DIRECT_RESP with a success or > failure code. > or > - FFA_MSG_SEND_DIRECT_REQ transmission failure. >=20 > Therefore, reorder the error handling conditions such that the > uninitialised variable issue is fixed. >=20 > Signed-off-by: Sami Mujawar > --- > The changes can be seen at: > https://github.com/samimujawar/edk2/tree/1657_stmm_ffa_fix_unused_var_v1 >=20 > ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c | 92 += +++++++++---------- > 1 file changed, 45 insertions(+), 47 deletions(-) >=20 > diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMm= Lib.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c > index a30369af9c91fb8045dfec7a68e2bd072706d101..73b63ca396e5395bdf2112709= b0aa2ab871a2a07 100644 > --- a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c > +++ b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c > @@ -57,36 +57,35 @@ GetMemoryPermissions ( > // for other Direct Request calls which are not atomic > // We therefore check only for Direct Response by the > // callee. > - if (GetMemoryPermissionsSvcArgs.Arg0 !=3D > + if (GetMemoryPermissionsSvcArgs.Arg0 =3D=3D > ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { > - // If Arg0 is not a Direct Response, that means we > - // have an FF-A error. We need to check Arg2 for the > - // FF-A error code. > - Ret =3D GetMemoryPermissionsSvcArgs.Arg2; > - switch (Ret) { > - case ARM_FFA_SPM_RET_INVALID_PARAMETERS: > - > - return EFI_INVALID_PARAMETER; > - > - case ARM_FFA_SPM_RET_DENIED: > - return EFI_NOT_READY; > - > - case ARM_FFA_SPM_RET_NOT_SUPPORTED: > - return EFI_UNSUPPORTED; > - > - case ARM_FFA_SPM_RET_BUSY: > - return EFI_NOT_READY; > - > - case ARM_FFA_SPM_RET_ABORTED: > - return EFI_ABORTED; > - } > - } else if (GetMemoryPermissionsSvcArgs.Arg0 =3D=3D > - ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { > // A Direct Response means FF-A success > // Now check the payload for errors > // The callee sends back the return value > // in Arg3 > Ret =3D GetMemoryPermissionsSvcArgs.Arg3; > + } else { > + // If Arg0 is not a Direct Response, that means we > + // have an FF-A error. We need to check Arg2 for the > + // FF-A error code. > + Ret =3D GetMemoryPermissionsSvcArgs.Arg2; > + switch (Ret) { > + case ARM_FFA_SPM_RET_INVALID_PARAMETERS: > + > + return EFI_INVALID_PARAMETER; > + > + case ARM_FFA_SPM_RET_DENIED: > + return EFI_NOT_READY; > + > + case ARM_FFA_SPM_RET_NOT_SUPPORTED: > + return EFI_UNSUPPORTED; > + > + case ARM_FFA_SPM_RET_BUSY: > + return EFI_NOT_READY; > + > + case ARM_FFA_SPM_RET_ABORTED: > + return EFI_ABORTED; > + } > } > } else { > Ret =3D GetMemoryPermissionsSvcArgs.Arg0; > @@ -150,35 +149,34 @@ RequestMemoryPermissionChange ( > // for other Direct Request calls which are not atomic > // We therefore check only for Direct Response by the > // callee. > - if (ChangeMemoryPermissionsSvcArgs.Arg0 !=3D > + if (ChangeMemoryPermissionsSvcArgs.Arg0 =3D=3D > ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { > - // If Arg0 is not a Direct Response, that means we > - // have an FF-A error. We need to check Arg2 for the > - // FF-A error code. > - Ret =3D ChangeMemoryPermissionsSvcArgs.Arg2; > - switch (Ret) { > - case ARM_FFA_SPM_RET_INVALID_PARAMETERS: > - return EFI_INVALID_PARAMETER; > - > - case ARM_FFA_SPM_RET_DENIED: > - return EFI_NOT_READY; > - > - case ARM_FFA_SPM_RET_NOT_SUPPORTED: > - return EFI_UNSUPPORTED; > - > - case ARM_FFA_SPM_RET_BUSY: > - return EFI_NOT_READY; > - > - case ARM_FFA_SPM_RET_ABORTED: > - return EFI_ABORTED; > - } > - } else if (ChangeMemoryPermissionsSvcArgs.Arg0 =3D=3D > - ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64) { > // A Direct Response means FF-A success > // Now check the payload for errors > // The callee sends back the return value > // in Arg3 > Ret =3D ChangeMemoryPermissionsSvcArgs.Arg3; > + } else { > + // If Arg0 is not a Direct Response, that means we > + // have an FF-A error. We need to check Arg2 for the > + // FF-A error code. > + Ret =3D ChangeMemoryPermissionsSvcArgs.Arg2; > + switch (Ret) { > + case ARM_FFA_SPM_RET_INVALID_PARAMETERS: > + return EFI_INVALID_PARAMETER; > + > + case ARM_FFA_SPM_RET_DENIED: > + return EFI_NOT_READY; > + > + case ARM_FFA_SPM_RET_NOT_SUPPORTED: > + return EFI_UNSUPPORTED; > + > + case ARM_FFA_SPM_RET_BUSY: > + return EFI_NOT_READY; > + > + case ARM_FFA_SPM_RET_ABORTED: > + return EFI_ABORTED; > + } This patch applies the same change twice in the same file. It looks to me like the switch statement should be in a static helper function. This would also improve readability of both host functions. [SAMI] I will send an updated patch shortly. [/SAMI] / Leif > } > } else { > Ret =3D ChangeMemoryPermissionsSvcArgs.Arg0; > --=20 > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20