Skip to contentSkip to conversation

Xen on Raspberry Pi 4 improvements

PATCH In review Christopher Clark 2 participants 7 messages Aug 7, 2020 – Aug 11, 2020 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

cover Xen on Raspberry Pi 4 improvements

Several improvements, the most significant being the kernel change:

* Switch the Linux kernel for Xen on the Raspberry Pi 4 to linux-yocto-dev from the linux-raspberrypi downstream kernel.

This will enable testing and preparation for switching over to the new linux-yocto kernel when it is upgraded, and also avoid build breakages and other difficulties experienced with the unstable linux-raspberrypi kernel.

Testing with linux-yocto-dev has been with the raspberrypi4-64 MACHINE from the meta-raspberrypi layer.

This change removes the patch series that was carried in this layer for the linux-raspberrypi kernel for Xen support.

Please note: There are currently in-flight dependencies for this series awaiting review: linux-yocto series, needed for Xen support:
https://lists.yoctoproject.org/g/linux-yocto/topic/linux_yocto_dev_kernel/76044154
and a kernel bugfix:
https://lists.yoctoproject.org/g/linux-yocto/message/8922

* Retire the sdcard image recipe now that the meta-raspberrypi recipe is extensible.

* Recipe bug fixes and improvements.

Christopher

Christopher Clark (5):
xen: retire the Raspberry Pi sdcard class
xen, raspberrypi: bugfix early boot messages: use earlycon=xenboot xen, rpi4: use RPI_EXTRA_CONFIG and drop the rpi-config_git.bbappend xen, linux-raspberrypi4: remove linux-raspberrypi bbappends and
patches
xen, raspi4, linux-yocto-dev: Enable Xen on Raspberry Pi 4

 classes/sdcard_image-rpi-xen.bbclass          | 120 ------------------
 conf/distro/include/meta-virt-xen.inc         |  21 ++-
 .../bootfiles/rpi-config_git.bbappend         |   6 -
 .../rpi-u-boot-scr/files/boot.cmd.xen.in      |   2 +-
 ...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 ---
 .../linux/linux-yocto-dev.bbappend            |  10 ++
 16 files changed, 25 insertions(+), 720 deletions(-)
 delete mode 100644 classes/sdcard_image-rpi-xen.bbclass
 delete mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend
 create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 xen: retire the Raspberry Pi sdcard class

The sdcard class in the meta-raspberrypi layer is now extensible with support for adding files such as hypervisor binaries to the boot partition, so this layer can switch to use that and drop the custom sdcard bbclass.

Uses the new RPI_SDIMG_EXTRA_DEPENDS and DEPLOYPAYLOAD variables,
and: IMAGE_CLASS: sdcard_image-rpi-xen => sdcard_image-rpi
IMAGE_FSTYPE: rpi-xen-sdimg => rpi-sdimg

Please note that the filename suffix of the image is changed by this.

Also apply _raspberrypi4-64 scoping to the Raspberry Pi settings.

---
 classes/sdcard_image-rpi-xen.bbclass  | 120 --------------------------
 conf/distro/include/meta-virt-xen.inc |  13 +--
 2 files changed, 8 insertions(+), 125 deletions(-)
 delete mode 100644 classes/sdcard_image-rpi-xen.bbclass
classes/sdcard_image-rpi-xen.bbclass deleted +0 -120
deleted file mode 100644
index c03520c..0000000
@@ -1,120 +0,0 @@
-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
-}
conf/distro/include/meta-virt-xen.inc +8 -5
index b61f612..1ad670e 100644
@@ -6,11 +6,14 @@ PACKAGECONFIG_append_pn-qemu_arm = " fdt"
 PACKAGECONFIG_append_pn-qemu_aarch64 = " fdt"
 
 # Raspberry Pi settings
-#  - Xen uses u-boot for configuration and uses the uart
-RPI_USE_U_BOOT = "1"
-ENABLE_UART = "1"
+# Xen uses u-boot for configuration and uses the uart
+RPI_USE_U_BOOT_raspberrypi4-64 = "1"
+ENABLE_UART_raspberrypi4-64 = "1"
 # Build the bootable SD card image
-IMAGE_CLASSES_append_raspberrypi4-64 = " sdcard_image-rpi-xen"
-IMAGE_FSTYPES_append_raspberrypi4-64 = " rpi-xen-sdimg"
+IMAGE_CLASSES_append_raspberrypi4-64 = " sdcard_image-rpi"
+IMAGE_FSTYPES_append_raspberrypi4-64 = " rpi-sdimg"
+# Add Xen to the bootable SD card image
+RPI_SDIMG_EXTRA_DEPENDS_append_raspberrypi4-64 = " xen:do_deploy"
+DEPLOYPAYLOAD_raspberrypi4-64 = "xen-${MACHINE}:xen"
 # Align kernel version with current meta-virtualization kernel version
 PREFERRED_VERSION_linux-raspberrypi ?= "5.4.%"
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 xen, raspberrypi: bugfix early boot messages: use earlycon=xenboot

