From: Stefano Stabellini <sstabellini@kernel.org>
To: julien.grall@arm.com
Cc: Stefano Stabellini <stefanos@xilinx.com>,
sstabellini@kernel.org, andrii_anisov@epam.com,
Achin.Gupta@arm.com, xen-devel@lists.xen.org,
Volodymyr_Babchuk@epam.com
Subject: [Xen-devel] [PATCH v8 6/8] xen/arm: handle "multiboot, device-tree" compatible nodes
Date: Wed, 2 Oct 2019 18:35:24 -0700 [thread overview]
Message-ID: <20191003013526.30768-6-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1910021833180.2691@sstabellini-ThinkPad-T480s>
Detect "multiboot,device-tree" compatible nodes. Add them to the bootmod
array as BOOTMOD_GUEST_DTB. In kernel_probe, find the right
BOOTMOD_GUEST_DTB and store a pointer to it in dtb_bootmodule.
Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Acked-by: Julien Grall <julien.grall@arm.com>
---
Changes in v4:
- use uint32_t
- remove useless 0 initialization
- add return value check
Changes in v2:
- rename BOOTMOD_DTB to BOOTMOD_GUEST_DTB
- rename multiboot,dtb to multiboot,device-tree
---
xen/arch/arm/bootfdt.c | 2 ++
xen/arch/arm/kernel.c | 14 +++++++++++++-
xen/arch/arm/setup.c | 1 +
xen/include/asm-arm/setup.h | 1 +
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index a7810abb15..08fb59f4e7 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -242,6 +242,8 @@ static void __init process_multiboot_node(const void *fdt, int node,
kind = BOOTMOD_RAMDISK;
else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
kind = BOOTMOD_XSM;
+ else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
+ kind = BOOTMOD_GUEST_DTB;
else
kind = BOOTMOD_UNKNOWN;
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 389bef2afa..8eff074836 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -425,7 +425,7 @@ int __init kernel_probe(struct kernel_info *info,
struct bootmodule *mod = NULL;
struct bootcmdline *cmd = NULL;
struct dt_device_node *node;
- u64 kernel_addr, initrd_addr, size;
+ u64 kernel_addr, initrd_addr, dtb_addr, size;
int rc;
/* domain is NULL only for the hardware domain */
@@ -469,6 +469,18 @@ int __init kernel_probe(struct kernel_info *info,
info->initrd_bootmodule = boot_module_find_by_addr_and_kind(
BOOTMOD_RAMDISK, initrd_addr);
}
+ else if ( dt_device_is_compatible(node, "multiboot,device-tree") )
+ {
+ uint32_t len;
+ const __be32 *val;
+
+ val = dt_get_property(node, "reg", &len);
+ if ( val == NULL )
+ continue;
+ dt_get_range(&val, node, &dtb_addr, &size);
+ info->dtb_bootmodule = boot_module_find_by_addr_and_kind(
+ BOOTMOD_GUEST_DTB, dtb_addr);
+ }
else
continue;
}
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 790eab94d6..705a917abf 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -369,6 +369,7 @@ const char * __init boot_module_kind_as_string(bootmodule_kind kind)
case BOOTMOD_KERNEL: return "Kernel";
case BOOTMOD_RAMDISK: return "Ramdisk";
case BOOTMOD_XSM: return "XSM";
+ case BOOTMOD_GUEST_DTB: return "DTB";
case BOOTMOD_UNKNOWN: return "Unknown";
default: BUG();
}
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index fa0a8721b2..2f8f24e286 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -16,6 +16,7 @@ typedef enum {
BOOTMOD_KERNEL,
BOOTMOD_RAMDISK,
BOOTMOD_XSM,
+ BOOTMOD_GUEST_DTB,
BOOTMOD_UNKNOWN
} bootmodule_kind;
--
2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-10-03 1:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 1:35 [Xen-devel] [PATCH v8 0/8] dom0less device assignment Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 1/8] xen/arm: introduce handle_device_interrupts Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 2/8] xen/arm: export device_tree_get_reg and device_tree_get_u32 Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 3/8] xen/arm: introduce kinfo->phandle_gic Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 4/8] xen/arm: copy dtb fragment to guest dtb Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 5/8] xen/arm: assign devices to boot domains Stefano Stabellini
2019-10-03 9:34 ` Julien Grall
2019-10-03 17:30 ` Stefano Stabellini
2019-10-03 9:51 ` Julien Grall
2019-10-03 17:32 ` Stefano Stabellini
2019-10-03 1:35 ` Stefano Stabellini [this message]
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 7/8] xen/arm: introduce nr_spis Stefano Stabellini
2019-10-03 1:35 ` [Xen-devel] [PATCH v8 8/8] xen/arm: add dom0-less device assignment info to docs Stefano Stabellini
2019-10-03 9:36 ` Julien Grall
2019-10-03 9:58 ` Julien Grall
2019-10-03 17:36 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191003013526.30768-6-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=Achin.Gupta@arm.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrii_anisov@epam.com \
--cc=julien.grall@arm.com \
--cc=stefanos@xilinx.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.