summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Clark <christopher.w.clark@gmail.com>2022-05-21 12:04:45 -0700
committerBruce Ashfield <bruce.ashfield@gmail.com>2022-05-25 12:18:18 -0400
commite69e3df88aa56bd05a8c2d5df759fed24072c55a (patch)
treebb7a9f18688081dc1957c2de323e05a5f36e2f6b
parentd9f49b8818bf62532ffd8126e89bf2cee401d6a7 (diff)
downloadmeta-virtualization-honister.tar.gz
xen: fix boot on the Raspberry Pi 4 with Xen 4.14honister
Apply the patch from Xen to fix device tree parsing in newer kernels. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch91
-rw-r--r--recipes-extended/xen/xen_4.14.bb1
2 files changed, 92 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch b/recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch
new file mode 100644
index 00000000..09a461b5
--- /dev/null
+++ b/recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch
@@ -0,0 +1,91 @@
1From 5a4087004d1adbbb223925f3306db0e5824a2bdc Mon Sep 17 00:00:00 2001
2From: Stefano Stabellini <sstabellini@kernel.org>
3Date: Tue, 9 Feb 2021 11:53:34 -0800
4Subject: [PATCH] xen: workaround missing device_type property in pci/pcie
5 nodes
6
7PCI buses differ from default buses in a few important ways, so it is
8important to detect them properly. Normally, PCI buses are expected to
9have the following property:
10
11 device_type = "pci"
12
13In reality, it is not always the case. To handle PCI bus nodes that
14don't have the device_type property, also consider the node name: if the
15node name is "pcie" or "pci" then consider the bus as a PCI bus.
16
17This commit is based on the Linux kernel commit
18d1ac0002dd29 "of: address: Work around missing device_type property in
19pcie nodes".
20
21This fixes Xen boot on RPi4. Some RPi4 kernels have the following node
22on their device trees:
23
24&pcie0 {
25 pci@1,0 {
26 #address-cells = <3>;
27 #size-cells = <2>;
28 ranges;
29
30 reg = <0 0 0 0 0>;
31
32 usb@1,0 {
33 reg = <0x10000 0 0 0 0>;
34 resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
35 };
36 };
37};
38
39The pci@1,0 node is a PCI bus. If we parse the node and its children as
40a default bus, the reg property under usb@1,0 would have to be
41interpreted as an address range mappable by the CPU, which is not the
42case and would break.
43
44Link: https://lore.kernel.org/xen-devel/YBmQQ3Tzu++AadKx@mattapan.m5p.com/
45[fix style on commit]
46Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
47Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
48Tested-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
49Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
50Acked-by: Julien Grall <jgrall@amazon.com>
51---
52 xen/common/device_tree.c | 16 +++++++++++++++-
53 1 file changed, 15 insertions(+), 1 deletion(-)
54
55diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
56index 18825e333e..03d25a81ce 100644
57--- a/xen/common/device_tree.c
58+++ b/xen/common/device_tree.c
59@@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __be32 *addr)
60 * PCI bus specific translator
61 */
62
63+static bool dt_node_is_pci(const struct dt_device_node *np)
64+{
65+ bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
66+
67+ if ( is_pci )
68+ printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
69+
70+ return is_pci;
71+}
72+
73 static bool_t dt_bus_pci_match(const struct dt_device_node *np)
74 {
75 /*
76 * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
77 * powermacs "ht" is hypertransport
78+ *
79+ * If none of the device_type match, and that the node name is
80+ * "pcie" or "pci", accept the device as PCI (with a warning).
81 */
82 return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
83- !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
84+ !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
85+ dt_node_is_pci(np);
86 }
87
88 static void dt_bus_pci_count_cells(const struct dt_device_node *np,
89--
902.25.1
91
diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
index 267db16c..c0fa938f 100644
--- a/recipes-extended/xen/xen_4.14.bb
+++ b/recipes-extended/xen/xen_4.14.bb
@@ -7,6 +7,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
7SRC_URI = " \ 7SRC_URI = " \
8 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ 8 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
9 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ 9 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
10 file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
10 " 11 "
11 12
12LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" 13LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"