|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 4/8] xen/arm: copy dtb fragment to guest dtb
On 24/09/2019 22:06, Stefano Stabellini wrote: On Wed, 11 Sep 2019, Julien Grall wrote:On 8/21/19 4:53 AM, Stefano Stabellini wrote:Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx> ---- Changes in v4: - use recursion in the implementation - rename handle_properties to handle_prop_pfdt - rename scan_pt_node to scan_pfdt_node - pass kinfo to handle_properties - use uint32_t instead of u32 - rename r to res - add "passthrough" and "aliases" check - add a name == NULL check - code style - move DTB fragment scanning earlier, before DomU GIC node creation - set guest_phandle_gic based on "/gic" - in-code comment Changes in v3: - switch to using device_tree_for_each_node for the copy Changes in v2: - add a note about the code coming from libxl in the commit message - copy /aliases - code style --- xen/arch/arm/domain_build.c | 112 +++++++++++++++++++++++++++++++++++ xen/include/asm-arm/kernel.h | 2 +- 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index cd585f05ca..c71b9f2889 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -14,6 +14,7 @@ #include <xen/guest_access.h> #include <xen/iocap.h> #include <xen/acpi.h> +#include <xen/vmap.h> #include <xen/warning.h> #include <acpi/actables.h> #include <asm/device.h> @@ -1713,6 +1714,111 @@ static int __init make_vpl011_uart_node(struct kernel_info *kinfo) } #endif +static int __init handle_prop_pfdt(struct kernel_info *kinfo, + const void *pfdt, int nodeoff, + uint32_t address_cells, uint32_t size_cells)Why do you need address_cells and size_cells in parameter?Yes, it will be necessary for later patches. ok.
Thinking again about this function, you will allow a users to describe a device in the node /aliases. So there are more to do in this function. + + rc = fdt_begin_node(fdt, fdt_get_name(pfdt, nodeoff, NULL)); + if ( rc ) + return rc; + + rc = handle_prop_pfdt(kinfo, pfdt, nodeoff, address_cells, size_cells); + if ( rc ) + return rc; + + address_cells = device_tree_get_u32(pfdt, nodeoff, "#address-cells", + address_cells); + size_cells = device_tree_get_u32(pfdt, nodeoff, "#size-cells", + size_cells); I am afraid this is not correct. device_tree_get_u32 take the default number of cells as 3rd parameter. This is used if the property does not exist. So if the children does not have the two properties, then you will end up to use the parent's value as default when parsing grandchildren "reg" properties.
This is ok as long as they don't depend on each other. This is not very clear from the code that "/gic" does not need to be parsed first, so you may want to explain in a comment. Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |