firmware: arm_ffa: Module-loading behavior

FIXED-TERM Klintefjord Boris (XC-CP/ENG3-SE) fixed-term.Boris.Klintefjord at se.bosch.com
Tue May 28 07:44:45 PDT 2024


Hi,

I noticed a (to me) strange behavior when using the kernel modules arm_ffa and
optee together. I use a Debian-based 6.6.x kernel. The optee driver uses
arm_ffa through the code (drivers/tee/optee/ffa_abi.c)

if (IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT))
    return ffa_register(&optee_ffa_driver);

However, optee can either use FF-A or an OP-TEE specific, SMCCC-based ABI. When
optee loads, it will detect which work and choose one.

The problem arises if optee and arm_ffa are compiled as modules. If FF-A is not
available on the system, then the arm_ffa module will fail to load with

ARM FF-A: FFA_VERSION returned not supported

(from drivers/firmware/arm_ffa/driver.c:ffa_version_check)

When I try to load the optee module, it depends on arm_ffa, and since that
fails to load, optee fails to load too. However, if I remove the arm_ffa module
completely from the kernel, optee will load successfully and work as expected,
using the OP-TEE specific ABI.

Basically, it looks like this:

| # | optee  | arm_ffa  | System uses FF-A | optee status           |
| 1 | Module | No       | Yes              | Loads, does not work   |
| 2 | Module | No       | No               | Loads, uses OP-TEE ABI |
| 3 | Module | Module   | Yes              | Loads, uses FF-A ABI   |
| 4 | Module | Module   | No               | Fails to load          |
| 5 | Module | Built-in | Yes              | Loads, uses FF-A ABI   |
| 6 | Module | Built-in | No               | Loads, uses OP-TEE ABI |

With "System uses FF-A" I mean that OP-TEE OS and all intermediate components
are configured to use FF-A.

Basically, I would expect setup 4 to work as setup 6.

My question is: Is this something that could/should be fixed in the arm_ffa
code and/or something that could/should be fixed in the optee code?

For reference, see also this related issue where I describe the same problem:
github.com/OP-TEE/optee_os/issues/6858

// Boris


More information about the linux-arm-kernel mailing list