[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: ffa: add support for FFA_ID_GET
commit 1ab2ae1610d99423af5b810829959431e43de12d Author: Jens Wiklander <jens.wiklander@xxxxxxxxxx> AuthorDate: Mon Jul 17 09:20:52 2023 +0200 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Thu Jul 20 23:26:08 2023 +0100 xen/arm: ffa: add support for FFA_ID_GET Adds support for the FF-A function FFA_ID_GET to return the ID of the calling client. Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx> --- xen/arch/arm/tee/ffa.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index f0a2715d4b..e157ed20ad 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -181,6 +181,12 @@ static bool ffa_get_version(uint32_t *vers) return true; } +static uint16_t get_vm_id(const struct domain *d) +{ + /* +1 since 0 is reserved for the hypervisor in FF-A */ + return d->domain_id + 1; +} + static void set_regs(struct cpu_user_regs *regs, register_t v0, register_t v1, register_t v2, register_t v3, register_t v4, register_t v5, register_t v6, register_t v7) @@ -195,6 +201,12 @@ static void set_regs(struct cpu_user_regs *regs, register_t v0, register_t v1, set_user_reg(regs, 7, v7); } +static void set_regs_success(struct cpu_user_regs *regs, uint32_t w2, + uint32_t w3) +{ + set_regs(regs, FFA_SUCCESS_32, 0, w2, w3, 0, 0, 0, 0); +} + static void handle_version(struct cpu_user_regs *regs) { struct domain *d = current->domain; @@ -224,6 +236,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs) case FFA_VERSION: handle_version(regs); return true; + case FFA_ID_GET: + set_regs_success(regs, get_vm_id(d), 0); + return true; default: gprintk(XENLOG_ERR, "ffa: unhandled fid 0x%x\n", fid); @@ -237,6 +252,12 @@ static int ffa_domain_init(struct domain *d) if ( !ffa_version ) return -ENODEV; + /* + * We can't use that last possible domain ID or get_vm_id() would cause + * an overflow. + */ + if ( d->domain_id >= UINT16_MAX) + return -ERANGE; ctx = xzalloc(struct ffa_ctx); if ( !ctx ) -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |