Skip to contentSkip to conversation

Xen on Raspberry Pi 4 fixes

PATCH In review Christopher Clark 3 participants 20 messages May 21, 2022 – May 25, 2022 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

cover Xen on Raspberry Pi 4 fixes

A series of fixes applied to master and across stable branches where needed to fix running Xen on the Raspberry Pi 4 board.

This updates Linux kernel configuration for Xen to remove tracking from the linux-yocto-dev kernel, either by applying a fixed revision and specification of a stable branch or replacing it with the linux-yocto kernel. The Xen build configuration is updated to remove the hypervisor defconfig for the Raspberry Pi and drop the arm64 prelink patch as a license correction and since the build no longer needs it with the newer gcc toolchain.

Tested on hardware.

Christopher Clark

gatesgarth:
01: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 02: xen: drop patch to workaround prelink on aarch64 03: xen: fix boot on the Raspberry Pi 4

hardknott:
04: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 05: xen: drop patch to workaround prelink on aarch64 06: xen: fix boot on the Raspberry Pi 4

honister:
07: linux-yocto-dev, xen, raspberrypi: remove tracking bbappend 08: xen: drop patch to workaround prelink on aarch64 09: xen: fix boot on the Raspberry Pi 4 with Xen 4.14

kirkstone:
10: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

master:
11: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

#1 lore raw

PATCH 1/3 linux-yocto-dev, raspberrypi: apply fixed revision to kernel

The default preferred Linux kernel for Xen on the Raspberry Pi 4 board in this branch is linux-yocto-dev, which unfortunately results in a branch tracking configuration rather than a fixed revision.

Apply a specified revision from the 5.10/standard/bcm-2xxx-rpi branch, per the kernel version for this release, and disable tracking. Revision is the current tip of v5.10/standard/bcm-2xxx-rpi branch, tested and verified working on the board.

---
 .../recipes-kernel/linux/linux-yocto-dev.bbappend         | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend +7 -1
index 85d6feb..9f5677f 100644
@@ -5,6 +5,12 @@ DEFAULT_CMDLINE := "${CMDLINE}"
 XEN_LINUX_CMDLINE ?= "console=hvc0 clk_ignore_unused earlycon=xenboot debug root=/dev/mmcblk0p2 rootwait"
 CMDLINE = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${XEN_LINUX_CMDLINE}', '${DEFAULT_CMDLINE}', d)}"
 
-KBRANCH_raspberrypi4-64 = "standard/bcm-2xxx-rpi"
+KBRANCH_raspberrypi4-64 = "v5.10/standard/bcm-2xxx-rpi"
 KMACHINE_raspberrypi4-64 = "bcm-2xxx-rpi4"
 COMPATIBLE_MACHINE_raspberrypi4-64 = "(raspberrypi4-64)"
+
+# Tip of v5.10/standard/bcm-2xxx-rpi
+SRCREV_machine_raspberrypi4-64 = "d172dd50154d2849e87d8acdedd073cf36ebde0b"
+
+# Tip of master:
+SRCREV_meta_raspberrypi4-64 = "942a3a2cc192a8b2e38a7fef4a40249c79f5c9f5"
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/1 xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

In reply to Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 in this branch is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision so not appropriate for a stable branch.

Remove the linux-yocto-dev in favour of the linux-yocto kernel version 5.15 which has been tested and verified working on the board.

---
 .../recipes-kernel/linux/linux-yocto-dev.bbappend         | 8 --------
 .../recipes-kernel/linux/linux-yocto_5.15.bbappend        | 6 ++++++
 2 files changed, 6 insertions(+), 8 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend
 create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -8
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend new file +6 -0
new file mode 100644
index 0000000..572f7ec
@@ -0,0 +1,6 @@
+# Enable use of the linux-yocto 5.15 kernel for the Raspberry Pi 4
+KBRANCH:raspberrypi4-64 ?= "v5.15/standard/bcm-2xxx-rpi"
+KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
+COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
+
+require linux-yocto_xen-rpi.inc
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#3 lore raw

