Skip to contentSkip to conversation

xen/arm: ffa: return FFA_RET_NOT_SUPPORTED on unhandled calls

PATCH In review Jens Wiklander 4 participants 4 messages Dec 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: ffa: return FFA_RET_NOT_SUPPORTED on unhandled calls

Until now has an unsupported FF-A request been reported back with ARM_SMCCC_ERR_UNKNOWN_FUNCTION in register x0. A FF-A caller would rather expect FFA_ERROR in x0 and FFA_RET_NOT_SUPPORTED in x2 so update ffa_handle_call() to return true and with the cpu_user_regs updated.

Fixes 38846de2176b ("xen/arm: tee: add a primitive FF-A mediator")
---
 xen/arch/arm/tee/ffa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/tee/ffa.c +2 -1
index 183528d13388..98905fec7967 100644
@@ -1477,7 +1477,8 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
 
     default:
         gprintk(XENLOG_ERR, "ffa: unhandled fid 0x%x\n", fid);
-        return false;
+        set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        return true;
     }
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 3 lines · Jens Wiklander

Until now has an unsupported FF-A request been reported back with

NIT: I think 'has' is in the wrong place

Quoted 6 lines

ARM_SMCCC_ERR_UNKNOWN_FUNCTION in register x0. A FF-A caller would rather expect FFA_ERROR in x0 and FFA_RET_NOT_SUPPORTED in x2 so update ffa_handle_call() to return true and with the cpu_user_regs updated.

Fixes 38846de2176b ("xen/arm: tee: add a primitive FF-A mediator")

Looking at Linux and TFA, this is indeed expected behavior, so:

~Michal

#2 lore raw
Quoted 7 lines · Michal Orzel

Hi,

Quoted 3 lines · Jens Wiklander

Until now has an unsupported FF-A request been reported back with

NIT: I think 'has' is in the wrong place

Indeed. I have updated the commit message and committed.

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v1 1/1
#3 lore raw
In reply to Jens Wiklander

Hi Jens,

Quoted 9 lines · Jens Wiklander

Until now has an unsupported FF-A request been reported back with ARM_SMCCC_ERR_UNKNOWN_FUNCTION in register x0. A FF-A caller would rather expect FFA_ERROR in x0 and FFA_RET_NOT_SUPPORTED in x2 so update ffa_handle_call() to return true and with the cpu_user_regs updated.

Fixes 38846de2176b ("xen/arm: tee: add a primitive FF-A mediator")

With the Nit from Michal fixed in the commit message (could be done on commit):

Cheers
Bertrand

Quoted 21 lines

---
xen/arch/arm/tee/ffa.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/tee/ffa.c +2 -1
index 183528d13388..98905fec7967 100644
@@ -1477,7 +1477,8 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
 
    default:
        gprintk(XENLOG_ERR, "ffa: unhandled fid 0x%x\n", fid);
-        return false;
+        set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        return true;
    }
 }
 
Signature · 1 line
2.34.1