ARM-software / tf-issues

Issue tracking for the ARM Trusted Firmware project
37 stars 16 forks source link

[question] Macro TRND_SUPPORT can't work together with SPM_MM #713

Open jasonhan8012 opened 1 year ago

jasonhan8012 commented 1 year ago

I find some code logic is conflicted if "SPM_MM" and" TRND_SUPPORT"macro defined at the same time . It will cause TRNG can't be used in latest Linux kernel.

std_svc_setup.c code as below:

if SPM_MM

/*
 * Dispatch SPM calls to SPM SMC handler and return its return
 * value
 */
if (**is_spm_mm_fid(smc_fid)**) {
    return spm_mm_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
                  handle, flags);
}

endif

...................

if TRNG_SUPPORT

if (**is_trng_fid(smc_fid)**) {
    return trng_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle,
            flags);
}

endif

spm_mm_svc.h code as below,range defined is 0xc4000040-0xc400007f as 64bit:

/ These macros are used to identify SPM-MM calls using the SMC function ID /

define SPM_MM_FID_MASK U(0xffff)

**#define SPM_MM_FID_MIN_VALUE U(0x40)

define SPM_MM_FID_MAX_VALUE U(0x7f)**

define is_spm_mm_fid(_fid) \

    ((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) \
     (((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE))

trng _svc.h TRNG defined as below:

/ SMC function IDs for TRNG queries /

define ARM_TRNG_VERSION U(0x84000050)

define ARM_TRNG_FEATURES U(0x84000051)

define ARM_TRNG_GET_UUID U(0x84000052)

define ARM_TRNG_RND32 U(0x84000053)

define ARM_TRNG_RND64 U(0xc4000053)

spm_mm_svc range covered Trng's range ,that will case Trng call can't be handled.

in <<ARM DEN 0028E SMC Calling Convention 1.4 2022>> 6.3 Implemented Standard Secure Service Calls

image

so pls check them. Thanks a lot !!

ssg-bot commented 1 year ago

Hello @jasonhan8012!

Thank you for raising an issue for Trusted Firmware-A.

The TF-A project has now migrated to www.trustedfirmware.org. This issue tracker will still remain accessible for some time, but only for historical reasons. From now on you should raise new issues on trustedfirmware.org.

If it is a query or a design discussion it is better discussed via the mailing list. If it is issue/bug which need to be tracked, raise an issue in the issue tracking board and also send an email to the mailing list to notify the TF-A community.

How do I raise issues for TF-A?

Please use our new issue tracking board. For this you just need to login with your existing GitHub account. We also have a guide to help you raise the issue with the appropriate labels and tags. This way it will be easier for both you and us to track and address the issue most effectively.

We are looking forward to seeing you in trustedfirmware.org!

The Trusted Firmware-A team