Re: [meta-virtualization][kirkstone][PATCH] xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

Hi,

Quoted 11 lines · Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 in this branch is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision so not appropriate for a stable branch.

Remove the linux-yocto-dev in favour of the linux-yocto kernel version 5.15 which has been tested and verified working on the board.

Cheers
Bertrand

Quoted 34 lines

---
.../recipes-kernel/linux/linux-yocto-dev.bbappend | 8 --------
.../recipes-kernel/linux/linux-yocto_5.15.bbappend | 6 ++++++

2 files changed, 6 insertions(+), 8 deletions(-)

delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend

dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -8
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend new file +6 -1
new file mode 100644
index 0000000..572f7ec
@@ -0,0 +1,6 @@
+# Enable use of the linux-yocto 5.15 kernel for the Raspberry Pi 4
+KBRANCH:raspberrypi4-64 ?= "v5.15/standard/bcm-2xxx-rpi"
+KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
+COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
+
+require linux-yocto_xen-rpi.inc
--
Quoted 2 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#4 lore raw

PATCH 1/3 linux-yocto-dev, raspberrypi: apply fixed revision to kernel

In reply to Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 board in this branch is linux-yocto-dev, which unfortunately results in a branch tracking configuration rather than a fixed revision.

Apply a specified revision from the 5.12/standard/bcm-2xxx-rpi branch, per the kernel version for this release, and disable tracking. Revision is the current tip of v5.12/standard/bcm-2xxx-rpi branch, tested and verified working on the board.

---
 .../recipes-kernel/linux/linux-yocto-dev.bbappend         | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend +7 -1
index 2a0416f..91558b3 100644
@@ -5,6 +5,12 @@ DEFAULT_CMDLINE := "${CMDLINE}"
 XEN_LINUX_CMDLINE ?= "console=hvc0 clk_ignore_unused earlycon=xenboot debug root=/dev/mmcblk0p2 rootwait"
 CMDLINE = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${XEN_LINUX_CMDLINE}', '${DEFAULT_CMDLINE}', d)}"
 
-KBRANCH_raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
+KBRANCH_raspberrypi4-64 ?= "v5.12/standard/bcm-2xxx-rpi"
 KMACHINE_raspberrypi4-64 ?= "bcm-2xxx-rpi4"
 COMPATIBLE_MACHINE_raspberrypi4-64 = "(raspberrypi4-64)"
+
+# Tip of v5.12/standard/bcm-2xxx-rpi
+SRCREV_machine_raspberrypi4-64 = "f48ad8b95fdcc48a3defe5d085cfd8c5390826b8"
+
+# Tip of master:
+SRCREV_meta_raspberrypi4-64 = "942a3a2cc192a8b2e38a7fef4a40249c79f5c9f5"
Signature · 1 line
2.25.1
#5 lore raw

PATCH 1/3 linux-yocto-dev, xen, raspberrypi: remove tracking bbappend

In reply to Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 in this branch is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision so not appropriate for a stable branch.

Remove the linux-yocto-dev in favour of the linux-yocto kernel, which has been tested and verified working on the board.

---
 .../recipes-kernel/linux/linux-yocto-dev.bbappend         | 8 --------
 1 file changed, 8 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -8
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
Signature · 1 line
2.25.1
Reviewed-by on v1 1/3
#6 lore raw

Re: [meta-virtualization][honister][PATCH 1/3] linux-yocto-dev, xen, raspberrypi: remove tracking bbappend

Hi,

Quoted 11 lines · Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 in this branch is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision so not appropriate for a stable branch.

Remove the linux-yocto-dev in favour of the linux-yocto kernel, which has been tested and verified working on the board.

Cheers
Bertrand

Quoted 20 lines

---
.../recipes-kernel/linux/linux-yocto-dev.bbappend | 8 --------

1 file changed, 8 deletions(-)

delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend

dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -9
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
--
Quoted 2 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#7 lore raw

