diff mbox series

[2/2] arm: add nocrypto TUNE_FEATURE to complement crypto

Message ID 20250812222142.1761197-2-jon.mason@arm.com
State Under Review
Headers show
Series [1/2] Revert "feature-arm-crypto: Add +nocrypto to -mcpu when crypto not in features" | expand

Commit Message

Jon Mason Aug. 12, 2025, 10:21 p.m. UTC
Add a `nocrypto` TUNE_FEATURE option to `feature-arm-crypto.inc`
to explicitly disable ARM crypto extensions via GCC flags. This
provides an opposing state to the existing `crypto` feature,
enabling more explicit control over crypto-related tuning.

Some vendors ship cores without crypto support, and this change
allows disabling it without requiring extensive audits of
dependent code paths. This approach avoids the knock-on effects
caused when `nocrypto` is applied implicitly in the absence of
`crypto` in TUNE_FEATURES.

TUNECONFLICTS was added to prevent both features from being
enabled simultaneously. When both are added, the following error
is seen during build:

  Feature 'nocrypto' conflicts with 'crypto'.
  Feature 'crypto' conflicts with 'nocrypto'.

Signed-off-by: Jon Mason <jon.mason@arm.com>
Cc: Ryan Eatmon <reatmon@ti.com>
Cc: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/machine/include/arm/feature-arm-crypto.inc | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Khem Raj Aug. 12, 2025, 10:40 p.m. UTC | #1
On Tue, Aug 12, 2025 at 3:21 PM Jon Mason <jdmason@kudzu.us> wrote:
>
> Add a `nocrypto` TUNE_FEATURE option to `feature-arm-crypto.inc`
> to explicitly disable ARM crypto extensions via GCC flags. This
> provides an opposing state to the existing `crypto` feature,
> enabling more explicit control over crypto-related tuning.
>
> Some vendors ship cores without crypto support, and this change
> allows disabling it without requiring extensive audits of
> dependent code paths. This approach avoids the knock-on effects
> caused when `nocrypto` is applied implicitly in the absence of
> `crypto` in TUNE_FEATURES.
>
> TUNECONFLICTS was added to prevent both features from being
> enabled simultaneously. When both are added, the following error
> is seen during build:
>
>   Feature 'nocrypto' conflicts with 'crypto'.
>   Feature 'crypto' conflicts with 'nocrypto'.
>

This looks fine to me. We need to add additional tunes in the
cortexa72 tune file to have a tune using it.

> Signed-off-by: Jon Mason <jon.mason@arm.com>
> Cc: Ryan Eatmon <reatmon@ti.com>
> Cc: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/conf/machine/include/arm/feature-arm-crypto.inc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/meta/conf/machine/include/arm/feature-arm-crypto.inc b/meta/conf/machine/include/arm/feature-arm-crypto.inc
> index aade6ce08d5e..c1f5b1225dfd 100644
> --- a/meta/conf/machine/include/arm/feature-arm-crypto.inc
> +++ b/meta/conf/machine/include/arm/feature-arm-crypto.inc
> @@ -3,3 +3,8 @@
>
>  TUNEVALID[crypto] = "Enable cryptographic instructions for ARMv8"
>  TUNE_CCARGS_MARCH_OPTS .= "${@bb.utils.contains('TUNE_FEATURES', 'crypto', '+crypto', '', d)}"
> +TUNECONFLICTS[crypto] = "nocrypto"
> +
> +TUNEVALID[nocrypto] = "Disable cryptographic instructions for ARMv8"
> +TUNE_CCARGS_MARCH_OPTS .= "${@bb.utils.contains('TUNE_FEATURES', 'nocrypto', '+nocrypto', '', d)}"
> +TUNECONFLICTS[nocrypto] = "crypto"
> --
> 2.39.5
>
diff mbox series

Patch

diff --git a/meta/conf/machine/include/arm/feature-arm-crypto.inc b/meta/conf/machine/include/arm/feature-arm-crypto.inc
index aade6ce08d5e..c1f5b1225dfd 100644
--- a/meta/conf/machine/include/arm/feature-arm-crypto.inc
+++ b/meta/conf/machine/include/arm/feature-arm-crypto.inc
@@ -3,3 +3,8 @@ 
 
 TUNEVALID[crypto] = "Enable cryptographic instructions for ARMv8"
 TUNE_CCARGS_MARCH_OPTS .= "${@bb.utils.contains('TUNE_FEATURES', 'crypto', '+crypto', '', d)}"
+TUNECONFLICTS[crypto] = "nocrypto"
+
+TUNEVALID[nocrypto] = "Disable cryptographic instructions for ARMv8"
+TUNE_CCARGS_MARCH_OPTS .= "${@bb.utils.contains('TUNE_FEATURES', 'nocrypto', '+nocrypto', '', d)}"
+TUNECONFLICTS[nocrypto] = "crypto"