[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v8 08/22] xen/arm: ffa: add support for FFA_ID_GET





On 13/04/2023 12:07, Henry Wang wrote:
Hi Jens,

-----Original Message-----
Subject: [XEN PATCH v8 08/22] 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>
---
  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 90ed71cbfda3..f129879c5b81 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;

Since here you want 0 to be reserved, I think maybe you can use
the "d->arch.p2m.vmid"? According to the logic in p2m_alloc_vmid(),
the "d->arch.p2m.vmid" is also a per-domain u16 value that starts
from 1.

I would rather not do that for a few reasons:
 1) This is assuming the P2M code is initialized first
2) We should not rely on the VMID to be fixed. We may need to change that if we want to run more VMs than the number of VMIDs (we may even need multiple VMIDs per domain...).

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.