public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] 18 register support for SMC/SVC on AARCH64
@ 2025-03-06  6:13 Kun Qin via groups.io
  2025-03-06  9:42 ` Leif Lindholm via groups.io
  0 siblings, 1 reply; 9+ messages in thread
From: Kun Qin via groups.io @ 2025-03-06  6:13 UTC (permalink / raw)
  To: edk2-devel-groups-io
  Cc: Leif Lindholm, Sami Mujawar, Ard Biesheuvel, olivier.deprez

[-- Attachment #1: Type: text/plain, Size: 2463 bytes --]

Hi ARM enthusiasts,

I recently filed a PR to allow 18 register support for SMC/SVC calls
between UEFI and secure partition components:
https://github.com/tianocore/edk2/pull/10685/files.


The main purpose of this change is to allow more registers to hold values
while doing FF-A transactions. In FF-A spec v1.2 and onward, the section
"FFA_*MSG_*SEND_*DIRECT_*REQ2" mentions that up to 18 general-purpose
registers can be used for such calls. However, the current SMC/SVC
implementation in EDK2 only supports up to 8 registers.

There were some differing opinions on how to support this more properly.
Could you please review the PR and chime in on the email thread about how
to proceed with it?


*TL;DR:*
In conversations with ARM stakeholders, they revealed concerns about using
18 registers all along because some older firmware components on the secure
side do not support full 18 register usage, and the returned values may not
be sane. Therefore, there is a need for a build flag that controls how many
registers are used during SMC calls to be backwards compatible, which is
the PcdSxcUse18Registers approach I went with in the PR.

The original approach of using the PCD was to make it a feature flag so
that all header files, assembly files, and C files will not even compile
the code that supports more than 8 registers if not needed. But that would
involve the PCDs getting pre-processed by the build framework, and all
components using the ArmSmcLib would thus have to add the PCD in their inf
files. So instead, we went with the runtime code evaluation.

On the PR, Sami suggested creating a new interface that supports SMC with
18 registers and making the PCD control which function to call. For FF-A
functions that only involve 8 registers or under, the caller should just
use the legacy interfaces. But the issue is, once Standalone MM hands off
the control using an 8 register SMC call, it will only be able to process 8
register incoming requests, which will not work if it is woken up by an
FFA_*MSG_*SEND_*DIRECT_*REQ2 call using 18 registers.

Any input is appreciated.

Regards,
Kun


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121153): https://edk2.groups.io/g/devel/message/121153
Mute This Topic: https://groups.io/mt/111543575/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 3191 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-12  6:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06  6:13 [edk2-devel] 18 register support for SMC/SVC on AARCH64 Kun Qin via groups.io
2025-03-06  9:42 ` Leif Lindholm via groups.io
2025-03-06 20:42   ` Kun Qin via groups.io
2025-03-06 22:57     ` Leif Lindholm via groups.io
2025-03-07 14:19       ` Sami Mujawar via groups.io
2025-03-10 12:23         ` Leif Lindholm via groups.io
2025-03-10 17:13           ` Kun Qin via groups.io
2025-03-10 18:25             ` Sami Mujawar via groups.io
2025-03-12  6:32               ` Kun Qin via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox