* [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4
@ 2020-06-30 1:54 Christopher Clark
2020-06-30 1:54 ` [meta-virtualization][PATCH v2 01/11] xen: apply layer settings when xen DISTRO_FEATURE is enabled Christopher Clark
` (12 more replies)
0 siblings, 13 replies; 18+ messages in thread
From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw)
To: meta-virtualization
Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard,
Stewart.Hildebrand
Changes since v1:
- rebased on to current meta-virtualization, meta-openembedded, poky
- updated Xen revision to the tip of stable 4.13
- fixed Xen build on ARM64 with gcc 10.1.0
- added upstream debugger patch to fix compiler warning
This series introduces support for running Xen on the Raspberry Pi 4
board, with meta-virtualization and meta-raspberrypi, using the
linux-raspberrypi kernel at version 5.4 which is the current
linux-yocto kernel version supported in this layer.
It introduces use of dynamic layers to handle configuration that is
both Xen and Raspberry Pi specific, and inclusion of Xen-specific
configuration when the 'xen' DISTRO_FEATURE is enabled to simplify
Xen image builds.
It applies a backported set of Xen-specific Linux kernel patches,
developed by upstream Xen developers working with the Linux Foundation
Eve Project, that are currently being iterated on for inclusion in the
Linux kernel.
Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested
only on this RPi4 board.
Christopher
Christopher Clark (11):
xen: apply layer settings when xen DISTRO_FEATURE is enabled
xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled
xen-tools: use non-busybox ifupdown tool if available
xen, xen-tools: update revision to Xen 4.13
meta-virt-xen.inc: add Raspberry Pi settings
xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4
xen, raspberry pi 4: provide a default defconfig for raspberrypi4
xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support
xen, raspberry pi: add Xen-specific SD card class
linux-raspberrypi: prefer kernel version 5.4
xen: add patch to fix build on ARM64 with gcc 10.1.0
classes/meta-virt-xen-cfg.bbclass | 6 +
classes/sdcard_image-rpi-xen.bbclass | 120 ++++
conf/distro/include/meta-virt-xen.inc | 19 +
conf/layer.conf | 19 +-
.../bootfiles/rpi-config_git.bbappend | 6 +
.../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++
.../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 +
.../xen/files/defconfig_raspberrypi4-64 | 117 ++++
.../recipes-extended/xen/xen_git.bbappend | 11 +
...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++
...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++
...struct-device-parameter-to-xen_phys_.patch | 78 +++
...struct-device-parameter-to-xen_bus_t.patch | 66 +++
...struct-device-parameter-to-is_xen_sw.patch | 57 ++
...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++
...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++
..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++
.../0011-adding-page-coherent-patch.patch | 39 ++
.../linux/linux-raspberrypi_%.bbappend | 5 +
.../linux/linux-raspberrypi_5.4.bbappend | 19 +
...xen-build-temporarily-inhibit-Werror.patch | 18 +-
...xen-arm64-implement-atomic-fetch-add.patch | 50 ++
...g-0-arrays-to-access-packet-contents.patch | 60 ++
.../files/xen-tools-libxl-gentypes-py3.patch | 140 -----
...tools-pygrub-change-tabs-into-spaces.patch | 40 --
...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------
.../xen/files/xen-tools-pygrub-py3.patch | 233 --------
...ls-python-fix-Wsign-compare-warnings.patch | 136 -----
...n-tools-update-python-scripts-to-py3.patch | 140 -----
recipes-extended/xen/xen-tools.inc | 16 +
recipes-extended/xen/xen-tools_git.bb | 13 +-
recipes-extended/xen/xen_git.bb | 11 +-
32 files changed, 1102 insertions(+), 1234 deletions(-)
create mode 100644 classes/meta-virt-xen-cfg.bbclass
create mode 100644 classes/sdcard_image-rpi-xen.bbclass
create mode 100644 conf/distro/include/meta-virt-xen.inc
create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in
create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend
create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64
create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend
create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch
create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch
delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch
--
2.17.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [meta-virtualization][PATCH v2 01/11] xen: apply layer settings when xen DISTRO_FEATURE is enabled 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 02/11] xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM " Christopher Clark ` (11 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand These settings are necessary for Xen and enabling them here, using the same mechanism that is used by k8s in this layer, simplifies building images for Xen. - Ensure that Xen mode is enabled in QEMU. - On ARM platforms: enable Flattened Device Tree (FDT) support. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- classes/meta-virt-xen-cfg.bbclass | 6 ++++++ conf/distro/include/meta-virt-xen.inc | 6 ++++++ conf/layer.conf | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 classes/meta-virt-xen-cfg.bbclass create mode 100644 conf/distro/include/meta-virt-xen.inc diff --git a/classes/meta-virt-xen-cfg.bbclass b/classes/meta-virt-xen-cfg.bbclass new file mode 100644 index 0000000..61b32aa --- /dev/null +++ b/classes/meta-virt-xen-cfg.bbclass @@ -0,0 +1,6 @@ +# We need to load the Xen meta-virt config components, only if "xen" +# is in the distro features. Since we don't know the distro flags during +# layer.conf load time, we delay using a special bbclass that simply includes +# the META_VIRT_XEN_CONFIG_PATH file. + +include ${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${META_VIRT_XEN_CONFIG_PATH}', '', d)} diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc new file mode 100644 index 0000000..a92b08b --- /dev/null +++ b/conf/distro/include/meta-virt-xen.inc @@ -0,0 +1,6 @@ +# Make sure Xen mode is enabled in qemu +PACKAGECONFIG_append_pn-qemu = " xen" + +# For builds for ARM platforms, enable fdt +PACKAGECONFIG_append_pn-qemu_arm = " fdt" +PACKAGECONFIG_append_pn-qemu_aarch64 = " fdt" diff --git a/conf/layer.conf b/conf/layer.conf index 697fb62..142621c 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -43,8 +43,10 @@ INHERIT += "sanity-meta-virt" # We need to load the meta-virt config components, only if "virtualization" # is in the distro features. Since we don't know the distro flags during # layer.conf load time, we delay using a special bbclass that simply includes -# the META_VIRT_CONFIG_PATH file, and likewise for the k8s configs +# the META_VIRT_CONFIG_PATH file, and likewise for the Xen and k8s configs META_VIRT_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-default-versions.inc" +META_VIRT_XEN_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/meta-virt-xen.inc" K8S_CONFIG_PATH = "${LAYERDIR}/conf/distro/include/k8s-versions.inc" USER_CLASSES_append = " meta-virt-cfg" USER_CLASSES_append = " meta-virt-k8s-cfg" +USER_CLASSES_append = " meta-virt-xen-cfg" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 02/11] xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 01/11] xen: apply layer settings when xen DISTRO_FEATURE is enabled Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 03/11] xen-tools: use non-busybox ifupdown tool if available Christopher Clark ` (10 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- recipes-extended/xen/xen-tools.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index 8b86f7b..c0e54b1 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc @@ -53,7 +53,13 @@ RDEPENDS_${PN} = "\ RDEPENDS_${PN}-dev = "" +# Qemu is necessary on ARM platforms, and to support HVM guests on x86 +QEMU = "${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'qemu', '', d)}" +QEMU_arm = "qemu" +QEMU_aarch64 = "qemu" + RRECOMMENDS_${PN} = " \ + ${QEMU} \ ${@bb.utils.contains('PACKAGECONFIG', 'hvm', 'seabios', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'externalblktap', '', '${BLKTAP_RRECOMMENDS}', d)} \ ${PN}-flask \ -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 03/11] xen-tools: use non-busybox ifupdown tool if available 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 01/11] xen: apply layer settings when xen DISTRO_FEATURE is enabled Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 02/11] xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM " Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 04/11] xen, xen-tools: update revision to Xen 4.13 Christopher Clark ` (9 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Adds: RSUGGESTS_${PN}-scripts-network = "ifupdown" Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> Suggested-by: Corey Minyard <cminyard@mvista.com> --- recipes-extended/xen/xen-tools.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index c0e54b1..154e224 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc @@ -113,6 +113,10 @@ RDEPENDS_${PN}-scripts-network = "\ ${PN}-volatiles \ " +RSUGGESTS_${PN}-scripts-network = "\ + ifupdown \ + " + RSUGGESTS_${PN}-xencov = "${PN}-xencov-split" RDEPENDS_${PN}-xencommons = "\ -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 04/11] xen, xen-tools: update revision to Xen 4.13 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (2 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 03/11] xen-tools: use non-busybox ifupdown tool if available Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 05/11] meta-virt-xen.inc: add Raspberry Pi settings Christopher Clark ` (8 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Pull to the current tip of the stable 4.13 branch and apply an upstream 4.14-release-acked patch to xen-tools for a compiler warning in kdd. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- ...xen-build-temporarily-inhibit-Werror.patch | 18 +- ...g-0-arrays-to-access-packet-contents.patch | 60 ++ .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- ...n-tools-update-python-scripts-to-py3.patch | 140 ----- recipes-extended/xen/xen-tools.inc | 6 + recipes-extended/xen/xen-tools_git.bb | 13 +- recipes-extended/xen/xen_git.bb | 6 +- 11 files changed, 89 insertions(+), 1232 deletions(-) create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch diff --git a/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch b/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch index 0f07555..6e43a4f 100644 --- a/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch +++ b/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch @@ -4,6 +4,8 @@ Date: Thu, 18 Jun 2020 09:05:22 -0400 Subject: [PATCH] xen/build: temporarily inhibit Werror Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +Rebased on Xen 4.13: +Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- tools/libxl/Makefile | 2 +- xen/Rules.mk | 2 +- @@ -13,8 +15,8 @@ diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 6da342ed61..c67560e269 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile -@@ -11,7 +11,7 @@ MINOR = 0 - XLUMAJOR = 4.12 +@@ -14,7 +14,7 @@ MINOR = 0 + XLUMAJOR = 4.13 XLUMINOR = 0 -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ @@ -38,3 +40,15 @@ index a151b3f625..a05ceec1e5 100644 -- 2.19.1 +diff --git a/tools/debugger/kdd/Makefile b/tools/debugger/kdd/Makefile +index 26116949d4..a72ad3b1e0 100644 +--- a/tools/debugger/kdd/Makefile ++++ b/tools/debugger/kdd/Makefile +@@ -1,7 +1,6 @@ + XEN_ROOT = $(CURDIR)/../../.. + include $(XEN_ROOT)/tools/Rules.mk + +-CFLAGS += -Werror + CFLAGS += $(CFLAGS_libxenctrl) + CFLAGS += -DXC_WANT_COMPAT_MAP_FOREIGN_API + LDLIBS += $(LDLIBS_libxenctrl) diff --git a/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch b/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch new file mode 100644 index 0000000..c1b110d --- /dev/null +++ b/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch @@ -0,0 +1,60 @@ +From 3471cafbdda35eacf04670881dd2aee2558b4f08 Mon Sep 17 00:00:00 2001 +From: Tim Deegan <tim@xen.org> +Date: Fri, 26 Jun 2020 10:40:44 +0000 +Subject: [PATCH] kdd: stop using [0] arrays to access packet contents + +GCC 10 is unhappy about this, and we already use 64k buffers +in the only places where packets are allocated, so move the +64k size into the packet definition. + +Reported-by: Olaf Hering <olaf@aepfle.de> +Signed-off-by: Tim Deegan <tim@xen.org> +Acked-by: Wei Liu <wl@xen.org> +Release-acked-by: Paul Durrant <paul@xen.org> +--- + tools/debugger/kdd/kdd.c | 4 ++-- + tools/debugger/kdd/kdd.h | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c +index 3ebda9b12c..866532f0c7 100644 +--- a/tools/debugger/kdd/kdd.c ++++ b/tools/debugger/kdd/kdd.c +@@ -79,11 +79,11 @@ typedef struct { + /* State of the debugger stub */ + typedef struct { + union { +- uint8_t txb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for tx */ ++ uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */ + kdd_pkt txp; /* Also readable as a packet structure */ + }; + union { +- uint8_t rxb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for rx */ ++ uint8_t rxb[sizeof (kdd_hdr)]; /* Marshalling area for rx */ + kdd_pkt rxp; /* Also readable as a packet structure */ + }; + unsigned int cur; /* Offset into rx where we'll put the next byte */ +diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h +index bfb00ba5c5..b9a17440df 100644 +--- a/tools/debugger/kdd/kdd.h ++++ b/tools/debugger/kdd/kdd.h +@@ -68,7 +68,6 @@ typedef struct { + uint16_t len; /* Payload length, excl. header and trailing byte */ + uint32_t id; /* Echoed in responses */ + uint32_t sum; /* Unsigned sum of all payload bytes */ +- uint8_t payload[0]; + } PACKED kdd_hdr; + + #define KDD_PKT_CMD 0x0002 /* Debugger commands (and replies to them) */ +@@ -323,7 +322,7 @@ typedef struct { + kdd_msg msg; + kdd_reg reg; + kdd_stc stc; +- uint8_t payload[0]; ++ uint8_t payload[65536]; + }; + } PACKED kdd_pkt; + +-- +2.17.1 + diff --git a/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch b/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch deleted file mode 100644 index 2399786..0000000 --- a/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 660d2dd863802ef464c90b32f187cb65861f8185 Mon Sep 17 00:00:00 2001 -From: Wei Liu <wei.liu2@citrix.com> -Date: Thu, 7 Mar 2019 12:33:38 +0000 -Subject: [PATCH] libxl: make python scripts work with python 2.6 and up - -Go through transformations suggested by 2to3 and pick the necessary -ones. - -Signed-off-by: Wei Liu <wei.liu2@citrix.com> -Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ---- - tools/libxl/gentest.py | 4 +++- - tools/libxl/gentypes.py | 12 +++++++----- - tools/libxl/idl.py | 15 ++++++++------- - 3 files changed, 18 insertions(+), 13 deletions(-) - -diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py -index 989959fc68..1cc7eebc82 100644 ---- a/tools/libxl/gentest.py -+++ b/tools/libxl/gentest.py -@@ -1,5 +1,7 @@ - #!/usr/bin/python - -+from __future__ import print_function -+ - import os - import sys - import re -@@ -86,7 +88,7 @@ def gen_rand_init(ty, v, indent = " ", parent = None): - - if __name__ == '__main__': - if len(sys.argv) < 3: -- print >>sys.stderr, "Usage: gentest.py <idl> <implementation>" -+ print("Usage: gentest.py <idl> <implementation>", file=sys.stderr) - sys.exit(1) - - random.seed(os.getenv('LIBXL_TESTIDL_SEED')) -diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py -index 88e5c5f30e..6417c9dd8c 100644 ---- a/tools/libxl/gentypes.py -+++ b/tools/libxl/gentypes.py -@@ -1,5 +1,7 @@ - #!/usr/bin/python - -+from __future__ import print_function -+ - import sys - import re - -@@ -576,14 +578,14 @@ def libxl_C_enum_from_string(ty, str, e, indent = " "): - - if __name__ == '__main__': - if len(sys.argv) != 6: -- print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-private> <header-json> <implementation>" -+ print("Usage: gentypes.py <idl> <header> <header-private> <header-json> <implementation>", file=sys.stderr) - sys.exit(1) - - (_, idlname, header, header_private, header_json, impl) = sys.argv - - (builtins,types) = idl.parse(idlname) - -- print "outputting libxl type definitions to %s" % header -+ print("outputting libxl type definitions to %s" % header) - - f = open(header, "w") - -@@ -633,7 +635,7 @@ if __name__ == '__main__': - f.write("""#endif /* %s */\n""" % (header_define)) - f.close() - -- print "outputting libxl JSON definitions to %s" % header_json -+ print("outputting libxl JSON definitions to %s" % header_json) - - f = open(header_json, "w") - -@@ -657,7 +659,7 @@ if __name__ == '__main__': - f.write("""#endif /* %s */\n""" % header_json_define) - f.close() - -- print "outputting libxl type internal definitions to %s" % header_private -+ print("outputting libxl type internal definitions to %s" % header_private) - - f = open(header_private, "w") - -@@ -683,7 +685,7 @@ if __name__ == '__main__': - f.write("""#endif /* %s */\n""" % header_json_define) - f.close() - -- print "outputting libxl type implementations to %s" % impl -+ print("outputting libxl type implementations to %s" % impl) - - f = open(impl, "w") - f.write(""" -diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py -index 2a7f3c44fe..d7367503b4 100644 ---- a/tools/libxl/idl.py -+++ b/tools/libxl/idl.py -@@ -1,3 +1,5 @@ -+from __future__ import print_function -+ - import sys - - PASS_BY_VALUE = 1 -@@ -11,7 +13,7 @@ DIR_BOTH = 3 - _default_namespace = "" - def namespace(s): - if type(s) != str: -- raise TypeError, "Require a string for the default namespace." -+ raise TypeError("Require a string for the default namespace.") - global _default_namespace - _default_namespace = s - -@@ -346,7 +348,7 @@ class OrderedDict(dict): - return [(x,self[x]) for x in self.__ordered] - - def parse(f): -- print >>sys.stderr, "Parsing %s" % f -+ print("Parsing %s" % f, file=sys.stderr) - - globs = {} - locs = OrderedDict() -@@ -362,11 +364,10 @@ def parse(f): - globs[n] = t - - try: -- execfile(f, globs, locs) -- except SyntaxError,e: -- raise SyntaxError, \ -- "Errors were found at line %d while processing %s:\n\t%s"\ -- %(e.lineno,f,e.text) -+ exec(compile(open(f).read(), f, 'exec'), globs, locs) -+ except SyntaxError as e: -+ raise SyntaxError("Errors were found at line %d while processing %s:\n\t%s" -+ % (e.lineno, f, e.text)) - - types = [t for t in locs.ordered_values() if isinstance(t,Type)] - --- -2.17.1 - diff --git a/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch b/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch deleted file mode 100644 index d913be2..0000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b9e1368af14ded6aee3bdf64e8329628b16291ff Mon Sep 17 00:00:00 2001 -From: Wei Liu <wei.liu2@citrix.com> -Date: Mon, 11 Mar 2019 12:55:29 +0000 -Subject: [PATCH] pygrub: change tabs into spaces - -Not sure why Python 2 never complained, but Python 3 does. - -Change tabs to spaces. - -Signed-off-by: Wei Liu <wei.liu2@citrix.com> -Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ---- - tools/pygrub/src/pygrub | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub -index 52a8965ad9..1189b1ca48 100755 ---- a/tools/pygrub/src/pygrub -+++ b/tools/pygrub/src/pygrub -@@ -858,7 +858,7 @@ if __name__ == "__main__": - output_directory = a - - if debug: -- logging.basicConfig(level=logging.DEBUG) -+ logging.basicConfig(level=logging.DEBUG) - - - try: -@@ -917,7 +917,7 @@ if __name__ == "__main__": - # IOErrors raised by fsimage.open - # RuntimeErrors raised by run_grub if no menu.lst present - if debug: -- traceback.print_exc() -+ traceback.print_exc() - fs = None - continue - --- -2.17.1 - diff --git a/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch b/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch deleted file mode 100644 index f4cbb67..0000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch +++ /dev/null @@ -1,529 +0,0 @@ -From 0aabd89dcfee9ee2a6caaa2ec7a475daf5cada53 Mon Sep 17 00:00:00 2001 -From: Wei Liu <wei.liu2@citrix.com> -Date: Thu, 7 Mar 2019 12:45:47 +0000 -Subject: [PATCH] pygrub: make python scripts work with 2.6 and up - -Run 2to3 and pick the sensible suggestions. - -Import print_function and absolute_import so 2.6 can work. - -There has never been a curses.wrapper module according to 2.x and 3.x -doc, only a function, so "import curses.wrapper" is not correct. It -happened to work because 2.x implemented a (undocumented) module. - -We only need to import curses to make curses.wrapper available to -pygrub. - -Signed-off-by: Wei Liu <wei.liu2@citrix.com> -Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ---- - tools/pygrub/src/ExtLinuxConf.py | 19 +++++---- - tools/pygrub/src/GrubConf.py | 39 ++++++++++-------- - tools/pygrub/src/LiloConf.py | 19 +++++---- - tools/pygrub/src/pygrub | 71 ++++++++++++++++---------------- - 4 files changed, 78 insertions(+), 70 deletions(-) - -diff --git a/tools/pygrub/src/ExtLinuxConf.py b/tools/pygrub/src/ExtLinuxConf.py -index d1789bf020..9fd635b9cf 100644 ---- a/tools/pygrub/src/ExtLinuxConf.py -+++ b/tools/pygrub/src/ExtLinuxConf.py -@@ -10,9 +10,11 @@ - # along with this program; If not, see <http://www.gnu.org/licenses/>. - # - -+from __future__ import print_function, absolute_import -+ - import sys, re, os - import logging --import GrubConf -+from . import GrubConf - - class ExtLinuxImage(object): - def __init__(self, lines, path): -@@ -32,7 +34,8 @@ class ExtLinuxImage(object): - self.lines = [] - self.path = path - self.root = "" -- map(self.set_from_line, lines) -+ for line in lines: -+ self.set_from_line(line) - - def set_from_line(self, line, replace = None): - (com, arg) = GrubConf.grub_exact_split(line, 2) -@@ -67,7 +70,7 @@ class ExtLinuxImage(object): - setattr(self, "initrd", a.replace("initrd=", "")) - arg = arg.replace(a, "") - -- if com is not None and self.commands.has_key(com): -+ if com is not None and com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip())) - else: -@@ -136,7 +139,7 @@ class ExtLinuxConfigFile(object): - def parse(self, buf = None): - if buf is None: - if self.filename is None: -- raise ValueError, "No config file defined to parse!" -+ raise ValueError("No config file defined to parse!") - - f = open(self.filename, 'r') - lines = f.readlines() -@@ -167,7 +170,7 @@ class ExtLinuxConfigFile(object): - - (com, arg) = GrubConf.grub_exact_split(l, 2) - com = com.lower() -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -207,8 +210,8 @@ class ExtLinuxConfigFile(object): - - if __name__ == "__main__": - if len(sys.argv) < 2: -- raise RuntimeError, "Need a configuration file to read" -+ raise RuntimeError("Need a configuration file to read") - g = ExtLinuxConfigFile(sys.argv[1]) - for i in g.images: -- print i -- print g.default -+ print(i) -+ print(g.default) -diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py -index dc810d55cb..f8d3799dc0 100644 ---- a/tools/pygrub/src/GrubConf.py -+++ b/tools/pygrub/src/GrubConf.py -@@ -12,6 +12,8 @@ - # along with this program; If not, see <http://www.gnu.org/licenses/>. - # - -+from __future__ import print_function, absolute_import -+ - import os, sys - import logging - import re -@@ -44,7 +46,7 @@ def get_path(s): - return (None, s) - idx = s.find(')') - if idx == -1: -- raise ValueError, "Unable to find matching ')'" -+ raise ValueError("Unable to find matching ')'") - d = s[:idx] - return (GrubDiskPart(d), s[idx + 1:]) - -@@ -100,7 +102,8 @@ class _GrubImage(object): - " initrd: %s\n" %(self.title, self.root, self.kernel, - self.args, self.initrd)) - def _parse(self, lines): -- map(self.set_from_line, lines) -+ for line in lines: -+ self.set_from_line(line) - - def reset(self, lines): - self._root = self._initrd = self._kernel = self._args = None -@@ -141,7 +144,7 @@ class GrubImage(_GrubImage): - def set_from_line(self, line, replace = None): - (com, arg) = grub_exact_split(line, 2) - -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -177,7 +180,7 @@ class _GrubConfigFile(object): - self.parse() - - def parse(self, buf = None): -- raise RuntimeError, "unimplemented parse function" -+ raise RuntimeError("unimplemented parse function") - - def hasPasswordAccess(self): - return self.passwordAccess -@@ -201,7 +204,7 @@ class _GrubConfigFile(object): - import crypt - if crypt.crypt(password, pwd[1]) == pwd[1]: - return True -- except Exception, e: -+ except Exception as e: - self.passExc = "Can't verify password: %s" % str(e) - return False - -@@ -213,7 +216,7 @@ class _GrubConfigFile(object): - - def set(self, line): - (com, arg) = grub_exact_split(line, 2) -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -233,7 +236,7 @@ class _GrubConfigFile(object): - self._default = val - - if self._default < 0: -- raise ValueError, "default must be positive number" -+ raise ValueError("default must be positive number") - default = property(_get_default, _set_default) - - def set_splash(self, val): -@@ -265,7 +268,7 @@ class GrubConfigFile(_GrubConfigFile): - def parse(self, buf = None): - if buf is None: - if self.filename is None: -- raise ValueError, "No config file defined to parse!" -+ raise ValueError("No config file defined to parse!") - - f = open(self.filename, 'r') - lines = f.readlines() -@@ -296,7 +299,7 @@ class GrubConfigFile(_GrubConfigFile): - continue - - (com, arg) = grub_exact_split(l, 2) -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -328,7 +331,7 @@ class Grub2Image(_GrubImage): - if com == "set": - (com,arg) = grub2_handle_set(arg) - -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -364,7 +367,7 @@ class Grub2ConfigFile(_GrubConfigFile): - def parse(self, buf = None): - if buf is None: - if self.filename is None: -- raise ValueError, "No config file defined to parse!" -+ raise ValueError("No config file defined to parse!") - - f = open(self.filename, 'r') - lines = f.readlines() -@@ -398,7 +401,7 @@ class Grub2ConfigFile(_GrubConfigFile): - title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l) - if title_match: - if img is not None: -- raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img) -+ raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img)) - img = [] - title = title_match.group(1) - continue -@@ -413,7 +416,7 @@ class Grub2ConfigFile(_GrubConfigFile): - menu_level -= 1 - continue - else: -- raise RuntimeError, "syntax error: closing brace without menuentry" -+ raise RuntimeError("syntax error: closing brace without menuentry") - - self.add_image(Grub2Image(title, img)) - img = None -@@ -428,7 +431,7 @@ class Grub2ConfigFile(_GrubConfigFile): - if com == "set": - (com,arg) = grub2_handle_set(arg) - -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - arg_strip = arg.strip() - if arg_strip == "${saved_entry}" or arg_strip == "${next_entry}": -@@ -443,7 +446,7 @@ class Grub2ConfigFile(_GrubConfigFile): - logging.warning("Unknown directive %s" %(com,)) - - if img is not None: -- raise RuntimeError, "syntax error: end of file with open menuentry(%d %s)" % (len(img),img) -+ raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img)) - - if self.hasPassword(): - self.setPasswordAccess(False) -@@ -462,12 +465,12 @@ class Grub2ConfigFile(_GrubConfigFile): - - if __name__ == "__main__": - if len(sys.argv) < 3: -- raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read" -+ raise RuntimeError('Need a grub version ("grub" or "grub2") and a grub.conf or grub.cfg to read') - if sys.argv[1] == "grub": - g = GrubConfigFile(sys.argv[2]) - elif sys.argv[1] == "grub2": - g = Grub2ConfigFile(sys.argv[2]) - else: -- raise RuntimeError, "Unknown config type %s" % sys.argv[1] -+ raise RuntimeError("Unknown config type %s" % sys.argv[1]) - for i in g.images: -- print i #, i.title, i.root, i.kernel, i.args, i.initrd -+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd -diff --git a/tools/pygrub/src/LiloConf.py b/tools/pygrub/src/LiloConf.py -index 2cb649f115..e3bfcb5244 100644 ---- a/tools/pygrub/src/LiloConf.py -+++ b/tools/pygrub/src/LiloConf.py -@@ -2,9 +2,11 @@ - #LiloConf.py - # - -+from __future__ import print_function, absolute_import -+ - import sys, re, os - import logging --import GrubConf -+from . import GrubConf - - class LiloImage(object): - def __init__(self, lines, path): -@@ -24,12 +26,13 @@ class LiloImage(object): - self.lines = [] - self.path = path - self.root = "" -- map(self.set_from_line, lines) -+ for line in lines: -+ self.set_from_line(line) - - def set_from_line(self, line, replace = None): - (com, arg) = GrubConf.grub_exact_split(line, 2) - -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip())) - else: -@@ -97,7 +100,7 @@ class LiloConfigFile(object): - def parse(self, buf = None): - if buf is None: - if self.filename is None: -- raise ValueError, "No config file defined to parse!" -+ raise ValueError("No config file defined to parse!") - - f = open(self.filename, 'r') - lines = f.readlines() -@@ -127,7 +130,7 @@ class LiloConfigFile(object): - continue - - (com, arg) = GrubConf.grub_exact_split(l, 2) -- if self.commands.has_key(com): -+ if com in self.commands: - if self.commands[com] is not None: - setattr(self, self.commands[com], arg.strip()) - else: -@@ -170,8 +173,8 @@ class LiloConfigFile(object): - - if __name__ == "__main__": - if len(sys.argv) < 2: -- raise RuntimeError, "Need a lilo.conf to read" -+ raise RuntimeError("Need a lilo.conf to read") - g = LiloConfigFile(sys.argv[1]) - for i in g.images: -- print i #, i.title, i.root, i.kernel, i.args, i.initrd -- print g.default -+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd -+ print(g.default) -diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub -index 1189b1ca48..dbdce315c6 100755 ---- a/tools/pygrub/src/pygrub -+++ b/tools/pygrub/src/pygrub -@@ -12,13 +12,15 @@ - # along with this program; If not, see <http://www.gnu.org/licenses/>. - # - -+from __future__ import print_function -+ - import os, sys, string, struct, tempfile, re, traceback, stat, errno - import copy - import logging - import platform - import xen.lowlevel.xc - --import curses, _curses, curses.wrapper, curses.textpad, curses.ascii -+import curses, _curses, curses.textpad, curses.ascii - import getopt - - import xenfsimage -@@ -77,7 +79,7 @@ def get_solaris_slice(file, offset): - buf = os.read(fd, 512) - os.close(fd) - if struct.unpack("<H", buf[508:510])[0] != DKL_MAGIC: -- raise RuntimeError, "Invalid disklabel magic" -+ raise RuntimeError("Invalid disklabel magic") - - nslices = struct.unpack("<H", buf[30:32])[0] - -@@ -88,7 +90,7 @@ def get_solaris_slice(file, offset): - if slicetag == V_ROOT: - return slicesect * SECTOR_SIZE - -- raise RuntimeError, "No root slice found" -+ raise RuntimeError("No root slice found") - - def get_fs_offset_gpt(file): - fd = os.open(file, os.O_RDONLY) -@@ -423,20 +425,17 @@ class Grub: - we're being given a raw config file rather than a disk image.""" - - if not os.access(fn, os.R_OK): -- raise RuntimeError, "Unable to access %s" %(fn,) -+ raise RuntimeError("Unable to access %s" %(fn,)) - -- cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), -- ["/boot/grub/grub.cfg", "/grub/grub.cfg", -- "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \ -- map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile), -- ["/boot/isolinux/isolinux.cfg", -+ cfg_list = [(x,grub.GrubConf.Grub2ConfigFile) for x in ["/boot/grub/grub.cfg", "/grub/grub.cfg", -+ "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]] + \ -+ [(x,grub.ExtLinuxConf.ExtLinuxConfigFile) for x in ["/boot/isolinux/isolinux.cfg", - "/boot/extlinux/extlinux.conf", - "/boot/extlinux.conf", - "/extlinux/extlinux.conf", -- "/extlinux.conf"]) + \ -- map(lambda x: (x,grub.GrubConf.GrubConfigFile), -- ["/boot/grub/menu.lst", "/boot/grub/grub.conf", -- "/grub/menu.lst", "/grub/grub.conf"]) -+ "/extlinux.conf"]] + \ -+ [(x,grub.GrubConf.GrubConfigFile) for x in ["/boot/grub/menu.lst", "/boot/grub/grub.conf", -+ "/grub/menu.lst", "/grub/grub.conf"]] - - if not fs: - # set the config file and parse it -@@ -448,12 +447,12 @@ class Grub: - - for f,parser in cfg_list: - if fs.file_exists(f): -- print >>sys.stderr, "Using %s to parse %s" % (parser,f) -+ print("Using %s to parse %s" % (parser,f), file=sys.stderr) - self.cf = parser() - self.cf.filename = f - break - if self.__dict__.get('cf', None) is None: -- raise RuntimeError, "couldn't find bootloader config file in the image provided." -+ raise RuntimeError("couldn't find bootloader config file in the image provided.") - f = fs.open_file(self.cf.filename) - # limit read size to avoid pathological cases - buf = f.read(FS_READ_MAX) -@@ -628,11 +627,11 @@ def run_grub(file, entry, fs, cfg_args): - if list_entries: - for i in range(len(g.cf.images)): - img = g.cf.images[i] -- print "title: %s" % img.title -- print " root: %s" % img.root -- print " kernel: %s" % img.kernel[1] -- print " args: %s" % img.args -- print " initrd: %s" % img.initrd[1] -+ print("title: %s" % img.title) -+ print(" root: %s" % img.root) -+ print(" kernel: %s" % img.kernel[1]) -+ print(" args: %s" % img.args) -+ print(" initrd: %s" % img.initrd[1]) - - if interactive and not list_entries: - curses.wrapper(run_main) -@@ -646,7 +645,7 @@ def run_grub(file, entry, fs, cfg_args): - sel = idx - - if sel == -1: -- print "No kernel image selected!" -+ print("No kernel image selected!") - sys.exit(1) - - try: -@@ -731,7 +730,7 @@ def format_sxp(kernel, ramdisk, args): - def format_simple(kernel, ramdisk, args, sep): - for check in (kernel, ramdisk, args): - if check is not None and sep in check: -- raise RuntimeError, "simple format cannot represent delimiter-containing value" -+ raise RuntimeError("simple format cannot represent delimiter-containing value") - s = ("kernel %s" % kernel) + sep - if ramdisk: - s += ("ramdisk %s" % ramdisk) + sep -@@ -744,7 +743,7 @@ if __name__ == "__main__": - sel = None - - def usage(): -- print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],) -+ print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr) - - def copy_from_image(fs, file_to_read, file_type, output_directory, - not_really): -@@ -755,8 +754,8 @@ if __name__ == "__main__": - sys.exit("The requested %s file does not exist" % file_type) - try: - datafile = fs.open_file(file_to_read) -- except Exception, e: -- print >>sys.stderr, e -+ except Exception as e: -+ print(e, file=sys.stderr) - sys.exit("Error opening %s in guest" % file_to_read) - (tfd, ret) = tempfile.mkstemp(prefix="boot_"+file_type+".", - dir=output_directory) -@@ -769,8 +768,8 @@ if __name__ == "__main__": - return ret - try: - os.write(tfd, data) -- except Exception, e: -- print >>sys.stderr, e -+ except Exception as e: -+ print(e, file=sys.stderr) - os.close(tfd) - os.unlink(ret) - del datafile -@@ -834,7 +833,7 @@ if __name__ == "__main__": - try: - part_offs = [ int(a) ] - except ValueError: -- print "offset value must be an integer" -+ print("offset value must be an integer") - usage() - sys.exit(1) - elif o in ("--entry",): -@@ -847,13 +846,13 @@ if __name__ == "__main__": - debug = True - elif o in ("--output-format",): - if a not in ["sxp", "simple", "simple0"]: -- print "unknown output format %s" % a -+ print("unknown output format %s" % a) - usage() - sys.exit(1) - output_format = a - elif o in ("--output-directory",): - if not os.path.isdir(a): -- print "%s is not an existing directory" % a -+ print("%s is not an existing directory" % a) - sys.exit(1) - output_directory = a - -@@ -862,8 +861,8 @@ if __name__ == "__main__": - - - try: -- os.makedirs(output_directory, 0700) -- except OSError,e: -+ os.makedirs(output_directory, 0o700) -+ except OSError as e: - if (e.errno == errno.EEXIST) and os.path.isdir(output_directory): - pass - else: -@@ -877,10 +876,10 @@ if __name__ == "__main__": - # debug - if isconfig: - chosencfg = run_grub(file, entry, fs, incfg["args"]) -- print " kernel: %s" % chosencfg["kernel"] -+ print(" kernel: %s" % chosencfg["kernel"]) - if chosencfg["ramdisk"]: -- print " initrd: %s" % chosencfg["ramdisk"] -- print " args: %s" % chosencfg["args"] -+ print(" initrd: %s" % chosencfg["ramdisk"]) -+ print(" args: %s" % chosencfg["args"]) - sys.exit(0) - - # if boot filesystem is set then pass to fsimage.open -@@ -926,7 +925,7 @@ if __name__ == "__main__": - - # Did looping through partitions find us a kernel? - if fs is None: -- raise RuntimeError, "Unable to find partition containing kernel" -+ raise RuntimeError("Unable to find partition containing kernel") - - bootcfg["kernel"] = copy_from_image(fs, chosencfg["kernel"], "kernel", - output_directory, not_really) --- -2.17.1 - diff --git a/recipes-extended/xen/files/xen-tools-pygrub-py3.patch b/recipes-extended/xen/files/xen-tools-pygrub-py3.patch deleted file mode 100644 index e486646..0000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-py3.patch +++ /dev/null @@ -1,233 +0,0 @@ -From 83a204e6951c6358f995da3b60dd61224e9d41ac Mon Sep 17 00:00:00 2001 -From: Wei Liu <wei.liu2@citrix.com> -Date: Tue, 5 Mar 2019 14:13:17 +0000 -Subject: [PATCH] pygrub/fsimage: make it work with python 3 - -With the help of two porting guides and cpython source code: - -1. Use PyBytes to replace PyString counterparts. -2. Use PyVarObject_HEAD_INIT. -3. Remove usage of Py_FindMethod. -4. Use new module initialisation routine. - -For #3, Py_FindMethod was removed, yet an alternative wasn't -documented. The code is the result of reverse-engineering cpython -commit 6116d4a1d1 - -https://docs.python.org/3/howto/cporting.html -http://python3porting.com/cextensions.html - -Signed-off-by: Wei Liu <wei.liu2@citrix.com> -Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ---- - tools/pygrub/src/fsimage/fsimage.c | 123 ++++++++++++++++------------- - 1 file changed, 69 insertions(+), 54 deletions(-) - -diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c -index 780207791c..2ebbbe35df 100644 ---- a/tools/pygrub/src/fsimage/fsimage.c -+++ b/tools/pygrub/src/fsimage/fsimage.c -@@ -26,12 +26,6 @@ - #include <xenfsimage.h> - #include <stdlib.h> - --#if (PYTHON_API_VERSION >= 1011) --#define PY_PAD 0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L --#else --#define PY_PAD 0L,0L,0L,0L --#endif -- - typedef struct fsimage_fs { - PyObject_HEAD - fsi_t *fs; -@@ -59,12 +53,24 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs) - - bufsize = size ? size : 4096; - -- if ((buffer = PyString_FromStringAndSize(NULL, bufsize)) == NULL) -+ buffer = -+#if PY_MAJOR_VERSION < 3 -+ PyString_FromStringAndSize(NULL, bufsize); -+#else -+ PyBytes_FromStringAndSize(NULL, bufsize); -+#endif -+ -+ if (buffer == NULL) - return (NULL); - - while (1) { - int err; -- void *buf = PyString_AS_STRING(buffer) + bytesread; -+ void *buf = -+#if PY_MAJOR_VERSION < 3 -+ PyString_AS_STRING(buffer) + bytesread; -+#else -+ PyBytes_AS_STRING(buffer) + bytesread; -+#endif - - err = fsi_pread_file(file->file, buf, bufsize, - bytesread + offset); -@@ -84,12 +90,20 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs) - if (bufsize == 0) - break; - } else { -+#if PY_MAJOR_VERSION < 3 - if (_PyString_Resize(&buffer, bytesread + bufsize) < 0) -+#else -+ if (_PyBytes_Resize(&buffer, bytesread + bufsize) < 0) -+#endif - return (NULL); - } - } - -+#if PY_MAJOR_VERSION < 3 - _PyString_Resize(&buffer, bytesread); -+#else -+ _PyBytes_Resize(&buffer, bytesread); -+#endif - return (buffer); - } - -@@ -106,11 +120,13 @@ static struct PyMethodDef fsimage_file_methods[] = { - { NULL, NULL, 0, NULL } - }; - -+#if PY_MAJOR_VERSION < 3 - static PyObject * - fsimage_file_getattr(fsimage_file_t *file, char *name) - { - return (Py_FindMethod(fsimage_file_methods, (PyObject *)file, name)); - } -+#endif - - static void - fsimage_file_dealloc(fsimage_file_t *file) -@@ -123,29 +139,18 @@ fsimage_file_dealloc(fsimage_file_t *file) - - static char fsimage_file_type__doc__[] = "Filesystem image file"; - PyTypeObject fsimage_file_type = { -- PyObject_HEAD_INIT(&PyType_Type) -- 0, /* ob_size */ -- "xenfsimage.file", /* tp_name */ -- sizeof(fsimage_file_t), /* tp_size */ -- 0, /* tp_itemsize */ -- (destructor) fsimage_file_dealloc, /* tp_dealloc */ -- 0, /* tp_print */ -- (getattrfunc) fsimage_file_getattr, /* tp_getattr */ -- 0, /* tp_setattr */ -- 0, /* tp_compare */ -- 0, /* tp_repr */ -- 0, /* tp_as_number */ -- 0, /* tp_as_sequence */ -- 0, /* tp_as_mapping */ -- 0, /* tp_hash */ -- 0, /* tp_call */ -- 0, /* tp_str */ -- 0, /* tp_getattro */ -- 0, /* tp_setattro */ -- 0, /* tp_as_buffer */ -- Py_TPFLAGS_DEFAULT, /* tp_flags */ -- fsimage_file_type__doc__, -- PY_PAD -+ PyVarObject_HEAD_INIT(&PyType_Type, 0) -+ .tp_name = "xenfsimage.file", -+ .tp_basicsize = sizeof(fsimage_file_t), -+ .tp_dealloc = (destructor) fsimage_file_dealloc, -+#if PY_MAJOR_VERSION < 3 -+ .tp_getattr = (getattrfunc) fsimage_file_getattr, -+#endif -+ .tp_flags = Py_TPFLAGS_DEFAULT, -+ .tp_doc = fsimage_file_type__doc__, -+#if PY_MAJOR_VERSION >= 3 -+ .tp_methods = fsimage_file_methods, -+#endif - }; - - static PyObject * -@@ -208,11 +213,13 @@ static struct PyMethodDef fsimage_fs_methods[] = { - { NULL, NULL, 0, NULL } - }; - -+#if PY_MAJOR_VERSION < 3 - static PyObject * - fsimage_fs_getattr(fsimage_fs_t *fs, char *name) - { - return (Py_FindMethod(fsimage_fs_methods, (PyObject *)fs, name)); - } -+#endif - - static void - fsimage_fs_dealloc (fsimage_fs_t *fs) -@@ -225,29 +232,18 @@ fsimage_fs_dealloc (fsimage_fs_t *fs) - PyDoc_STRVAR(fsimage_fs_type__doc__, "Filesystem image"); - - PyTypeObject fsimage_fs_type = { -- PyObject_HEAD_INIT(&PyType_Type) -- 0, /* ob_size */ -- "xenfsimage.fs", /* tp_name */ -- sizeof(fsimage_fs_t), /* tp_size */ -- 0, /* tp_itemsize */ -- (destructor) fsimage_fs_dealloc, /* tp_dealloc */ -- 0, /* tp_print */ -- (getattrfunc) fsimage_fs_getattr, /* tp_getattr */ -- 0, /* tp_setattr */ -- 0, /* tp_compare */ -- 0, /* tp_repr */ -- 0, /* tp_as_number */ -- 0, /* tp_as_sequence */ -- 0, /* tp_as_mapping */ -- 0, /* tp_hash */ -- 0, /* tp_call */ -- 0, /* tp_str */ -- 0, /* tp_getattro */ -- 0, /* tp_setattro */ -- 0, /* tp_as_buffer */ -- Py_TPFLAGS_DEFAULT, /* tp_flags */ -- fsimage_fs_type__doc__, -- PY_PAD -+ PyVarObject_HEAD_INIT(&PyType_Type, 0) -+ .tp_name = "xenfsimage.fs", -+ .tp_basicsize = sizeof(fsimage_fs_t), -+ .tp_dealloc = (destructor) fsimage_fs_dealloc, -+#if PY_MAJOR_VERSION < 3 -+ .tp_getattr = (getattrfunc) fsimage_fs_getattr, -+#endif -+ .tp_flags = Py_TPFLAGS_DEFAULT, -+ .tp_doc = fsimage_fs_type__doc__, -+#if PY_MAJOR_VERSION >= 3 -+ .tp_methods = fsimage_fs_methods, -+#endif - }; - - static PyObject * -@@ -309,8 +305,27 @@ static struct PyMethodDef fsimage_module_methods[] = { - { NULL, NULL, 0, NULL } - }; - -+#if PY_MAJOR_VERSION >= 3 -+static struct PyModuleDef fsimage_module_def = { -+ PyModuleDef_HEAD_INIT, -+ .m_name = "xenfsimage", -+ .m_size = -1, -+ .m_methods = fsimage_module_methods, -+}; -+#endif -+ - PyMODINIT_FUNC -+#if PY_MAJOR_VERSION >= 3 -+PyInit_xenfsimage(void) -+#else - initxenfsimage(void) -+#endif - { -+#if PY_MAJOR_VERSION < 3 - Py_InitModule("xenfsimage", fsimage_module_methods); -+#else -+ if (PyType_Ready(&fsimage_fs_type) < 0 || PyType_Ready(&fsimage_file_type) < 0) -+ return NULL; -+ return PyModule_Create(&fsimage_module_def); -+#endif - } --- -2.17.1 - diff --git a/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch b/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch deleted file mode 100644 index b32c5d0..0000000 --- a/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 88d703a361d34d75f81fc6d30b31d0abc8aa17eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - <marmarek@invisiblethingslab.com> -Date: Fri, 9 Aug 2019 03:01:36 +0100 -Subject: [PATCH] python: fix -Wsign-compare warnings -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Specifically: -xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_create’: -xen/lowlevel/xc/xc.c:147:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 147 | for ( i = 0; i < sizeof(xen_domain_handle_t); i++ ) - | ^ -xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_sethandle’: -xen/lowlevel/xc/xc.c:312:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 312 | for ( i = 0; i < sizeof(xen_domain_handle_t); i++ ) - | ^ -xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_getinfo’: -xen/lowlevel/xc/xc.c:391:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 391 | for ( j = 0; j < sizeof(xen_domain_handle_t); j++ ) - | ^ -xen/lowlevel/xc/xc.c: In function ‘pyxc_get_device_group’: -xen/lowlevel/xc/xc.c:677:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] - 677 | for ( i = 0; i < num_sdevs; i++ ) - | ^ -xen/lowlevel/xc/xc.c: In function ‘pyxc_physinfo’: -xen/lowlevel/xc/xc.c:988:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 988 | for ( i = 0; i < sizeof(pinfo.hw_cap)/4; i++ ) - | ^ -xen/lowlevel/xc/xc.c:994:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 994 | for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) - | ^ -xen/lowlevel/xc/xc.c:998:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] - 998 | for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ ) - | ^ -xen/lowlevel/xs/xs.c: In function ‘xspy_ls’: -xen/lowlevel/xs/xs.c:191:23: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] - 191 | for (i = 0; i < xsval_n; i++) - | ^ -xen/lowlevel/xs/xs.c: In function ‘xspy_get_permissions’: -xen/lowlevel/xs/xs.c:297:23: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] - 297 | for (i = 0; i < perms_n; i++) { - | ^ -cc1: all warnings being treated as errors - -Use size_t for loop iterators where it's compared with sizeof() or -similar construct. - -Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> -Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> - -Modified to apply to Xen 4.12.2 by Christopher Clark -Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> ---- - tools/python/xen/lowlevel/xc/xc.c | 13 ++++++++----- - tools/python/xen/lowlevel/xs/xs.c | 4 ++-- - 2 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c -index 522cbe3b9c..188bfa34da 100644 ---- a/tools/python/xen/lowlevel/xc/xc.c -+++ b/tools/python/xen/lowlevel/xc/xc.c -@@ -117,7 +117,8 @@ static PyObject *pyxc_domain_create(XcObject *self, - PyObject *kwds) - { - uint32_t dom = 0, target = 0; -- int ret, i; -+ int ret; -+ size_t i; - PyObject *pyhandle = NULL; - struct xen_domctl_createdomain config = { - .handle = { -@@ -295,7 +296,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self, - - static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args) - { -- int i; -+ size_t i; - uint32_t dom; - PyObject *pyhandle; - xen_domain_handle_t handle; -@@ -336,7 +337,8 @@ static PyObject *pyxc_domain_getinfo(XcObject *self, - PyObject *list, *info_dict, *pyhandle; - - uint32_t first_dom = 0; -- int max_doms = 1024, nr_doms, i, j; -+ int max_doms = 1024, nr_doms, i; -+ size_t j; - xc_dominfo_t *info; - - static char *kwd_list[] = { "first_dom", "max_doms", NULL }; -@@ -631,7 +633,8 @@ static PyObject *pyxc_get_device_group(XcObject *self, - { - uint32_t sbdf; - uint32_t max_sdevs, num_sdevs; -- int domid, seg, bus, dev, func, rc, i; -+ int domid, seg, bus, dev, func, rc; -+ size_t i; - PyObject *Pystr; - char *group_str; - char dev_str[9]; -@@ -971,7 +974,7 @@ static PyObject *pyxc_physinfo(XcObject *self) - { - xc_physinfo_t pinfo; - char cpu_cap[128], virt_caps[128], *p; -- int i; -+ size_t i; - const char *virtcap_names[] = { "hvm", "hvm_directio" }; - - if ( xc_physinfo(self->xc_handle, &pinfo) != 0 ) -diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c -index 9a0acfc25c..ea50f86bc3 100644 ---- a/tools/python/xen/lowlevel/xs/xs.c -+++ b/tools/python/xen/lowlevel/xs/xs.c -@@ -186,7 +186,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args) - Py_END_ALLOW_THREADS - - if (xsval) { -- int i; -+ size_t i; - PyObject *val = PyList_New(xsval_n); - for (i = 0; i < xsval_n; i++) - #if PY_MAJOR_VERSION >= 3 -@@ -276,7 +276,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args) - struct xs_handle *xh = xshandle(self); - struct xs_permissions *perms; - unsigned int perms_n = 0; -- int i; -+ size_t i; - - xs_transaction_t th; - char *thstr; --- -2.17.1 - diff --git a/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch b/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch deleted file mode 100644 index 455072b..0000000 --- a/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch +++ /dev/null @@ -1,140 +0,0 @@ -From a9047a722ba5de38e7c1d762ffcfb74c36725fe2 Mon Sep 17 00:00:00 2001 -From: Andrew Cooper <andrew.cooper3@citrix.com> -Date: Mon, 11 Mar 2019 19:18:40 +0000 -Subject: [PATCH] tools/xen-foreign: Update python scripts to be Py3 compatible - -The issues are: - * dict.has_key() was completely removed in Py3 - * dict.keys() is an iterable rather than list in Py3, so .sort() doesn't work. - * list.sort(cmp=) was deprecated in Py2.4 and removed in Py3. - -The has_key() issue is trivially fixed by switching to using the in keyword. -The sorting issue could be trivially fixed, but take the opportunity to -improve the code. - -The reason for the sorting is to ensure that "unsigned long" gets replaced -before "long", and the only reason sorting is necessary is because -inttypes[arch] is needlessly a dictionary. Update inttypes[arch] to be a list -of tuples rather than a dictionary, and process them in list order. - -Reported-by: George Dunlap <george.dunlap@eu.citrix.com> -Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> -Acked-by: Wei Liu <wei.liu2@citrix.com> ---- - tools/include/xen-foreign/mkchecker.py | 2 +- - tools/include/xen-foreign/mkheader.py | 58 +++++++++++++------------- - 2 files changed, 29 insertions(+), 31 deletions(-) - -diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py -index fdad869a91..199b0eebbc 100644 ---- a/tools/include/xen-foreign/mkchecker.py -+++ b/tools/include/xen-foreign/mkchecker.py -@@ -37,7 +37,7 @@ for struct in structs: - f.write('\tprintf("%%-25s |", "%s");\n' % struct); - for a in archs: - s = struct + "_" + a; -- if compat_arches.has_key(a): -+ if a in compat_arches: - compat = compat_arches[a] - c = struct + "_" + compat; - else: -diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py -index 97e0c7a984..fb268f0dce 100644 ---- a/tools/include/xen-foreign/mkheader.py -+++ b/tools/include/xen-foreign/mkheader.py -@@ -17,13 +17,13 @@ header = {}; - footer = {}; - - #arm --inttypes["arm32"] = { -- "unsigned long" : "__danger_unsigned_long_on_arm32", -- "long" : "__danger_long_on_arm32", -- "xen_pfn_t" : "uint64_t", -- "xen_ulong_t" : "uint64_t", -- "uint64_t" : "__align8__ uint64_t", --}; -+inttypes["arm32"] = [ -+ ("unsigned long", "__danger_unsigned_long_on_arm32"), -+ ("long", "__danger_long_on_arm32"), -+ ("xen_pfn_t", "uint64_t"), -+ ("xen_ulong_t", "uint64_t"), -+ ("uint64_t", "__align8__ uint64_t"), -+] - header["arm32"] = """ - #define __arm___ARM32 1 - #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -@@ -38,13 +38,13 @@ footer["arm32"] = """ - #undef __DECL_REG - """ - --inttypes["arm64"] = { -- "unsigned long" : "__danger_unsigned_long_on_arm64", -- "long" : "__danger_long_on_arm64", -- "xen_pfn_t" : "uint64_t", -- "xen_ulong_t" : "uint64_t", -- "uint64_t" : "__align8__ uint64_t", --}; -+inttypes["arm64"] = [ -+ ("unsigned long", "__danger_unsigned_long_on_arm64"), -+ ("long", "__danger_long_on_arm64"), -+ ("xen_pfn_t", "uint64_t"), -+ ("xen_ulong_t", "uint64_t"), -+ ("uint64_t", "__align8__ uint64_t"), -+] - header["arm64"] = """ - #define __aarch64___ARM64 1 - #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -@@ -60,12 +60,12 @@ footer["arm64"] = """ - """ - - # x86_32 --inttypes["x86_32"] = { -- "unsigned long" : "uint32_t", -- "long" : "uint32_t", -- "xen_pfn_t" : "uint32_t", -- "xen_ulong_t" : "uint32_t", --}; -+inttypes["x86_32"] = [ -+ ("unsigned long", "uint32_t"), -+ ("long", "uint32_t"), -+ ("xen_pfn_t", "uint32_t"), -+ ("xen_ulong_t", "uint32_t"), -+] - header["x86_32"] = """ - #define __DECL_REG_LO8(which) uint32_t e ## which ## x - #define __DECL_REG_LO16(name) uint32_t e ## name -@@ -79,12 +79,12 @@ footer["x86_32"] = """ - """; - - # x86_64 --inttypes["x86_64"] = { -- "unsigned long" : "__align8__ uint64_t", -- "long" : "__align8__ uint64_t", -- "xen_pfn_t" : "__align8__ uint64_t", -- "xen_ulong_t" : "__align8__ uint64_t", --}; -+inttypes["x86_64"] = [ -+ ("unsigned long", "__align8__ uint64_t"), -+ ("long", "__align8__ uint64_t"), -+ ("xen_pfn_t", "__align8__ uint64_t"), -+ ("xen_ulong_t", "__align8__ uint64_t"), -+] - header["x86_64"] = """ - #if defined(__GNUC__) && !defined(__STRICT_ANSI__) - # define __DECL_REG(name) union { uint64_t r ## name, e ## name; } -@@ -205,10 +205,8 @@ for struct in structs: - output = re.sub("\\b(%s)_t\\b" % struct, "\\1_%s_t" % arch, output); - - # replace: integer types --integers = inttypes[arch].keys(); --integers.sort(lambda a, b: cmp(len(b),len(a))); --for type in integers: -- output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output); -+for old, new in inttypes[arch]: -+ output = re.sub("\\b%s\\b" % old, new, output) - - # print results - f = open(outfile, "w"); --- -2.17.1 - diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index 154e224..2feed00 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc @@ -65,6 +65,7 @@ RRECOMMENDS_${PN} = " \ ${PN}-flask \ ${PN}-hvmloader \ ${PN}-shim \ + ${PN}-ucode \ ${PN}-xenpaging \ " @@ -202,6 +203,7 @@ PACKAGES = " \ ${PN}-scripts-network \ ${PN}-shim \ ${PN}-staticdev \ + ${PN}-ucode \ ${PN}-volatiles \ ${PN}-xcutils \ ${PN}-xencommons \ @@ -529,6 +531,10 @@ FILES_${PN}-shim = " \ ${libdir}/xen/boot/xen-shim \ " +FILES_${PN}-ucode = "\ + ${sbindir}/xen-ucode \ + " + FILES_${PN}-volatiles = "\ ${sysconfdir}/default/volatiles/99_xen \ ${sysconfdir}/tmpfiles.d/xen.conf \ diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb index de9acc0..5f41915 100644 --- a/recipes-extended/xen/xen-tools_git.bb +++ b/recipes-extended/xen/xen-tools_git.bb @@ -1,21 +1,16 @@ -SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58" +SRCREV ?= "9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab" -XEN_REL ?= "4.12" +XEN_REL ?= "4.13" XEN_BRANCH ?= "stable-${XEN_REL}" SRC_URI = " \ git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \ - file://xen-tools-update-python-scripts-to-py3.patch \ - file://xen-tools-libxl-gentypes-py3.patch \ - file://xen-tools-python-fix-Wsign-compare-warnings.patch \ - file://xen-tools-pygrub-change-tabs-into-spaces.patch \ - file://xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch \ - file://xen-tools-pygrub-py3.patch \ file://0001-xen-build-temporarily-inhibit-Werror.patch \ + file://xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch \ " -LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" +LIC_FILES_CHKSUM ?= "file://COPYING;md5=4295d895d4b5ce9d070263d52f030e49" PV = "${XEN_REL}+git${SRCPV}" diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb index a7475ac..142bdcc 100644 --- a/recipes-extended/xen/xen_git.bb +++ b/recipes-extended/xen/xen_git.bb @@ -1,11 +1,11 @@ -SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58" +SRCREV ?= "9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab" -XEN_REL ?= "4.12" +XEN_REL ?= "4.13" XEN_BRANCH ?= "stable-${XEN_REL}" SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}" -LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" +LIC_FILES_CHKSUM ?= "file://COPYING;md5=4295d895d4b5ce9d070263d52f030e49" PV = "${XEN_REL}+git${SRCPV}" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 05/11] meta-virt-xen.inc: add Raspberry Pi settings 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (3 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 04/11] xen, xen-tools: update revision to Xen 4.13 Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 06/11] xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 Christopher Clark ` (7 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- conf/distro/include/meta-virt-xen.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc index a92b08b..2ada83a 100644 --- a/conf/distro/include/meta-virt-xen.inc +++ b/conf/distro/include/meta-virt-xen.inc @@ -4,3 +4,11 @@ PACKAGECONFIG_append_pn-qemu = " xen" # For builds for ARM platforms, enable fdt PACKAGECONFIG_append_pn-qemu_arm = " fdt" PACKAGECONFIG_append_pn-qemu_aarch64 = " fdt" + +# Raspberry Pi settings +# - Xen guest console +KERNEL_CONSOLE = "hvc0" +SERIAL_CONSOLES = "115200;hvc0" +# - Xen uses u-boot for configuration and uses the uart +RPI_USE_U_BOOT = "1" +ENABLE_UART = "1" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 06/11] xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (4 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 05/11] meta-virt-xen.inc: add Raspberry Pi settings Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 07/11] xen, raspberry pi 4: provide a default defconfig for raspberrypi4 Christopher Clark ` (6 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand A Xen-specific u-boot script is needed for launching Xen, and the GIC (interrupt controller) needs to be enabled. Since this is both Xen-specific and Raspberry Pi-specific, use a dynamic layer to conditionally enable the recipes when both meta-virtualization and meta-raspberrypi are in use together. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- conf/layer.conf | 15 ++++++ .../bootfiles/rpi-config_git.bbappend | 6 +++ .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 +++++++++++++++++++ .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 +++++++ 4 files changed, 87 insertions(+) create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend diff --git a/conf/layer.conf b/conf/layer.conf index 142621c..1ec7a15 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -11,6 +11,21 @@ BBFILE_PRIORITY_virtualization-layer = "8" # Custom licenses used by some packages in this layer LICENSE_PATH += "${LAYERDIR}/files/custom-licenses" +# The dynamic-layers directory hosts extensions and layer-specific +# modifications. +# +# The .bbappend and .bb files are included if the respective layer +# collection is available. +BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bbappend' % layer \ + for layer in BBFILE_COLLECTIONS.split())}" +BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bb' % layer \ + for layer in BBFILE_COLLECTIONS.split())}" + +BBFILES_DYNAMIC += " \ + raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bb \ + raspberrypi:${LAYERDIR}/dynamic-layers/rasbperrypi/*/*/*.bbappend \ +" + # This should only be incremented on significant changes that will # cause compatibility issues with other layers LAYERVERSION_virtualization-layer = "1" diff --git a/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend b/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend new file mode 100644 index 0000000..2b9c4fb --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend @@ -0,0 +1,6 @@ +do_deploy_append() { + # We need the GIC enabled for Xen to work. + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'yes', 'no', d)}" = "yes" ]; then + echo "enable_gic=1" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt + fi +} diff --git a/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in b/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in new file mode 100644 index 0000000..6c38d7d --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in @@ -0,0 +1,49 @@ +# Set the fdt address to what came from the GPU, so we can edit it +fdt addr ${fdt_addr} + +# Pull the bootargs that the GPU has edited +fdt get value bootargs /chosen bootargs + +# Set module load addresses +setenv xen_loadaddr "0x00200000" +setenv kernel_loadaddr "0x00400000" + +# Add some space to the fdt so we can edit it +fdt resize 0x1000 +echo Add boot arguments for Xen +fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/soc/serial@7e215040 dom0_mem='@@RPI_DOM0_MEM@@' @@RPI_DEBUG_XEN_ARGS@@" + +echo Add boot arguments for dom0 +setenv dom0_bootargs "console=hvc0 earlyprintk=xen debug root=/dev/mmcblk0p2 rootwait" +fdt set /chosen xen,dom0-bootargs \"${dom0_bootargs}\" + +echo Add a dom0 node to chosen to put Linux boot information in +fdt mknode /chosen dom0 + +echo Set this for the Linux boot command +fdt set /chosen/dom0 compatible "xen,linux-zimage", "xen,multiboot-module" + +# Tell Xen where PCI is +fdt set /scb/pcie@7d500000 device_type "pci" + +echo Delay to allow the MMC card to be ready +sleep 1 + +echo Load Xen into memory +fatload mmc 0:1 ${xen_loadaddr} xen +echo Load Linux kernel into memory +fatload mmc 0:1 ${kernel_loadaddr} Image +setenv kernel_size 0x$filesize + +echo Set the address and size for the Linux kernel so Xen can pick it up +fdt set /chosen/dom0 reg <${kernel_loadaddr} ${kernel_size}> + +# Define the size and address cells +fdt set /chosen '#size-cells' <1> +fdt set /chosen '#address-cells' <1> + +# Display the chosen fdt section - can be important for debugging +fdt print /chosen + +echo Boot Xen +booti ${xen_loadaddr} - ${fdt_addr} diff --git a/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend b/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend new file mode 100644 index 0000000..2a51116 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend @@ -0,0 +1,17 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +RPI_DOM0_MEM ??= "256M" +RPI_DEBUG_XEN_ARGS ??= "sync_console bootscrub=0" + +SRC_URI += "file://boot.cmd.xen.in" + +# If the distro is Xen enabled, override the default boot.cmd.in with the +# alternative boot.cmd.xen.in from this layer, with variables subsitution here +do_compile_append() { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'yes', 'no', d)}" = "yes" ]; then + sed -e 's/@@RPI_DOM0_MEM@@/${RPI_DOM0_MEM}/' \ + -e 's/@@RPI_DEBUG_XEN_ARGS@@/${RPI_DEBUG_XEN_ARGS}/' \ + "${WORKDIR}/boot.cmd.xen.in" > "${WORKDIR}/boot.cmd" + mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr + fi +} -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 07/11] xen, raspberry pi 4: provide a default defconfig for raspberrypi4 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (5 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 06/11] xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 08/11] xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support Christopher Clark ` (5 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- .../xen/files/defconfig_raspberrypi4-64 | 117 ++++++++++++++++++ .../recipes-extended/xen/xen_git.bbappend | 11 ++ 2 files changed, 128 insertions(+) create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend diff --git a/dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 b/dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 new file mode 100644 index 0000000..f3343d3 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 @@ -0,0 +1,117 @@ +# +# Automatically generated file; DO NOT EDIT. +# Xen/arm 4.13.0 Configuration +# +CONFIG_64BIT=y +CONFIG_ARM_64=y +CONFIG_ARM=y +CONFIG_ARCH_DEFCONFIG="arch/arm/configs/arm64_defconfig" + +# +# Architecture Features +# +CONFIG_NR_CPUS=128 +# CONFIG_ACPI is not set +CONFIG_GICV3=y +# CONFIG_HAS_ITS is not set +CONFIG_HVM=y +# CONFIG_NEW_VGIC is not set +CONFIG_SBSA_VUART_CONSOLE=y +CONFIG_ARM_SSBD=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y +# CONFIG_TEE is not set + +# +# ARM errata workaround via the alternative framework +# +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_819472=y +CONFIG_ARM64_ERRATUM_832075=y +CONFIG_ARM64_ERRATUM_834220=y +CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR=y +CONFIG_ALL_PLAT=y +# CONFIG_QEMU is not set +# CONFIG_RCAR3 is not set +# CONFIG_MPSOC is not set +# CONFIG_NO_PLAT is not set +CONFIG_ALL64_PLAT=y +# CONFIG_ALL32_PLAT is not set +CONFIG_MPSOC_PLATFORM=y + +# +# Common Features +# +CONFIG_GRANT_TABLE=y +CONFIG_HAS_ALTERNATIVE=y +CONFIG_HAS_DEVICE_TREE=y +CONFIG_HAS_FAST_MULTIPLY=y +# CONFIG_MEM_ACCESS is not set +CONFIG_HAS_PDX=y + +# +# Speculative hardening +# +CONFIG_SPECULATIVE_HARDEN_ARRAY=y +# CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP is not set +CONFIG_XSM=y +CONFIG_XSM_FLASK=y +CONFIG_XSM_FLASK_AVC_STATS=y +# CONFIG_XSM_FLASK_POLICY is not set +CONFIG_XSM_SILO=y +# CONFIG_XSM_DUMMY_DEFAULT is not set +# CONFIG_XSM_FLASK_DEFAULT is not set +CONFIG_XSM_SILO_DEFAULT=y +# CONFIG_ARGO is not set + +# +# Schedulers +# +CONFIG_SCHED_CREDIT=y +CONFIG_SCHED_CREDIT2=y +CONFIG_SCHED_RTDS=y +CONFIG_SCHED_ARINC653=y +CONFIG_SCHED_NULL=y +# CONFIG_SCHED_CREDIT_DEFAULT is not set +CONFIG_SCHED_CREDIT2_DEFAULT=y +# CONFIG_SCHED_RTDS_DEFAULT is not set +# CONFIG_SCHED_ARINC653_DEFAULT is not set +# CONFIG_SCHED_NULL_DEFAULT is not set +CONFIG_SCHED_DEFAULT="credit2" +# CONFIG_LIVEPATCH is not set +# CONFIG_ENFORCE_UNIQUE_SYMBOLS is not set +# CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set +CONFIG_CMDLINE="" +CONFIG_DOM0_MEM="" +CONFIG_TRACEBUFFER=y + +# +# Device Drivers +# +CONFIG_HAS_NS16550=y +CONFIG_HAS_CADENCE_UART=y +CONFIG_HAS_MVEBU=y +CONFIG_HAS_MESON=y +CONFIG_HAS_PL011=y +CONFIG_HAS_SCIF=y +CONFIG_HAS_PASSTHROUGH=y +CONFIG_ARM_SMMU=y +# CONFIG_IPMMU_VMSA is not set +CONFIG_IOMMU_FORCE_PT_SHARE=y +CONFIG_DEFCONFIG_LIST="arch/arm/configs/arm64_defconfig" + +# +# Debugging Options +# +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_FRAME_POINTER=y +# CONFIG_COVERAGE is not set +# CONFIG_DEBUG_LOCK_PROFILE is not set +CONFIG_DEBUG_LOCKS=y +# CONFIG_PERF_COUNTERS is not set +CONFIG_VERBOSE_DEBUG=y +# CONFIG_DEVICE_TREE_DEBUG is not set +CONFIG_SCRUB_DEBUG=y +# CONFIG_DEBUG_TRACE is not set +CONFIG_XMEM_POOL_POISON=y diff --git a/dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend b/dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend new file mode 100644 index 0000000..995dfd3 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend @@ -0,0 +1,11 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI_append_raspberrypi4-64 = " \ + file://defconfig_raspberrypi4-64 \ + " + +do_post_patch_append_raspberrypi4-64() { + if [ ! -e "${WORKDIR}/defconfig" ] ; then + cp "${WORKDIR}/defconfig_raspberrypi4-64" "${WORKDIR}/defconfig" + fi +} -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 08/11] xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (6 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 07/11] xen, raspberry pi 4: provide a default defconfig for raspberrypi4 Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 09/11] xen, raspberry pi: add Xen-specific SD card class Christopher Clark ` (4 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Kernel patches are in process of Linux review and submission, and are backported from the Linux Foundation's Eve Project kernel from 5.6 to 5.4 (some patches not needed for 5.4, hence gaps in the patch sequence number) https://github.com/lf-edge/eve/tree/master/pkg/new-kernel/patches-5.6.x A bbappend applies Xen overrides to the boot command line. Since linux-raspberrypi depends on linux-yocto, and linux-yocto_virtualization introduces a requirement for cfg/virtio.scc obtain it from the yocto kernel cache. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++++++++++ ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++++++++++ ...struct-device-parameter-to-xen_phys_.patch | 78 ++++++++++++++++ ...struct-device-parameter-to-xen_bus_t.patch | 66 ++++++++++++++ ...struct-device-parameter-to-is_xen_sw.patch | 57 ++++++++++++ ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++++++++++++++++++ ...translations-in-xen_dma_s_kernel_5.4.patch | 68 ++++++++++++++ ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 ++++++++++++++++ .../0011-adding-page-coherent-patch.patch | 39 ++++++++ .../linux/linux-raspberrypi_%.bbappend | 5 ++ .../linux/linux-raspberrypi_5.4.bbappend | 19 ++++ 11 files changed, 586 insertions(+) create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch new file mode 100644 index 0000000..09144ce --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch @@ -0,0 +1,44 @@ +From f5f4de59377afdd9a80e0f47df109eacf427c203 Mon Sep 17 00:00:00 2001 +From: Boris Ostrovsky <boris.ostrovsky@oracle.com> +Date: Wed, 20 May 2020 16:42:06 -0700 +Subject: [PATCH 01/10] swiotlb-xen: use vmalloc_to_page on vmalloc virt + addresses + +Don't just assume that virt_to_page works on all virtual addresses. +Instead add a is_vmalloc_addr check and use vmalloc_to_page on vmalloc +virt addresses. + +Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index b6d27762c6f8..a42129cba36e 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -335,6 +335,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, + int order = get_order(size); + phys_addr_t phys; + u64 dma_mask = DMA_BIT_MASK(32); ++ struct page *pg; + + if (hwdev && hwdev->coherent_dma_mask) + dma_mask = hwdev->coherent_dma_mask; +@@ -346,9 +347,11 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, + /* Convert the size to actually allocated. */ + size = 1UL << (order + XEN_PAGE_SHIFT); + ++ pg = is_vmalloc_addr(vaddr) ? vmalloc_to_page(vaddr) : ++ virt_to_page(vaddr); + if (!WARN_ON((dev_addr + size - 1 > dma_mask) || + range_straddles_page_boundary(phys, size)) && +- TestClearPageXenRemapped(virt_to_page(vaddr))) ++ TestClearPageXenRemapped(pg)) + xen_destroy_contiguous_region(phys, order); + + xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs); +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch new file mode 100644 index 0000000..9c572a1 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch @@ -0,0 +1,47 @@ +From d078eac368946990c27b86198d2a37416ea02002 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:42:11 -0700 +Subject: [PATCH 02/10] swiotlb-xen: remove start_dma_addr + +It is not strictly needed. Call virt_to_phys on xen_io_tlb_start +instead. It will be useful not to have a start_dma_addr around with the +next patches. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index a42129cba36e..b5e0492b07b9 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -52,8 +52,6 @@ static unsigned long xen_io_tlb_nslabs; + * Quick lookup value of the bus address of the IOTLB. + */ + +-static u64 start_dma_addr; +- + /* + * Both of these functions should avoid XEN_PFN_PHYS because phys_addr_t + * can be 32bit when dma_addr_t is 64bit leading to a loss in +@@ -241,7 +239,6 @@ int __ref xen_swiotlb_init(int verbose, bool early) + m_ret = XEN_SWIOTLB_EFIXUP; + goto error; + } +- start_dma_addr = xen_virt_to_bus(xen_io_tlb_start); + if (early) { + if (swiotlb_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs, + verbose)) +@@ -389,7 +386,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, + */ + trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force); + +- map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, ++ map = swiotlb_tbl_map_single(dev, virt_to_phys(xen_io_tlb_start), phys, + size, size, dir, attrs); + if (map == (phys_addr_t)DMA_MAPPING_ERROR) + return DMA_MAPPING_ERROR; +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch new file mode 100644 index 0000000..d90701b --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch @@ -0,0 +1,78 @@ +From 5ef503632a8df9be70f3c1ff828780e4348a03dc Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:42:11 -0700 +Subject: [PATCH 03/10] swiotlb-xen: add struct device* parameter to + xen_phys_to_bus + +The parameter is unused in this patch. +No functional changes. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index b5e0492b07b9..958ee5517e0b 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -57,7 +57,7 @@ static unsigned long xen_io_tlb_nslabs; + * can be 32bit when dma_addr_t is 64bit leading to a loss in + * information if the shift is done before casting to 64bit. + */ +-static inline dma_addr_t xen_phys_to_bus(phys_addr_t paddr) ++static inline dma_addr_t xen_phys_to_bus(struct device *dev, phys_addr_t paddr) + { + unsigned long bfn = pfn_to_bfn(XEN_PFN_DOWN(paddr)); + dma_addr_t dma = (dma_addr_t)bfn << XEN_PAGE_SHIFT; +@@ -78,9 +78,9 @@ static inline phys_addr_t xen_bus_to_phys(dma_addr_t baddr) + return paddr; + } + +-static inline dma_addr_t xen_virt_to_bus(void *address) ++static inline dma_addr_t xen_virt_to_bus(struct device *dev, void *address) + { +- return xen_phys_to_bus(virt_to_phys(address)); ++ return xen_phys_to_bus(dev, virt_to_phys(address)); + } + + static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) +@@ -309,7 +309,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, + * Do not use virt_to_phys(ret) because on ARM it doesn't correspond + * to *dma_handle. */ + phys = *dma_handle; +- dev_addr = xen_phys_to_bus(phys); ++ dev_addr = xen_phys_to_bus(hwdev, phys); + if (((dev_addr + size - 1 <= dma_mask)) && + !range_straddles_page_boundary(phys, size)) + *dma_handle = dev_addr; +@@ -367,7 +367,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, + unsigned long attrs) + { + phys_addr_t map, phys = page_to_phys(page) + offset; +- dma_addr_t dev_addr = xen_phys_to_bus(phys); ++ dma_addr_t dev_addr = xen_phys_to_bus(dev, phys); + + BUG_ON(dir == DMA_NONE); + /* +@@ -392,7 +392,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, + return DMA_MAPPING_ERROR; + + phys = map; +- dev_addr = xen_phys_to_bus(map); ++ dev_addr = xen_phys_to_bus(dev, map); + + /* + * Ensure that the address returned is DMA'ble +@@ -536,7 +536,7 @@ xen_swiotlb_sync_sg_for_device(struct device *dev, struct scatterlist *sgl, + static int + xen_swiotlb_dma_supported(struct device *hwdev, u64 mask) + { +- return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask; ++ return xen_virt_to_bus(hwdev, xen_io_tlb_end - 1) <= mask; + } + + const struct dma_map_ops xen_swiotlb_dma_ops = { +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch new file mode 100644 index 0000000..ccd03f1 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch @@ -0,0 +1,66 @@ +From ed2cec0f196028f4eaed0951f1f82efd9e6b1b67 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:42:12 -0700 +Subject: [PATCH 04/10] swiotlb-xen: add struct device* parameter to + xen_bus_to_phys + +The parameter is unused in this patch. +No functional changes. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index 958ee5517e0b..9b4306a56feb 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -67,7 +67,7 @@ static inline dma_addr_t xen_phys_to_bus(struct device *dev, phys_addr_t paddr) + return dma; + } + +-static inline phys_addr_t xen_bus_to_phys(dma_addr_t baddr) ++static inline phys_addr_t xen_bus_to_phys(struct device *dev, dma_addr_t baddr) + { + unsigned long xen_pfn = bfn_to_pfn(XEN_PFN_DOWN(baddr)); + dma_addr_t dma = (dma_addr_t)xen_pfn << XEN_PAGE_SHIFT; +@@ -339,7 +339,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, + + /* do not use virt_to_phys because on ARM it doesn't return you the + * physical address */ +- phys = xen_bus_to_phys(dev_addr); ++ phys = xen_bus_to_phys(hwdev, dev_addr); + + /* Convert the size to actually allocated. */ + size = 1UL << (order + XEN_PAGE_SHIFT); +@@ -420,7 +420,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, + static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, + size_t size, enum dma_data_direction dir, unsigned long attrs) + { +- phys_addr_t paddr = xen_bus_to_phys(dev_addr); ++ phys_addr_t paddr = xen_bus_to_phys(hwdev, dev_addr); + + BUG_ON(dir == DMA_NONE); + +@@ -436,7 +436,7 @@ static void + xen_swiotlb_sync_single_for_cpu(struct device *dev, dma_addr_t dma_addr, + size_t size, enum dma_data_direction dir) + { +- phys_addr_t paddr = xen_bus_to_phys(dma_addr); ++ phys_addr_t paddr = xen_bus_to_phys(dev, dma_addr); + + if (!dev_is_dma_coherent(dev)) + xen_dma_sync_for_cpu(dma_addr, paddr, size, dir); +@@ -449,7 +449,7 @@ static void + xen_swiotlb_sync_single_for_device(struct device *dev, dma_addr_t dma_addr, + size_t size, enum dma_data_direction dir) + { +- phys_addr_t paddr = xen_bus_to_phys(dma_addr); ++ phys_addr_t paddr = xen_bus_to_phys(dev, dma_addr); + + if (is_xen_swiotlb_buffer(dma_addr)) + swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_DEVICE); +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch new file mode 100644 index 0000000..9ef4059 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch @@ -0,0 +1,57 @@ +From f19187658bc7625f5e3ef89f56d599552b37a497 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:42:15 -0700 +Subject: [PATCH 07/10] swiotlb-xen: add struct device* parameter to + is_xen_swiotlb_buffer + +The parameter is unused in this patch. +No functional changes. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index ef58f05ae445..c50448fd9b75 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -97,7 +97,7 @@ static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) + return 0; + } + +-static int is_xen_swiotlb_buffer(dma_addr_t dma_addr) ++static int is_xen_swiotlb_buffer(struct device *dev, dma_addr_t dma_addr) + { + unsigned long bfn = XEN_PFN_DOWN(dma_addr); + unsigned long xen_pfn = bfn_to_local_pfn(bfn); +@@ -428,7 +428,7 @@ static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, + xen_dma_sync_for_cpu(hwdev, dev_addr, paddr, size, dir); + + /* NOTE: We use dev_addr here, not paddr! */ +- if (is_xen_swiotlb_buffer(dev_addr)) ++ if (is_xen_swiotlb_buffer(hwdev, dev_addr)) + swiotlb_tbl_unmap_single(hwdev, paddr, size, size, dir, attrs); + } + +@@ -441,7 +441,7 @@ xen_swiotlb_sync_single_for_cpu(struct device *dev, dma_addr_t dma_addr, + if (!dev_is_dma_coherent(dev)) + xen_dma_sync_for_cpu(dev, dma_addr, paddr, size, dir); + +- if (is_xen_swiotlb_buffer(dma_addr)) ++ if (is_xen_swiotlb_buffer(dev, dma_addr)) + swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_CPU); + } + +@@ -451,7 +451,7 @@ xen_swiotlb_sync_single_for_device(struct device *dev, dma_addr_t dma_addr, + { + phys_addr_t paddr = xen_bus_to_phys(dev, dma_addr); + +- if (is_xen_swiotlb_buffer(dma_addr)) ++ if (is_xen_swiotlb_buffer(dev, dma_addr)) + swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_DEVICE); + + if (!dev_is_dma_coherent(dev)) +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch new file mode 100644 index 0000000..2b59e18 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch @@ -0,0 +1,88 @@ +From 9838cc0b60a4287034ac3bc94a3adf08bc1c3858 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:42:57 -0700 +Subject: [PATCH 08/10] swiotlb-xen: introduce phys_to_dma/dma_to_phys + translations + +Call dma_to_phys in is_xen_swiotlb_buffer. +Call phys_to_dma in xen_phys_to_bus. +Call dma_to_phys in xen_bus_to_phys. + +Everything is taken care of by these changes except for +xen_swiotlb_alloc_coherent and xen_swiotlb_free_coherent, which need a +few explicit phys_to_dma/dma_to_phys calls. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + drivers/xen/swiotlb-xen.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c +index c50448fd9b75..d011c4c7aa72 100644 +--- a/drivers/xen/swiotlb-xen.c ++++ b/drivers/xen/swiotlb-xen.c +@@ -64,14 +64,16 @@ static inline dma_addr_t xen_phys_to_bus(struct device *dev, phys_addr_t paddr) + + dma |= paddr & ~XEN_PAGE_MASK; + +- return dma; ++ return phys_to_dma(dev, dma); + } + +-static inline phys_addr_t xen_bus_to_phys(struct device *dev, dma_addr_t baddr) ++static inline phys_addr_t xen_bus_to_phys(struct device *dev, ++ dma_addr_t dma_addr) + { ++ phys_addr_t baddr = dma_to_phys(dev, dma_addr); + unsigned long xen_pfn = bfn_to_pfn(XEN_PFN_DOWN(baddr)); +- dma_addr_t dma = (dma_addr_t)xen_pfn << XEN_PAGE_SHIFT; +- phys_addr_t paddr = dma; ++ phys_addr_t paddr = (xen_pfn << XEN_PAGE_SHIFT) | ++ (baddr & ~XEN_PAGE_MASK); + + paddr |= baddr & ~XEN_PAGE_MASK; + +@@ -99,7 +101,7 @@ static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) + + static int is_xen_swiotlb_buffer(struct device *dev, dma_addr_t dma_addr) + { +- unsigned long bfn = XEN_PFN_DOWN(dma_addr); ++ unsigned long bfn = XEN_PFN_DOWN(dma_to_phys(dev, dma_addr)); + unsigned long xen_pfn = bfn_to_local_pfn(bfn); + phys_addr_t paddr = XEN_PFN_PHYS(xen_pfn); + +@@ -304,11 +306,11 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, + if (hwdev && hwdev->coherent_dma_mask) + dma_mask = hwdev->coherent_dma_mask; + +- /* At this point dma_handle is the physical address, next we are ++ /* At this point dma_handle is the dma address, next we are + * going to set it to the machine address. + * Do not use virt_to_phys(ret) because on ARM it doesn't correspond + * to *dma_handle. */ +- phys = *dma_handle; ++ phys = dma_to_phys(hwdev, *dma_handle); + dev_addr = xen_phys_to_bus(hwdev, phys); + if (((dev_addr + size - 1 <= dma_mask)) && + !range_straddles_page_boundary(phys, size)) +@@ -319,6 +321,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, + xen_free_coherent_pages(hwdev, size, ret, (dma_addr_t)phys, attrs); + return NULL; + } ++ *dma_handle = phys_to_dma(hwdev, *dma_handle); + SetPageXenRemapped(virt_to_page(ret)); + } + memset(ret, 0, size); +@@ -351,7 +354,8 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, + TestClearPageXenRemapped(pg)) + xen_destroy_contiguous_region(phys, order); + +- xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs); ++ xen_free_coherent_pages(hwdev, size, vaddr, phys_to_dma(hwdev, phys), ++ attrs); + } + + /* +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch new file mode 100644 index 0000000..9676698 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch @@ -0,0 +1,68 @@ +From 9749386d4ba0adb545cfad494b312894909cc7a4 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:43:07 -0700 +Subject: [PATCH 09/10] xen/arm: introduce phys/dma translations in + xen_dma_sync_for_* + +Add phys_to_dma/dma_to_phys calls to +xen_dma_sync_for_cpu, xen_dma_sync_for_device, and +xen_arch_need_swiotlb. + +In xen_arch_need_swiotlb, take the opportunity to switch to the simpler +pfn_valid check we use everywhere else. + +dma_cache_maint is fixed by the next patch. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +Rebased onto 5.4 by: Christoher Clark <christopher.w.clark@gmail.com> +--- + arch/arm/xen/mm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c +index 38fa917c8585..dc1fb57d2e12 100644 +--- a/arch/arm/xen/mm.c ++++ b/arch/arm/xen/mm.c +@@ -1,5 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0-only + #include <linux/cpu.h> ++#include <linux/dma-direct.h> + #include <linux/dma-noncoherent.h> + #include <linux/gfp.h> + #include <linux/highmem.h> +@@ -73,7 +74,7 @@ static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) + void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir) + { +- if (pfn_valid(PFN_DOWN(handle))) ++ if (pfn_valid(PFN_DOWN(dma_to_phys(dev, handle)))) + arch_sync_dma_for_cpu(dev, paddr, size, dir); + else if (dir != DMA_TO_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); +@@ -82,7 +83,7 @@ void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, + void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir) + { +- if (pfn_valid(PFN_DOWN(handle))) ++ if (pfn_valid(PFN_DOWN(dma_to_phys(dev, handle)))) + arch_sync_dma_for_device(dev, paddr, size, dir); + else if (dir == DMA_FROM_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); +@@ -95,7 +96,7 @@ bool xen_arch_need_swiotlb(struct device *dev, + dma_addr_t dev_addr) + { + unsigned int xen_pfn = XEN_PFN_DOWN(phys); +- unsigned int bfn = XEN_PFN_DOWN(dev_addr); ++ unsigned int bfn = XEN_PFN_DOWN(dma_to_phys(dev, dev_addr)); + + /* + * The swiotlb buffer should be used if +@@ -112,7 +113,7 @@ bool xen_arch_need_swiotlb(struct device *dev, + * require a bounce buffer because the device doesn't support coherent + * memory and we are not able to flush the cache. + */ +- return (!hypercall_cflush && (xen_pfn != bfn) && ++ return (!hypercall_cflush && !pfn_valid(bfn) && + !dev_is_dma_coherent(dev)); + } + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch new file mode 100644 index 0000000..8e2dc3c --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch @@ -0,0 +1,75 @@ +From 1f1182bf84ec7a6d1ec74c56fccd66ff013077af Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:43:08 -0700 +Subject: [PATCH 10/10] xen/arm: call dma_to_phys on the dma_addr_t parameter + of dma_cache_maint + +Add a struct device* parameter to dma_cache_maint. + +Translate the dma_addr_t parameter of dma_cache_maint by calling +dma_to_phys. Do it for the first page and all the following pages, in +case of multipage handling. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + arch/arm/xen/mm.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c +index 7639251bcc79..6ddf3b3c1ab5 100644 +--- a/arch/arm/xen/mm.c ++++ b/arch/arm/xen/mm.c +@@ -43,15 +43,18 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) + static bool hypercall_cflush = false; + + /* buffers in highmem or foreign pages cannot cross page boundaries */ +-static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) ++static void dma_cache_maint(struct device *dev, dma_addr_t handle, ++ size_t size, u32 op) + { + struct gnttab_cache_flush cflush; + +- cflush.a.dev_bus_addr = handle & XEN_PAGE_MASK; + cflush.offset = xen_offset_in_page(handle); + cflush.op = op; ++ handle &= XEN_PAGE_MASK; + + do { ++ cflush.a.dev_bus_addr = dma_to_phys(dev, handle); ++ + if (size + cflush.offset > XEN_PAGE_SIZE) + cflush.length = XEN_PAGE_SIZE - cflush.offset; + else +@@ -60,7 +63,7 @@ static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) + HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1); + + cflush.offset = 0; +- cflush.a.dev_bus_addr += cflush.length; ++ handle += cflush.length; + size -= cflush.length; + } while (size); + } +@@ -79,7 +82,7 @@ void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, + if (pfn_valid(PFN_DOWN(dma_to_phys(dev, handle)))) + arch_sync_dma_for_cpu(paddr, size, dir); + else if (dir != DMA_TO_DEVICE) +- dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); ++ dma_cache_maint(dev, handle, size, GNTTAB_CACHE_INVAL); + } + + void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, +@@ -89,9 +92,9 @@ void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, + if (pfn_valid(PFN_DOWN(dma_to_phys(dev, handle)))) + arch_sync_dma_for_device(paddr, size, dir); + else if (dir == DMA_FROM_DEVICE) +- dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); ++ dma_cache_maint(dev, handle, size, GNTTAB_CACHE_INVAL); + else +- dma_cache_maint(handle, size, GNTTAB_CACHE_CLEAN); ++ dma_cache_maint(dev, handle, size, GNTTAB_CACHE_CLEAN); + } + + bool xen_arch_need_swiotlb(struct device *dev, +-- +2.15.4 + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch new file mode 100644 index 0000000..a84ae74 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch @@ -0,0 +1,39 @@ +From 1f1182bf84ec7a6d1ec74c56fccd66ff013077af Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini <stefano.stabellini@xilinx.com> +Date: Wed, 20 May 2020 16:43:08 -0700 +Subject: [PATCH 11/11] xen/arm: call dma_to_phys on the dma_addr_t parameter + of dma_cache_maint + +Add a struct device* parameter to dma_cache_maint. + +Translate the dma_addr_t parameter of dma_cache_maint by calling +dma_to_phys. Do it for the first page and all the following pages, in +case of multipage handling. + +Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> +--- + include/xen/arm/page-coherent.h | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c +index 7639251bcc79..6ddf3b3c1ab5 100644 +--- a/include/xen/arm/page-coherent.h 2020-05-20 06:22:38.000000000 +0000 ++++ b/include/xen/arm/page-coherent.h 2020-05-29 00:37:15.604981421 +0000 +@@ -8,12 +8,17 @@ + static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, + dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) + { ++ void *cpu_addr; ++ if (dma_alloc_from_dev_coherent(hwdev, size, dma_handle, &cpu_addr)) ++ return cpu_addr; + return dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); + } + + static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, + void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) + { ++ if (dma_release_from_dev_coherent(hwdev, get_order(size), cpu_addr)) ++ return; + dma_direct_free(hwdev, size, cpu_addr, dma_handle, attrs); + } + diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend new file mode 100644 index 0000000..25979e2 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -0,0 +1,5 @@ +# For a Xen-enabled distro, override the contents of cmdline.txt + +DEFAULT_CMDLINE := "${CMDLINE}" +XEN_LINUX_CMDLINE ?= "console=hvc0 clk_ignore_unused earlyprintk=xen debug root=/dev/mmcblk0p2 rootwait" +CMDLINE = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${XEN_LINUX_CMDLINE}', '${DEFAULT_CMDLINE}', d)}" diff --git a/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend new file mode 100644 index 0000000..ec8d677 --- /dev/null +++ b/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend @@ -0,0 +1,19 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch \ + file://0002-swiotlb-xen-remove-start_dma_addr.patch \ + file://0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch \ + file://0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch \ + file://0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch \ + file://0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch \ + file://0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch \ + file://0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch \ + file://0011-adding-page-coherent-patch.patch \ + " + +# Add support for virtio.scc which linux-yocto_virtualization adds +SRCREV_meta = "aafb8f095e97013d6e55b09ed150369cbe0c6476" +SRC_URI_append += " \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=kernel-meta \ + " -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 09/11] xen, raspberry pi: add Xen-specific SD card class 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (7 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 08/11] xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 10/11] linux-raspberrypi: prefer kernel version 5.4 Christopher Clark ` (3 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand At the moment the regular meta-raspberrypi SD card class does not allow for optional inclusion of extra files in the SD card boot partition without requiring those same files be present in the root filesystem. This affects hypervisor binaries, such as Xen, which do not necessarily belong within the guest filesystem. As a workaround, inherit the sdcard_image-rpi.bbclass and clone the main IMAGE_CMD function, adding the Xen-specific deploy that is needed. This can be retired when the parent class has extensibility added. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- classes/sdcard_image-rpi-xen.bbclass | 120 ++++++++++++++++++++++++++ conf/distro/include/meta-virt-xen.inc | 3 + 2 files changed, 123 insertions(+) create mode 100644 classes/sdcard_image-rpi-xen.bbclass diff --git a/classes/sdcard_image-rpi-xen.bbclass b/classes/sdcard_image-rpi-xen.bbclass new file mode 100644 index 0000000..c03520c --- /dev/null +++ b/classes/sdcard_image-rpi-xen.bbclass @@ -0,0 +1,120 @@ +inherit sdcard_image-rpi + +# This image class should be retired and folded into sdcard_image-rpi.bbclass +# when it has support for adding binaries to the boot partition that are not +# present in the root partition filesystem: ie. the hypervisor (xen) image. + +do_image_rpi_xen_sdimg[depends] = " \ + parted-native:do_populate_sysroot \ + mtools-native:do_populate_sysroot \ + dosfstools-native:do_populate_sysroot \ + virtual/kernel:do_deploy \ + ${IMAGE_BOOTLOADER}:do_deploy \ + rpi-config:do_deploy \ + ${@bb.utils.contains('MACHINE_FEATURES', 'armstub', 'armstubs:do_deploy', '' ,d)} \ + ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \ + ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot-default-script:do_deploy', '',d)} \ + xen:do_deploy \ + " + +do_image_rpi_xen_sdimg[recrdeps] = "do_build" + +IMAGE_TYPEDEP_rpi-xen-sdimg = "${SDIMG_ROOTFS_TYPE}" + +SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.rpi-xen-sdimg" + +# Take from: IMAGE_CMD_rpi-sdimg from meta-raspberrypi, current as of: 44d7dd0e +# with modification to include the Xen hypervisor binary in the boot partition. +IMAGE_CMD_rpi-xen-sdimg () { + + # Align partitions + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) + SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE) + + echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB" + + # Check if we are building with device tree support + DTS="${KERNEL_DEVICETREE}" + + # Initialize sdcard image file + dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE} + + # Create partition table + parted -s ${SDIMG} mklabel msdos + # Create boot partition and mark it as bootable + parted -s ${SDIMG} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) + parted -s ${SDIMG} set 1 boot on + # Create rootfs partition to the end of disk + parted -s ${SDIMG} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s + parted ${SDIMG} print + + # Create a vfat image with boot files + BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') + rm -f ${WORKDIR}/boot.img + mkfs.vfat -F32 -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* into boot.img" + if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} ::/ || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} into boot.img" + fi + if test -n "${DTS}"; then + # Copy board device trees to root folder + for dtbf in ${@split_overlays(d, True)}; do + dtb=`basename $dtbf` + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img" + done + + # Copy device tree overlays to dedicated folder + mmd -i ${WORKDIR}/boot.img overlays + for dtbf in ${@split_overlays(d, False)}; do + dtb=`basename $dtbf` + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::overlays/$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img" + done + fi + if [ "${RPI_USE_U_BOOT}" = "1" ]; then + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/u-boot.bin into boot.img" + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/boot.scr into boot.img" + if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${KERNEL_IMAGETYPE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin into boot.img" + else + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${KERNEL_IMAGETYPE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} into boot.img" + fi + else + if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin into boot.img" + else + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} into boot.img" + fi + fi + # -- Begin Xen deploy modification + mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/xen-${MACHINE} ::xen || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/xen-${MACHINE} into boot.img" + # -- End Xen deploy modification + + if [ -n "${FATPAYLOAD}" ] ; then + echo "Copying payload into VFAT" + for entry in ${FATPAYLOAD} ; do + # use bbwarn instead of bbfatal to stop aborting on vfat issues like not supporting .~lock files + mcopy -v -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}$entry :: || bbwarn "mcopy cannot copy ${IMAGE_ROOTFS}$entry into boot.img" + done + fi + + # Add stamp file + echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info + mcopy -v -i ${WORKDIR}/boot.img ${WORKDIR}/image-version-info :: || bbfatal "mcopy cannot copy ${WORKDIR}/image-version-info into boot.img" + + # Deploy vfat partition + if [ "${SDIMG_VFAT_DEPLOY}" = "1" ]; then + cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT} + ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT} + fi + + # Burn Partitions + dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) + # If SDIMG_ROOTFS_TYPE is a .xz file use xzcat + if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz" + then + xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) + else + dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) + fi +} diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc index 2ada83a..b4a20fe 100644 --- a/conf/distro/include/meta-virt-xen.inc +++ b/conf/distro/include/meta-virt-xen.inc @@ -12,3 +12,6 @@ SERIAL_CONSOLES = "115200;hvc0" # - Xen uses u-boot for configuration and uses the uart RPI_USE_U_BOOT = "1" ENABLE_UART = "1" +# Build the bootable SD card image +IMAGE_CLASSES_append_raspberrypi4-64 = " sdcard_image-rpi-xen" +IMAGE_FSTYPES_append_raspberrypi4-64 = " rpi-xen-sdimg" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 10/11] linux-raspberrypi: prefer kernel version 5.4 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (8 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 09/11] xen, raspberry pi: add Xen-specific SD card class Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 11/11] xen: add patch to fix build on ARM64 with gcc 10.1.0 Christopher Clark ` (2 subsequent siblings) 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand Aligns with Yocto's current kernel version. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- conf/distro/include/meta-virt-xen.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc index b4a20fe..2c8ef0b 100644 --- a/conf/distro/include/meta-virt-xen.inc +++ b/conf/distro/include/meta-virt-xen.inc @@ -15,3 +15,5 @@ ENABLE_UART = "1" # Build the bootable SD card image IMAGE_CLASSES_append_raspberrypi4-64 = " sdcard_image-rpi-xen" IMAGE_FSTYPES_append_raspberrypi4-64 = " rpi-xen-sdimg" +# Align kernel version with current meta-virtualization kernel version +PREFERRED_VERSION_linux-raspberrypi ?= "5.4.%" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [meta-virtualization][PATCH v2 11/11] xen: add patch to fix build on ARM64 with gcc 10.1.0 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (9 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 10/11] linux-raspberrypi: prefer kernel version 5.4 Christopher Clark @ 2020-06-30 1:54 ` Christopher Clark 2020-06-30 8:13 ` [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Bertrand Marquis 2020-07-06 20:26 ` Bruce Ashfield 12 siblings, 0 replies; 18+ messages in thread From: Christopher Clark @ 2020-06-30 1:54 UTC (permalink / raw) To: meta-virtualization Cc: cardoe, bruce.ashfield, Bertrand.Marquis, cminyard, Stewart.Hildebrand The newer gcc toolchain won't link due to a missing builtin: __sync_fetch_and_add. Xen is built with -fno-builtin, so add a patch to implement the one required function. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> --- ...xen-arm64-implement-atomic-fetch-add.patch | 50 +++++++++++++++++++ recipes-extended/xen/xen_git.bb | 5 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch diff --git a/recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch b/recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch new file mode 100644 index 0000000..6e957a5 --- /dev/null +++ b/recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christopher Clark <christopher.w.clark@gmail.com> +Date: Fri, 26 June 2020 16:34:00 -0800 +Subject: [PATCH] xen: implement atomic op to fix arm64 compilation + +Xen's ARM implementation of arch_fetch_and_add since f9cc3cd9 +uses a builtin, despite the build being performed with -fno-builtin. +With gcc 10.1.0, this now breaks prelinking spinlock.c, so +implement the one atomic operation that is required with logic +derived from Linux's atomic_ll_sc.h: ATOMIC_FETCH_OP and comparison with +the binary produced with and without the patch with gcc 9.2.0. + +Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> +diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h +index e5d062667d..c46dd3ac71 100644 +--- a/xen/include/asm-arm/system.h ++++ b/xen/include/asm-arm/system.h +@@ -55,7 +55,32 @@ static inline int local_abort_is_enabled(void) + return !(flags & PSR_ABT_MASK); + } + ++#ifdef CONFIG_ARM_64 ++ ++/* see atomic_ll_sc.h: ATOMIC_FETCH_OP(name, mb, acq, rel, cl, op, asm_op, constraint) */ ++static inline int arch_fetch_and_add(unsigned int *ptr, unsigned long i) ++{ ++ int register lptr asm("x0"); ++ int register result asm("w1"); ++ int register newval asm("w2"); ++ int register status asm("w3"); ++ ++ asm volatile( ++ " mov %[lptr], %[ptr]\n" ++ "1: ldxr %w[result], [%[lptr]]\n" ++ " add %w[newval], %w[result], %w[i]\n" ++ " stlxr %w[status], %w[newval], [%[lptr]]\n" ++ " cbnz %w[status], 1b\n" ++ " dmb ish\n" ++ : [result] "=&r" (result), [lptr] "=&r" (lptr), [newval] "=&r" (newval), [status] "=&r" (status), [i] "+r" (i), "+Q" (*ptr) ++ : [ptr] "r" (ptr), "r" (i) ++ : "memory"); ++ ++ return result; ++} ++#else + #define arch_fetch_and_add(x, v) __sync_fetch_and_add(x, v) ++#endif + + extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next); + diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb index 142bdcc..7765ed7 100644 --- a/recipes-extended/xen/xen_git.bb +++ b/recipes-extended/xen/xen_git.bb @@ -3,7 +3,10 @@ SRCREV ?= "9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab" XEN_REL ?= "4.13" XEN_BRANCH ?= "stable-${XEN_REL}" -SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}" +SRC_URI = " \ + git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ + file://xen-arm64-implement-atomic-fetch-add.patch \ + " LIC_FILES_CHKSUM ?= "file://COPYING;md5=4295d895d4b5ce9d070263d52f030e49" -- 2.17.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (10 preceding siblings ...) 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 11/11] xen: add patch to fix build on ARM64 with gcc 10.1.0 Christopher Clark @ 2020-06-30 8:13 ` Bertrand Marquis 2020-07-01 5:52 ` Christopher Clark 2020-07-06 20:26 ` Bruce Ashfield 12 siblings, 1 reply; 18+ messages in thread From: Bertrand Marquis @ 2020-06-30 8:13 UTC (permalink / raw) To: Christopher Clark Cc: meta-virtualization@yoctoproject.org, Doug Goldstein, Bruce Ashfield, Corey Minyard, Stewart Hildebrand, nd HI > On 30 Jun 2020, at 02:54, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@lists.yoctoproject.org> wrote: > > This series introduces support for running Xen on the Raspberry Pi 4 > board, with meta-virtualization and meta-raspberrypi, using the > linux-raspberrypi kernel at version 5.4 which is the current > linux-yocto kernel version supported in this layer. > > It introduces use of dynamic layers to handle configuration that is > both Xen and Raspberry Pi specific, and inclusion of Xen-specific > configuration when the 'xen' DISTRO_FEATURE is enabled to simplify > Xen image builds. > > It applies a backported set of Xen-specific Linux kernel patches, > developed by upstream Xen developers working with the Linux Foundation > Eve Project, that are currently being iterated on for inclusion in the > Linux kernel. > > Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested > only on this RPi4 board. Could you give a sumup of what was changed in v2 ? That’s a big serie and reviewing it would be easier with some infos on what has been changed. Thanks Bertrand > > Christopher > > Christopher Clark (11): > xen: apply layer settings when xen DISTRO_FEATURE is enabled > xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled > xen-tools: use non-busybox ifupdown tool if available > xen, xen-tools: update revision to Xen 4.13 > meta-virt-xen.inc: add Raspberry Pi settings > xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 > xen, raspberry pi 4: provide a default defconfig for raspberrypi4 > xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support > xen, raspberry pi: add Xen-specific SD card class > linux-raspberrypi: prefer kernel version 5.4 > xen: add patch to fix build on ARM64 with gcc 10.1.0 > > classes/meta-virt-xen-cfg.bbclass | 6 + > classes/sdcard_image-rpi-xen.bbclass | 120 ++++ > conf/distro/include/meta-virt-xen.inc | 19 + > conf/layer.conf | 19 +- > .../bootfiles/rpi-config_git.bbappend | 6 + > .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ > .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + > .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ > .../recipes-extended/xen/xen_git.bbappend | 11 + > ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ > ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ > ...struct-device-parameter-to-xen_phys_.patch | 78 +++ > ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ > ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ > ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ > ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ > ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ > .../0011-adding-page-coherent-patch.patch | 39 ++ > .../linux/linux-raspberrypi_%.bbappend | 5 + > .../linux/linux-raspberrypi_5.4.bbappend | 19 + > ...xen-build-temporarily-inhibit-Werror.patch | 18 +- > ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ > ...g-0-arrays-to-access-packet-contents.patch | 60 ++ > .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- > ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- > ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ > .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- > ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- > ...n-tools-update-python-scripts-to-py3.patch | 140 ----- > recipes-extended/xen/xen-tools.inc | 16 + > recipes-extended/xen/xen-tools_git.bb | 13 +- > recipes-extended/xen/xen_git.bb | 11 +- > 32 files changed, 1102 insertions(+), 1234 deletions(-) > create mode 100644 classes/meta-virt-xen-cfg.bbclass > create mode 100644 classes/sdcard_image-rpi-xen.bbclass > create mode 100644 conf/distro/include/meta-virt-xen.inc > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend > create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch > create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch > > -- > 2.17.1 > > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-06-30 8:13 ` [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Bertrand Marquis @ 2020-07-01 5:52 ` Christopher Clark 2020-07-01 10:04 ` Bertrand Marquis 0 siblings, 1 reply; 18+ messages in thread From: Christopher Clark @ 2020-07-01 5:52 UTC (permalink / raw) To: Bertrand Marquis Cc: meta-virtualization@yoctoproject.org, Doug Goldstein, Bruce Ashfield, Corey Minyard, Stewart Hildebrand, nd On Tue, Jun 30, 2020 at 1:13 AM Bertrand Marquis <Bertrand.Marquis@arm.com> wrote: > > HI > > > On 30 Jun 2020, at 02:54, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@lists.yoctoproject.org> wrote: > > > > This series introduces support for running Xen on the Raspberry Pi 4 > > board, with meta-virtualization and meta-raspberrypi, using the > > linux-raspberrypi kernel at version 5.4 which is the current > > linux-yocto kernel version supported in this layer. > > > > It introduces use of dynamic layers to handle configuration that is > > both Xen and Raspberry Pi specific, and inclusion of Xen-specific > > configuration when the 'xen' DISTRO_FEATURE is enabled to simplify > > Xen image builds. > > > > It applies a backported set of Xen-specific Linux kernel patches, > > developed by upstream Xen developers working with the Linux Foundation > > Eve Project, that are currently being iterated on for inclusion in the > > Linux kernel. > > > > Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested > > only on this RPi4 board. > > > Could you give a sumup of what was changed in v2 ? > That’s a big serie and reviewing it would be easier with some infos on what has been changed. Hi Bertrand, Thanks for your interest. I think your reply just clipped the start of my message that contained the summary of the changes in v2? The text was: Changes since v1: - rebased on to current meta-virtualization, meta-openembedded, poky - updated Xen revision to the tip of stable 4.13 - fixed Xen build on ARM64 with gcc 10.1.0 - added upstream debugger patch to fix compiler warning ie. The most notable change is that this series applies and build to completion with much more up to date poky and meta-openembedded repos. The last patch in the series is necessary to enable that: it adds a new implementation of an atomic primitive to Xen for the spinlock implementation on ARM64, replacing use of a builtin which the newer compiler does not make available for the current Xen build, possibly since -fno-builtin is presented as a compiler option. I've also pulled the Xen revision closer to the tip of stable 4.13 branch and applied handling for warnings that the new gcc version reports. Christopher > > Thanks > Bertrand > > > > > Christopher > > > > Christopher Clark (11): > > xen: apply layer settings when xen DISTRO_FEATURE is enabled > > xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled > > xen-tools: use non-busybox ifupdown tool if available > > xen, xen-tools: update revision to Xen 4.13 > > meta-virt-xen.inc: add Raspberry Pi settings > > xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 > > xen, raspberry pi 4: provide a default defconfig for raspberrypi4 > > xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support > > xen, raspberry pi: add Xen-specific SD card class > > linux-raspberrypi: prefer kernel version 5.4 > > xen: add patch to fix build on ARM64 with gcc 10.1.0 > > > > classes/meta-virt-xen-cfg.bbclass | 6 + > > classes/sdcard_image-rpi-xen.bbclass | 120 ++++ > > conf/distro/include/meta-virt-xen.inc | 19 + > > conf/layer.conf | 19 +- > > .../bootfiles/rpi-config_git.bbappend | 6 + > > .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ > > .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + > > .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ > > .../recipes-extended/xen/xen_git.bbappend | 11 + > > ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ > > ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ > > ...struct-device-parameter-to-xen_phys_.patch | 78 +++ > > ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ > > ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ > > ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ > > ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ > > ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ > > .../0011-adding-page-coherent-patch.patch | 39 ++ > > .../linux/linux-raspberrypi_%.bbappend | 5 + > > .../linux/linux-raspberrypi_5.4.bbappend | 19 + > > ...xen-build-temporarily-inhibit-Werror.patch | 18 +- > > ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ > > ...g-0-arrays-to-access-packet-contents.patch | 60 ++ > > .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- > > ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- > > ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ > > .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- > > ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- > > ...n-tools-update-python-scripts-to-py3.patch | 140 ----- > > recipes-extended/xen/xen-tools.inc | 16 + > > recipes-extended/xen/xen-tools_git.bb | 13 +- > > recipes-extended/xen/xen_git.bb | 11 +- > > 32 files changed, 1102 insertions(+), 1234 deletions(-) > > create mode 100644 classes/meta-virt-xen-cfg.bbclass > > create mode 100644 classes/sdcard_image-rpi-xen.bbclass > > create mode 100644 conf/distro/include/meta-virt-xen.inc > > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend > > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in > > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend > > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 > > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend > > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend > > create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch > > create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch > > delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch > > > > -- > > 2.17.1 > > > > > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-07-01 5:52 ` Christopher Clark @ 2020-07-01 10:04 ` Bertrand Marquis 2020-07-01 12:53 ` Bruce Ashfield 0 siblings, 1 reply; 18+ messages in thread From: Bertrand Marquis @ 2020-07-01 10:04 UTC (permalink / raw) To: Christopher Clark Cc: meta-virtualization@yoctoproject.org, Doug Goldstein, Bruce Ashfield, Corey Minyard, Stewart Hildebrand, nd Hi Christopher, > On 1 Jul 2020, at 06:52, Christopher Clark <christopher.w.clark@gmail.com> wrote: > > On Tue, Jun 30, 2020 at 1:13 AM Bertrand Marquis > <Bertrand.Marquis@arm.com> wrote: >> >> HI >> >>> On 30 Jun 2020, at 02:54, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@lists.yoctoproject.org> wrote: >>> >>> This series introduces support for running Xen on the Raspberry Pi 4 >>> board, with meta-virtualization and meta-raspberrypi, using the >>> linux-raspberrypi kernel at version 5.4 which is the current >>> linux-yocto kernel version supported in this layer. >>> >>> It introduces use of dynamic layers to handle configuration that is >>> both Xen and Raspberry Pi specific, and inclusion of Xen-specific >>> configuration when the 'xen' DISTRO_FEATURE is enabled to simplify >>> Xen image builds. >>> >>> It applies a backported set of Xen-specific Linux kernel patches, >>> developed by upstream Xen developers working with the Linux Foundation >>> Eve Project, that are currently being iterated on for inclusion in the >>> Linux kernel. >>> >>> Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested >>> only on this RPi4 board. >> >> >> Could you give a sumup of what was changed in v2 ? >> That’s a big serie and reviewing it would be easier with some infos on what has been changed. > > Hi Bertrand, > > Thanks for your interest. I think your reply just clipped the start of > my message that contained the summary of the changes in v2? The text > was: > > Changes since v1: > - rebased on to current meta-virtualization, meta-openembedded, poky > - updated Xen revision to the tip of stable 4.13 > - fixed Xen build on ARM64 with gcc 10.1.0 > - added upstream debugger patch to fix compiler warning > > ie. The most notable change is that this series applies and build to > completion with much more up to date poky and meta-openembedded repos. > The last patch in the series is necessary to enable that: it adds a > new implementation of an atomic primitive to Xen for the spinlock > implementation on ARM64, replacing use of a builtin which the newer > compiler does not make available for the current Xen build, possibly > since -fno-builtin is presented as a compiler option. > I've also pulled the Xen revision closer to the tip of stable 4.13 > branch and applied handling for warnings that the new gcc version > reports. > Thanks, this is a very interesting serie which could define how boards specific support could be handled. I am not quite sure if the dynamic layer should be in meta-virtualization and activate if meta-rpi4 is there or in meta-rpi4 activated if meta-virtualization is there. @Bruce: Do you think it is ok to start defining dynamic layers this way in meta-virtualization ? I would see a risk of them not being maintained or tested. Bertrand > Christopher > >> >> Thanks >> Bertrand >> >>> >>> Christopher >>> >>> Christopher Clark (11): >>> xen: apply layer settings when xen DISTRO_FEATURE is enabled >>> xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled >>> xen-tools: use non-busybox ifupdown tool if available >>> xen, xen-tools: update revision to Xen 4.13 >>> meta-virt-xen.inc: add Raspberry Pi settings >>> xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 >>> xen, raspberry pi 4: provide a default defconfig for raspberrypi4 >>> xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support >>> xen, raspberry pi: add Xen-specific SD card class >>> linux-raspberrypi: prefer kernel version 5.4 >>> xen: add patch to fix build on ARM64 with gcc 10.1.0 >>> >>> classes/meta-virt-xen-cfg.bbclass | 6 + >>> classes/sdcard_image-rpi-xen.bbclass | 120 ++++ >>> conf/distro/include/meta-virt-xen.inc | 19 + >>> conf/layer.conf | 19 +- >>> .../bootfiles/rpi-config_git.bbappend | 6 + >>> .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ >>> .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + >>> .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ >>> .../recipes-extended/xen/xen_git.bbappend | 11 + >>> ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ >>> ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ >>> ...struct-device-parameter-to-xen_phys_.patch | 78 +++ >>> ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ >>> ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ >>> ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ >>> ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ >>> ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ >>> .../0011-adding-page-coherent-patch.patch | 39 ++ >>> .../linux/linux-raspberrypi_%.bbappend | 5 + >>> .../linux/linux-raspberrypi_5.4.bbappend | 19 + >>> ...xen-build-temporarily-inhibit-Werror.patch | 18 +- >>> ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ >>> ...g-0-arrays-to-access-packet-contents.patch | 60 ++ >>> .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- >>> ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- >>> ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ >>> .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- >>> ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- >>> ...n-tools-update-python-scripts-to-py3.patch | 140 ----- >>> recipes-extended/xen/xen-tools.inc | 16 + >>> recipes-extended/xen/xen-tools_git.bb | 13 +- >>> recipes-extended/xen/xen_git.bb | 11 +- >>> 32 files changed, 1102 insertions(+), 1234 deletions(-) >>> create mode 100644 classes/meta-virt-xen-cfg.bbclass >>> create mode 100644 classes/sdcard_image-rpi-xen.bbclass >>> create mode 100644 conf/distro/include/meta-virt-xen.inc >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend >>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 >>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend >>> create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch >>> create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch >>> delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch >>> >>> -- >>> 2.17.1 >>> >>> ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-07-01 10:04 ` Bertrand Marquis @ 2020-07-01 12:53 ` Bruce Ashfield 2020-07-01 12:58 ` Bertrand Marquis 0 siblings, 1 reply; 18+ messages in thread From: Bruce Ashfield @ 2020-07-01 12:53 UTC (permalink / raw) To: Bertrand Marquis Cc: Christopher Clark, meta-virtualization@yoctoproject.org, Doug Goldstein, Corey Minyard, Stewart Hildebrand, nd On Wed, Jul 1, 2020 at 6:04 AM Bertrand Marquis <Bertrand.Marquis@arm.com> wrote: > > Hi Christopher, > > > On 1 Jul 2020, at 06:52, Christopher Clark <christopher.w.clark@gmail.com> wrote: > > > > On Tue, Jun 30, 2020 at 1:13 AM Bertrand Marquis > > <Bertrand.Marquis@arm.com> wrote: > >> > >> HI > >> > >>> On 30 Jun 2020, at 02:54, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@lists.yoctoproject.org> wrote: > >>> > >>> This series introduces support for running Xen on the Raspberry Pi 4 > >>> board, with meta-virtualization and meta-raspberrypi, using the > >>> linux-raspberrypi kernel at version 5.4 which is the current > >>> linux-yocto kernel version supported in this layer. > >>> > >>> It introduces use of dynamic layers to handle configuration that is > >>> both Xen and Raspberry Pi specific, and inclusion of Xen-specific > >>> configuration when the 'xen' DISTRO_FEATURE is enabled to simplify > >>> Xen image builds. > >>> > >>> It applies a backported set of Xen-specific Linux kernel patches, > >>> developed by upstream Xen developers working with the Linux Foundation > >>> Eve Project, that are currently being iterated on for inclusion in the > >>> Linux kernel. > >>> > >>> Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested > >>> only on this RPi4 board. > >> > >> > >> Could you give a sumup of what was changed in v2 ? > >> That’s a big serie and reviewing it would be easier with some infos on what has been changed. > > > > Hi Bertrand, > > > > Thanks for your interest. I think your reply just clipped the start of > > my message that contained the summary of the changes in v2? The text > > was: > > > > Changes since v1: > > - rebased on to current meta-virtualization, meta-openembedded, poky > > - updated Xen revision to the tip of stable 4.13 > > - fixed Xen build on ARM64 with gcc 10.1.0 > > - added upstream debugger patch to fix compiler warning > > > > ie. The most notable change is that this series applies and build to > > completion with much more up to date poky and meta-openembedded repos. > > The last patch in the series is necessary to enable that: it adds a > > new implementation of an atomic primitive to Xen for the spinlock > > implementation on ARM64, replacing use of a builtin which the newer > > compiler does not make available for the current Xen build, possibly > > since -fno-builtin is presented as a compiler option. > > I've also pulled the Xen revision closer to the tip of stable 4.13 > > branch and applied handling for warnings that the new gcc version > > reports. > > > > Thanks, this is a very interesting serie which could define how boards specific support could be handled. > > I am not quite sure if the dynamic layer should be in meta-virtualization and activate if meta-rpi4 is there or in meta-rpi4 activated if meta-virtualization is there. > > @Bruce: Do you think it is ok to start defining dynamic layers this way in meta-virtualization ? Yes, this is the way we decided to do it in previous discussions. We'd (for now) rather have the full stack in one place, versus having it spread across multiple repos. The test matrix starts to get very difficult if we have things spread about, and with this out statement of what has been tested is very clear. I'll be testing it and so will Christopher. If the model breaks, we'll of course revisit it and adjust as necessary :D Bruce > > I would see a risk of them not being maintained or tested. > > Bertrand > > > > Christopher > > > >> > >> Thanks > >> Bertrand > >> > >>> > >>> Christopher > >>> > >>> Christopher Clark (11): > >>> xen: apply layer settings when xen DISTRO_FEATURE is enabled > >>> xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled > >>> xen-tools: use non-busybox ifupdown tool if available > >>> xen, xen-tools: update revision to Xen 4.13 > >>> meta-virt-xen.inc: add Raspberry Pi settings > >>> xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 > >>> xen, raspberry pi 4: provide a default defconfig for raspberrypi4 > >>> xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support > >>> xen, raspberry pi: add Xen-specific SD card class > >>> linux-raspberrypi: prefer kernel version 5.4 > >>> xen: add patch to fix build on ARM64 with gcc 10.1.0 > >>> > >>> classes/meta-virt-xen-cfg.bbclass | 6 + > >>> classes/sdcard_image-rpi-xen.bbclass | 120 ++++ > >>> conf/distro/include/meta-virt-xen.inc | 19 + > >>> conf/layer.conf | 19 +- > >>> .../bootfiles/rpi-config_git.bbappend | 6 + > >>> .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ > >>> .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + > >>> .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ > >>> .../recipes-extended/xen/xen_git.bbappend | 11 + > >>> ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ > >>> ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ > >>> ...struct-device-parameter-to-xen_phys_.patch | 78 +++ > >>> ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ > >>> ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ > >>> ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ > >>> ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ > >>> ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ > >>> .../0011-adding-page-coherent-patch.patch | 39 ++ > >>> .../linux/linux-raspberrypi_%.bbappend | 5 + > >>> .../linux/linux-raspberrypi_5.4.bbappend | 19 + > >>> ...xen-build-temporarily-inhibit-Werror.patch | 18 +- > >>> ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ > >>> ...g-0-arrays-to-access-packet-contents.patch | 60 ++ > >>> .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- > >>> ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- > >>> ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ > >>> .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- > >>> ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- > >>> ...n-tools-update-python-scripts-to-py3.patch | 140 ----- > >>> recipes-extended/xen/xen-tools.inc | 16 + > >>> recipes-extended/xen/xen-tools_git.bb | 13 +- > >>> recipes-extended/xen/xen_git.bb | 11 +- > >>> 32 files changed, 1102 insertions(+), 1234 deletions(-) > >>> create mode 100644 classes/meta-virt-xen-cfg.bbclass > >>> create mode 100644 classes/sdcard_image-rpi-xen.bbclass > >>> create mode 100644 conf/distro/include/meta-virt-xen.inc > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend > >>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend > >>> create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch > >>> create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch > >>> delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch > >>> > >>> -- > >>> 2.17.1 > >>> > >>> > -- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-07-01 12:53 ` Bruce Ashfield @ 2020-07-01 12:58 ` Bertrand Marquis 0 siblings, 0 replies; 18+ messages in thread From: Bertrand Marquis @ 2020-07-01 12:58 UTC (permalink / raw) To: Bruce Ashfield Cc: Christopher Clark, meta-virtualization@yoctoproject.org, Doug Goldstein, Corey Minyard, Stewart Hildebrand, nd > On 1 Jul 2020, at 13:53, Bruce Ashfield <bruce.ashfield@gmail.com> wrote: > > On Wed, Jul 1, 2020 at 6:04 AM Bertrand Marquis > <Bertrand.Marquis@arm.com> wrote: >> >> Hi Christopher, >> >>> On 1 Jul 2020, at 06:52, Christopher Clark <christopher.w.clark@gmail.com> wrote: >>> >>> On Tue, Jun 30, 2020 at 1:13 AM Bertrand Marquis >>> <Bertrand.Marquis@arm.com> wrote: >>>> >>>> HI >>>> >>>>> On 30 Jun 2020, at 02:54, Christopher Clark via lists.yoctoproject.org <christopher.w.clark=gmail.com@lists.yoctoproject.org> wrote: >>>>> >>>>> This series introduces support for running Xen on the Raspberry Pi 4 >>>>> board, with meta-virtualization and meta-raspberrypi, using the >>>>> linux-raspberrypi kernel at version 5.4 which is the current >>>>> linux-yocto kernel version supported in this layer. >>>>> >>>>> It introduces use of dynamic layers to handle configuration that is >>>>> both Xen and Raspberry Pi specific, and inclusion of Xen-specific >>>>> configuration when the 'xen' DISTRO_FEATURE is enabled to simplify >>>>> Xen image builds. >>>>> >>>>> It applies a backported set of Xen-specific Linux kernel patches, >>>>> developed by upstream Xen developers working with the Linux Foundation >>>>> Eve Project, that are currently being iterated on for inclusion in the >>>>> Linux kernel. >>>>> >>>>> Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested >>>>> only on this RPi4 board. >>>> >>>> >>>> Could you give a sumup of what was changed in v2 ? >>>> That’s a big serie and reviewing it would be easier with some infos on what has been changed. >>> >>> Hi Bertrand, >>> >>> Thanks for your interest. I think your reply just clipped the start of >>> my message that contained the summary of the changes in v2? The text >>> was: >>> >>> Changes since v1: >>> - rebased on to current meta-virtualization, meta-openembedded, poky >>> - updated Xen revision to the tip of stable 4.13 >>> - fixed Xen build on ARM64 with gcc 10.1.0 >>> - added upstream debugger patch to fix compiler warning >>> >>> ie. The most notable change is that this series applies and build to >>> completion with much more up to date poky and meta-openembedded repos. >>> The last patch in the series is necessary to enable that: it adds a >>> new implementation of an atomic primitive to Xen for the spinlock >>> implementation on ARM64, replacing use of a builtin which the newer >>> compiler does not make available for the current Xen build, possibly >>> since -fno-builtin is presented as a compiler option. >>> I've also pulled the Xen revision closer to the tip of stable 4.13 >>> branch and applied handling for warnings that the new gcc version >>> reports. >>> >> >> Thanks, this is a very interesting serie which could define how boards specific support could be handled. >> >> I am not quite sure if the dynamic layer should be in meta-virtualization and activate if meta-rpi4 is there or in meta-rpi4 activated if meta-virtualization is there. >> >> @Bruce: Do you think it is ok to start defining dynamic layers this way in meta-virtualization ? > > Yes, this is the way we decided to do it in previous discussions. > > We'd (for now) rather have the full stack in one place, versus having > it spread across multiple repos. The test matrix starts to get very > difficult if we have things spread about, and with this out statement > of what has been tested is very clear. ok just wanted to make sure that was clear. > > I'll be testing it and so will Christopher. > > If the model breaks, we'll of course revisit it and adjust as necessary :D That works for me :-) Bertrand > > Bruce > >> >> I would see a risk of them not being maintained or tested. >> >> Bertrand >> >> >>> Christopher >>> >>>> >>>> Thanks >>>> Bertrand >>>> >>>>> >>>>> Christopher >>>>> >>>>> Christopher Clark (11): >>>>> xen: apply layer settings when xen DISTRO_FEATURE is enabled >>>>> xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled >>>>> xen-tools: use non-busybox ifupdown tool if available >>>>> xen, xen-tools: update revision to Xen 4.13 >>>>> meta-virt-xen.inc: add Raspberry Pi settings >>>>> xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 >>>>> xen, raspberry pi 4: provide a default defconfig for raspberrypi4 >>>>> xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support >>>>> xen, raspberry pi: add Xen-specific SD card class >>>>> linux-raspberrypi: prefer kernel version 5.4 >>>>> xen: add patch to fix build on ARM64 with gcc 10.1.0 >>>>> >>>>> classes/meta-virt-xen-cfg.bbclass | 6 + >>>>> classes/sdcard_image-rpi-xen.bbclass | 120 ++++ >>>>> conf/distro/include/meta-virt-xen.inc | 19 + >>>>> conf/layer.conf | 19 +- >>>>> .../bootfiles/rpi-config_git.bbappend | 6 + >>>>> .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ >>>>> .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + >>>>> .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ >>>>> .../recipes-extended/xen/xen_git.bbappend | 11 + >>>>> ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ >>>>> ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ >>>>> ...struct-device-parameter-to-xen_phys_.patch | 78 +++ >>>>> ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ >>>>> ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ >>>>> ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ >>>>> ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ >>>>> ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ >>>>> .../0011-adding-page-coherent-patch.patch | 39 ++ >>>>> .../linux/linux-raspberrypi_%.bbappend | 5 + >>>>> .../linux/linux-raspberrypi_5.4.bbappend | 19 + >>>>> ...xen-build-temporarily-inhibit-Werror.patch | 18 +- >>>>> ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ >>>>> ...g-0-arrays-to-access-packet-contents.patch | 60 ++ >>>>> .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- >>>>> ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- >>>>> ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ >>>>> .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- >>>>> ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- >>>>> ...n-tools-update-python-scripts-to-py3.patch | 140 ----- >>>>> recipes-extended/xen/xen-tools.inc | 16 + >>>>> recipes-extended/xen/xen-tools_git.bb | 13 +- >>>>> recipes-extended/xen/xen_git.bb | 11 +- >>>>> 32 files changed, 1102 insertions(+), 1234 deletions(-) >>>>> create mode 100644 classes/meta-virt-xen-cfg.bbclass >>>>> create mode 100644 classes/sdcard_image-rpi-xen.bbclass >>>>> create mode 100644 conf/distro/include/meta-virt-xen.inc >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend >>>>> create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend >>>>> create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch >>>>> create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch >>>>> delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch >>>>> >>>>> -- >>>>> 2.17.1 >>>>> >>>>> >> > > > -- > - Thou shalt not follow the NULL pointer, for chaos and madness await > thee at its end > - "Use the force Harry" - Gandalf, Star Trek II ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark ` (11 preceding siblings ...) 2020-06-30 8:13 ` [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Bertrand Marquis @ 2020-07-06 20:26 ` Bruce Ashfield 12 siblings, 0 replies; 18+ messages in thread From: Bruce Ashfield @ 2020-07-06 20:26 UTC (permalink / raw) To: Christopher Clark Cc: meta-virtualization, cardoe, Bertrand.Marquis, cminyard, Stewart.Hildebrand@dornerworks.comhange-folder>? In message: [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 on 29/06/2020 Christopher Clark wrote: > Changes since v1: > - rebased on to current meta-virtualization, meta-openembedded, poky > - updated Xen revision to the tip of stable 4.13 > - fixed Xen build on ARM64 with gcc 10.1.0 > - added upstream debugger patch to fix compiler warning > > This series introduces support for running Xen on the Raspberry Pi 4 > board, with meta-virtualization and meta-raspberrypi, using the > linux-raspberrypi kernel at version 5.4 which is the current > linux-yocto kernel version supported in this layer. > > It introduces use of dynamic layers to handle configuration that is > both Xen and Raspberry Pi specific, and inclusion of Xen-specific > configuration when the 'xen' DISTRO_FEATURE is enabled to simplify > Xen image builds. > > It applies a backported set of Xen-specific Linux kernel patches, > developed by upstream Xen developers working with the Linux Foundation > Eve Project, that are currently being iterated on for inclusion in the > Linux kernel. > > Xen is uprev'd to version 4.13; this is currently compile-and-boot-tested > only on this RPi4 board. These have soaked on the list long enough, things build here as well, so I've pulled these into master. Bruce > > Christopher > > Christopher Clark (11): > xen: apply layer settings when xen DISTRO_FEATURE is enabled > xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM is enabled > xen-tools: use non-busybox ifupdown tool if available > xen, xen-tools: update revision to Xen 4.13 > meta-virt-xen.inc: add Raspberry Pi settings > xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 > xen, raspberry pi 4: provide a default defconfig for raspberrypi4 > xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support > xen, raspberry pi: add Xen-specific SD card class > linux-raspberrypi: prefer kernel version 5.4 > xen: add patch to fix build on ARM64 with gcc 10.1.0 > > classes/meta-virt-xen-cfg.bbclass | 6 + > classes/sdcard_image-rpi-xen.bbclass | 120 ++++ > conf/distro/include/meta-virt-xen.inc | 19 + > conf/layer.conf | 19 +- > .../bootfiles/rpi-config_git.bbappend | 6 + > .../rpi-u-boot-scr/files/boot.cmd.xen.in | 49 ++ > .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 17 + > .../xen/files/defconfig_raspberrypi4-64 | 117 ++++ > .../recipes-extended/xen/xen_git.bbappend | 11 + > ...vmalloc_to_page-on-vmalloc-virt-addr.patch | 44 ++ > ...02-swiotlb-xen-remove-start_dma_addr.patch | 47 ++ > ...struct-device-parameter-to-xen_phys_.patch | 78 +++ > ...struct-device-parameter-to-xen_bus_t.patch | 66 +++ > ...struct-device-parameter-to-is_xen_sw.patch | 57 ++ > ...oduce-phys_to_dma-dma_to_phys-transl.patch | 88 +++ > ...translations-in-xen_dma_s_kernel_5.4.patch | 68 +++ > ..._to_phys-on-the-dma_addr_t-parameter.patch | 75 +++ > .../0011-adding-page-coherent-patch.patch | 39 ++ > .../linux/linux-raspberrypi_%.bbappend | 5 + > .../linux/linux-raspberrypi_5.4.bbappend | 19 + > ...xen-build-temporarily-inhibit-Werror.patch | 18 +- > ...xen-arm64-implement-atomic-fetch-add.patch | 50 ++ > ...g-0-arrays-to-access-packet-contents.patch | 60 ++ > .../files/xen-tools-libxl-gentypes-py3.patch | 140 ----- > ...tools-pygrub-change-tabs-into-spaces.patch | 40 -- > ...-python-scripts-work-with-2.6-and-up.patch | 529 ------------------ > .../xen/files/xen-tools-pygrub-py3.patch | 233 -------- > ...ls-python-fix-Wsign-compare-warnings.patch | 136 ----- > ...n-tools-update-python-scripts-to-py3.patch | 140 ----- > recipes-extended/xen/xen-tools.inc | 16 + > recipes-extended/xen/xen-tools_git.bb | 13 +- > recipes-extended/xen/xen_git.bb | 11 +- > 32 files changed, 1102 insertions(+), 1234 deletions(-) > create mode 100644 classes/meta-virt-xen-cfg.bbclass > create mode 100644 classes/sdcard_image-rpi-xen.bbclass > create mode 100644 conf/distro/include/meta-virt-xen.inc > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in > create mode 100644 dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 > create mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend > create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend > create mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch > create mode 100644 recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-pygrub-py3.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch > delete mode 100644 recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch > > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-07-06 20:27 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-30 1:54 [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 01/11] xen: apply layer settings when xen DISTRO_FEATURE is enabled Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 02/11] xen-tools: add RRECOMENDS qemu on ARM and x86 when HVM " Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 03/11] xen-tools: use non-busybox ifupdown tool if available Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 04/11] xen, xen-tools: update revision to Xen 4.13 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 05/11] meta-virt-xen.inc: add Raspberry Pi settings Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 06/11] xen, raspberry pi: add dynamic-layer for Xen configuration for Rpi4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 07/11] xen, raspberry pi 4: provide a default defconfig for raspberrypi4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 08/11] xen, linux-raspberrypi: add Linux kernel 5.4 patches for Xen support Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 09/11] xen, raspberry pi: add Xen-specific SD card class Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 10/11] linux-raspberrypi: prefer kernel version 5.4 Christopher Clark 2020-06-30 1:54 ` [meta-virtualization][PATCH v2 11/11] xen: add patch to fix build on ARM64 with gcc 10.1.0 Christopher Clark 2020-06-30 8:13 ` [meta-virtualization][PATCH v2 00/11] Xen on Raspberry Pi 4 Bertrand Marquis 2020-07-01 5:52 ` Christopher Clark 2020-07-01 10:04 ` Bertrand Marquis 2020-07-01 12:53 ` Bruce Ashfield 2020-07-01 12:58 ` Bertrand Marquis 2020-07-06 20:26 ` Bruce Ashfield
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.