|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC v2 3/8] xen/arm: Export host device-tree to hypfs
Hi Oleksii, On 08/02/2022 18:00, Oleksii Moisieiev wrote: If enabled, host device-tree will be exported to hypfs and can be accessed through /devicetree path. Exported device-tree has the same format, as the device-tree exported to the sysfs by the Linux kernel. This is useful when XEN toolstack needs an access to the host device-tree. Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx> --- xen/arch/arm/Kconfig | 8 + xen/arch/arm/Makefile | 1 + xen/arch/arm/host_dtb_export.c | 307 +++++++++++++++++++++++++++++++++ There is nothing specific in this file. So can this be moved in common/?
A Xen built with ACPI enabled will still be able to boot on a host using Device-Tree. So I don't think should depend on ACPI. Also, I think this should depend on HAS_DEVICE_TREE rather than ARM.
This is mostly hypfs related. So CCing Juergen for his input on the code. @@ -0,0 +1,307 @@ +/* + * xen/arch/arm/host_dtb_export.c + * + * Export host device-tree to the hypfs so toolstack can access + * host device-tree from Dom0 + * + * Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx> + * Copyright (C) 2021, EPAM Systems. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <xen/device_tree.h> +#include <xen/err.h> +#include <xen/guest_access.h> +#include <xen/hypfs.h> +#include <xen/init.h> + +#define HOST_DT_DIR "devicetree" + +static int host_dt_dir_read(const struct hypfs_entry *entry, + XEN_GUEST_HANDLE_PARAM(void) uaddr); +static unsigned int host_dt_dir_getsize(const struct hypfs_entry *entry); + +static const struct hypfs_entry *host_dt_dir_enter( + const struct hypfs_entry *entry); +static void host_dt_dir_exit(const struct hypfs_entry *entry); + +static struct hypfs_entry *host_dt_dir_findentry( + const struct hypfs_entry_dir *dir, const char *name, unsigned int name_len); This is new code. So can you please make sure to avoid forward declaration by re-ordering the code. [...] What does guaranteee that name will be big enough for the new value? The hypfs should not modify the device-tree. So can this be const? + const struct dt_property *prop; + struct hypfs_dyndir_id *data; + + data = hypfs_get_dyndata(); + if ( !data ) + return -EINVAL; [...] [...] dt_host can be NULL when booting on ACPI platform. So I think this wants to be turned to a normal check and return directly. Also could you explain why you need to check dt_host->sibling? Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |