diff options
| author | Christopher Clark <christopher.w.clark@gmail.com> | 2022-05-21 12:04:45 -0700 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2022-05-25 12:18:18 -0400 |
| commit | e69e3df88aa56bd05a8c2d5df759fed24072c55a (patch) | |
| tree | bb7a9f18688081dc1957c2de323e05a5f36e2f6b | |
| parent | d9f49b8818bf62532ffd8126e89bf2cee401d6a7 (diff) | |
| download | meta-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.patch | 91 | ||||
| -rw-r--r-- | recipes-extended/xen/xen_4.14.bb | 1 |
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 @@ | |||
| 1 | From 5a4087004d1adbbb223925f3306db0e5824a2bdc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Stefano Stabellini <sstabellini@kernel.org> | ||
| 3 | Date: Tue, 9 Feb 2021 11:53:34 -0800 | ||
| 4 | Subject: [PATCH] xen: workaround missing device_type property in pci/pcie | ||
| 5 | nodes | ||
| 6 | |||
| 7 | PCI buses differ from default buses in a few important ways, so it is | ||
| 8 | important to detect them properly. Normally, PCI buses are expected to | ||
| 9 | have the following property: | ||
| 10 | |||
| 11 | device_type = "pci" | ||
| 12 | |||
| 13 | In reality, it is not always the case. To handle PCI bus nodes that | ||
| 14 | don't have the device_type property, also consider the node name: if the | ||
| 15 | node name is "pcie" or "pci" then consider the bus as a PCI bus. | ||
| 16 | |||
| 17 | This commit is based on the Linux kernel commit | ||
| 18 | d1ac0002dd29 "of: address: Work around missing device_type property in | ||
| 19 | pcie nodes". | ||
| 20 | |||
| 21 | This fixes Xen boot on RPi4. Some RPi4 kernels have the following node | ||
| 22 | on 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 | |||
| 39 | The pci@1,0 node is a PCI bus. If we parse the node and its children as | ||
| 40 | a default bus, the reg property under usb@1,0 would have to be | ||
| 41 | interpreted as an address range mappable by the CPU, which is not the | ||
| 42 | case and would break. | ||
| 43 | |||
| 44 | Link: https://lore.kernel.org/xen-devel/YBmQQ3Tzu++AadKx@mattapan.m5p.com/ | ||
| 45 | [fix style on commit] | ||
| 46 | Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> | ||
| 47 | Tested-by: Elliott Mitchell <ehem+xen@m5p.com> | ||
| 48 | Tested-by: Jukka Kaartinen <jukka.kaartinen@unikie.com> | ||
| 49 | Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> | ||
| 50 | Acked-by: Julien Grall <jgrall@amazon.com> | ||
| 51 | --- | ||
| 52 | xen/common/device_tree.c | 16 +++++++++++++++- | ||
| 53 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
| 54 | |||
| 55 | diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c | ||
| 56 | index 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 | -- | ||
| 90 | 2.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}" | |||
| 7 | SRC_URI = " \ | 7 | SRC_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 | ||
| 12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" |