PATCH 2/3 xen: drop patch to workaround prelink on aarch64

In reply to Christopher Clark

Patch is not needed for image prelinking since the gcc toolchain in this branch successfully links Xen without it.

Remove the patch from the stable branch since the BSD license of the modified header file differs vs the GPLv2 source code referenced. Removal preferred to replacement with a new patch that moves the function into GPLv2 .c source files since the build now succeeds without it.

---
 ...xen-arm64-implement-atomic-fetch-add.patch | 50 -------------------
 recipes-extended/xen/xen_4.14.bb              |  1 -
 recipes-extended/xen/xen_git.bb               |  1 -
 3 files changed, 52 deletions(-)
 delete mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch
recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch deleted +0 -50
deleted file mode 100644
index 6e957a5..0000000
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Clark <[email protected]>
-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 <[email protected]>
-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);
- 
recipes-extended/xen/xen_4.14.bb +0 -1
index 653e3b6..6ac3236 100644
@@ -5,7 +5,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
recipes-extended/xen/xen_git.bb +0 -1
index 2b62c5c..fba12e5 100644
@@ -5,7 +5,6 @@ XEN_BRANCH ?= "master"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
Signature · 1 line
2.25.1
#8 lore raw

PATCH 2/3 xen: drop patch to workaround prelink on aarch64

In reply to Christopher Clark

Patch is not needed for image prelinking since the gcc toolchain in this branch successfully links Xen without it.

Remove the patch from the stable branch since the BSD license of the modified header file differs vs the GPLv2 source code referenced. Removal preferred to replacement with a new patch that moves the function into GPLv2 .c source files since the build now succeeds without it.

---
 ...xen-arm64-implement-atomic-fetch-add.patch | 50 -------------------
 recipes-extended/xen/xen_4.14.bb              |  1 -
 recipes-extended/xen/xen_4.15.bb              |  1 -
 recipes-extended/xen/xen_git.bb               |  1 -
 4 files changed, 53 deletions(-)
 delete mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch
recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch deleted +0 -50
deleted file mode 100644
index 6e957a5..0000000
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Clark <[email protected]>
-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 <[email protected]>
-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);
- 
recipes-extended/xen/xen_4.14.bb +0 -1
index 653e3b6..6ac3236 100644
@@ -5,7 +5,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
recipes-extended/xen/xen_4.15.bb +0 -1
index 2842c0a..138773d 100644
@@ -5,7 +5,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
recipes-extended/xen/xen_git.bb +0 -1
index eaf3956..04874d4 100644
@@ -5,7 +5,6 @@ XEN_BRANCH ?= "master"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
Signature · 1 line
2.25.1
#9 lore raw

PATCH 2/3 xen: drop patch to workaround prelink on aarch64

In reply to Christopher Clark

Patch is not needed for image prelinking since the gcc toolchain in this branch successfully links Xen without it.

Remove the patch from the stable branch since the BSD license of the modified header file differs vs the GPLv2 source code referenced. Removal preferred to replacement with a new patch that moves the function into GPLv2 .c source files since the build now succeeds without it.

---
 ...xen-arm64-implement-atomic-fetch-add.patch | 50 -------------------
 recipes-extended/xen/xen_4.14.bb              |  1 -
 recipes-extended/xen/xen_4.15.bb              |  1 -
 recipes-extended/xen/xen_git.bb               |  1 -
 4 files changed, 53 deletions(-)
 delete mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch
recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch deleted +0 -50
deleted file mode 100644
index 6e957a5..0000000
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Clark <[email protected]>
-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 <[email protected]>
-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);
- 
recipes-extended/xen/xen_4.14.bb +0 -1
index 0d7d20b..267db16 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
recipes-extended/xen/xen_4.15.bb +0 -1
index 0cfaf0c..1b87ae8 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
recipes-extended/xen/xen_git.bb +0 -1
index 3957de1..2fbfb54 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "master"
 
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
     "
 
