The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=288ba78edcfd82b4b558a46fae78e4076acbe200

commit 288ba78edcfd82b4b558a46fae78e4076acbe200
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2025-06-24 16:47:28 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2025-06-24 17:45:42 +0000

    dev/psci: Check for functions before calling
    
    In the SMCCC TRNG and Errata ABI drivers check if the version
    functions are implemented before calling them. Without this the firmware
    may complain about an unimplemented function being called.
    
    Reported by:    bz
    Reviewed by:    bz
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D50978
---
 sys/dev/psci/smccc_errata.c | 3 ++-
 sys/dev/psci/smccc_trng.c   | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/dev/psci/smccc_errata.c b/sys/dev/psci/smccc_errata.c
index 92f39c72c7f0..ebfc0f8b67ee 100644
--- a/sys/dev/psci/smccc_errata.c
+++ b/sys/dev/psci/smccc_errata.c
@@ -70,7 +70,8 @@ errata_identify(driver_t *driver, device_t parent)
 {
        int32_t version;
 
-       if (smccc_get_version() < SMCCC_MAKE_VERSION(1, 1))
+       /* Check if Errata ABI is supported */
+       if (smccc_arch_features(EM_VERSION) != SMCCC_RET_SUCCESS)
                return;
 
        /* Check we have Errata 1.0 or later */
diff --git a/sys/dev/psci/smccc_trng.c b/sys/dev/psci/smccc_trng.c
index 5f54d8adc24a..bf8c95a81c83 100644
--- a/sys/dev/psci/smccc_trng.c
+++ b/sys/dev/psci/smccc_trng.c
@@ -69,8 +69,8 @@ trng_identify(driver_t *driver, device_t parent)
 {
        int32_t version;
 
-       /* TRNG depends on SMCCC 1.1 (per the spec) */
-       if (smccc_get_version() < SMCCC_MAKE_VERSION(1, 1))
+       /* Check if TRNG is supported */
+       if (smccc_arch_features(TRNG_VERSION) != SMCCC_RET_SUCCESS)
                return;
 
        /* Check we have TRNG 1.0 or later */

Reply via email to