|
[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
On 09/02/2022 10:20, Oleksii Moisieiev wrote: Hi Julien, Hi, On Tue, Feb 08, 2022 at 06:26:54PM +0000, Julien Grall wrote: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/?You're right. I will move it to common. You can avoid most of those forward declarations if you define the static variable now but fill them up after (see [1]). I don't think we can avoid the static variable forward declaration without reworking the API. BTW, I could not fully apply the series on the staging tree: Applying: xen/hypfs: support fo nested dynamic hypfs nodes Applying: libs: libxenhypfs - handle blob properties Applying: xen/arm: Export host device-tree to hypfs Applying: xen/arm: add generic SCI mediator framework error: patch failed: MAINTAINERS:512 error: MAINTAINERS: patch does not apply error: patch failed: xen/arch/arm/domain_build.c:1894 error: xen/arch/arm/domain_build.c: patch does not apply error: xen/include/asm-arm/domain.h: does not exist in index Patch failed at 0004 xen/arm: add generic SCI mediator framework hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".From the errors, it sounds like your baseline is from a couple of months ago. Please make sure to send your series based on the latest staging (at the time you send it).
Can you explain why that data->data is not const?
dt_host will always points to the root of the host device-tree. I don't think it is the job of hypfs to enforce it unless you expect the code to be buggy if this happens. But then I would argue the code should be hardened. Cheers, [1] diff --git a/xen/arch/arm/host_dtb_export.c b/xen/arch/arm/host_dtb_export.c index 794395683cd1..5f242b2cb683 100644 --- a/xen/arch/arm/host_dtb_export.c +++ b/xen/arch/arm/host_dtb_export.c @@ -26,39 +26,9 @@ #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);
-
-static const struct hypfs_funcs host_dt_dir_funcs = {
- .enter = host_dt_dir_enter,
- .exit = host_dt_dir_exit,
- .read = host_dt_dir_read,
- .write = hypfs_write_deny,
- .getsize = host_dt_dir_getsize,
- .findentry = host_dt_dir_findentry,
-};
-
-static int host_dt_prop_read(const struct hypfs_entry *entry,
- XEN_GUEST_HANDLE_PARAM(void) uaddr);
-
-static unsigned int host_dt_prop_getsize(const struct hypfs_entry *entry);
-
-const struct hypfs_funcs host_dt_prop_ro_funcs = {
- .enter = host_dt_dir_enter,
- .exit = host_dt_dir_exit,
- .read = host_dt_prop_read,
- .write = hypfs_write_deny,
- .getsize = host_dt_prop_getsize,
- .findentry = hypfs_leaf_findentry,
-};
+/* Forward declare it */
+static const struct hypfs_funcs host_dt_dir_funcs;
+static const struct hypfs_funcs host_dt_prop_ro_funcs;
static HYPFS_DIR_INIT_FUNC(dt_dir, "node_template", &host_dt_dir_funcs);
@@ -260,6 +230,15 @@ static struct hypfs_entry *host_dt_dir_findentry(
return ERR_PTR(-ENOENT);
};
+static const struct hypfs_funcs host_dt_dir_funcs = {
+ .enter = host_dt_dir_enter,
+ .exit = host_dt_dir_exit,
+ .read = host_dt_dir_read,
+ .write = hypfs_write_deny,
+ .getsize = host_dt_dir_getsize,
+ .findentry = host_dt_dir_findentry,
+};
+
static int host_dt_prop_read(const struct hypfs_entry *entry,
XEN_GUEST_HANDLE_PARAM(void) uaddr)
{
@@ -293,6 +272,15 @@ static unsigned int host_dt_prop_getsize(const
struct hypfs_entry *entry)
return prop->length;
}
+static const struct hypfs_funcs host_dt_prop_ro_funcs = {
+ .enter = host_dt_dir_enter,
+ .exit = host_dt_dir_exit,
+ .read = host_dt_prop_read,
+ .write = hypfs_write_deny,
+ .getsize = host_dt_prop_getsize,
+ .findentry = hypfs_leaf_findentry,
+};
+
static HYPFS_DIR_INIT_FUNC(host_dt_dir, HOST_DT_DIR, &host_dt_dir_funcs);
static int __init host_dtb_export_init(void)
--
Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |