From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.92.18.77]) by mx.groups.io with SMTP id smtpd.web11.2102.1689267419467753726 for ; Thu, 13 Jul 2023 09:56:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=BSN09JY1; spf=pass (domain: outlook.com, ip: 40.92.18.77, mailfrom: chris.fernald@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aWIaYQ5HkRHOXIxtoWWusXYzvrPI5NntFFYCFIPfUxQmurta8vAtofKK1yoDDKhGUU4PDwlWDHivMJfsunnvWusz1Z9k8OXJvYxQcLmnVgFdT9EIq3JOv6IcItoOhpG3m1ZkQ/RuZLJyThSjmDNZ/S/sVOGOq29371HJ2pZrIOsgpshKz+VHjrQJujWm2AnK635dbPatSc/3WpV5KUqJQDRbJRkVBdIzKSTxr4t+yF1Rc1nLqiD/GpE5Y0tm68E837AFH3NH7FwuI4JmqD7bMFYKFxyphTg4ZPdErFYNBgpD24V6DvSNrQA1SA35Uipv96SfBKCaJPlXekuH37rrxw== 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=bUmbddENVk2l7ft1P6ogSQIvVVS8Qxj71mpI5dD872o=; b=amFhG1dGZX5p6rxxanDDnLfdO6eV32CEu1NSLqVJC5XXHNkBOjYornOMb+CIbzrcWjv1+hRjr5JUl1Q+jO+p5/BAn+4YCdkxrooah/V35KnVS4wygyA4KylQyH6/98+8nI5t91u1zkMFSnKPJkvOmUXR0m3VlfkF+07/JtdkELwyekT6ss2G/Fjy9ghw9Oby2aHiuEwW0/DyZ/4gohc6s9wTt5cM0DqkSRI6WysSwpv17mF4A13SPqFZa6X4XlthjD734UwqrGQDKGbCHVBpPSpr4t04deHSFhQaaDiUoADR4wmdJ2zdjEXsfhx0KUk5npfxYRnTYhOtoOtqFvSa8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bUmbddENVk2l7ft1P6ogSQIvVVS8Qxj71mpI5dD872o=; b=BSN09JY1/BswfW0WzTxEdgsFCAvyg67Z28UXGjRcb60UNA9AmmOAndmwqLs+alGZvQ8IRq3Iycr4A6jiM5H98AAqE47XccWnsRNcv9dYtjgpa5hCjfJEItCetV7jGXbuwpmbzdsFJXJs1s2aERvfuwro8nDiNWmpirNCFn0PBd47C/vdOzDlyH+gDqaH9Bc76PJazF3Ssw5bsK+KPfgDmHe9HVQuHgYyLGA3SmOOx3XJHHawOgIB/nze7nLj790sXZ8EDSVYSK5Iw+/13xnGuh1fSe7DZEb6sl9fDN1Snr33h6jW+3XkhvoybbVMGx2QslMVOt8D/9U/EuQEQTPfpQ== Received: from IA1PR19MB6275.namprd19.prod.outlook.com (2603:10b6:208:3e9::19) by CH2PR19MB4021.namprd19.prod.outlook.com (2603:10b6:610:a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.24; Thu, 13 Jul 2023 16:56:58 +0000 Received: from IA1PR19MB6275.namprd19.prod.outlook.com ([fe80::f8b:7745:ff38:8b5c]) by IA1PR19MB6275.namprd19.prod.outlook.com ([fe80::f8b:7745:ff38:8b5c%7]) with mapi id 15.20.6588.025; Thu, 13 Jul 2023 16:56:58 +0000 Message-ID: Date: Thu, 13 Jul 2023 09:56:54 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [edk2-devel] [edk2-platforms][PATCH V1 14/20] ArmPkg/MmCommunicationDxe: Introduce FF-A version check To: devel@edk2.groups.io, nishant.sharma@arm.com Cc: Ard Biesheuvel , Sami Mujawar , Thomas Abraham , Sayanta Pattanayak , Achin Gupta References: <20230711143658.781597-1-nishant.sharma@arm.com> <20230711143658.781597-15-nishant.sharma@arm.com> From: "Chris Fernald" In-Reply-To: <20230711143658.781597-15-nishant.sharma@arm.com> X-TMN: [quldzajg75JtfdKSXqc2jD5NyhweI/V8iD51Vn45k8MnpeFjkE5b0wB1iNYLiswt] X-ClientProxiedBy: MW4PR04CA0033.namprd04.prod.outlook.com (2603:10b6:303:6a::8) To IA1PR19MB6275.namprd19.prod.outlook.com (2603:10b6:208:3e9::19) Return-Path: chris.fernald@outlook.com X-Microsoft-Original-Message-ID: <18190d6c-5455-c185-51f1-913fe2a0981f@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR19MB6275:EE_|CH2PR19MB4021:EE_ X-MS-Office365-Filtering-Correlation-Id: 7649b474-5f6e-4dbb-d24c-08db83c22b2f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3jHT+1B+5aNhnqkyK0wAKjORfz6I+vNwdV2erifoSNehwEeuENzOHP/NY7s44e8RgwJR89B++EWJ2QTUsG0S+ZZLL27JKe3aWL1bvBw6zJfdMO46938IjDbDuup5WakSm4pSXByi536+dC7AUr9e/kaMsJiT++23QNldmJ/KsvaQcLD4E8mPf7CKdd+ZEkepfccwZbHoAqqUeY66ZZ3YF0Ab7J18NNOiXl735mVO7Twbx9hmdC9D5nbVm8ZZwmeW/5iZD7ZyGNc6cByZzhszkOk92ny83NlLc3fbuCCNDKVGXwED58g4wappTQn4LHkc4yP0M2lX30FNv0rRTW6mLdGqNgeo07KPeJGBR3dw7IhaKHv1pq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1R6YmJy?= =?utf-8?B?b1NmNzhVS3JEaFBGWmxJMS9pbkVWTlZienRLQ0ZIY3JTeEJUbVdaMW4zdUJp?= =?utf-8?B?WU1EWk93R1pmMGEwbThDQmJ0K2FSQ285MkhYc1MwMnF0U0laVzVXNTdTSys1?= =?utf-8?B?VnVNaVZ5TjJGRlJnWGgvdVMzVXl6aktJWVpVQXVnRE95a3E1ZytzRit4UG11?= =?utf-8?Q?BPuSSQDT9Ik7v1Vq9M=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7649b474-5f6e-4dbb-d24c-08db83c22b2f X-MS-Exchange-CrossTenant-AuthSource: IA1PR19MB6275.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 16:56:58.0349 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR19MB4021 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Might as well use MAKE_FFA_VERSION from ArmFfaSvc.h for consistency. -Chris On 7/11/2023 7:36 AM, Nishant Sharma wrote: > From: Achin Gupta > > This patch adds support for querying whether FF-A v1.1 is supported by the > FF-A impplementation. > > Signed-off-by: Achin Gupta > Signed-off-by: Nishant Sharma > --- > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 3 +++ > ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h | 7 ++++++- > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 17 ++++++++++++----- > 3 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > index 05b6de73ff34..c15b1a7a86ae 100644 > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf > @@ -31,6 +31,9 @@ > ArmPkg/ArmPkg.dec > MdePkg/MdePkg.dec > > +[FixedPcd] > + gArmTokenSpaceGuid.PcdFfaEnable > + > [LibraryClasses] > ArmLib > ArmSmcLib > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h > index 5c5fcb576856..71edf7f49174 100644 > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h > @@ -16,7 +16,12 @@ > #define MM_MAJOR_VER(x) (((x) & MM_MAJOR_VER_MASK) >> MM_MAJOR_VER_SHIFT) > #define MM_MINOR_VER(x) ((x) & MM_MINOR_VER_MASK) > > +#if (FixedPcdGet32 (PcdFfaEnable) == 1) > #define MM_CALLER_MAJOR_VER 0x1UL > -#define MM_CALLER_MINOR_VER 0x0 > +#define MM_CALLER_MINOR_VER 0x1UL > +#else > +#define MM_CALLER_MAJOR_VER 0x1UL > +#define MM_CALLER_MINOR_VER 0x0UL > +#endif > > #endif /* MM_COMMUNICATE_H_ */ > diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > index 85d9034555f0..a6fcd590a65b 100644 > --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c > @@ -18,6 +18,7 @@ > > #include > > +#include > #include > > #include "MmCommunicate.h" > @@ -250,14 +251,20 @@ GetMmCompatibility ( > { > EFI_STATUS Status; > UINT32 MmVersion; > - ARM_SMC_ARGS MmVersionArgs; > + ARM_SMC_ARGS SmcArgs = {0}; > > - // MM_VERSION uses SMC32 calling conventions > - MmVersionArgs.Arg0 = ARM_SMC_ID_MM_VERSION_AARCH32; > + if (FixedPcdGet32 (PcdFfaEnable) != 0) { > + SmcArgs.Arg0 = ARM_SVC_ID_FFA_VERSION_AARCH32; > + SmcArgs.Arg1 = MM_CALLER_MAJOR_VER << MM_MAJOR_VER_SHIFT; > + SmcArgs.Arg1 |= MM_CALLER_MINOR_VER; > + } else { > + // MM_VERSION uses SMC32 calling conventions > + SmcArgs.Arg0 = ARM_SMC_ID_MM_VERSION_AARCH32; > + } > > - ArmCallSmc (&MmVersionArgs); > + ArmCallSmc (&SmcArgs); > > - MmVersion = MmVersionArgs.Arg0; > + MmVersion = SmcArgs.Arg0; > > if ((MM_MAJOR_VER (MmVersion) == MM_CALLER_MAJOR_VER) && > (MM_MINOR_VER (MmVersion) >= MM_CALLER_MINOR_VER))