Signature · 1 line
2.25.1
Reviewed-by on v1 2/3
#10 lore raw

Re: [meta-virtualization][honister][PATCH 2/3] xen: drop patch to workaround prelink on aarch64

Hi,

Quoted 11 lines · Christopher Clark

Patch is not needed for image prelinking since the gcc toolchain in this branch successfully links Xen without it.

Remove the patch from the stable branch since the BSD license of the modified header file differs vs the GPLv2 source code referenced. Removal preferred to replacement with a new patch that moves the function into GPLv2 .c source files since the build now succeeds without it.

Cheers
Bertrand

Quoted 101 lines

---

...xen-arm64-implement-atomic-fetch-add.patch | 50 -------------------
recipes-extended/xen/xen_4.14.bb              |  1 -
recipes-extended/xen/xen_4.15.bb              |  1 -
recipes-extended/xen/xen_git.bb               |  1 -
4 files changed, 53 deletions(-)

delete mode 100644 recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch

recipes-extended/xen/files/xen-arm64-implement-atomic-fetch-add.patch deleted +0 -50
deleted file mode 100644
index 6e957a5..0000000
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Christopher Clark <[email protected]>
-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 <[email protected]>
-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);
-
recipes-extended/xen/xen_4.14.bb +0 -1
index 0d7d20b..267db16 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
    git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
    "
 
recipes-extended/xen/xen_4.15.bb +0 -1
index 0cfaf0c..1b87ae8 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 
 SRC_URI = " \
    git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
    "
 
recipes-extended/xen/xen_git.bb +0 -2
index 3957de1..2fbfb54 100644
@@ -6,7 +6,6 @@ XEN_BRANCH ?= "master"
 
 SRC_URI = " \
    git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
-    file://xen-arm64-implement-atomic-fetch-add.patch \
    file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
    "
 
--
Quoted 2 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#11 lore raw

PATCH 3/3 xen: fix boot on the Raspberry Pi 4 with Xen 4.14

In reply to Christopher Clark

Apply the patch from Xen to fix device tree parsing in newer kernels.

---
 ...issing-device_type-property-in-pci-p.patch | 91 +++++++++++++++++++
 recipes-extended/xen/xen_4.14.bb              |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch
recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch new file +91 -0
new file mode 100644
index 0000000..09a461b
@@ -0,0 +1,91 @@
+From 5a4087004d1adbbb223925f3306db0e5824a2bdc Mon Sep 17 00:00:00 2001
+From: Stefano Stabellini <[email protected]>
+Date: Tue, 9 Feb 2021 11:53:34 -0800
+Subject: [PATCH] xen: workaround missing device_type property in pci/pcie
+ nodes
+
+PCI buses differ from default buses in a few important ways, so it is
+important to detect them properly. Normally, PCI buses are expected to
+have the following property:
+
+    device_type = "pci"
+
+In reality, it is not always the case. To handle PCI bus nodes that
+don't have the device_type property, also consider the node name: if the
+node name is "pcie" or "pci" then consider the bus as a PCI bus.
+
+This commit is based on the Linux kernel commit
+d1ac0002dd29 "of: address: Work around missing device_type property in
+pcie nodes".
+
+This fixes Xen boot on RPi4. Some RPi4 kernels have the following node
+on their device trees:
+
+&pcie0 {
+	pci@1,0 {
+		#address-cells = <3>;
+		#size-cells = <2>;
+		ranges;
+
+		reg = <0 0 0 0 0>;
+
+		usb@1,0 {
+			reg = <0x10000 0 0 0 0>;
+			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
+		};
+	};
+};
+
+The pci@1,0 node is a PCI bus. If we parse the node and its children as
+a default bus, the reg property under usb@1,0 would have to be
+interpreted as an address range mappable by the CPU, which is not the
+case and would break.
+
+Link: https://lore.kernel.org/xen-devel/[email protected]/
+[fix style on commit]
+Signed-off-by: Stefano Stabellini <[email protected]>
+Tested-by: Elliott Mitchell <[email protected]>
+Tested-by: Jukka Kaartinen <[email protected]>
+Reviewed-by: Bertrand Marquis <[email protected]>
+Acked-by: Julien Grall <[email protected]>
+---
+ xen/common/device_tree.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
+index 18825e333e..03d25a81ce 100644
+--- a/xen/common/device_tree.c
++++ b/xen/common/device_tree.c
+@@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __be32 *addr)
+  * PCI bus specific translator
+  */
+ 
++static bool dt_node_is_pci(const struct dt_device_node *np)
++{
++    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
++
++    if ( is_pci )
++        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
++
++    return is_pci;
++}
++
+ static bool_t dt_bus_pci_match(const struct dt_device_node *np)
+ {
+     /*
+      * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
+      * powermacs "ht" is hypertransport
++     *
++     * If none of the device_type match, and that the node name is
++     * "pcie" or "pci", accept the device as PCI (with a warning).
+      */
+     return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
+-        !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
++        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
++        dt_node_is_pci(np);
+ }
+ 
+ static void dt_bus_pci_count_cells(const struct dt_device_node *np,
+-- 
+2.25.1
+
recipes-extended/xen/xen_4.14.bb +1 -0
index 267db16..c0fa938 100644
@@ -7,6 +7,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.25.1
Reviewed-by on v1 3/3
#12 lore raw

Re: [meta-virtualization][honister][PATCH 3/3] xen: fix boot on the Raspberry Pi 4 with Xen 4.14

Hi Christopher,

Quoted 5 lines · Christopher Clark

Apply the patch from Xen to fix device tree parsing in newer kernels.

Cheers
Bertrand

Quoted 114 lines

---
...issing-device_type-property-in-pci-p.patch | 91 +++++++++++++++++++
recipes-extended/xen/xen_4.14.bb | 1 +

2 files changed, 92 insertions(+)

create mode 100644 recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch

recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch new file +91 -0
new file mode 100644
index 0000000..09a461b
@@ -0,0 +1,91 @@
+From 5a4087004d1adbbb223925f3306db0e5824a2bdc Mon Sep 17 00:00:00 2001
+From: Stefano Stabellini <[email protected]>
+Date: Tue, 9 Feb 2021 11:53:34 -0800
+Subject: [PATCH] xen: workaround missing device_type property in pci/pcie
+ nodes
+
+PCI buses differ from default buses in a few important ways, so it is
+important to detect them properly. Normally, PCI buses are expected to
+have the following property:
+
+    device_type = "pci"
+
+In reality, it is not always the case. To handle PCI bus nodes that
+don't have the device_type property, also consider the node name: if the
+node name is "pcie" or "pci" then consider the bus as a PCI bus.
+
+This commit is based on the Linux kernel commit
+d1ac0002dd29 "of: address: Work around missing device_type property in
+pcie nodes".
+
+This fixes Xen boot on RPi4. Some RPi4 kernels have the following node
+on their device trees:
+
+&pcie0 {
+     pci@1,0 {
+             #address-cells = <3>;
+             #size-cells = <2>;
+             ranges;
+
+             reg = <0 0 0 0 0>;
+
+             usb@1,0 {
+                     reg = <0x10000 0 0 0 0>;
+                     resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
+             };
+     };
+};
+
+The pci@1,0 node is a PCI bus. If we parse the node and its children as
+a default bus, the reg property under usb@1,0 would have to be
+interpreted as an address range mappable by the CPU, which is not the
+case and would break.
+
+Link: https://lore.kernel.org/xen-devel/[email protected]/
+[fix style on commit]
+Signed-off-by: Stefano Stabellini <[email protected]>
+Tested-by: Elliott Mitchell <[email protected]>
+Tested-by: Jukka Kaartinen <[email protected]>
+Reviewed-by: Bertrand Marquis <[email protected]>
+Acked-by: Julien Grall <[email protected]>
+---
+ xen/common/device_tree.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
+index 18825e333e..03d25a81ce 100644
+--- a/xen/common/device_tree.c
++++ b/xen/common/device_tree.c
+@@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __be32 *addr)
+  * PCI bus specific translator
+  */
+
++static bool dt_node_is_pci(const struct dt_device_node *np)
++{
++    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
++
++    if ( is_pci )
++        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
++
++    return is_pci;
++}
++
+ static bool_t dt_bus_pci_match(const struct dt_device_node *np)
+ {
+     /*
+      * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
+      * powermacs "ht" is hypertransport
++     *
++     * If none of the device_type match, and that the node name is
++     * "pcie" or "pci", accept the device as PCI (with a warning).
+      */
+     return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
+-        !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
++        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
++        dt_node_is_pci(np);
+ }
+
+ static void dt_bus_pci_count_cells(const struct dt_device_node *np,
+--
+2.25.1
+
recipes-extended/xen/xen_4.14.bb +1 -0
index 267db16..c0fa938 100644
@@ -7,6 +7,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
   git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
   file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
   "
 
Quoted 4 lines

LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" --
2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#13 lore raw

PATCH 3/3 xen: fix boot on the Raspberry Pi 4

In reply to Christopher Clark

Apply the patch from Xen to fix device tree parsing in newer kernels and remove the Xen configuration file since the default works.

---
 .../xen/files/defconfig_raspberrypi4-64       | 117 ------------------
 .../recipes-extended/xen/xen_git.bbappend     |  11 --
 ...issing-device_type-property-in-pci-p.patch |  91 ++++++++++++++
 recipes-extended/xen/xen_4.14.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 5 files changed, 93 insertions(+), 128 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64
 delete mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend
 create mode 100644 recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch
dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 deleted +0 -117
deleted file mode 100644
index f3343d3..0000000
@@ -1,117 +0,0 @@
-#
-# 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
dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend deleted +0 -11
deleted file mode 100644
index 995dfd3..0000000
@@ -1,11 +0,0 @@
-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
-}
recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch new file +91 -0

