diff mbox series

[XEN] xen/arm: ffa: return FFA_RET_NOT_SUPPORTED on unhandled calls

Message ID 20231213103241.2346813-1-jens.wiklander@linaro.org (mailing list archive)
State New
Headers show
Series [XEN] xen/arm: ffa: return FFA_RET_NOT_SUPPORTED on unhandled calls | expand

Commit Message

Jens Wiklander Dec. 13, 2023, 10:32 a.m. UTC
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")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michal Orzel Dec. 13, 2023, 1:06 p.m. UTC | #1
Hi,

On 13/12/2023 11:32, Jens Wiklander wrote:
> 
> 
> Until now has an unsupported FF-A request been reported back with
NIT: I think 'has' is in the wrong place

> 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")
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Looking at Linux and TFA, this is indeed expected behavior, so:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
Bertrand Marquis Dec. 13, 2023, 2:12 p.m. UTC | #2
Hi Jens,


> On 13 Dec 2023, at 11:32, Jens Wiklander <jens.wiklander@linaro.org> wrote:
> 
> 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")
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

With the Nit from Michal fixed in the commit message (could be done on commit):
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> xen/arch/arm/tee/ffa.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
> index 183528d13388..98905fec7967 100644
> --- a/xen/arch/arm/tee/ffa.c
> +++ b/xen/arch/arm/tee/ffa.c
> @@ -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;
>     }
> }
> 
> -- 
> 2.34.1
>
Julien Grall Dec. 13, 2023, 4:25 p.m. UTC | #3
On 13/12/2023 13:06, Michal Orzel wrote:
> Hi,
> 
> On 13/12/2023 11:32, Jens Wiklander wrote:
>>
>>
>> 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,
diff mbox series

Patch

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 183528d13388..98905fec7967 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -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;
     }
 }