Skip to content

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

@jasonhan8012

Description

@jasonhan8012

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 !!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions