Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96120C77B61 for ; Thu, 13 Apr 2023 12:36:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.520688.808540 (Exim 4.92) (envelope-from ) id 1pmwBg-0001tv-Or; Thu, 13 Apr 2023 12:36:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 520688.808540; Thu, 13 Apr 2023 12:36:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmwBg-0001to-L1; Thu, 13 Apr 2023 12:36:28 +0000 Received: by outflank-mailman (input) for mailman id 520688; Thu, 13 Apr 2023 12:36:27 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmwBf-0001tf-HJ for xen-devel@lists.xenproject.org; Thu, 13 Apr 2023 12:36:27 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmwBf-00025L-3y; Thu, 13 Apr 2023 12:36:27 +0000 Received: from 54-240-197-238.amazon.com ([54.240.197.238] helo=[192.168.20.117]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pmwBe-00056E-TF; Thu, 13 Apr 2023 12:36:27 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=rFaQOQZqtnuZCv66vbPgUNGabOZCkbkvgGmoXQcw9Yw=; b=TXYAaVXq0oLG7bDbTNU6uUCqSE VqnqfX7vZp3irdfobVXvVSjoQ4XDv6WNcsbG5Nhmu+2szP99ainFVkbqMWU7RviO26XsKK3gD2wtF mIARx/mUsmOUwtdvG+IhyGDskc4SgnV1lx8CloV3O/Krcq6ktI/q0sqQk4B9ycIXC5W4=; Message-ID: <137a1457-aacc-e763-b313-4266be3fa032@xen.org> Date: Thu, 13 Apr 2023 13:36:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [XEN PATCH v8 08/22] xen/arm: ffa: add support for FFA_ID_GET Content-Language: en-US To: Henry Wang , Jens Wiklander , "xen-devel@lists.xenproject.org" Cc: Bertrand Marquis , Marc Bonnici , Achin Gupta , Volodymyr Babchuk , Stefano Stabellini References: <20230413071424.3273490-1-jens.wiklander@linaro.org> <20230413071424.3273490-9-jens.wiklander@linaro.org> From: Julien Grall In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 >> --- >> 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