From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.69]) by mx.groups.io with SMTP id smtpd.web12.32838.1606126226070167973 for ; Mon, 23 Nov 2020 02:10:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=lBqsjIq2; spf=pass (domain: arm.com, ip: 40.107.1.69, 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=HSNi+Z/XCFS3YN5yPN6t90JpVLYi+ZSuDioAV19i33s=; b=lBqsjIq2jY3gUoG7KBvCH+1TF9dnOEtTCIrNI2zc1HrOXeKtHRVQOxLs4iDcOdHXa4xdGa+aEpbaYanEORehvJ4liOlCn4EST6kp5qbpeBK98F8CVEB9XimAPEIh70DPOz3uip0TroZRXJsqMk/CxT6DBadkw94tAEiLi6rS7Ao= Received: from AM5PR1001CA0040.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::17) by DBBPR08MB4917.eurprd08.prod.outlook.com (2603:10a6:10:f1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.22; Mon, 23 Nov 2020 10:10:22 +0000 Received: from AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::c0) by AM5PR1001CA0040.outlook.office365.com (2603:10a6:206:15::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Mon, 23 Nov 2020 10:10:22 +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 AM5EUR03FT023.mail.protection.outlook.com (10.152.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Mon, 23 Nov 2020 10:10:22 +0000 Received: ("Tessian outbound 797fb8e1da56:v71"); Mon, 23 Nov 2020 10:10:21 +0000 X-CR-MTA-TID: 64aa7808 Received: from caa83f3eade6.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B1ABA285-6E3C-4AE5-9372-9A495BC25F82.1; Mon, 23 Nov 2020 10:10:16 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id caa83f3eade6.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 23 Nov 2020 10:10:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nNGfQx9CYypuesl4UgG/esRhFXo05ADtZ9a0xd2tYjIXAIqY8TY0ioJy0TQyHYk4tu8dvAhSFA1qyLP2fCKMBX4K8UccsPe9bO0kbYo3lZID1v5XDVUAvgSiLGiFc8fstkKGHKyqf/YanK36qX8SLajhiuo96WUb9bKMXebXQuhOZfVqGal65C+fhJ5LNxak3eC/tZjO8K9DwzRpDVGs65qS9z91O+0Q2UsRTTeEZ9NJD6Yr0huWdyIZnMpH0ld5OKtk46NvykQHmasqUEHVAAbrhpaxbSaD6c7Ok0LvZafkrL0yqg8mQjq1PkoXVO+R8ARCZs6yVZyar9cdYxmZ9A== 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=HSNi+Z/XCFS3YN5yPN6t90JpVLYi+ZSuDioAV19i33s=; b=b2YA1nbO8LZOG+jQslidfy2CQCy20ZREW2ys6wtZSR/Ewt1agyaA7CaLaD56DF6qEQG+H0hjISzuf/k2RPDpgr5XKVMBc37i99p8HE+FY2nEPsEu0am7NdV+sH4niTzGMmI2luIN0OOJr8J8Yir2FgrzQX/02HKCEsGy+K1GwyYU4rDM0zcKHQvbKJTcTK05+P++v8ffpGS5gm4T54/1S/FMnlAj2CEwaA4sxt7KNwOznjAhTTfYBcMuYCa5xAHLq1wviSUW6wBCiaQ3nrDRctRMsMot+lfT6tTjMb5vlkG/sd1Or3Q0dH2K24Ts3Mys0xC4y0e0kfMVBipDJwRDuQ== 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=HSNi+Z/XCFS3YN5yPN6t90JpVLYi+ZSuDioAV19i33s=; b=lBqsjIq2jY3gUoG7KBvCH+1TF9dnOEtTCIrNI2zc1HrOXeKtHRVQOxLs4iDcOdHXa4xdGa+aEpbaYanEORehvJ4liOlCn4EST6kp5qbpeBK98F8CVEB9XimAPEIh70DPOz3uip0TroZRXJsqMk/CxT6DBadkw94tAEiLi6rS7Ao= Received: from DB7PR08MB3097.eurprd08.prod.outlook.com (2603:10a6:5:1d::27) by DB8PR08MB5449.eurprd08.prod.outlook.com (2603:10a6:10:119::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Mon, 23 Nov 2020 10:10:14 +0000 Received: from DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::315c:f6c3:2600:bd39]) by DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::315c:f6c3:2600:bd39%6]) with mapi id 15.20.3589.030; Mon, 23 Nov 2020 10:10:14 +0000 From: "Sami Mujawar" To: Sughosh Ganu , "devel@edk2.groups.io" CC: Ard Biesheuvel , Jiewen Yao , Achin Gupta , nd Subject: Re: [PATCH v1 06/12] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Thread-Topic: [PATCH v1 06/12] StandaloneMmPkg: Add option to use FF-A calls for getting SPM version Thread-Index: AQHWp54HSZYSZC+KLECFGoYOnLr4R6nVqHhQ Date: Mon, 23 Nov 2020 10:10:14 +0000 Message-ID: References: <20201021113233.25548-1-sughosh.ganu@linaro.org> <20201021113233.25548-7-sughosh.ganu@linaro.org> In-Reply-To: <20201021113233.25548-7-sughosh.ganu@linaro.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 727AABCBE2D55E43BBE54B16A13836B0.1 x-checkrecipientchecked: true Authentication-Results-Original: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; x-originating-ip: [2a00:23c6:548a:4800:4595:5a81:16:79bb] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 40117855-afd8-4289-ca54-08d88f97fd11 x-ms-traffictypediagnostic: DB8PR08MB5449:|DBBPR08MB4917: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: tXFJRUD7UWgFfQvYXDZNnRosv+vDmbjhSXbHExm2VxPKFNH9kFMwBJqKE0cMJ85jxeeYkfCeFtosLvONrzeqZ2gSZCDzCtvbB5BIbqraCADO9tnJv+ODHlKKHB0NdoXflpfMZptZqVo6ejBj0dBllS1hfnhLLqcojK4+KaV+J7W3de6xYUMWsAiFG9rCmvj4zlJaJpJZcr7anTcWv0AcyLN+kF6K/4Zklrr79U69riRrrvAjmPaOdMicE/69PFlTVlpkS0Jm6N3TRtpI/VDUxEuYybXitRersV3QPB/Dxxx0FP4eX1oxB98QhaRaH1qxHofQsm+L7s/WyQWgMGSz7A== 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)(346002)(366004)(396003)(136003)(8676002)(8936002)(4326008)(83380400001)(7696005)(6506007)(53546011)(478600001)(19627235002)(9686003)(71200400001)(55016002)(52536014)(5660300002)(76116006)(66946007)(33656002)(66476007)(110136005)(66556008)(64756008)(66446008)(86362001)(186003)(54906003)(316002)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?laEsz738vanid9U+ebw/Ebnkefe1f91BPtaDVV9xeUGpPjfEOA2fQ17R0rt5?= =?us-ascii?Q?D4UCRpQRAvQO6eH4FwOLhEKevm6eatSV9er/Wx65CZqyP/XIh/X8KyehqLAP?= =?us-ascii?Q?ua73+EY+5HgExBiO2g8y2yrAFoOMQC3+fcxvgQxKCl+dmpr29jR28w/0qCXG?= =?us-ascii?Q?kduvRa6KvepysrGhMGusSsjXBaPDsuDhO4jR+iRqqROe5Aau3NtID0MnMnu4?= =?us-ascii?Q?f0llnFlz34l7t9UBVFl7+0nhBOkivo+7/Xr4ZWDBqbDX9M1Up7rdVPApHhiB?= =?us-ascii?Q?6xjkjSB0QmAV8opoNF6Hw2KDw07pyn0JFXspUiZ/Y6OUDIBwiacYDdhI3S50?= =?us-ascii?Q?ptvpg4RUZy9gxGmmCHuZK3DABio81fCcFacWLZ275lRIWOO1oaEHJ3iqA+T3?= =?us-ascii?Q?Da2YdDe3Lt4VUm79Zun+GNUG6P5GfcylX/tjZZa9JxL+9cc0grp5qgPxZM5p?= =?us-ascii?Q?Npw/QzK3ujsMEjsM6tqtWVSwGI31AKWpfXyTLicIUlZTa1ccwMwmkK+rt2k/?= =?us-ascii?Q?EIO6xS4LDYmrkwCD2pr4uMGlN+YlbAbLFFQvdN1tlSe+xNaFyAM8EIAqJELd?= =?us-ascii?Q?zd6NzSByDrBOMLUidGF8RWXmJiJWPSLcGDLtVz8uHoxx/AoRcZkEWc/SGEeW?= =?us-ascii?Q?hJjSwRPp3hISfL19DedY3ijZRo94K4J8LTGef1wN5ZjyvoZ/MHWuCi9A+imD?= =?us-ascii?Q?8XpzGRGaUkrzPHSntomAJW3cslrlWwL3yc7Lw87zpeximX67buaVr9poHcJG?= =?us-ascii?Q?CKbWIaTcg9LYnxkvUDLWZtfoOFszBFj9ok/7BiI/GbWasww2XbREFHiZwnFc?= =?us-ascii?Q?iRMwms+cqU9IPA00HomYqR9aVtntCtjyFb7+Swo0cnNJ8j6nwnjhN13rFaUN?= =?us-ascii?Q?br6E8Dm87oUCJcikuej1gCzfQt9TygmLp/z1230AvbS3FO3ELzNYwi4UG7PC?= =?us-ascii?Q?A2K+/EbCjNiYBMi1xbZuFg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5449 Original-Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b1c20c5b-4247-4f09-f57c-08d88f97f891 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jc3fgQGrctqFKtyA6CVB3w6hLeVj+CydTjbTOsWMqsRUc439tkjOUaPlEa625aQpyre+vAo7H0E9lPXIcKiDcaRaPyN4BCedSBYK02ztPGUxICKqYPzUmqJdOcx8O2Bg0M4CRpGHweA1Dx00R+46iysvzB/h5Fjh66BxyAqXp2CVqxX/ht0EkLnKivwkCUaaHWjnb4V8bIB6+B/xFJmt+BNjiu429Z8V2FOJJBijPJgsTdA7hl2aBuEI6Q78sVNwm721MnO1HWJQIMtuwqHfBQPEfqS0WwYTXq5LpCVw4ozyF5ieBkrVOQJgKdzeh/6jjgEuYKgZfY8TzmkPxqTaG5qEbAZvybNaNuqBV18cMFX2jYPF/vdf/16lJN7wUWmrZeM52SB/UKibNgwfYEiTUg== 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)(396003)(346002)(376002)(136003)(39860400002)(46966005)(86362001)(336012)(8936002)(8676002)(26005)(70586007)(4326008)(6506007)(33656002)(186003)(7696005)(53546011)(82740400003)(81166007)(356005)(110136005)(36906005)(47076004)(316002)(54906003)(83380400001)(55016002)(9686003)(19627235002)(52536014)(5660300002)(70206006)(82310400003)(478600001)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2020 10:10:22.0750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40117855-afd8-4289-ca54-08d88f97fd11 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: AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4917 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Sughosh, Please find my response inline marked [SAMI]. Regards, Sami Mujawar -----Original Message----- From: Sughosh Ganu =20 Sent: 21 October 2020 12:32 PM To: devel@edk2.groups.io Cc: Ard Biesheuvel ; Sami Mujawar ; Jiewen Yao ; Achin Gupta Subject: [PATCH v1 06/12] StandaloneMmPkg: Add option to use FF-A calls for= getting SPM version From: Achin Gupta With the introduction of Firmware Framework(FF-A), a Secure Partition can get the SPM version either using FF-A calls or through the existing svc calls. Use a runtime check to use either of the two methods based on the Pcd feature flag value. Signed-off-by: Achin Gupta Co-developed-by: Sughosh Ganu --- StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 ++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 31 ++++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 7d6ee4e08e..f8184f501b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -49,5 +49,8 @@ gEfiStandaloneMmNonSecureBufferGuid gEfiArmTfCpuDriverEpDescriptorGuid =20 +[Pcd] + gArmTokenSpaceGuid.PcdFfaEnable + [BuildOptions] GCC:*_*_*_CC_FLAGS =3D -fpie diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 33f0db654f..7d1e3c4d7c 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include @@ -165,19 +166,31 @@ EFI_STATUS GetSpmVersion (VOID) { EFI_STATUS Status; - UINT16 SpmMajorVersion; - UINT16 SpmMinorVersion; + UINT16 CurSpmMajorVer; + UINT16 SpmMajorVer; [SAMI] I think a 'Caller & Callee' prefix would add clarity. See FFA Spec, = Section 8.1.1 [/SAMI] + UINT16 CurSpmMinorVer; + UINT16 SpmMinorVer; UINT32 SpmVersion; ARM_SVC_ARGS SpmVersionArgs; =20 - SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + if (FeaturePcdGet (PcdFfaEnable)) { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_FFA_VERSION_AARCH32; + SpmVersionArgs.Arg1 =3D SPM_MAJOR_VER << SPM_MAJOR_VER_SHIFT; + SpmVersionArgs.Arg1 |=3D SPM_MINOR_VER; + SpmMajorVer =3D SPM_MAJOR_VER_FFA; + SpmMinorVer =3D SPM_MINOR_VER_FFA; + } else { + SpmVersionArgs.Arg0 =3D ARM_SVC_ID_SPM_VERSION_AARCH32; + SpmMajorVer =3D SPM_MAJOR_VER; + SpmMinorVer =3D SPM_MINOR_VER; + } =20 ArmCallSvc (&SpmVersionArgs); =20 SpmVersion =3D SpmVersionArgs.Arg0; [SAMI] The Version FID for FFA and for SPM based on the MM interface both = return NOT_SUPPORTED as an error code.=20 Can we check the error code for failure, please? [/SAMI] - SpmMajorVersion =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_= SHIFT); - SpmMinorVersion =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); + CurSpmMajorVer =3D ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_S= HIFT); + CurSpmMinorVer =3D ((SpmVersion & SPM_MINOR_VER_MASK) >> 0); =20 // Different major revision values indicate possibly incompatible functi= ons. // For two revisions, A and B, for which the major revision values are @@ -186,17 +199,17 @@ GetSpmVersion (VOID) // revision A must work in a compatible way with revision B. // However, it is possible for revision B to have a higher // function count than revision A. - if ((SpmMajorVersion =3D=3D SPM_MAJOR_VER) && - (SpmMinorVersion >=3D SPM_MINOR_VER)) + if ((CurSpmMajorVer =3D=3D SpmMajorVer) && + (CurSpmMinorVer >=3D SpmMinorVer)) { DEBUG ((DEBUG_INFO, "SPM Version: Major=3D0x%x, Minor=3D0x%x\n", - SpmMajorVersion, SpmMinorVersion)); + CurSpmMajorVer, CurSpmMinorVer)); Status =3D EFI_SUCCESS; } else { DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Maj= or=3D0x%x, Minor=3D0x%x.\n Expected: Major=3D0x%x, Minor>=3D0x%x.\n", - SpmMajorVersion, SpmMinorVersion, SPM_MAJOR_VER, SPM_MINOR_VER= )); + CurSpmMajorVer, CurSpmMinorVer, SpmMajorVer, SpmMinorVer)); Status =3D EFI_UNSUPPORTED; } =20 --=20 2.17.1