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

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


  • To: Michal Orzel <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 8 Sep 2022 10:54:15 +0000
  • Accept-language: zh-CN, 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=Zd0IC8Y2iehB1yUyrT6crDSgwo/gPRk5TFCVmLD/Ee0=; b=BzSIHiHv3y5KD/g6CRGdLon8xHMdSIm+6bfrZ0ns8F5qItJI9YUrEKnGWNadmmpAAvupqVfEF40MeIJMqBHHClCASKhmcIrkD6OCd4roXKAhx+WuT9naWaP2lmRKBQbH5HnZ1X5OEwmT9z5tgHUn2rtHN9MrR2Jqy1Zlqcw2ZnI1No3SwNpJDcz4Lylyg1FbiHhNX5booO0uKrfc7LoXlBlnAcQwHSzLsTeMWWYJUMB71MbpWAOZoNLMA6za6Tl6WNw+cmrotG+LT4IYvvfy5PrLCk1W0TLt7FdXQjvHmMi4cWJVQlz5fLKRkC5k4Rtiv/1orGXpVlJYAsCq1uAveA==
  • 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=Zd0IC8Y2iehB1yUyrT6crDSgwo/gPRk5TFCVmLD/Ee0=; b=Xa8a5gmqr3LrRxt1dCvX/Sw4Oql4omSF+6RmGY7oLxylkI+Qvrx5LXVopn6wcQsGkU+ukvHsl08r/M6x67kVboPz5wWN8qJfmm8cojcY26mhHuopLH4pDwkYzQujFvdbvdfFOEE0OrN8TGzk/3Q9yVa615cyD+qwT69+K1Bsqdrxkhfyvw3UjzZkE6MJiegvY9TjLbWSbBheHBfZGFhpXJHNCpMHn6UT4R+iVvswd2WdY9NL6zZ+z0BL7jHCdo4YPk9hOz7WrTeQ3Q5vwa9/Pg/ncoOn2naqf7VxUUSCzcMK+UW9tQQfvsrf20by0FgM30pRjKXLdJ9NEL2f6YV7uA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Fc6rO9REIzcrfrGAlO4OFUBuy+lGy3Pd63fNz0+w9ndN2dz9PYhNYApEMx8JJpk7ujfnEzaUYCxqeWSN9+Zr3hyeu25bWdLJBuHYTL4K1nh+zV77l8cDIwjNfAPtDkP/X47ovvP2Moie0tdyjNweNGA8b5kSukZ9/JECZsKm0bHebgSxtYMAGOFmAVU9IOTpVDrgQFcShC8DRA5N7c9nASuT25IurN+98Y0rPJCpKqUT6i3GoY7N4yetEwmSJ6OduJl0y/jpJJImQosVNA5L2+pfm9AxPg22OOFgY1wiPrgYR4lK4LFwMyzj1lToaGGX6F4Nt7zDjzTRLWmwWmQPQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MnGQjZ075hxPEAAdebVsMEbDUP6wsS752hCTo6m0mMf3MPsNtt7C+tn5i33EtR1Tk8i+eK8o55veroNBpQkX/PlQVgWUxNSdCpcnmDGplk11Vj1X8gfwcoHtqR+2WM5Zuug53ee9Q4WdIZO6qur1xDdPju7ZVdkdaPL+e+fIgwYOo+ia52iDbNT48pfOy15A3v5GTbpA0kHi6B+wEJjNI41hWi3jIXYak/oS5sPCtbHdEv8dzLB31zCI/jBjOqFNzabThwzczrMkP69WyrDg2i3L9X/Jf9FH6xxyKdJbwPWdTxFyWIcv6fnspqzh3AVG+CPp0KtlwzS1kdpnu0S9BA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 08 Sep 2022 10:54:48 +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: AQHYw2XP4kTWxhuEi0Wfg39PE1aR463VV3SAgAAAWqA=
  • Thread-topic: [PATCH] xen/arm, device-tree: Make static-mem use #{address,size}-cells

Hi Michal,

Thank you very much for your review, as always :))

> -----Original Message-----
> From: Michal Orzel <michal.orzel@xxxxxxx>
> > @@ -362,14 +362,13 @@ device-tree:
> >
> >      / {
> >          chosen {
> > +            #address-cells = <0x1>;
> > +            #size-cells = <0x1>;
> > +            ...
> >              domU1 {
> >                  compatible = "xen,domain";
> > -                #address-cells = <0x2>;
> > -                #size-cells = <0x2>;
> Why did you remove this set if it relates to the childs of domU1 (e.g. kernel,
> ramdisk) and not to domU1 itself?

Well, I think here the example is just how we setup the static memory, so we 
just
want to emphasize the related part. I agree users can add another #address-cells
and #size-cells for domU1 node for the parts that you mentioned, but that is
not reflected by the current example (I can't find anything related to kernel,
ramdisk, etc. in current example). I might get it wrong but having two 
#address-cells
and #size-cells in that case would be quite misleading from my understanding.
So I decided to remove it.

But I am open to other opinions. So shall we let the discussion go on for a bit 
longer?
I will revert this change if most people think this removing is unnecessary.

> 
> >                  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>;
> The same here.

Same as above.

> 
> >                         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 ec81a45de9..cd264793d5 100644
> > --- a/xen/arch/arm/bootfdt.c
> > +++ b/xen/arch/arm/bootfdt.c
> > @@ -352,11 +352,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, 
> > true);
> >  }
> > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> > index b76a84e8f5..258d74699d 100644
> > --- a/xen/arch/arm/domain_build.c
> > +++ b/xen/arch/arm/domain_build.c
> > @@ -563,21 +563,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);
> There is a type mismatch here as e.g. addr_cells is u32 and dt_n_addr_cells
> return type is int.
> But I don't think this can be harmful and also it's strange for me that
> dt_n_addr_cells
> is defined to return int given that it either returns 2 or be32_to_cpup, which
> means it should return u32.

Yeah. I agree. I did a git blame here and found this function is introduced 9
years ago in "dbd1243 xen/arm: Add helpers to use the device tree". So I think
probably it would be easier to ask the author for the following action directly 
:))

@Julien, what do you think? Shall we modify the return type of these two
functions?

> 
> >
> >      *cell = (const __be32 *)prop->value;
> >      *length = prop->length;
> > --
> > 2.17.1
> >
> >
> Apart from that:
> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

Thanks!

Kind regards,
Henry

> 
> ~Michal

 


Rackspace

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