This event has been changed.
Title: TF-A Tech Forum
Topic: Feature Detection MechanismPresented by : Jayanth
ChidanandAgenda:Feature detection mechanism is a diagnostic tool to quickly
check and get assured of whether the architectural features enabled by
software match with the given hardware implementation at an early stage of
booting. It aims at mitigating the runtime-exceptions.I will be covering
the implementation work completed so far and the impact ofReferences:TF-A
Mailing List
PostPatchesDocumentation=================================================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 (changed)
When: Thu Apr 21, 2022 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
Event details:
https://calendar.google.com/calendar/event?action=VIEW&eid=NWlub3Ewdm1tMmk1…
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've started to experiment with MTE in OP-TEE at S-EL1. I've compiled
TF-A with CTX_INCLUDE_MTE_REGS and I'm testing this on QEMU. Before
trying to use MTE in OP-TEE I check id_aa64pfr1_el1 and skip MTE
initializations if unavailable.
This works as long as TF-A always is compiled with
CTX_INCLUDE_MTE_REGS if MTE is available. If TF-A is compiled without
CTX_INCLUDE_MTE_REGS OP-TEE will be trapped into EL3 when trying to
access one of the MTE registers. I suppose this is because SCR_EL3.ATA
is 0. Is there a way for OP-TEE to tell if the MTE registers are safe
to access?
Thanks,
Jens
Hi,
I'm working on a hobby project: AARCH64 Hypervisor on Raspberry Pi 4b. I
have a problem with trapping a psci smc. I'll explain everything and what
steps I have followed.
Right now, I'm implementing SMC trapping. I can successfully forward almost
all SMCs except for PSCI_CPU_ON_AARCH64. Linux makes these SMCs to bring
up secondary CPUs during booting. Here's what I'm trying to do:
- trap the PSCI_CPU_ON_AARCH64 SMC,
- preserve the entry_point address in global variable
- replace the entrypoint with my entrypoint and make the smc to tf-a(or
simply forward it.)
- when secondary cpus come online at the given address, where I set
their stack point and then eret the original address.
Secondary cpus won't come online at the given address. Even if I don't
change any arguments of CPU_ON smc and forward it as it is, the secondary
cpus still won't come online. However, without trapping
enabled(HCR_EL2.TSC=0), everything works fine.
I tried to debug inside Trusted Firmware. I know that overall path for
secondary CPU hotplug in is:
CPU released from reset -> (ROM and possibly some other bootloader) ->
bl31/aarch64/bl31_entrypoint.S:bl31_warm_entrypoint() ->
lib/psci/psci_common.c:psci_warmboot_entrypoint() ->
lib/psci/psci_on.c:psci_cpu_on_finish() -> rpi3_pwr_domain_on_finish()
I printed at all these points in Trusted Firmware with and without trapping
enabled. Here's what I found: Nothing gets printed anywhere in that path if
trapping is enabled. However, without trapping enabled, I can print
anywhere even in bl31_entrypoint.S:bl31_warm_entrypoint(). What could be
the problem?
Here's my code:
https://github.com/SikkiLadho/Leo/blob/4f272eff39934058a7f989c91aad82eab810…
--
Mushahid Hussain
Hello,
Are there any immediate plans to add support for Cortex-X1 in TF-A? If
not then I'll be happy to submit CL for it. For start, it will cover a
subset of errata workarounds. Then people can add more as needed. Let
me know what you think.
Thanks,
Okash
This event has been changed with this note:
"Agenda for this week:
Session this week will be:
CCA Attestation and Measured boot
Presented by Tamas Ban
As a follow up to TF-A mailing list posting
https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.…"
Title: TF-A Tech Forum
Session this week will be:CCA Attestation and Measured bootPresented by
Tamas BanAs a follow up to TF-A mailing list posting
https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.…
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 (changed)
When: Thu Apr 7, 2022 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
Event details:
https://calendar.google.com/calendar/event?action=VIEW&eid=NWlub3Ewdm1tMmk1…
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
Hello All,
We are sending this note, to notify you of all the implementation details related to the Architectural Features Detection Mechanism.
Summary:
This is a diagnostic tool, which is targeted to mitigate the runtime exceptions due to incorrect feature enablement. This is currently marked as experimental and disabled by default, but our target is to make it mandatory over the time.
All the platform owners are expected to read the details(and review the patch) and give it a try by enabling this mechanism and share your thoughts/feedback or any questions to @Jayanth Dodderi Chidanand<mailto:JAYANTHDODDERI.CHIDANAND@arm.com> or me.
Patches under Review: https://review.trustedfirmware.org/q/topic:jc/detect_feat
Details:
1. What is Feature Detection Mechanism?
* Feature Detection is a procedure/mechanism aimed at identifying the features which are enabled ( by software) and not detected/supported in the hardware.
* It could be considered as a diagnostic tool to quickly check and get assured which features are not supported by the hardware at an early stage of booting.
2. Why do we need it?
Currently, most of the feature-specific register's context management, save and restore routines are conditionally controlled with the ARM_ARCH_AT_LEAST macro, which is primarily causing exceptions under various scenarios like:
* For a given version of the architecture, the optional and mandatory features control the access to various registers. If the given version of implementation does not support both, unconditional access to such registers leads to undefined behaviour.
* Accessing registers without verifying their actual presence for the given implementation.
In general, the problem is broader than just this specific case. We should not rely on ARM_ARCH_AT_LEAST macro to associate with an architecture extension but rather supply the individual ENABLE_FEAT_xxx option for each feature.
Again, having individual build flags, won't resolve this completely. There is still room for error as users may unknowingly enable the flags. So, the build flags still need to be validated before performing any action guarded by them.
This mechanism helps in resolving this issue completely. It assists in detecting the features which are not present in the platform but are enabled by software unknowingly. It prevents the runtime exception, due to the consequences already mentioned.
3. How have we designed and implemented it?
We are introducing a tri-state approach for each feature build flag. From now on, the build flags take three values/states ( 0,1 or 2), and they imply as follows:
The 3 states are:
* ENABLE_FEAT_xxx = 0: The feature is disabled statically at compile time.
* ENABLE_FEAT_xxx = 1: The feature is enabled and must be present in hardware. There will be hard panic if the feature is not present at cold boot.
* ENABLE_FEAT_xxx = 2: The feature is enabled and detected at runtime
Based on the value defined for each feature flag, they get detected either at boot-time or at runtime, respectively.
For simplicity, let's take FEAT_HCX which is available in arch version 8.7. We provide a build option for enabling this feature, say "ENABLE_FEAT_HCX".
* ENABLE_FEAT_HCX=0; The feature is disabled statically at compile time.
* ENABLE_FEAT_HCX=1; The feature is enabled and must be present in hardware. There will be hard panic if the feature is not present at cold boot. i.e., we detect, whether the HCX feature is present in the PE, by reading its ID register and if not, panic will be called. Thereby at an early boot phase, we stop and report that FEAT_HCX is not supported by PE.
* ENABLE_FEAT_HCX=2; The feature is enabled but dynamically enabled at runtime depending on hardware capability. Here, a feature detection check will happen during runtime.
4. What is the status of this implementation? Is it completely implemented and tested?
We have divided the entire implementation into two phases. In phase-1 FEAT_STATES { 0, 1} are handled and FEAT_STATE{2} will be handled ahead. Currently, we are in phase-1 delivery, wherein we are introducing a procedure, which will read through all the enabled feature build flags, and if they are defined to state1, ENABLE_FEAT_XXX=1 the respective feature will be detected.
5. Which all features are considered here?
TF-A supports most arm architectural features from v8.0 and upwards. Some are mandatory and some are optional features as per the Arm ARM docs. So, both ( Mandatory and optional features from v8.0) are detected under this mechanism.
6. Does this mechanism modify or impact any existing implementation related to any of the architectural features supported in TF-A?
* Yes.
* Ideally, TF-A enables the architectural features which are mandatory by default from a particular arch version and upwards ( as per Arm-ARM docs ) and disables the optional features by default and allows the platforms to make the decision on enabling the optional feature based on their requirements.
* This pattern is followed for most of the features. However, there are some cases wherein optional features are enabled by default within TF-A ( Eg; FEAT_SPE, FEAT_SVE ), which shouldn't have been handled this way.
* With the feature detection mechanism in place, as stated earlier the procedure runs through all the enabled features(optional and mandatory) and identifies them.
* Now, FEAT_SPE and FEAT_SVE are optional features, which are enabled by default and when detected will not be identified by the PE, if it doesn't support it and panics during booting.
* So, since we have enabled these optional features within the TF-A build system, it would panic and stop booting.
* If we upstream this mechanism, all the partner's platforms will be impacted involuntarily.
This problem will not be seen in other cases like:
* Mandatory Feature: Let's say FEAT_FGT which is mandatory from the 8.6 version. So, if a platform is based on v8.6 it will implement this, and this feature will be detected. So no issue here. If the platform is based on v8.5, this FEAT_FGT is not enabled by the TF-A. It gets enabled from 8.6. So here, in this case, the feature is disabled so nothing to worry about.
* Optional Feature: Let's say FEAT_NV2 which is an optional feature from arch version 8.4. is supported by TF-A. Since it is an optional one as per Arm ARM, TF-A implements and disables it by default and allows the platforms to decide and enable them as per their requirements. So here, if the platform enables it, it implies they are sure this feature is implemented. If not, this mechanism will help them by detecting it, so that they disable it in future. In general, this would not break the boot flow in all scenarios.
But if the optional feature is enabled by TF-A itself, will stop the boot flow in most of scenarios.
So, to avoid breaking change, we have decided to overlook such optional features for now and update our partners and get their feedback. Based on that, in future, we will disable these optional features which were enabled by default and will send another email to enable it explicitly according to their requirements.
7. What should the platforms be aware of, with the upstreaming of this mechanism?
* Currently, we are introducing this entire implementation as an experimental mechanism, wherein we provide an explicit build flag (FEATURE_DETECTION) to enable the feature detection mechanism itself. We urge the platforms to enable this mechanism, test it and get used to its behaviour before it gets mandated.
* So, for now, it wouldn't cause any issue. But our plan is to make sure this mechanism runs by default, as we want to mitigate the runtime Exceptions. As part of the 2.7 release, we are targeting to upstream this implementation and later, have some time window, wherein our partners get used to it and provide feedback as well.
8. Will there be any breakdown during runtime, with respect to any of the platforms?
Yes. It's explained in detail above.
9. What is the long-term plan with this mechanism? When will this be completely implemented and tested end to end?
We target it to be implemented full-fledged by EoY 2022, but it depends on the feedback received from our partners and get this done.
Thanks
Hi,
It seems like setting ENABLE_PIE=1 and compiling with clang/LLVM
results in linker errors. E.g. compiling ti/k3 which has ENABLE_PIE=1,
with clang and lld version 14.0.1 results in linker errors like
"ld.lld: error: can't create dynamic relocation R_AARCH64_ABS64
against local symbol in readonly segment; recompile object files with
-fPIC or pass '-Wl,-z,notext' to allow text relocations in the
output".
Is this expected? If not, are there any plans to fix this?
Thanks,
Okash
Hi,
In Arm CCA the Security Model strongly recommends implementing the CCA HES functionality to ensure the system security properties. A way to achieve this is to add a trusted subsystem to the system, which behaves like a secure enclave. In ARM reference design this trusted subsystem is called to Runtime Security Subsystem (RSS). RSS can execute a firmware component that implements the functional requirements of the HES. But its firmware is not restricted to be only the HES, other tenants are also allowed. The goal of the CCA HES is to provide fundamental services to the AP to ensure its security properties. These fundamental services include secure boot, measured boot and attestation, etc. You can find more information about the role of CCA HES and about its functional requirements in the Arm CCA Security Model [1]. In ARM reference design the CCA HES is going to be executed by RSS. CCA HES is based on TF-M.
In this patch series [2] the AP side support of the CCA HES functionalities is going to be introduced:
- Communication over an MHU channel between the AP and RSS.
- Communication abstracted by the PSA API. So, AP can leverage standard PSA calls to invoke these services on the RSS.
- CCA HES provides a measured boot backend. Measurements are taken during AP boot can be stored by RSS and retrieved as part of the CCA Platform Attestation token.
- CCA Platform Attestation token can be requested from RSS.
Currently, there is no publicly available FVP platform to test these patches, but it will be available later this year. Some limited testing is available on the AEM FVP. Here the RSS based measured boot backend is enabled and mocked version of the measured boot and attestation APIs are available. Due to the lack of RSS in the FVP, the APIs do not communicate to RSS, instead just print the measurements to the console and return to a hard-coded attestation token.
[1] https://developer.arm.com/documentation/DEN0096/latest
[2] https://review.trustedfirmware.org/q/topic:%2522rss/mboot-attest%2522
Best regards,
Tamas Ban