[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: Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 8 Sep 2022 12:20:25 +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=Z82F4EPGqp02NKo0C0gyevuhSIkEumDNmZjeE1poCp4=; b=b5JVJtiM3zBUUudHLdW7zKX1p0ME8rrTeWaQ2ycQ0tukg6LMSqTOrkY+C04i8FQxWTUA83+0050qRPVV5l/R4cX86tJvhacgqPti5LbGl9JAwByHqc61Ppicgc4jNn28fl53hrfcjftu7YiII3sumqiLAM4asQDEX5WPLkJw+jD4xKVM5KqT0NfAsu/ahn8u79/q6S8o/wR84qVnWKozMo6rCkVCx0wWraooBPq65w0cBCoRT3tgiqXYVdr+C9IasOwJL3HusQFpw573ny0kVLvwLc82AbfFG4tKE6NtV1S4QWiD9TiufwKhzE3B/xY8qQdVjkJvokx0AF2estrJbQ==
  • 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=Z82F4EPGqp02NKo0C0gyevuhSIkEumDNmZjeE1poCp4=; b=abjpj2J911mcZjohJUXPl8wO/erVmgyJdtg1fLG1qdp7MbT31Jxk6fUpm9ZcVfJx2GlY+LzVmHOX4m7jPAfoYaP/HdXXVRM2RGaFlxAjgLCp1Jdo1XASqawrddn6gkxYModE2S3UqumE7yk1gbKZGJea9h6Dn3iz01uYY+ond5GCtxFJy87EADiWuP/zccAaGhWqguuos8A1dPpDe+giSoKKqeB5G3iYQqXL77fjvux/bcClVUFXQ6Au8XDReoKJ3l7oxz/x555iqjFoB2f/HEVuRfScTctEUHfz468NongRjgZ7h0uuNz9ZDLdGD78IRrO/IJ7IFzhNM3/iR+Oi2g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UzltbDZB8d0WoEiBOKmR1YBgi13QCoVnXupJptqXgY/nFhHRDmQm52hSMOGQVoHWDbDDsOusGubaGVm4gJ2AAvObcMppIv8HpWtP9Jk9BYdoxhYv2Y688mFMniPyj4ZXuBxgw3ri0FJRBNxNuGZJ7C9gkjd5PG6901SgXpc7kdpSuYKJf+UoRx8jb0/kKw2treCowMYhF+cQGz+D4EtrU6+CvmQ0wSI8qyWQutcFROBCk3zCPZ4aNhwxmcSXYtmS+jXgn+HVNOGi0oOgwN7CSNy9LmCjO2Nt69Wb18pfoIlf9zP7ek0uY8+SGyfFs+O3N0IUH9eEI71Bs79mz8s8Fg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+IGR14JQzitljevu1t3SuTrksX/nORcoSInlSs6SZKgqG8pjhYZ60KmNtal99CEE9L7HpeVAUvqbLu3Vekkl8yzF85Blk1j5lHhYIRd/XcfLnrM/Xtilr8xsdmQlH5FxM7FQuL5uA3HJWjPVWPzfS7tzG3vgzz+2YSXodd61s1xQ1A/nw+kWF/4/Z8OzdGUGKdXf1SrA+o6qwKm+5Xts3yAE1k2jbxaNZN4ZqNKMlrfDRkMn2C4RwzvQGUyELlck/fg6TZ4JI89o9vfvU7WC7lii0MbaPI2UhJRmUVre20JQnwACRR4n/ty4Nvr3xhVn4wZtEwcTlHrwvKw0pQZCw==
  • 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 12:20: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: AQHYw2XP4kTWxhuEi0Wfg39PE1aR463VV3SAgAAAWqCAABXxgIAABIfA
  • Thread-topic: [PATCH] xen/arm, device-tree: Make static-mem use #{address,size}-cells

Hi Julien and Michal,

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> >>>       / {
> >>>           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.
> 
> I agree with that. As this is only a small part of the DT we want to
> focus on what is necessary for the current section.
> 
> > So I decided to remove it.
> 
> I would mention it in the commit message because the change seems
> unrelated otherwise.

Sure.

> 
> The same apply for replacing adding extra "====". But TBH, this change
> feels completely unrelated to this patch. So I think it is better to
> have a separate patch.

I would revert this change for "====", as sending a patch adding
"====" seems to not make too much sense.....

> 
> [...]
> 
> >>> 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 :))
> 
> The code was imported from Linux where it seems to be more common to
> use
> "int" rather than "unsigned".
> 
> >
> > @Julien, what do you think? Shall we modify the return type of these two
> > functions?
> 
> I think it would be good to be consistent. However, there are other
> users of d_n_addr_cells() (some are expecting 'int'). So if you switch
> to a different type then this use will be consistent but not the others.
> 
> I would only suggest to look at it if you have if you have copious time
> and fancy going down the rabbit hole :).
> 
> As to which type to chose, we are phasing out use of uXX in new code. So
> this should be 'uint32_t'. I would also be fine to use 'unsigned int'
> for the outside interface.
> 
> I don't have a strong opinion either way.

I personally would like to keep the current way, changing the type to me
sounds like out of scope with this patch and will bring us the risk of breaking
other places.

So I will address the commit message and "====" changes and send a v2.

Kind regards,
Henry


> 
> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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