public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kun Qin via groups.io" <kuqin12=gmail.com@groups.io>
To: edk2-devel-groups-io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	olivier.deprez@arm.com
Subject: [edk2-devel] 18 register support for SMC/SVC on AARCH64
Date: Wed, 5 Mar 2025 22:13:13 -0800	[thread overview]
Message-ID: <CABhrWrQcTi_4hSVwDgXi8ti1eC3XJ1qkXzR-vQUdGv9WxoUNWQ@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2025-03-06  6:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  6:13 Kun Qin via groups.io [this message]
2025-03-06  9:42 ` [edk2-devel] 18 register support for SMC/SVC on AARCH64 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABhrWrQcTi_4hSVwDgXi8ti1eC3XJ1qkXzR-vQUdGv9WxoUNWQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox