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

Re: [PATCH v2] xen/arm, device-tree: Make static-mem use #{address,size}-cells


  • To: Henry Wang <Henry.Wang@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 9 Sep 2022 07:48:28 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=BXpdL0fXIP6gm/iZrwbFgwzgWBFsNARNpmZG2tI9bzQ=; b=F2k6con5ZIKgzFwMZjv4pb7k0CjCXmkL2z0xOc3InE7/BbB6rTp/apQh7RMcQypNH+g3/bSIoYM3goCO/R6FHjNw3Va1Ind2GcUF3XZ8FAYB19pwW8HKniZSTwv93RbzpI27sSKVxk3ZyWQCMAOkH1w+pTr0Lk6JimstYRTb6+D12qz9SF+mYOqMPeF1kb5xk9wmNRMxauk5g38ipTWopLRQ1lUmL5K6gcLBhKPutFwstu8o4tad/OBpbK/cAt5u4pNR/lscC1ZkoY3QlP1GHk1KZpYxILAMBptIQnxSXiNNjTYqEcTlxfeli6z2F2Met4dXE7quIzjDfY8URrmVLQ==
  • 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=BXpdL0fXIP6gm/iZrwbFgwzgWBFsNARNpmZG2tI9bzQ=; b=Hsn5jxhEcoO22Ri/0fe+M3bDxH0WGptZPd96F+z5i3BpXreKmxrxdhOXXKeal2SAwceVSn/UerLsHOByd3Ht2OmgSHyT7S2ZjFsHtHpUTqTAJ8x/xJuktcb3YIEB5Ed8IEhap6xuE9aaBLpYOOSXYWNL/AZ84NZIIKW6bxNsWdpjAT49woL8QMxzEQ4nyLHBBKIBHHuyn6Vi3e1FAIf/x/1krSueKo081vGO4d7qd5Py+3e00ZRW9d6q5y7z7R9N1sPGs8gpYEKfo4gch/Yd8Rdjuf/cn4/EZ0e/QQCo1/g2NMY8353kejZfKJAiF4+sZltZy58JMiUUozUP4Xhokg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=jVusraUOH3iZ/tISpSklAAjMIK9pasPeLUb9SqUPCj+ZbMZpG4eVrBQmoBEVYF+YEBGXdfoxTon17Lfwc3hVxEnHTV7UARR0WwdompA48+AVajooqM86x+kEBI3wm6Ai2VDrTUJjYbVpXSwR+4loCw3zo1imCJwDPlesU0iOlMYldVRBkfkYMWDUGCu997UCSyqplhwRkopTl1VDCRKGJcxAQkTs7v0YLr+1wTf7twwnIInbB/5V0GlNl3AEJPd39X6iPX67AWKj3Q2h6vYw8YvcPVVTwQJH92i04eJ1NNcMs8uqFkZSguwAfpKSzk9FTjFibyism6TJrSD+r4y86w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EAIzsIBe5xE186A4wRfvi2gWgaxKCzE2H2Mwh4kRNwz7DXxswKP/WZ47pBFe8T2wOx7c3AmkWtKyCoVP7qKrz8BCYYtJEEoMFxuUaTzNnWKRLE0/xzC0mDb85xBej2b+RsHIz5cVmt+MJzOt8/TDC9s/+dH5/Fd+s935voFuWz1WQfHfeoo5E7lCYjFfNtvSEvSXTeywweL79o0a5NEMNGA0hs1klWjeyrpJV2rviNNAGfbHyk2crOy+vtbEOmbdz4l+gt6gPxEr6LxzZgZWVr72WWQDlugjfXrpU0RW4gIa0/brM/Q3bI9KdAC/qzTAkVkl6tXF6A8Iw/84NfVKPg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen developer discussion <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 07:48:43 +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: AQHYxAxmzg40DV+m0E2yYMsfRrvCOK3WuP8A
  • Thread-topic: [PATCH v2] xen/arm, device-tree: Make static-mem use #{address,size}-cells

Hi Henry,

