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,
Can you try below steps, try with fresh pull?
1. Login with your github account on https://review.trustedfirmware.org/admin/repos/TF-A%2Ftrusted-firmware-a
2.
git clone "ssh://<user>@review.trustedfirmware.org:29418/TF-A/trusted-firmware-a
3. git push <remote-name> HEAD:refs/for/integration
4. While pushing if it complains about git hooks, run scp -p -P 29418 <user>@review.trustedfirmware.org:hooks/commit-msg "trusted-firmware-a/.git/hooks/" and amend your commit (it will give you this hint)
________________________________
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Nicolas Boulenguez via TF-A <tf-a(a)lists.trustedfirmware.org>
Sent: 03 April 2021 13:02
To: raghu.ncstate(a)icloud.com <raghu.ncstate(a)icloud.com>
Cc: tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>; 'Benjamin Copeland' <ben.copeland(a)linaro.org>
Subject: Re: [TF-A] please fix incomplete distclean Makefile target
raghu.ncstate(a)icloud.com:
> Are you pushing ssh://<username>@review.trustedfirmware.org:29418/TF-A/trusted-firmware-a HEAD:refs/for/integration?
> Note that 29418 port. That tripped me up initially. It is not clear from your earlier emails where you cloned from(review.trustedfirmware.org or git.trustedfirmware.org).
[α] links to [β] which recommends
# git clone "https://review.trustedfirmware.org/TF-A/trusted-firmware-a"
I had an existing repository (most contributors probably do) and used
'git add remote' and 'git fetch' instead.
[α] recommends
# git push <remote-name> HEAD:refs/for/integration%<topic-branch>
As expected, the host requires a password.
# git push ssh://<user>@review.trustedfirmware.org:29418/TF-A/trusted-firmware-a HEAD:refs/for/integration?
-> fatal: invalid refspec 'HEAD:refs/for/integration?'
Anyhow, the host would require an SSH key.
[α] https://developer.trustedfirmware.org/w/tf_a/gerrit-getting-started/
[β] https://review.trustedfirmware.org/admin/repos/TF-A%2Ftrusted-firmware-a
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
Hi All,
We are using the snprintf() (which uses vsnprintf() and unsigned_num_print()) from libc of ATF version 2.4and running into an issue for printing a number into a string where even if I provide large enough string to hold the number, it does not print it. I don't see that issue with it when I try to print a string using the same snprintf().I understand that, as per the documentation use of snprintf is "banned or discouraged". But for the use case,that we are using for, it is safe enough to use it assuming that it does it what it is supposed to do.
I am not sure if this is a known bug or what, but upon a further inspection, I found that there seems be a small bugin the unsigned_num_print() for one of the 'if' condition given below which is causing the issue in terms of calculatingthe available space in the string.
if (*chars_printed < n) {
.... do the prinring....}
I believe it is supposed to be
if (*chars_printed <= n) { ----------------->> Notice '<=' instead of '<' }
Any comment on whether this is on purpose or really a small bug?
The calling routine (vsnprintf) is already reducing 'n' by 1 for the terminating null character.
Thank you very much for your support.-hiren
On 4/19/21 11:11 AM, Jan Kiszka via TF-A wrote:
> On 19.04.21 17:21, Michal Simek wrote:
>> On 4/18/21 8:44 PM, Jan Kiszka wrote:
>>> when SPD or DEBUG is enabled, TF-A is moved to RAM on the zynqmp (as it
>>> longer fits into OCM). U-Boot happens to avoid that region, but the
>>> kernel's DTB has no reservation entry, and Linux will trigger an
>>> exception when accessing that region during early boot.
>>>
>>> Can we improve this - without requiring the user to manually add a
>>> reservation to the DTB? Should we unconditionally reserve
>>> 0x1000..0x7ffff in all BL33 DTBs? Or is there a chance to communicate
>>> that need? Or some way to detect in BL33 whether it is needed?
>>
>> Normally this ddr region should be also protected by security IPs that
>> NS has no access there.
>> It means in Xilinx flow this can be (and should be) propagated via
>> device-tree generator to final DTS file that you don't need to touch it
>> by hand.
>> I am not aware about any way that NS can query secure world what memory
>> can be used. And not sure if there is any standard way to do so.
>>
>
> OK, understood. But then, to be safe, shouldn't the upstream "static"
> default DT contain an exclusion of that region so that it won't get
> stuck if it is in use? Would block half a meg, but when you have a
> custom platform that does not need that, you can and will provide your
> own DT anyway.
Ideally, the static DTS is a description of the hardware only, and not
of runtime constraints imposed by the firmware. If BL31 needs to reserve
some memory, it can add that reservation to the DTB at runtime. The
fdt_add_reserved_memory() function is available for this purpose. For an
example, see the code used by the rpi4[0] or sun50i_h616[1] platforms.
If you later load a DTB from disk for use by Linux, you will need to
copy the reserved-memory nodes from the U-Boot DTB to the loaded DTB.
Regards,
Samuel
[0]:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/rpi/r…
[1]:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/allwi…
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-
> 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
[+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-
> 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.
Thanks, Gary, and to everybody who contributed to this release!
I’d like to quickly remind everybody that, as part of the v2.5 release, the Trusted Firmware-A project formally adopted the Conventional Commits v1.0.0<https://www.conventionalcommits.org/en/v1.0.0/> specification to enable us to radically reduce our time-to-release in the future. Thank you to everybody who took part in the discussions that allowed us to integrate this, and to those whose concerns I hope we have by now satisfied.
As part of this effort, we have introduced a commit verification check to the existing Gerrit-triggered CI job. Where before this applied only to Arm employees, this now includes everybody (even you, reader of this email). This will no doubt require some initial mental reorientation as it did for our Arm-based guinea pigs, but I hope that this it will become a non-issue in short time.
To aid in the transition, we are also now packaging additional tooling, namely Commitizen<https://commitizen-tools.github.io/commitizen/> and commitlint<https://commitlint.js.org/#/>, to make writing conformant commits easier, the installation instructions for which have been integrated into the v2.5 prerequisites page<https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/prerequi…>. These tools are optional, but highly recommended if you do find your commits being rejected by the CI.
Please note that patches currently awaiting review on Gerrit will need to adhere to this specification before merging (this should only take a minute).
If you missed previous communications or are unfamiliar with Conventional Commits, here is a brief summary of the format that commit messages are now expected to take:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Where the <type> is one of:
* feat: A new feature
* fix: A bug fix
* docs: Documentation only changes
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* refactor: A code change that neither fixes a bug nor adds a feature
* perf: A code change that improves performance
* test: Adding missing tests or correcting existing tests
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* chore: Other changes that don't modify src or test files
* revert: Reverts a previous commit
And the [optional scope] consists of an optional parentheses-wrapped scope of your choosing, similarly to how many contributors prefixed their commits previously.
A real-world example:
docs(prerequisites): add `--no-save` to `npm install`
To avoid the mistake fixed by the previous commit, ensure users install
the Node.js dependencies without polluting the lock file by passing
`--no-save` to the `npm install` line.
Change-Id: I10b5cc17b9001fc2e26deee02bf99ce033a949c1
Signed-off-by: Chris Kay <chris.kay(a)arm.com>
If you have the time, please do read up on the specification for additional details – I promise it’s short.
So long, and happy committing. 😊
Regards,
Chris
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Gary Morrison via TF-A <tf-a(a)lists.trustedfirmware.org>
Date: Thursday, 20 May 2021 at 15:59
To: tf-a(a)lists.trustedfirmware.org <tf-a(a)lists.trustedfirmware.org>
Subject: [TF-A] Trusted Firmware version 2.5 is now available
Trusted Firmware version 2.5 is now available and can be found here:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tag/?h=v2.5https://git.trustedfirmware.org/TF-A/tf-a-tests.git/tag/?h=v2.5https://git.trustedfirmware.org/hafnium/hafnium.git/tag/?h=v2.5https://git.trustedfirmware.org/ci/tf-a-ci-scripts.git/tag/?h=v2.5
Please refer to the read-the-docs and change log for further information.
Regards,
Gary Morrison -- Arm
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
Hello Heiko,
Thanks for your patch!
TF-A project uses Gerrit as the review system for patches, would you
mind posting your patch there instead? More details about the patch
submission process can be found here:
https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.html
Regarding the patch itself, I agree with you that this feature would be
useful to other platforms as well. I wonder whether we need a new build
option for this, though. We already got LOG_LEVEL, which if set to 0,
will effectively silent any console output. However, it will still embed
the console driver code within the firmware, if I am not mistaken. So
perhaps we should change that, and make LOG_LEVEL=0 compile the console
driver code out, in addition to what it already does today.
How does that sound to you?
Regards,
Sandrine
On 5/18/21 4:01 PM, Heiko Schocher via TF-A wrote:
> when bootloaders and kernels console output is disabled,
> (called silent boot) no output on console is recommended.
>
> Add commandline option IMX_BOOT_SILENT to disable
> console registration at all.
>
> Default value is 0, so patch does not change current
> functionality.
>
> Signed-off-by: Heiko Schocher <hs(a)denx.de>
> ---
> I just added this to imx8mp, but may this option is
> useful on other platforms too?
>
> plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c | 4 ++++
> plat/imx/imx8m/imx8mp/platform.mk | 3 +++
> 2 files changed, 7 insertions(+)
>
> diff --git a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
> index 22fbd5e4b..d75143270 100644
> --- a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
> +++ b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
> @@ -95,7 +95,9 @@ static void bl31_tzc380_setup(void)
> void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
> u_register_t arg2, u_register_t arg3)
> {
> +#if (IMX_BOOT_SILENT == 0)
> static console_t console;
> +#endif
> unsigned int i;
>
> /* Enable CSU NS access permission */
> @@ -109,10 +111,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
>
> imx8m_caam_init();
>
> +#if (IMX_BOOT_SILENT == 0)
> console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
> IMX_CONSOLE_BAUDRATE, &console);
> /* This console is only used for boot stage */
> console_set_scope(&console, CONSOLE_FLAG_BOOT);
> +#endif
>
> /*
> * tell BL3-1 where the non-secure software image is located
> diff --git a/plat/imx/imx8m/imx8mp/platform.mk b/plat/imx/imx8m/imx8mp/platform.mk
> index 1d11e3df4..471c96e70 100644
> --- a/plat/imx/imx8m/imx8mp/platform.mk
> +++ b/plat/imx/imx8m/imx8mp/platform.mk
> @@ -54,3 +54,6 @@ $(eval $(call add_define,BL32_SIZE))
>
> IMX_BOOT_UART_BASE ?= 0x30890000
> $(eval $(call add_define,IMX_BOOT_UART_BASE))
> +
> +IMX_BOOT_SILENT ?= 0
> +$(eval $(call add_define,IMX_BOOT_SILENT))
>