91 lines not on this page · raw message

recipes-extended/xen/xen_4.14.bb +1 -0
index 6ac3236..14dd54a 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen_git.bb +1 -0
index fba12e5..5b16d58 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.25.1
#14 lore raw

PATCH 3/3 xen: fix boot on the Raspberry Pi 4 with Xen 4.14

In reply to Christopher Clark

Apply the patch from Xen to fix device tree parsing in newer kernels and remove the Xen configuration file since the default works.

---
 .../xen/files/defconfig_raspberrypi4-64       | 117 ------------------
 .../recipes-extended/xen/xen_git.bbappend     |  11 --
 ...issing-device_type-property-in-pci-p.patch |  91 ++++++++++++++
 recipes-extended/xen/xen_4.14.bb              |   1 +
 4 files changed, 92 insertions(+), 128 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64
 delete mode 100644 dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend
 create mode 100644 recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch
dynamic-layers/raspberrypi/recipes-extended/xen/files/defconfig_raspberrypi4-64 deleted +0 -117
deleted file mode 100644
index f3343d3..0000000
@@ -1,117 +0,0 @@
-#
-# 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
dynamic-layers/raspberrypi/recipes-extended/xen/xen_git.bbappend deleted +0 -11
deleted file mode 100644
index 995dfd3..0000000
@@ -1,11 +0,0 @@
-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
-}
recipes-extended/xen/files/0001-xen-workaround-missing-device_type-property-in-pci-p.patch new file +91 -0

91 lines not on this page · raw message

recipes-extended/xen/xen_4.14.bb +1 -0
index 6ac3236..14dd54a 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-xen-workaround-missing-device_type-property-in-pci-p.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.25.1
#15 lore raw

PATCH 1/1 xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

In reply to Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision.

Remove the linux-yocto-dev in favour of the linux-yocto kernel version 5.15 which has been tested and verified working on the board.