> On 9 Sep 2022, at 06:23, Henry Wang <Henry.Wang@xxxxxxx> wrote:
> 
> In order to keep consistency in the device tree binding, there is
> no need for static memory allocation feature to define a specific
> set of address and size cells for "xen,static-mem" property.
> 
> Therefore, this commit reuses the regular #{address,size}-cells
> for parsing the device tree "xen,static-mem" property. Update
> the documentation accordingly.
> 
> Also, take the chance to remove the unnecessary "#address-cells"
> and "#size-cells" in the domU1 node of the device tree to only
> emphasize the related part that the example is showing.
> 
> Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> Changes from v1 to v2:
> - Remove the "----" addition, as it is unnecessary to this patch.
> - Mention the removal of #address-cells and #size-cells in domU1
>  node in the commit message.
> ---
> docs/misc/arm/device-tree/booting.txt | 11 +++++------
> docs/misc/arm/passthrough-noiommu.txt |  7 +++----
> xen/arch/arm/bootfdt.c                |  5 -----
> xen/arch/arm/domain_build.c           | 16 ++--------------
> 4 files changed, 10 insertions(+), 29 deletions(-)
> 
> diff --git a/docs/misc/arm/device-tree/booting.txt 
> b/docs/misc/arm/device-tree/booting.txt
> index 5395a1077c..10caf4f1af 100644
> --- a/docs/misc/arm/device-tree/booting.txt
> +++ b/docs/misc/arm/device-tree/booting.txt
> @@ -350,8 +350,8 @@ areas are pre-defined by configuration using physical 
> address ranges.
> 
> Memory can be statically allocated to a domain using the property "xen,static-
> mem" defined in the domain configuration. The number of cells for the address
> -and the size must be defined using respectively the properties
> -"#xen,static-mem-address-cells" and "#xen,static-mem-size-cells".
> +and the size must be defined respectively by the parent node properties
> +"#address-cells" and "#size-cells".
> 
> The property 'memory' is still needed and should match the amount of memory
> given to the guest. Currently, it either comes from static memory or lets Xen
> @@ -366,14 +366,13 @@ device-tree:
> 
>     / {
>         chosen {
> +            #address-cells = <0x1>;
> +            #size-cells = <0x1>;
> +            ...
>             domU1 {
>                 compatible = "xen,domain";
> -                #address-cells = <0x2>;
> -                #size-cells = <0x2>;
>                 cpus = <2>;
>                 memory = <0x0 0x80000>;
> -                #xen,static-mem-address-cells = <0x1>;
> -                #xen,static-mem-size-cells = <0x1>;
>                 xen,static-mem = <0x30000000 0x20000000>;
>                 ...
>             };
> diff --git a/docs/misc/arm/passthrough-noiommu.txt 
> b/docs/misc/arm/passthrough-noiommu.txt
> index 3e2ef21ad7..69b8de1975 100644
> --- a/docs/misc/arm/passthrough-noiommu.txt
> +++ b/docs/misc/arm/passthrough-noiommu.txt
> @@ -33,14 +33,13 @@ on static allocation in the device-tree:
> 
> / {
>       chosen {
> +             #address-cells = <0x1>;
> +             #size-cells = <0x1>;
> +             ...
>               domU1 {
>                       compatible = "xen,domain";
> -                     #address-cells = <0x2>;
> -                     #size-cells = <0x2>;
>                       cpus = <2>;
>                       memory = <0x0 0x80000>;
> -                     #xen,static-mem-address-cells = <0x1>;
> -                     #xen,static-mem-size-cells = <0x1>;
>                       xen,static-mem = <0x30000000 0x20000000>;
>                       direct-map;
>                       ...
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index 9e1ea60094..59675f086b 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -370,11 +370,6 @@ static int __init process_domain_node(const void *fdt, 
> int node,
>         /* No "xen,static-mem" present. */
>         return 0;
> 
> -    address_cells = device_tree_get_u32(fdt, node,
> -                                        "#xen,static-mem-address-cells", 0);
> -    size_cells = device_tree_get_u32(fdt, node,
> -                                     "#xen,static-mem-size-cells", 0);
> -
>     return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_cells,
>                                    size_cells, &bootinfo.reserved_mem,
>                                    MEMBANK_STATIC_DOMAIN);
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 7412303d20..9040a8c6cb 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -565,21 +565,9 @@ static int __init parse_static_mem_prop(const struct 
> dt_device_node *node,
>     const struct dt_property *prop;
> 
>     prop = dt_find_property(node, "xen,static-mem", NULL);
> -    if ( !dt_property_read_u32(node, "#xen,static-mem-address-cells",
> -                               addr_cells) )
> -    {
> -        printk(XENLOG_ERR
> -               "failed to read \"#xen,static-mem-address-cells\".\n");
> -        return -EINVAL;
> -    }
> 
> -    if ( !dt_property_read_u32(node, "#xen,static-mem-size-cells",
> -                               size_cells) )
> -    {
> -        printk(XENLOG_ERR
> -               "failed to read \"#xen,static-mem-size-cells\".\n");
> -        return -EINVAL;
> -    }
> +    *addr_cells = dt_n_addr_cells(node);
> +    *size_cells = dt_n_size_cells(node);
> 
>     *cell = (const __be32 *)prop->value;
>     *length = prop->length;
> -- 
> 2.17.1
> 




 


Rackspace

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