Skip to content

Commit

Permalink
Generalise the SME state management attributes (ARM-software#276)
Browse files Browse the repository at this point in the history
This patch replaces __arm_shared_za and __arm_new_za with more
general attributes.  The purpose is twofold:

* To allow the same approach to be taken for ZT0, and for any
  other similar state that is added in future.

* To allow the programmer to give the compiler more information
  about when state is live (if the programmer wants to).

__arm_shared_za is directly equivalent to __arm_inout("za").
Any code that is already using __arm_shared_za, or that prefers
that syntax for some reason, could just #define one to the other.
Similarly, __arm_new_za is directly equivalent to __arm_new("za").

The patch also removes __arm_preserves_za and replaces it with a more
restricted __arm_preserves attribute.  The old  __arm_preserves_za
could be attached to both private-ZA and shared-ZA functions.
However, the private-ZA version had somewhat dubious semantics:

* It made a promise about how ZA would be handled by a C/C++ function
  that doesn't use ZA directly.  It wasn't obvious how the burden of
  keeping that promise was distributed between the programmer and
  the compiler.  (The feature was always intended to be low-level.)

* The semantics for private-ZA functions meant that callers would
  still need to prepare a lazy save buffer.  __arm_preserves_za just
  meant that they could avoid having to restore from it afterwards.

I'm hoping to replace the private-ZA form of __arm_preserves_za
with an alternative, optional, extension that avoids the need for the
lazy save buffer, and that would be handled entirely by the compiler.

In contrast, __arm_preserves("za") makes a function shared-ZA.

Co-authored-by: Sander de Smalen <[email protected]>
  • Loading branch information
2 people authored and hassnaaHamdi committed Mar 11, 2024
1 parent e619f29 commit 7f52adc
Showing 1 changed file with 633 additions and 446 deletions.
Loading

0 comments on commit 7f52adc

Please sign in to comment.