---
 .../recipes-kernel/linux/linux-yocto-dev.bbappend         | 8 --------
 .../recipes-kernel/linux/linux-yocto_5.15.bbappend        | 6 ++++++
 2 files changed, 6 insertions(+), 8 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend
 create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -8
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend new file +6 -0
new file mode 100644
index 0000000..572f7ec
@@ -0,0 +1,6 @@
+# Enable use of the linux-yocto 5.15 kernel for the Raspberry Pi 4
+KBRANCH:raspberrypi4-64 ?= "v5.15/standard/bcm-2xxx-rpi"
+KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
+COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
+
+require linux-yocto_xen-rpi.inc
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#16 lore raw

Re: [meta-virtualization][PATCH] xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

Hi,

Quoted 11 lines · Christopher Clark

The default preferred Linux kernel for Xen on the Raspberry Pi 4 is linux-yocto. The alternative provided option is linux-yocto-dev, but this is unintentionally a branch tracking configuration rather than a fixed revision.

Remove the linux-yocto-dev in favour of the linux-yocto kernel version 5.15 which has been tested and verified working on the board.

Cheers
Bertrand

Quoted 34 lines

---
.../recipes-kernel/linux/linux-yocto-dev.bbappend | 8 --------
.../recipes-kernel/linux/linux-yocto_5.15.bbappend | 6 ++++++

2 files changed, 6 insertions(+), 8 deletions(-)

delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend

dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend deleted +0 -8
deleted file mode 100644
index 5f43052..0000000
@@ -1,8 +0,0 @@
-# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
-# with Xen-on-ARM-specific command line options
-
-KBRANCH:raspberrypi4-64 ?= "standard/bcm-2xxx-rpi"
-KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
-COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
-
-require linux-yocto_xen-rpi.inc
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto_5.15.bbappend new file +6 -1
new file mode 100644
index 0000000..572f7ec
@@ -0,0 +1,6 @@
+# Enable use of the linux-yocto 5.15 kernel for the Raspberry Pi 4
+KBRANCH:raspberrypi4-64 ?= "v5.15/standard/bcm-2xxx-rpi"
+KMACHINE:raspberrypi4-64 ?= "bcm-2xxx-rpi4"
+COMPATIBLE_MACHINE:raspberrypi4-64 = "(raspberrypi4-64)"
+
+require linux-yocto_xen-rpi.inc
--
Quoted 2 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#17 lore raw
In reply to Christopher Clark

Hi Christopher,

Quoted 22 lines · Christopher Clark

A series of fixes applied to master and across stable branches where needed to fix running Xen on the Raspberry Pi 4 board.

This updates Linux kernel configuration for Xen to remove tracking from the linux-yocto-dev kernel, either by applying a fixed revision and specification of a stable branch or replacing it with the linux-yocto kernel. The Xen build configuration is updated to remove the hypervisor defconfig for the Raspberry Pi and drop the arm64 prelink patch as a license correction and since the build no longer needs it with the newer gcc toolchain.

Tested on hardware.

Christopher Clark

gatesgarth:
01: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 02: xen: drop patch to workaround prelink on aarch64 03: xen: fix boot on the Raspberry Pi 4

Quoted 4 lines

hardknott:
04: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 05: xen: drop patch to workaround prelink on aarch64 06: xen: fix boot on the Raspberry Pi 4

Hardknott and gatesgarth are EOL so I do not think those patches are needed.

Quoted 11 lines

honister:
07: linux-yocto-dev, xen, raspberrypi: remove tracking bbappend 08: xen: drop patch to workaround prelink on aarch64 09: xen: fix boot on the Raspberry Pi 4 with Xen 4.14

kirkstone:
10: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

master:
11: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#18 lore raw
In reply to Christopher Clark
Quoted 11 lines · Christopher Clark

A series of fixes applied to master and across stable branches where needed to fix running Xen on the Raspberry Pi 4 board.