In reply to Christopher Clark

Replaces the prior use of earlyprintk which is an x86-specific option.

---
 .../recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in            | 2 +-
 .../recipes-kernel/linux/linux-raspberrypi_%.bbappend           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
dynamic-layers/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.xen.in +1 -1
index 6c38d7d..84d533a 100644
@@ -14,7 +14,7 @@ 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"
+setenv dom0_bootargs "console=hvc0 earlycon=xenboot 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
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend +1 -1
index 25979e2..bead4aa 100644
@@ -1,5 +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"
+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)}"
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 xen, rpi4: use RPI_EXTRA_CONFIG and drop the rpi-config_git.bbappend

In reply to Christopher Clark

The GIC that is needed by Xen can be enabled via the rpi-config recipe variable. Fixes the build after the upstream recipe changed recently.

---
 conf/distro/include/meta-virt-xen.inc                       | 2 ++
 .../recipes-bsp/bootfiles/rpi-config_git.bbappend           | 6 ------
 2 files changed, 2 insertions(+), 6 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
conf/distro/include/meta-virt-xen.inc +2 -0
index 1ad670e..fe3fd22 100644
@@ -15,5 +15,7 @@ IMAGE_FSTYPES_append_raspberrypi4-64 = " rpi-sdimg"
 # Add Xen to the bootable SD card image
 RPI_SDIMG_EXTRA_DEPENDS_append_raspberrypi4-64 = " xen:do_deploy"
 DEPLOYPAYLOAD_raspberrypi4-64 = "xen-${MACHINE}:xen"
+# We need the GIC enabled for Xen to work
+RPI_EXTRA_CONFIG_append_raspberrypi4-64  = "\nenable_gic=1"
 # Align kernel version with current meta-virtualization kernel version
 PREFERRED_VERSION_linux-raspberrypi ?= "5.4.%"
dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend deleted +0 -6
deleted file mode 100644
index 2b9c4fb..0000000
@@ -1,6 +0,0 @@
-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
-}
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 xen, linux-raspberrypi4: remove linux-raspberrypi bbappends and patches

In reply to Christopher Clark

Retiring use of the downstream vendor kernel for use with Xen.

---
 conf/distro/include/meta-virt-xen.inc         |  2 -
 ...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 ----
 12 files changed, 588 deletions(-)
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
 delete mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend
conf/distro/include/meta-virt-xen.inc +0 -2
index fe3fd22..0a91ef9 100644
@@ -17,5 +17,3 @@ RPI_SDIMG_EXTRA_DEPENDS_append_raspberrypi4-64 = " xen:do_deploy"
 DEPLOYPAYLOAD_raspberrypi4-64 = "xen-${MACHINE}:xen"
 # We need the GIC enabled for Xen to work
 RPI_EXTRA_CONFIG_append_raspberrypi4-64  = "\nenable_gic=1"
-# Align kernel version with current meta-virtualization kernel version
-PREFERRED_VERSION_linux-raspberrypi ?= "5.4.%"
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch deleted +0 -44

44 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch deleted +0 -47

47 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch deleted +0 -78

78 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch deleted +0 -66

66 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch deleted +0 -57

57 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch deleted +0 -88

88 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch deleted +0 -68

68 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch deleted +0 -75

75 lines not on this page · raw message

dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch deleted +0 -39
deleted file mode 100644
index a84ae74..0000000
@@ -1,39 +0,0 @@
-From 1f1182bf84ec7a6d1ec74c56fccd66ff013077af Mon Sep 17 00:00:00 2001
-From: Stefano Stabellini <[email protected]>
-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 <[email protected]>
----
- 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);
- }
- 
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend deleted +0 -5
deleted file mode 100644
index bead4aa..0000000
@@ -1,5 +0,0 @@
-# For a Xen-enabled distro, override the contents of cmdline.txt
-
-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)}"
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend deleted +0 -19
deleted file mode 100644
index ec8d677..0000000
@@ -1,19 +0,0 @@
-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 \
-    "
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 xen, raspi4, linux-yocto-dev: Enable Xen on Raspberry Pi 4

In reply to Christopher Clark

Enable linux-yocto-dev as the Linux kernel for Xen on the Raspberry Pi 4, with the bcm-2xxx-rpi4 KMACHINE and KBRANCH.

Set a Raspberry Pi SD card variable to increase the size of the boot partition to accommodate both the kernel and the Xen hypervisor.

