This event has been canceled with this note:
"No subjects to present this week so cancelling."
Title: TF-A Tech Forum
We run an open technical forum call for anyone to participate and it is not
restricted to Trusted Firmware project members. It will operate under the
guidance of the TF TSC. Feel free to forward this invite to
colleagues. Invites are via the TF-A mailing list and also published on the
Trusted Firmware website. Details are
here: https://www.trustedfirmware.org/meetings/tf-a-technical-forum/Tr…
Firmware is inviting you to a scheduled Zoom meeting.Join Zoom
Meetinghttps://zoom.us/j/9159704974Meeting ID: 915 970 4974One tap
mobile+16465588656,,9159704974# US (New York)+16699009128,,9159704974# US
(San Jose)Dial by your location +1 646 558
8656 US (New York) +1 669 900
9128 US (San Jose) 877 853 5247 US
Toll-free 888 788 0099 US Toll-freeMeeting ID:
915 970 4974Find your local
number: https://zoom.us/u/ad27hc6t7h
When: Thu Sep 9, 2021 4pm – 5pm United Kingdom Time
Calendar: tf-a(a)lists.trustedfirmware.org
Who:
* Bill Fletcher - creator
* marek.bykowski(a)gmail.com
* okash.khawaja(a)gmail.com
* tf-a(a)lists.trustedfirmware.org
Invitation from Google Calendar: https://calendar.google.com/calendar/
You are receiving this courtesy email at the account
tf-a(a)lists.trustedfirmware.org because you are an attendee of this event.
To stop receiving future updates for this event, decline this event.
Alternatively you can sign up for a Google account at
https://calendar.google.com/calendar/ and control your notification
settings for your entire calendar.
Forwarding this invitation could allow any recipient to send a response to
the organizer and be added to the guest list, or invite others regardless
of their own invitation status, or to modify your RSVP. Learn more at
https://support.google.com/calendar/answer/37135#forwarding
Hi,
When I check the tf-static-checks for the FIP/FCONF series I pushed for
STM32MP1, I have a failure:
1d204ee4a:plat/st/common/bl2_io_storage.c:
['tools_share/firmware_image_package.h
should be in project group, after system group']
First I didn't understand the issue, as the file is in project group.
But the issue is due to previous include:
#include <plat/common/platform.h>
As it is inside include/plat directory, it is seen as a platform include.
For me the files in this include/plat/common directory are more project,
but what is your point of view?
If they are platform files, I should modify my series to reflect that.
If they are project files, then the check-include-order.py script should
be updated.
Here is what could be the correction:
diff --git a/script/static-checks/check-include-order.py
b/script/static-checks/check-include-order.py
index aaf84f1..53d355b 100755
--- a/script/static-checks/check-include-order.py
+++ b/script/static-checks/check-include-order.py
@@ -87,6 +87,8 @@ def inc_order_is_correct(inc_list, path, commit_hash=""):
incs = collections.defaultdict(list)
error_msgs = []
plat_incs = dir_include_paths("plat") |
dir_include_paths("include/plat")
+ plat_common_incs = dir_include_paths("include/plat/common")
+ plat_incs.difference_update(plat_common_incs)
libc_incs = dir_include_paths("include/lib/libc")
Best regards,
Yann
On 7/28/21 10:50 AM, guillaume pivetta via TF-A wrote:
> Hi, I’m trying to implement a secure boot on a STM32MP1 without using
> the FIP file.
>
Hi Guillaume,
Sorry for this very late reply.
> For now , I am not able to use FIP format during the boot process so I
> use a depreciated boot process with TF-Av2.2 as FSBL and U-Boot as SSBL
> to boot my Board.
>
That's quite an old software.
If you can, I'd suggest you update the software to the version delivered
by ST, based on a v2.4 label.
The sources are available there:
https://github.com/STMicroelectronics/arm-trusted-firmware
And you should take the v2.4-stm32mp branch.
In this software, FIP is available, and with a better support for
TUSTED_BOARD_BOOT.
> My boot process do Romcode -> TF-A (BL2) -> SP_min (BL32) -> U-Boot
> (BL33) -> Linux kernel
>
> I succefully implemented signature authentification between U-Boot and
> Linux image, but between TF-A and U-Boot it’s a little bit harder.
>
> I learned on ST wiki how to sign my u-boot binary with the
> STM32MP_SigningTool_CLI, but when I sign my binary with a custom private
> key, TF-A don’t authentified it on boot, even if i tryed to pass my key
> to TF-A at compilation time with the BL33_KEY argument, which i think is
> dedicated to the FIP usage.
>
> I found, in the sources of TF-A, what I think being a developpement key,
> named « arm_rotpk_ecdsa.pem ».
>
> And when I sign my binary with this key, I am able to perform the
> signature check and continu my boot process. So I tryed to change this
> key with a custom one and recompile TF-A to update the key in the final
> binary, but it seem that it is not so simple.
>
> I found yesterday that the auth_mod_init() function wasn’t call because
> I had forgotten the TUSTED_BOARD_BOOT=1 compilation argument. But when I
> activate it, the compilation doesn’t work and i see
>
> « build/arm-trusted-firmware-v2.2/bl2/bl2_main.c:91: undefined reference
> to `auth_mod_init' »
>
> Whitch traditionnaly append when linker don’t find the .o where the
> functions are implemented.
>
> I would like to know if it is possible to implement some kind of
> authentification with custom keys without FIP and if yes where can i
> find some hints/ressources/tutorial ?
>
> I don’t find a lot of ressources about secure boot without FIP so I hope
> you will be able to help me.
>
>
If you can switch to a newer software with FIP, you can check:
https://wiki.st.com/stm32mpu/wiki/How_to_configure_TF-A_FIP
Else, the page that could help you is there:
https://wiki.st.com/stm32mpu-ecosystem-v2/wiki/STM32MP15_secure_boot
If you need more help, the better is to use the links given at the
bottom of the wiki pages:
ST Support Center (https://community.st.com/s/onlinesupport) or ST
Community MPU Forum
(https://community.st.com/s/topic/0TO0X0000003u2AWAQ/stm32-mpus).
Best regards,
Yann
This event has been canceled with this note:
"Cancelling TF-A Tech forum this week as we have no scheduled topic."
Title: TF-A Tech Forum
We run an open technical forum call for anyone to participate and it is not
restricted to Trusted Firmware project members. It will operate under the
guidance of the TF TSC. Feel free to forward this invite to
colleagues. Invites are via the TF-A mailing list and also published on the
Trusted Firmware website. Details are
here: https://www.trustedfirmware.org/meetings/tf-a-technical-forum/Tr…
Firmware is inviting you to a scheduled Zoom meeting.Join Zoom
Meetinghttps://zoom.us/j/9159704974Meeting ID: 915 970 4974One tap
mobile+16465588656,,9159704974# US (New York)+16699009128,,9159704974# US
(San Jose)Dial by your location +1 646 558
8656 US (New York) +1 669 900
9128 US (San Jose) 877 853 5247 US
Toll-free 888 788 0099 US Toll-freeMeeting ID:
915 970 4974Find your local
number: https://zoom.us/u/ad27hc6t7h
When: Thu Aug 26, 2021 4pm – 5pm United Kingdom Time
Calendar: tf-a(a)lists.trustedfirmware.org
Who:
* Bill Fletcher - creator
* marek.bykowski(a)gmail.com
* okash.khawaja(a)gmail.com
* tf-a(a)lists.trustedfirmware.org
Invitation from Google Calendar: https://calendar.google.com/calendar/
You are receiving this courtesy email at the account
tf-a(a)lists.trustedfirmware.org because you are an attendee of this event.
To stop receiving future updates for this event, decline this event.
Alternatively you can sign up for a Google account at
https://calendar.google.com/calendar/ and control your notification
settings for your entire calendar.
Forwarding this invitation could allow any recipient to send a response to
the organizer and be added to the guest list, or invite others regardless
of their own invitation status, or to modify your RSVP. Learn more at
https://support.google.com/calendar/answer/37135#forwarding
Hi,
I did the test report SDEI to kernel with fatal severity in APEI / CPER while EL3 received
SEA(SCR_EL3.EA = 1). Kernel will panic and print calltrace, but this calltrace was not the
position where error occured(another word where throw SEA), instead calltrace in ghes.c.
How can SDEI solution let kernel print calltrace at right position?
For issue analysis, the right position calltrace is very useful. For ACPI firmware-first,
we set SCR_EL3.EA = 1, although the solution rethrow EA back to kernel will suffer from some
problems, but this solution can let kernel print calltrace at right position.
Best Regards,
Ming Huang
On 5/25/21 8:08 PM, James Morse via TF-A wrote:
> Hi Pali,
>
> I assume the aborts you are ignoring are precise! SError can be imprecise.
> I guess these are due to some integration issue with the PCIe root-complex. You shouldn't
> get aborts outside a RAS error. PCIe has DPC/eDPC and AER for signalling RAS errors - I
> guess these aren't supported on your platform.
>
>
> To emulte the synchronous/asynchronous exceptions means emulating what the CPU would do if
> SCR_EL3.EA weren't set. I'm not sure how familiar you are with the CPU's exception model
> and all its routing/masking controls. A short tour of what is involved:
> (the numbered references are for DDI0487G.a, they may have moved in your version)
>
>
> To emulate an exception you need to copy ESR_EL3, SPSR_EL3 and ELR_EL3 to the ESR, SPSR
> and ELR of the target EL. You need to calculated new PSTATE and PC for SPSR_EL3 and
> ELR_EL3. The way the CPU does this is described in the psuedocode in the arm-arm. See
> AArch64.TakeException. This will involve reading SCTLR of the target EL.
> For Synchronous-External-Abort, if the FnV bit is clear, you should copy FAR_EL3 to FAR of
> the target EL too.
>
> There is a GPL implementation of some of these bits in the kernel's KVM code, but that is
> probably of limited use due to the license.
>
>
> To determine the target EL you need to examine the routing controls set by the lower ELs.
> Synchronous Exceptions are the easiest as they can't be masked:
> The routing rules are describe in D1.12.4 "Routing synchronous External Aborts" is a
> little terse. It glosses over HCR_EL2.TGE that would also route the exception to EL2.
>
> For a synchronous-external-abort triggered by EL1 where HCR_EL2.TERR is not supported, or
> clear: If the fault was at stage1, it goes to EL1, if the fault was at stage2, it goes to
> EL2. There is nothing the ESR to tell you which it was as the CPU indicates this with the
> target EL, which was overridden by SCR_EL3.EA. (The architecture doesn't expect you to be
> re-injecting exceptions from EL3).
> Pragmatically the best option is to allow HCR_EL2.AMO to route synchronous exceptions to
> EL2 too. (this is a big hint that a hypervisor is managing errors for this exception
> level). If ELR_EL3.S1PTW is set, this is definitely a stage2 fault, EL1 should never see
> this bit set.
> (Synchronous Exceptions can't be routed to a lower EL).
>
>
> Synchronous errors were the easy one. Asynchronous error routing is described in D1.13.1
> "Asynchronous exception routing". You want to take note of HCR_EL2.{AMO, TGE}. But it can
> also be masked by PSTATE.A of the target EL. (See D1.13.2 "Asynchronous exception masking"):
> If SPSR_EL3.M is the target EL, SPSR_EL3.A would have masked SError. You cannot emulate
> the exception if this bit is set.
> If SPSR_EL3.M is lower than the target EL, then you can emulate the exception to the
> target EL.
> If SPSR_EL3.M is higher than the target EL, then SError is effectively masked, and you
> cannot emulate the exception.
>
>
> (I don't think HPFAR_EL2 needs to be set for these cases, but I'd need to check)
>
>
> Finally, you still need something to do if you can't emulate the exception. Updating a
> system log if you have one and rebooting is the only real option.
>
>
>
> Thanks,
>
> James
>
>
> On 25/05/2021 11:08, Pali Rohár wrote:
>> Hello!
>>
>> Platform is not ACPI based. PCIe core in some cases sends External
>> Aborts to kernel which needs to be masked/ignored. I have not found a
>> way how to reconfigure PCIE core to not send these aborts.
>>
>> In mentioned review is a link to kernel list where was discussion about
>> custom kernel handlers to ignore some of EA. But this approach was
>> rejected with information that TF-A should handle these aborts and
>> ignores those which should not be propagated back to kernel.
>>
>> If I clear SCR_EL3.EA then aborts (including those which should be
>> ignored) are sent to kernel and kernel makes them fatal. So this is not
>> a solution.
>>
>> If I do not clear SCR_EL3.EA then in TF-A board/platform code I can
>> implement check for aborts which needs to be ignored. But remaining
>> aborts are not delivered to kernel and TF-A makes them fatal. Which is
>> not correct too.
>>
>> So, what I need, is to route all External Aborts to TF-A, implement
>> logic which ignores specific PCIE aborts and all remaining aborts needs
>> to be propagated back to kernel like if SCR_EL3.EA is clear.
>>
>> So it means to implement some logic of abort injection.
>>
>> On Tuesday 25 May 2021 11:00:09 James Morse wrote:
>>> Hi Guys,
>>>
>>> Does this platform need external-aborts to be routed to EL3? If not, you can clear
>>> SCR_EL3.EA and be done with it. This allows the EL2 OS/Hypervisor to take control of the
>>> routing of these exceptions. (which sounds like what you want)
>>>
>>>
>>> Otherwise:
>>> As Soby describes, the choices are SDEI or emulate the exception according to the arm-arm
>>> psuedocode as if EL3 weren't implemented. This is best avoided as its difficult to get
>>> right: you have to create a new PSTATE for the target exception level, and read the
>>> routing controls to work out which exception level that is.
>>>
>>> As Achin says, emulating the exception isn't always possible as Asynchronous exceptions
>>> can be masked. The hardware does this automatically when it takes an exception (e.g. irq).
>>> (Linux unmask it again once its read the CPU state).
>>>
>>> This can leave you holding what may be an imprecise-asynchronous-abort in EL3, unable to
>>> emulate the exception or proceed without causing any RAS error to become uncontained.
>>> If you can't inject the emulated exception, the error still has to be handled at EL3. If
>>> this is an ACPI system you can do a soft restart of the normal-world and present the error
>>> via ACPI's BERT (boot error record table) which describes an error that happened in a
>>> previous life.
>>>
>>>
>>> If your platform is ACPI firmware-first, using SDEI will make life easier. You still need
>>> to handle the 'SDEI masked' case, but it is a lot less likely to happen. Linux only does
>>> this over power-management events that (may) disable the MMU.
>>>
>>>
>>> (EL2 doesn't have any of these problems as errors are almost always contained by stage2,
>>> and it has hardware features for injecting asynchronous exceptions, which cope with the
>>> masking and deferring)
>>>
>>>
>>> Thanks,
>>>
>>> James
>>>
>>>
>>> On 25/05/2021 10:08, Achin Gupta wrote:
>>>> Hi,
>>>>
>>>> The last time I checked injecting an SError from a higher to lower EL is a bad
>>>> idea since the latter could be running with SErrors masked.
>>>>
>>>> EL3 could check this before injecting but then there is no consistent contract
>>>> with the lower EL about reporting of these errors. SDEI does not suffer from the
>>>> same problem.
>>>>
>>>> +James who knows more from the OS/Hypervisor perspective.
>>>>
>>>> cheers,
>>>> Achin
>>>> --------------------------------------------------------------------------------
>>>> *From:* TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Soby Mathew
>>>> via TF-A <tf-a(a)lists.trustedfirmware.org>
>>>> *Sent:* 25 May 2021 09:59
>>>> *To:* Pali Rohár <pali(a)kernel.org>
>>>> *Cc:* kabel(a)kernel.org <kabel(a)kernel.org>; tf-a(a)lists.trustedfirmware.org
>>>> <tf-a(a)lists.trustedfirmware.org>
>>>> *Subject:* Re: [TF-A] Rethrow SError from EL3 to kernel on arm64
>>>> [+tf-a list]
>>>> Hi Pali,
>>>> There are 2 philosophies for handing SError in the system, kernel first and
>>>> firmware first. Assuming you want to stick with firmware first handling (i.e
>>>> scr_el3.ea is set to 1), then as you mentioned, there are 2 ways to notify the
>>>> kernel for delegating the error handling: SDEI and SError injection back to
>>>> kernel. Upstream TF-A only supports SDEI at the moment.
>>>>
>>>> For SError injection back to lower EL, you have to setup the hardware state via
>>>> software at higher EL in such a way that it appears that the fault was taken to
>>>> the exception vector at the lower exception level. The pseudocode function
>>>> AArch64.TakeException() in ARM ARM shows the behavior when the PE takes an
>>>> exception to an Exception level using AArch64 in Non-debug state. This behaviour
>>>> has to replicated and it involves the higher EL setting up the PSTATE registers
>>>> correctly and values in other registers for the lower EL (spsr, elr and fault
>>>> syndrome registers) and jumping to the right offset point to by the vbar_elx of
>>>> the lower EL. To the lower EL is appears as a SError has triggered at its
>>>> exception vector and it can proceed with the fault handling.
>>>>
>>>> Best Regards
>>>> Soby Mathew
>>>>
>>>>> -----Original Message-----
>>>>> From: Pali Rohár <pali(a)kernel.org>
>>>>> Sent: Monday, May 24, 2021 6:07 PM
>>>>> To: Soby Mathew <Soby.Mathew(a)arm.com>
>>>>> Subject: Rethrow SError from EL3 to kernel on arm64
>>>>>
>>>>> Hello Soby!
>>>>>
>>>>> I have found following discussion in Armada 3720 PCIe SError issue:
>>>>> https://review.trustedfirmware.org/c/TF-A/trusted-firmware-
>>>> <https://review.trustedfirmware.org/c/TF-A/trusted-firmware->
>>>>> a/+/1541/comment/ca882427_d142bde2/
>>>>>
>>>>> TF-A on Armada 3720 redirects all SErrors to EL3 and panic in TF-A handler.
>>>>> You wrote in that discussion:
>>>>>
>>>>> Ideally you need to signal the SError back to kernel from EL3 using
>>>>> SDEI or inject the SError to the lower EL and the kernel can decide to
>>>>> die or not.
>>>>>
>>>>> And I would like to ask you, could you help me with implementation of this
>>>>> SError rethrow functionality? Because I have absolutely no idea how to do it
>>>>> and catching all SErrors in EL3 is causing issues because some of them can be
>>>>> handled and recovered by kernel.
>>>> --
>>>> TF-A mailing list
>>>> TF-A(a)lists.trustedfirmware.org
>>>> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
>>>> <https://lists.trustedfirmware.org/mailman/listinfo/tf-a>
>>>>
>>>
>
Hi Andrew,
I have submitted the change as you have passed it through the ML as a base for the discussion.
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/11002
The issue is acknowledged, we had a brief discussion internally as to how best to refactor if need be.
It looks to us the main problem is that SPM-MM (pre-dating FF-A) has aged a bit and mixes standard and impdef func ids.
e.g. MM is an Arm standard and only defines two func ids (0x84000040, 0x84000041) so it may just be a matter of updating SPM_MM_FID_MAX_VALUE to 0x41 such that MM related services go through.
The other ids 0xX4000060, 61, 64, 65 are purely impdef for the SPM-MM to/from SP communication. Thus we may define SP_MM_FID_MIN_VALUE/SP_MM_FID_MAX_VALUE and a corresponding is_sp_mm_fid macro.
This would avoid the clash with TRNG IDs (0xX4000050, 51, 52, 53).
What do you reckon?
Btw out of curiosity how did you discover this? Do you have a setup enabling both SPM_MM and TRNG_SUPPORT option? Or maybe this is because of Trusty SPD reuse of spm_mm_smc_handler?
Regards,
Olivier.
________________________________________
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Andrew Scull via TF-A <tf-a(a)lists.trustedfirmware.org>
Sent: 04 August 2021 22:50
To: Manish Pandey2
Cc: tf-a(a)lists.trustedfirmware.org; Jimmy Brisson; Andre Przywara
Subject: Re: [TF-A] TRNG SMCs intercepted by SPM-MM
I'm seeing server errors when I try "Generate Password" or setting the ssh key so I'm not sure how to push and authenticate. I've sent the patch directly to you, Manish, so the formatting doesn't get messed up and I don't know how to make git-send-email add it to a thread nicely..
On Wed, 4 Aug 2021 at 05:51, Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>> wrote:
Hi Andrew,
Thanks for reporting the bug, "DEN0060A_ARM_MM_Interface_Specification.pdf" does not talk about range for SPM_MM but don't know how it's mentioned in the comments.
Will you be able to push a patch following instructions at https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.htm…
5. Contributor’s Guide — Trusted Firmware-A documentation<https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.htm…>
5. Contributor’s Guide¶ 5.1. Getting Started¶. Make sure you have a Github account and you are logged on both developer.trustedfirmware.org<http://developer.trustedfirmware.org> and review.trustedfirmware.org<http://review.trustedfirmware.org>. If you plan to contribute a major piece of work, it is usually a good idea to start a discussion around it on the mailing list.
trustedfirmware-a.readthedocs.io<http://trustedfirmware-a.readthedocs.io>
Repository: https://review.trustedfirmware.org/admin/repos/TF-A/trusted-firmware-a , you will be able to login to gerrit using github credentials.
TF-A/trusted-firmware-a · Gerrit Code Review<https://review.trustedfirmware.org/admin/repos/TF-A/trusted-firmware-a>
Gerrit Code Review
review.trustedfirmware.org<http://review.trustedfirmware.org>
If not, then could you please send me the patch file (it appears copying directly from email generates corrupt patch file)
Thanks
Manish
________________________________
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org<mailto:tf-a-bounces@lists.trustedfirmware.org>> on behalf of Andrew Scull via TF-A <tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org>>
Sent: 03 August 2021 22:32
To: tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org> <tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org>>
Cc: Andre Przywara <Andre.Przywara(a)arm.com<mailto:Andre.Przywara@arm.com>>; Jimmy Brisson <Jimmy.Brisson(a)arm.com<mailto:Jimmy.Brisson@arm.com>>
Subject: [TF-A] TRNG SMCs intercepted by SPM-MM
I've failed to figure out how to upload a CL so I'm resorting to this,
it's more of a bug report anyway. There seems to be a conflict in how
the standard SMCs are claimed with the TRNG SMCs claimed by SPM-MM
before TRNG would get a chance to handle them properly.
The patch below might fix the issue but I've not tested it or even
built against ToT.
----
The TRNG SMCs use 0x84000050 to 0x84000053 which is in the range that
SPM-MM claims for itself. Resolve this conflict by making SMC-MM much
more selective about the SMCs it claims for itself.
Signed-off-by: Andrew Scull <ascull(a)google.com<mailto:ascull@google.com>>
Change-Id: If86b0d6a22497d34315c61fe72645b642c6e35f3
---
include/services/spm_mm_svc.h | 12 ++----------
services/std_svc/spm_mm/spm_mm_main.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/services/spm_mm_svc.h b/include/services/spm_mm_svc.h
index 3148beb80..4247c95a1 100644
--- a/include/services/spm_mm_svc.h
+++ b/include/services/spm_mm_svc.h
@@ -38,17 +38,8 @@
#define SPM_MM_VERSION_COMPILED
SPM_MM_VERSION_FORM(SPM_MM_VERSION_MAJOR, \
SPM_MM_VERSION_MINOR)
-/* These macros are used to identify SPM-MM calls using the SMC function ID */
-#define SPM_MM_FID_MASK U(0xffff)
-#define SPM_MM_FID_MIN_VALUE U(0x40)
-#define SPM_MM_FID_MAX_VALUE U(0x7f)
-#define is_spm_mm_fid(_fid) \
- ((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) && \
- (((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE))
-
/*
* SMC IDs defined in [1] for accessing MM services from the Non-secure world.
- * These FIDs occupy the range 0x40 - 0x5f.
* [1] DEN0060A_ARM_MM_Interface_Specification.pdf
*/
#define MM_VERSION_AARCH32 U(0x84000040)
@@ -59,7 +50,6 @@
* SMC IDs defined for accessing services implemented by the Secure Partition
* Manager from the Secure Partition(s). These services enable a partition to
* handle delegated events and request privileged operations from the manager.
- * They occupy the range 0x60-0x7f.
*/
#define SPM_MM_VERSION_AARCH32 U(0x84000060)
#define MM_SP_EVENT_COMPLETE_AARCH64 U(0xC4000061)
@@ -94,6 +84,8 @@
int32_t spm_mm_setup(void);
+bool is_spm_mm_fid(uint32_t smc_fid);
+
uint64_t spm_mm_smc_handler(uint32_t smc_fid,
uint64_t x1,
uint64_t x2,
diff --git a/services/std_svc/spm_mm/spm_mm_main.c
b/services/std_svc/spm_mm/spm_mm_main.c
index 14c0038ba..07226b0fb 100644
--- a/services/std_svc/spm_mm/spm_mm_main.c
+++ b/services/std_svc/spm_mm/spm_mm_main.c
@@ -266,6 +266,18 @@ static uint64_t mm_communicate(uint32_t smc_fid,
uint64_t mm_cookie,
SMC_RET1(handle, rc);
}
+/* Predicate indicating that a function id is part of SPM-MM */
+bool is_spm_mm_fid(uint32_t smc_fid)
+{
+ return ((smc_fid == MM_VERSION_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH64) ||
+ (smc_fid == SPM_MM_VERSION_AARCH32) ||
+ (smc_fid == MM_SP_EVENT_COMPLETE_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64));
+}
+
/*******************************************************************************
* Secure Partition Manager SMC handler.
******************************************************************************/
--
2.32.0.554.ge1b32706d8-goog
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org<mailto:TF-A@lists.trustedfirmware.org>
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
Hi Andrew,
Thanks for reporting the bug, "DEN0060A_ARM_MM_Interface_Specification.pdf" does not talk about range for SPM_MM but don't know how it's mentioned in the comments.
Will you be able to push a patch following instructions at https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.htm…
5. Contributor’s Guide — Trusted Firmware-A documentation<https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.htm…>
5. Contributor’s Guide¶ 5.1. Getting Started¶. Make sure you have a Github account and you are logged on both developer.trustedfirmware.org and review.trustedfirmware.org. If you plan to contribute a major piece of work, it is usually a good idea to start a discussion around it on the mailing list.
trustedfirmware-a.readthedocs.io
Repository: https://review.trustedfirmware.org/admin/repos/TF-A/trusted-firmware-a , you will be able to login to gerrit using github credentials.
TF-A/trusted-firmware-a · Gerrit Code Review<https://review.trustedfirmware.org/admin/repos/TF-A/trusted-firmware-a>
Gerrit Code Review
review.trustedfirmware.org
If not, then could you please send me the patch file (it appears copying directly from email generates corrupt patch file)
Thanks
Manish
________________________________
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Andrew Scull via TF-A <tf-a(a)lists.trustedfirmware.org>
Sent: 03 August 2021 22:32
To: tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>
Cc: Andre Przywara <Andre.Przywara(a)arm.com>; Jimmy Brisson <Jimmy.Brisson(a)arm.com>
Subject: [TF-A] TRNG SMCs intercepted by SPM-MM
I've failed to figure out how to upload a CL so I'm resorting to this,
it's more of a bug report anyway. There seems to be a conflict in how
the standard SMCs are claimed with the TRNG SMCs claimed by SPM-MM
before TRNG would get a chance to handle them properly.
The patch below might fix the issue but I've not tested it or even
built against ToT.
----
The TRNG SMCs use 0x84000050 to 0x84000053 which is in the range that
SPM-MM claims for itself. Resolve this conflict by making SMC-MM much
more selective about the SMCs it claims for itself.
Signed-off-by: Andrew Scull <ascull(a)google.com>
Change-Id: If86b0d6a22497d34315c61fe72645b642c6e35f3
---
include/services/spm_mm_svc.h | 12 ++----------
services/std_svc/spm_mm/spm_mm_main.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/services/spm_mm_svc.h b/include/services/spm_mm_svc.h
index 3148beb80..4247c95a1 100644
--- a/include/services/spm_mm_svc.h
+++ b/include/services/spm_mm_svc.h
@@ -38,17 +38,8 @@
#define SPM_MM_VERSION_COMPILED
SPM_MM_VERSION_FORM(SPM_MM_VERSION_MAJOR, \
SPM_MM_VERSION_MINOR)
-/* These macros are used to identify SPM-MM calls using the SMC function ID */
-#define SPM_MM_FID_MASK U(0xffff)
-#define SPM_MM_FID_MIN_VALUE U(0x40)
-#define SPM_MM_FID_MAX_VALUE U(0x7f)
-#define is_spm_mm_fid(_fid) \
- ((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) && \
- (((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE))
-
/*
* SMC IDs defined in [1] for accessing MM services from the Non-secure world.
- * These FIDs occupy the range 0x40 - 0x5f.
* [1] DEN0060A_ARM_MM_Interface_Specification.pdf
*/
#define MM_VERSION_AARCH32 U(0x84000040)
@@ -59,7 +50,6 @@
* SMC IDs defined for accessing services implemented by the Secure Partition
* Manager from the Secure Partition(s). These services enable a partition to
* handle delegated events and request privileged operations from the manager.
- * They occupy the range 0x60-0x7f.
*/
#define SPM_MM_VERSION_AARCH32 U(0x84000060)
#define MM_SP_EVENT_COMPLETE_AARCH64 U(0xC4000061)
@@ -94,6 +84,8 @@
int32_t spm_mm_setup(void);
+bool is_spm_mm_fid(uint32_t smc_fid);
+
uint64_t spm_mm_smc_handler(uint32_t smc_fid,
uint64_t x1,
uint64_t x2,
diff --git a/services/std_svc/spm_mm/spm_mm_main.c
b/services/std_svc/spm_mm/spm_mm_main.c
index 14c0038ba..07226b0fb 100644
--- a/services/std_svc/spm_mm/spm_mm_main.c
+++ b/services/std_svc/spm_mm/spm_mm_main.c
@@ -266,6 +266,18 @@ static uint64_t mm_communicate(uint32_t smc_fid,
uint64_t mm_cookie,
SMC_RET1(handle, rc);
}
+/* Predicate indicating that a function id is part of SPM-MM */
+bool is_spm_mm_fid(uint32_t smc_fid)
+{
+ return ((smc_fid == MM_VERSION_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH64) ||
+ (smc_fid == SPM_MM_VERSION_AARCH32) ||
+ (smc_fid == MM_SP_EVENT_COMPLETE_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64));
+}
+
/*******************************************************************************
* Secure Partition Manager SMC handler.
******************************************************************************/
--
2.32.0.554.ge1b32706d8-goog
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
I've failed to figure out how to upload a CL so I'm resorting to this,
it's more of a bug report anyway. There seems to be a conflict in how
the standard SMCs are claimed with the TRNG SMCs claimed by SPM-MM
before TRNG would get a chance to handle them properly.
The patch below might fix the issue but I've not tested it or even
built against ToT.
----
The TRNG SMCs use 0x84000050 to 0x84000053 which is in the range that
SPM-MM claims for itself. Resolve this conflict by making SMC-MM much
more selective about the SMCs it claims for itself.
Signed-off-by: Andrew Scull <ascull(a)google.com>
Change-Id: If86b0d6a22497d34315c61fe72645b642c6e35f3
---
include/services/spm_mm_svc.h | 12 ++----------
services/std_svc/spm_mm/spm_mm_main.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/services/spm_mm_svc.h b/include/services/spm_mm_svc.h
index 3148beb80..4247c95a1 100644
--- a/include/services/spm_mm_svc.h
+++ b/include/services/spm_mm_svc.h
@@ -38,17 +38,8 @@
#define SPM_MM_VERSION_COMPILED
SPM_MM_VERSION_FORM(SPM_MM_VERSION_MAJOR, \
SPM_MM_VERSION_MINOR)
-/* These macros are used to identify SPM-MM calls using the SMC function ID */
-#define SPM_MM_FID_MASK U(0xffff)
-#define SPM_MM_FID_MIN_VALUE U(0x40)
-#define SPM_MM_FID_MAX_VALUE U(0x7f)
-#define is_spm_mm_fid(_fid) \
- ((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) && \
- (((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE))
-
/*
* SMC IDs defined in [1] for accessing MM services from the Non-secure world.
- * These FIDs occupy the range 0x40 - 0x5f.
* [1] DEN0060A_ARM_MM_Interface_Specification.pdf
*/
#define MM_VERSION_AARCH32 U(0x84000040)
@@ -59,7 +50,6 @@
* SMC IDs defined for accessing services implemented by the Secure Partition
* Manager from the Secure Partition(s). These services enable a partition to
* handle delegated events and request privileged operations from the manager.
- * They occupy the range 0x60-0x7f.
*/
#define SPM_MM_VERSION_AARCH32 U(0x84000060)
#define MM_SP_EVENT_COMPLETE_AARCH64 U(0xC4000061)
@@ -94,6 +84,8 @@
int32_t spm_mm_setup(void);
+bool is_spm_mm_fid(uint32_t smc_fid);
+
uint64_t spm_mm_smc_handler(uint32_t smc_fid,
uint64_t x1,
uint64_t x2,
diff --git a/services/std_svc/spm_mm/spm_mm_main.c
b/services/std_svc/spm_mm/spm_mm_main.c
index 14c0038ba..07226b0fb 100644
--- a/services/std_svc/spm_mm/spm_mm_main.c
+++ b/services/std_svc/spm_mm/spm_mm_main.c
@@ -266,6 +266,18 @@ static uint64_t mm_communicate(uint32_t smc_fid,
uint64_t mm_cookie,
SMC_RET1(handle, rc);
}
+/* Predicate indicating that a function id is part of SPM-MM */
+bool is_spm_mm_fid(uint32_t smc_fid)
+{
+ return ((smc_fid == MM_VERSION_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH32) ||
+ (smc_fid == MM_COMMUNICATE_AARCH64) ||
+ (smc_fid == SPM_MM_VERSION_AARCH32) ||
+ (smc_fid == MM_SP_EVENT_COMPLETE_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64) ||
+ (smc_fid == MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64));
+}
+
/*******************************************************************************
* Secure Partition Manager SMC handler.
******************************************************************************/
--
2.32.0.554.ge1b32706d8-goog