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

RE: [XEN PATCH v8 15/22] xen/arm: ffa: add defines for sharing memory


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 13 Apr 2023 11:46:59 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kldRuhPLful5lckP+1pa4Nka1yK3wWVImOAu6JXy/wo=; b=DaNo9raLfPmNnsNDNC5oFJzNEx/QveKHZxq/UE64F6dBSjBkTB8NVb6cqfpIZntabrZNz8M6ZJ3C+F5P9FdUUtzBjHD8EoIx0203Y95WopmehztIAUUlBZ+k6h77w7eANGwVpMq161pt+H3gUB58ZTLGLDMTuX0LucEUoDADXrfNvhFK2AmmgLVI4cbvu6VAGnuQmSz7qN+O1SXoRj4Nql+fs5HUY9ffKC2AUHx5JJigjreveoW0nhnaNT+j0Z3TNISyJoXvwhrYppS2cvkrMMPtJOLLQI7aE+vpRGmMW+zBKioWT1VdGMVVNYpL/dF6ida/sR7xJhfmMGpceD5+kw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQb0TfzET0VtJ8ScGdEmGsWv+lDOmcRoQPy+dK68L3PXRLFNn+3cpYBHTxha4YrliRhSu3lhKaW+GsRJfaNj51+CJndWdzsV+jTjFUr8p9Fe0MmX8tkf1AUicgDAGy+Mcwu3mkM3GtvX9lcnjkAjrVahpgZtxpZTK2KWeFCqB9ARuCsbn4MZsf7uMDHK+Pp8j9n9IYHceYrsI9SmjMQYGBXP3VFIIFSvIoSfhzWpNKDIpmK6/HMXu4OeD4a7gEnfWJ6FKgeMGIkiI7qcJjMBpM+e6qk5cnvmfog5bpwTi9MeV0SE0JLJCc6FPK1pSgMitZVGGYUddVMuS/WqvAWpOA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Marc Bonnici <Marc.Bonnici@xxxxxxx>, Achin Gupta <Achin.Gupta@xxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Thu, 13 Apr 2023 11:47:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZbdhXhHRhSefTr0SCWhhFgt3t1K8pG5rg
  • Thread-topic: [XEN PATCH v8 15/22] xen/arm: ffa: add defines for sharing memory

Hi Jens,

> -----Original Message-----
> Subject: [XEN PATCH v8 15/22] xen/arm: ffa: add defines for sharing memory
> 
> Adds defines needed for sharing using the function FFA_MEM_SHARE and
> friends.

Same as my comments in previous patches, I would suggest to also mention
the references in commit message.

> 
> Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
> ---
>  xen/arch/arm/tee/ffa.c | 60
> ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> + * FF-A doesn't have any direct requirments on GlobalPlatform or vice

Typo: s/requirements/requirements/

> + * versa, but an implementation can very well use FF-A in order to provide
> + * a GlobalPlatform interface on top.
> + *
> + * Global Platform specification for TEE requires that any TEE
> + * implementation should allow to share buffers with size of at least
> + * 512KB, defined in TEEC-1.0C page 24, Table 4-1,
> + * TEEC_CONFIG_SHAREDMEM_MAX_SIZE.
> + * Due to align issue mentioned above, we need to increase this

s/align issue/alignment issue/ ?

> + * value with one.
> + */
> +#define FFA_MAX_SHM_PAGE_COUNT          (SZ_512K / FFA_PAGE_SIZE + 1)
> +
> +/*
> + * Limits the number of shared buffers that guest can have at once. This
> + * is to prevent case, when guests tricks XEN into exhausting its own

Typo: s/tricks/trick/

> + * memory by allocating many small buffers. This value has been chosen
> + * arbitrary.

Typo: s/ arbitrary/arbitrarily/

> + */
> +#define FFA_MAX_SHM_COUNT               32
> +
> +/* FF-A-1.1-REL0 section 10.9.2 Memory region handle, page 167 */
> +#define FFA_HANDLE_HYP_FLAG             BIT(63, ULL)
> +#define FFA_HANDLE_INVALID              0xffffffffffffffffULL
> +
> +/*
> + * Memory attributes: Normal memory, Write-Back cacheable, Inner
> shareable
> + * Defined in FF-A-1.1-REL0 Table 10.18 at page 175.
> + */
> +#define FFA_NORMAL_MEM_REG_ATTR         0x2fU
> +/*
> + * Memory access permissions: Read-write
> + * Defined in FF-A-1.1-REL0 Table 10.15 at page 168.
> + */
> +#define FFA_MEM_ACC_RW                  0x2U
> +
> +/* FF-A-1.1-REL0 section 10.11.4 Flags usage, page 184-187 */
> +/* Clear memory before mapping in receiver */
> +#define FFA_MEMORY_REGION_FLAG_CLEAR            BIT(0, U)
> +/* Relayer may time slice this operation */
> +#define FFA_MEMORY_REGION_FLAG_TIME_SLICE       BIT(1, U)
> +/* Clear memory after receiver relinquishes it */
> +#define FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH BIT(2, U)
> +/* Share memory transaction */
> +#define FFA_MEMORY_REGION_TRANSACTION_TYPE_SHARE (1U << 3)
> +

I confirm the values introduced in this patch are consistent with in-code
comments on top of them. Thanks for the pointer :)

With the typos corrected:
Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>

Kind regards,
Henry


>  /*
>   * Flags and field values used for the MSG_SEND_DIRECT_REQ/RESP:
>   * BIT(31): Framework or partition message
> --
> 2.34.1
> 




 


Rackspace

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