---
Please note: There are currently in-flight dependencies for this awaiting review: linux-yocto series, needed for Xen support:
https://lists.yoctoproject.org/g/linux-yocto/topic/linux_yocto_dev_kernel/76044154
and a Yocto kernel bugfix:
https://lists.yoctoproject.org/g/linux-yocto/message/8922

 conf/distro/include/meta-virt-xen.inc                  |  4 ++++
 .../recipes-kernel/linux/linux-yocto-dev.bbappend      | 10 ++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend
conf/distro/include/meta-virt-xen.inc +4 -0
index 0a91ef9..44853d9 100644
@@ -17,3 +17,7 @@ RPI_SDIMG_EXTRA_DEPENDS_append_raspberrypi4-64 = " xen:do_deploy"
 DEPLOYPAYLOAD_raspberrypi4-64 = "xen-${MACHINE}:xen"
 # We need the GIC enabled for Xen to work
 RPI_EXTRA_CONFIG_append_raspberrypi4-64  = "\nenable_gic=1"
+# Increase boot partition for space for kernel and Xen
+BOOT_SPACE_raspberrypi4-64 = "61440"
+# Override the meta-raspberrypi default kernel preference
+PREFERRED_PROVIDER_virtual/kernel_raspberrypi4-64 = "linux-yocto-dev"
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-yocto-dev.bbappend new file +10 -0
new file mode 100644
index 0000000..85d6feb
@@ -0,0 +1,10 @@
+# For a Xen-enabled distro on the Raspberry Pi, override the contents of cmdline.txt
+# with Xen-on-ARM-specific command line options
+
+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"
+KMACHINE_raspberrypi4-64 = "bcm-2xxx-rpi4"
+COMPATIBLE_MACHINE_raspberrypi4-64 = "(raspberrypi4-64)"
Signature · 1 line
2.17.1
#6 lore raw
In reply to Christopher Clark
Quoted 16 lines · Christopher Clark

Several improvements, the most significant being the kernel change:

* Switch the Linux kernel for Xen on the Raspberry Pi 4 to linux-yocto-dev from the linux-raspberrypi downstream kernel.

This will enable testing and preparation for switching over to the new linux-yocto kernel when it is upgraded, and also avoid build breakages and other difficulties experienced with the unstable linux-raspberrypi kernel.

Testing with linux-yocto-dev has been with the raspberrypi4-64 MACHINE from the meta-raspberrypi layer.

This change removes the patch series that was carried in this layer for the linux-raspberrypi kernel for Xen support.

Quoted 8 lines

Please note: There are currently in-flight dependencies for this series awaiting review: linux-yocto series, needed for Xen support:

https://lists.yoctoproject.org/g/linux-yocto/topic/linux_yocto_dev_kernel/76044154
and a kernel bugfix:
https://lists.yoctoproject.org/g/linux-yocto/message/8922

merged

And the kernel elements are in place as well.

I have pending SRCREV updates for the kernel, but if you build with the tip of the branch by setting your own SRCREVs, it is functional.

Bruce

Quoted 65 lines

* Retire the sdcard image recipe now that the meta-raspberrypi recipe is extensible.

* Recipe bug fixes and improvements.

Christopher

Christopher Clark (5):
xen: retire the Raspberry Pi sdcard class
xen, raspberrypi: bugfix early boot messages: use earlycon=xenboot xen, rpi4: use RPI_EXTRA_CONFIG and drop the rpi-config_git.bbappend xen, linux-raspberrypi4: remove linux-raspberrypi bbappends and
patches
xen, raspi4, linux-yocto-dev: Enable Xen on Raspberry Pi 4

 classes/sdcard_image-rpi-xen.bbclass          | 120 ------------------
 conf/distro/include/meta-virt-xen.inc         |  21 ++-
 .../bootfiles/rpi-config_git.bbappend         |   6 -
 .../rpi-u-boot-scr/files/boot.cmd.xen.in      |   2 +-
 ...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 ---
 .../linux/linux-yocto-dev.bbappend            |  10 ++
 16 files changed, 25 insertions(+), 720 deletions(-)
 delete mode 100644 classes/sdcard_image-rpi-xen.bbclass
 delete mode 100644
dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0001-swiotlb-xen-use-vmalloc_to_page-on-vmalloc-virt-addr.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0002-swiotlb-xen-remove-start_dma_addr.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0003-swiotlb-xen-add-struct-device-parameter-to-xen_phys_.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0004-swiotlb-xen-add-struct-device-parameter-to-xen_bus_t.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0007-swiotlb-xen-add-struct-device-parameter-to-is_xen_sw.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0008-swiotlb-xen-introduce-phys_to_dma-dma_to_phys-transl.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0009-xen-arm-introduce-phys-dma-translations-in-xen_dma_s_kernel_5.4.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0010-xen-arm-call-dma_to_phys-on-the-dma_addr_t-parameter.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/files/0011-adding-page-coherent-patch.patch
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
 delete mode 100644
dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend
 create mode 100644

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

--
2.17.1

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