This updates Linux kernel configuration for Xen to remove tracking from the linux-yocto-dev kernel, either by applying a fixed revision and specification of a stable branch or replacing it with the linux-yocto kernel. The Xen build configuration is updated to remove the hypervisor defconfig for the Raspberry Pi and drop the arm64 prelink patch as a license correction and since the build no longer needs it with the newer gcc toolchain.

I appreciate the patches for all the branches, it gives more confidence in how thorough things look!

I will avoid the EOL branches, but if someone really wants them, they are on the list and I wouldn't fight too hard about not applying them.

Just so I'm clear, there aren't actually 11 patches, just some of the patches repeated across the various branches .. totalling 11. If that is wrong, please do follow up to the branches with more patches, as I definitely didn't get 11.

Bruce

Quoted 25 lines

Tested on hardware.

Christopher Clark

gatesgarth:
01: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 02: xen: drop patch to workaround prelink on aarch64 03: xen: fix boot on the Raspberry Pi 4

hardknott:
04: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 05: xen: drop patch to workaround prelink on aarch64 06: xen: fix boot on the Raspberry Pi 4

honister:
07: linux-yocto-dev, xen, raspberrypi: remove tracking bbappend 08: xen: drop patch to workaround prelink on aarch64 09: xen: fix boot on the Raspberry Pi 4 with Xen 4.14

kirkstone:
10: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

master:
11: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#19 lore raw
Quoted 15 lines · Bruce Ashfield
Quoted 11 lines · Christopher Clark

A series of fixes applied to master and across stable branches where needed to fix running Xen on the Raspberry Pi 4 board.

This updates Linux kernel configuration for Xen to remove tracking from the linux-yocto-dev kernel, either by applying a fixed revision and specification of a stable branch or replacing it with the linux-yocto kernel. The Xen build configuration is updated to remove the hypervisor defconfig for the Raspberry Pi and drop the arm64 prelink patch as a license correction and since the build no longer needs it with the newer gcc toolchain.

Quoted 5 lines

I appreciate the patches for all the branches, it gives more confidence in how thorough things look!

I will avoid the EOL branches, but if someone really wants them, they are on the list and I wouldn't fight too hard about not applying them.

ack, ok

Quoted 4 lines

Just so I'm clear, there aren't actually 11 patches, just some of the patches repeated across the various branches .. totalling 11. If that is wrong, please do follow up to the branches with more patches, as I definitely didn't get 11.

It is a bit confusing, sorry - I sent 11 patches in total, so I put "0/11" on the cover letter, but that's the total over 5 branches. (They are in sequence starting here:
https://lists.yoctoproject.org/g/meta-virtualization/message/7298 and listed in the first message in this thread)
When I sent each patch, I put the branch name that the patch applies to in the Subject line.

There are at most 3 patches for any given branch, and although the patches do look similar between branches, there are small differences:
eg. selection of "v5.10/standard/bcm-2xxx-rpi" for gatesgarth vs "v5.12/standard/bcm-2xxx-rpi" for hardknott, reflecting the state of linux-yocto-dev at the point that the branch was active.
So I sent the patches that I tested in each branch, and I would recommend applying the sent one rather than picking similar ones across between branches for these.

thanks,

Christopher

Quoted 35 lines

Bruce

Quoted 20 lines

Tested on hardware.

Christopher Clark

gatesgarth:
01: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 02: xen: drop patch to workaround prelink on aarch64 03: xen: fix boot on the Raspberry Pi 4

hardknott:
04: linux-yocto-dev, raspberrypi: apply fixed revision to kernel 05: xen: drop patch to workaround prelink on aarch64 06: xen: fix boot on the Raspberry Pi 4

honister:
07: linux-yocto-dev, xen, raspberrypi: remove tracking bbappend 08: xen: drop patch to workaround prelink on aarch64 09: xen: fix boot on the Raspberry Pi 4 with Xen 4.14

Quoted 5 lines

kirkstone:
10: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

master:
11: xen, raspberry pi: replace linux-yocto-dev with linux-yocto 5.15

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II