[edk2-devel] [PATCH v1 10/12] ArmPkg/StandaloneMmMmuLib: Add option to use FF-A calls to set memory region's permissions
Sami Mujawar
sami.mujawar at arm.com
Mon Nov 23 14:21:59 UTC 2020
One more suggestion added inline marked [SAMI].
Regards,
Sami Mujawar
-----Original Message-----
From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Sami Mujawar via groups.io
Sent: 23 November 2020 01:43 PM
To: Sughosh Ganu <sughosh.ganu at linaro.org>; devel at edk2.groups.io
Cc: Ard Biesheuvel <Ard.Biesheuvel at arm.com>; Jiewen Yao <jiewen.yao at intel.com>; Achin Gupta <Achin.Gupta at arm.com>; nd <nd at arm.com>
Subject: Re: [edk2-devel] [PATCH v1 10/12] ArmPkg/StandaloneMmMmuLib: Add option to use FF-A calls to set memory region's permissions
Hi Sughosh,
Please find my response inline marked [SAMI].
Regards,
Sami Mujawar
-----Original Message-----
From: Sughosh Ganu <sughosh.ganu at linaro.org>
Sent: 21 October 2020 12:33 PM
To: devel at edk2.groups.io
Cc: Ard Biesheuvel <Ard.Biesheuvel at arm.com>; Sami Mujawar <Sami.Mujawar at arm.com>; Jiewen Yao <jiewen.yao at intel.com>; Achin Gupta <Achin.Gupta at arm.com>
Subject: [PATCH v1 10/12] ArmPkg/StandaloneMmMmuLib: Add option to use FF-A calls to set memory region's permissions
From: Achin Gupta <achin.gupta at arm.com>
Allow setting memory region's permissions using either of the Firmware
Framework(FF-A) ABI transport or through the earlier used SVC calls.
Signed-off-by: Achin Gupta <achin.gupta at arm.com>
Co-developed-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c | 24 ++++++++++++++++----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c
index ab13602556..fef5eb4d22 100644
--- a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c
+++ b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c
@@ -63,17 +63,31 @@ RequestMemoryPermissionChange (
IN UINTN Permissions
)
{
+ BOOLEAN FfaEnabled;
EFI_STATUS Status;
ARM_SVC_ARGS ChangeMemoryPermissionsSvcArgs = {0};
- ChangeMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;
- ChangeMemoryPermissionsSvcArgs.Arg1 = BaseAddress;
- ChangeMemoryPermissionsSvcArgs.Arg2 = EFI_SIZE_TO_PAGES(Length);
- ChangeMemoryPermissionsSvcArgs.Arg3 = Permissions;
+ FfaEnabled = FeaturePcdGet (PcdFfaEnable);
+
+ if (FfaEnabled) {
+ ChangeMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64;
+ ChangeMemoryPermissionsSvcArgs.Arg1 = 0x3;
[SAMI] Can you define macros for the endpoint IDs, please? Also add reference to where information/documentation about the endpoint Ids can be found.
[/SAMI]
+ ChangeMemoryPermissionsSvcArgs.Arg2 = 0;
+ ChangeMemoryPermissionsSvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;
+ ChangeMemoryPermissionsSvcArgs.Arg4 = BaseAddress;
+ ChangeMemoryPermissionsSvcArgs.Arg5 = EFI_SIZE_TO_PAGES(Length);
[SAMI] Add a space between EFI_SIZE_TO_PAGES and starting parenthesis. [/SAMI]
+ ChangeMemoryPermissionsSvcArgs.Arg6 = Permissions;
+ } else {
+ ChangeMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;
+ ChangeMemoryPermissionsSvcArgs.Arg1 = BaseAddress;
+ ChangeMemoryPermissionsSvcArgs.Arg2 = EFI_SIZE_TO_PAGES(Length);
[SAMI] Add a space between EFI_SIZE_TO_PAGES and starting parenthesis. [/SAMI]
+ ChangeMemoryPermissionsSvcArgs.Arg3 = Permissions;
+ }
ArmCallSvc (&ChangeMemoryPermissionsSvcArgs);
- Status = ChangeMemoryPermissionsSvcArgs.Arg0;
+ Status = FfaEnabled ?
+ ChangeMemoryPermissionsSvcArgs.Arg3 : ChangeMemoryPermissionsSvcArgs.Arg0;
[SAMI] In case of FFA, Arg0 may also contain an error code, right? See FFA spec, section 10.2.
[/SAMI]
switch (Status) {
case ARM_SVC_SPM_RET_SUCCESS:
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67806): https://edk2.groups.io/g/devel/message/67806
Mute This Topic: https://groups.io/mt/77703658/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list