Misc updates for the dom0less support
cover Misc updates for the dom0less support
From: Oleksandr Tyshchenko <[email protected]>
Hello all,
this is a collection of patches (#2-5) for improving the dom0less support and a patch (#1) for dealing with uImage.
Oleksandr Tyshchenko (5):
uboot-script-gen: Update to deal with uImage which is not executable
uboot-script-gen: Extend DOMU_ENHANCED to specify "no-xenstore"
uboot-script-gen: Add ability to specify grant table params
uboot-script-gen: Add ability to unselect "vpl011"
uboot-script-gen: Add ability to specify "nr_spis"
README.md | 29 +++++++++++++++++++++++++---- scripts/uboot-script-gen | 35 +++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/5 uboot-script-gen: Update to deal with uImage which is not executable
From: Oleksandr Tyshchenko <[email protected]>
uImage is the Image that has a U-Boot wrapper, it doesn't contain "executable" string which subsequent "file" command is looking for when inspecting it.
Below the proof:
otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage.gz binaries/uImage.gz: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit, OS Kernel Image (gzip), 9822180 bytes, Fri Sep 29 15:39:42 2023, Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XE1EF21BF, Data CRC: 0XC418025
otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage binaries/uImage: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit, OS Kernel Image (Not compressed), 23269888 bytes, Fri Sep 29 15:40:19 2023, Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XA0B7D051, Data CRC: 0X42083F51
--- scripts/uboot-script-gen | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/uboot-script-gen +4 -4
@@ -505,9 +505,9 @@ function check_file_type() # if file doesn't know what it is, it outputs data, so include that # since some executables aren't recongnized - if [ "$type" = "executable" ] + if [[ "$type" = "executable"* ]] then - type="executable\|data\|ARM OpenFirmware" + type="$type\|data\|ARM OpenFirmware" # file in older distros (ex: RHEL 7.4) just output data for device # tree blobs elif [ "$type" = "Device Tree Blob" ]
@@ -712,7 +712,7 @@ xen_file_loading() { if test "$DOM0_KERNEL" then - check_compressed_file_type $DOM0_KERNEL "executable" + check_compressed_file_type $DOM0_KERNEL "executable\|uImage" dom0_kernel_addr=$memaddr load_file $DOM0_KERNEL "dom0_linux" dom0_kernel_size=$filesize
@@ -747,7 +747,7 @@ xen_file_loading() cleanup_and_return_err fi - check_compressed_file_type ${DOMU_KERNEL[$i]} "executable" + check_compressed_file_type ${DOMU_KERNEL[$i]} "executable\|uImage" domU_kernel_addr[$i]=$memaddr load_file ${DOMU_KERNEL[$i]} "domU${i}_kernel" domU_kernel_size[$i]=$filesize
Signature · 1 line
2.34.1
Re: [ImageBuilder 1/5] uboot-script-gen: Update to deal with uImage which is not executable
Quoted 15 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
uImage is the Image that has a U-Boot wrapper, it doesn't contain "executable" string which subsequent "file" command is looking for when inspecting it.
Below the proof:
otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage.gz binaries/uImage.gz: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit, OS Kernel Image (gzip), 9822180 bytes, Fri Sep 29 15:39:42 2023, Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XE1EF21BF, Data CRC: 0XC418025
Quoted 8 lines
otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage binaries/uImage: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit, OS Kernel Image (Not compressed), 23269888 bytes, Fri Sep 29 15:40:19 2023, Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XA0B7D051, Data CRC: 0X42083F51Suggested-by Stefano Stabellini <[email protected]>Signed-off-by Oleksandr Tyshchenko <[email protected]>
~Michal
PATCH 2/5 uboot-script-gen: Extend DOMU_ENHANCED to specify "no-xenstore"
In reply to Oleksandr TyshchenkoFrom: Oleksandr Tyshchenko <[email protected]>
We need some Xen services to be available within single dom0less DomU. Just using "enabled" will lead to Xen panic because of no Dom0.
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) At the moment, Xenstore support requires dom0 to be present (XEN) ****************************************
--- README.md | 7 ++++--- scripts/uboot-script-gen | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-)
README.md +4 -3
@@ -217,9 +217,10 @@ Where: If set to 1, the VM is direct mapped. The default is 1. This is only applicable when DOMU_STATIC_MEM is specified. -- DOMU_ENHANCED[number] can be set to 1 or 0, default is 1 when Dom0 is - present. If set to 1, the VM can use PV drivers. Older Linux kernels - might break. +- DOMU_ENHANCED[number] can be set to 0, 1, or 2. Default is 1 when Dom0 + is present. If set to 1, the VM can use PV drivers. Older Linux + kernels might break. If set to 2, "no-xenstore" is specified, see Xen + documentation about dom0less "no-xenstore" option. - DOMU_CPUPOOL[number] specifies the id of the cpupool (created using CPUPOOL[number] option, where number == id) that will be assigned to domU.
scripts/uboot-script-gen +3 -0
@@ -348,6 +348,9 @@ function xen_device_tree_editing() if [[ "${DOMU_ENHANCED[$i]}" == 1 || ("$DOM0_KERNEL" && "${DOMU_ENHANCED[$i]}" != 0) ]] then dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + elif [ "${DOMU_ENHANCED[$i]}" == 2 ] + then + dt_set "/chosen/domU$i" "xen,enhanced" "str" "no-xenstore" fi if test -n "${DOMU_SHARED_MEM[i]}"
Signature · 1 line
2.34.1
Re: [ImageBuilder 2/5] uboot-script-gen: Extend DOMU_ENHANCED to specify "no-xenstore"
Quoted 7 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
We need some Xen services to be available within single dom0less DomU. Just using "enabled" will lead to Xen panic because of no Dom0.
Quoted 6 lines
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) At the moment, Xenstore support requires dom0 to be present (XEN) ****************************************Signed-off-by Oleksandr Tyshchenko <[email protected]>
~Michal
PATCH 3/5 uboot-script-gen: Add ability to specify grant table params
In reply to Oleksandr TyshchenkoFrom: Oleksandr Tyshchenko <[email protected]>
Use DOMU_GRANT_VER to set "max_grant_version" dt property. Use DOMU_GRANT_FRAMES to set "max_grant_frames" dt property. Use DOMU_MAPTRACK_FRAMES to set "max_maptrack_frames" dt property.
--- README.md | 10 ++++++++++ scripts/uboot-script-gen | 13 +++++++++++++ 2 files changed, 23 insertions(+)
README.md +10 -0
@@ -222,6 +222,16 @@ Where: kernels might break. If set to 2, "no-xenstore" is specified, see Xen documentation about dom0less "no-xenstore" option. +- DOMU_GRANT_VER[number] is optional but specifies the maximum version + of grant table shared structure (the maximum security supported version + by Xen on Arm64 is 1) + +- DOMU_GRANT_FRAMES[number] is optional but specifies the maximum number + of grant table frames (the default value used by Xen on Arm64 is 64) + +- DOMU_MAPTRACK_FRAMES[number] is optional but specifies the maximum number + of grant maptrack frames (the default value used by Xen on Arm64 is 1024) + - DOMU_CPUPOOL[number] specifies the id of the cpupool (created using CPUPOOL[number] option, where number == id) that will be assigned to domU.
scripts/uboot-script-gen +13 -0
@@ -353,6 +353,19 @@ function xen_device_tree_editing() dt_set "/chosen/domU$i" "xen,enhanced" "str" "no-xenstore" fi + if test -n "${DOMU_GRANT_VER[i]}" + then + dt_set "/chosen/domU$i" "max_grant_version" "int" "${DOMU_GRANT_VER[i]}" + fi + if test -n "${DOMU_GRANT_FRAMES[i]}" + then + dt_set "/chosen/domU$i" "max_grant_frames" "int" "${DOMU_GRANT_FRAMES[i]}" + fi + if test -n "${DOMU_MAPTRACK_FRAMES[i]}" + then + dt_set "/chosen/domU$i" "max_maptrack_frames" "int" "${DOMU_MAPTRACK_FRAMES[i]}" + fi + if test -n "${DOMU_SHARED_MEM[i]}" then add_device_tree_static_shared_mem "/chosen/domU${i}" "${DOMU_SHARED_MEM[i]}"
Signature · 1 line
2.34.1
Re: [ImageBuilder 3/5] uboot-script-gen: Add ability to specify grant table params
Quoted 9 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
Use
DOMU_GRANT_VERto set "max_grant_version" dt property. UseDOMU_GRANT_FRAMESto set "max_grant_frames" dt property. UseDOMU_MAPTRACK_FRAMESto set "max_maptrack_frames" dt property.Signed-off-by Oleksandr Tyshchenko <[email protected]>
~Michal
PATCH 4/5 uboot-script-gen: Add ability to unselect "vpl011"
In reply to Oleksandr TyshchenkoFrom: Oleksandr Tyshchenko <[email protected]>
Introduce new option DOMU_VPL011[nr] that can be set to 0 or 1 (default).
Also align "console=ttyAMA0" Linux cmd arg setting with "vpl011" presense.
--- README.md | 7 ++++++- scripts/uboot-script-gen | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
README.md +6 -1
@@ -151,7 +151,8 @@ Where: - DOMU_KERNEL[number] specifies the DomU kernel to use. - DOMU_CMD[number] specifies the command line arguments for DomU's Linux - kernel. If not set, then "console=ttyAMA0" is used. + kernel. If not set and DOMU_VPL011[number] is not set to 0, then + "console=ttyAMA0" is used. - DOMU_RAMDISK[number] specifies the DomU ramdisk to use.
@@ -232,6 +233,10 @@ Where: - DOMU_MAPTRACK_FRAMES[number] is optional but specifies the maximum number of grant maptrack frames (the default value used by Xen on Arm64 is 1024) +- DOMU_VPL011[number] is optional but used to enable (1)/disable (0) a virtual + PL011 UART for domain. The default is 1. If explicitly set to 0, then + "console=ttyAMA0" is not used as a default DOMU_CMD[number]. + - DOMU_CPUPOOL[number] specifies the id of the cpupool (created using CPUPOOL[number] option, where number == id) that will be assigned to domU.
scripts/uboot-script-gen +5 -2
@@ -344,7 +344,10 @@ function xen_device_tree_editing() add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" dt_set "/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}" fi - dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" + if test -z "${DOMU_VPL011[$i]}" || test "${DOMU_VPL011[$i]}" -eq "1" + then + dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" + fi if [[ "${DOMU_ENHANCED[$i]}" == 1 || ("$DOM0_KERNEL" && "${DOMU_ENHANCED[$i]}" != 0) ]] then dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled"
@@ -677,7 +680,7 @@ function xen_config() then DOMU_VCPUS[$i]=1 fi - if test -z "${DOMU_CMD[$i]}" + if test -z "${DOMU_CMD[$i]}" && (test -z "${DOMU_VPL011[$i]}" || test "${DOMU_VPL011[$i]}" -eq "1") then DOMU_CMD[$i]="console=ttyAMA0" fi
Signature · 1 line
2.34.1
Re: [ImageBuilder 4/5] uboot-script-gen: Add ability to unselect "vpl011"
Quoted 11 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
Introduce new option DOMU_VPL011[nr] that can be set to 0 or 1 (default).
Also align "console=ttyAMA0" Linux cmd arg setting with "vpl011" presense.
Suggested-by Michal Orzel <[email protected]>Signed-off-by Oleksandr Tyshchenko <[email protected]>
That said, I noticed ...
Quoted 35 lines
--- README.md | 7 ++++++- scripts/uboot-script-gen | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-)README.md +6
-1@@ -151,7 +151,8 @@ Where: - DOMU_KERNEL[number] specifies the DomU kernel to use. - DOMU_CMD[number] specifies the command line arguments for DomU's Linux - kernel. If not set, then "console=ttyAMA0" is used. + kernel. If not set and DOMU_VPL011[number] is not set to 0, then + "console=ttyAMA0" is used. - DOMU_RAMDISK[number] specifies the DomU ramdisk to use.@@ -232,6 +233,10 @@ Where: - DOMU_MAPTRACK_FRAMES[number] is optional but specifies the maximum number of grant maptrack frames (the default value used by Xen on Arm64 is 1024) +- DOMU_VPL011[number] is optional but used to enable (1)/disable (0) a virtual + PL011 UART for domain. The default is 1. If explicitly set to 0, then + "console=ttyAMA0" is not used as a default DOMU_CMD[number]. + - DOMU_CPUPOOL[number] specifies the id of the cpupool (created using CPUPOOL[number] option, where number == id) that will be assigned to domU.scripts/uboot-script-gen +0
-0
scripts/uboot-script-gen function xen_device_tree_editing() · line 349
Quoted 7 lines
scripts/uboot-script-gen +3
-1@@ -344,7 +344,10 @@ function xen_device_tree_editing() add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" dt_set "/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}" fi - dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" + if test -z "${DOMU_VPL011[$i]}" || test "${DOMU_VPL011[$i]}" -eq "1" + then + dt_set "/chosen/domU$i" "vpl011" "hex" "0x1"
... that the property type is incorrect. According to Xen docs, this should be a bool property. @Stefano, can you fix it on commit?
~Michal
PATCH 5/5 uboot-script-gen: Add ability to specify "nr_spis"
In reply to Oleksandr TyshchenkoFrom: Oleksandr Tyshchenko <[email protected]>
This is needed to have a possibility of assigning a specified number of shared peripheral interrupts (SPIs) to domain.
--- README.md | 5 +++++ scripts/uboot-script-gen | 4 ++++ 2 files changed, 9 insertions(+)
README.md +5 -0
@@ -237,6 +237,11 @@ Where: PL011 UART for domain. The default is 1. If explicitly set to 0, then "console=ttyAMA0" is not used as a default DOMU_CMD[number]. +- DOMU_NR_SPIS[number] is optional. It specifies a number of shared peripheral + interrupts (SPIs) to be assigned to domain (depending on the underlying + hardware platform). The minimum possible value is 0, if DOMU_VPL011[number] + is also explicitly set to 0. Otherwise the minimum value is 1. + - DOMU_CPUPOOL[number] specifies the id of the cpupool (created using CPUPOOL[number] option, where number == id) that will be assigned to domU.
scripts/uboot-script-gen +4 -0
@@ -348,6 +348,10 @@ function xen_device_tree_editing() then dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" fi + if test -n "${DOMU_NR_SPIS[$i]}" + then + dt_set "/chosen/domU$i" "nr_spis" "int" "${DOMU_NR_SPIS[$i]}" + fi if [[ "${DOMU_ENHANCED[$i]}" == 1 || ("$DOM0_KERNEL" && "${DOMU_ENHANCED[$i]}" != 0) ]] then dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled"
Signature · 1 line
2.34.1
Re: [ImageBuilder 5/5] uboot-script-gen: Add ability to specify "nr_spis"
Quoted 9 lines · Oleksandr Tyshchenko
From: Oleksandr Tyshchenko <[email protected]>
This is needed to have a possibility of assigning a specified number of shared peripheral interrupts (SPIs) to domain.
Signed-off-by Oleksandr Tyshchenko <[email protected]>Signed-off-by Stefano Stabellini <[email protected]>
~Michal