riscv: Run with other QEMU models
Subsystems (4)
cover riscv: Run with other QEMU models
Provide a couple patches allowing a QEMU machine model other than 'virt' to be used. We just need to be able to override 'virt' in the command line and it's also nice to be able to specify a different UART address for any early (pre DT parsing) outputs.
Andrew Jones (2):
configure: Allow earlycon for all architectures
riscv: Introduce MACHINE_OVERRIDE
configure | 88 +++++++++++++++++++++++++++---------------------------- riscv/run | 6 ++-- 2 files changed, 47 insertions(+), 47 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/2 configure: Allow earlycon for all architectures
From: Andrew Jones <[email protected]>
earlycon could be used by any architecture so check it outside the arm block and apply it to riscv right away.
--- configure | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 45 deletions(-)
configure +43 -45
@@ -78,10 +78,9 @@ usage() { 4k [default], 16k, 64k for arm64. 4k [default], 64k for ppc64. --earlycon=EARLYCON - Specify the UART name, type and address (optional, arm and - arm64 only). The specified address will overwrite the UART - address set by the --target option. EARLYCON can be one of - (case sensitive): + Specify the UART name, type and address (optional). + The specified address will overwrite the UART address set by + the --target option. EARLYCON can be one of (case sensitive): uart[8250],mmio,ADDR Specify an 8250 compatible UART at address ADDR. Supported register stride is 8 bit only.
@@ -283,6 +282,41 @@ else fi fi +if [ "$earlycon" ]; then + IFS=, read -r name type_addr addr <<<"$earlycon" + if [ "$name" != "uart" ] && [ "$name" != "uart8250" ] && [ "$name" != "pl011" ]; then + echo "unknown earlycon name: $name" + usage + fi + + if [ "$name" = "pl011" ]; then + if [ -z "$addr" ]; then + addr=$type_addr + else + if [ "$type_addr" != "mmio32" ]; then + echo "unknown $name earlycon type: $type_addr" + usage + fi + fi + else + if [ "$type_addr" != "mmio" ]; then + echo "unknown $name earlycon type: $type_addr" + usage + fi + fi + + if [ -z "$addr" ]; then + echo "missing $name earlycon address" + usage + fi + if [[ $addr =~ ^0(x|X)[0-9a-fA-F]+$ ]] || [[ $addr =~ ^[0-9]+$ ]]; then + uart_early_addr=$addr + else + echo "invalid $name earlycon address: $addr" + usage + fi +fi + [ -z "$processor" ] && processor="$arch" if [ "$processor" = "arm64" ]; then
@@ -296,51 +330,14 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then testdir=arm if [ "$target" = "qemu" ]; then - arm_uart_early_addr=0x09000000 + : "${uart_early_addr:=0x9000000}" elif [ "$target" = "kvmtool" ]; then - arm_uart_early_addr=0x1000000 + : "${uart_early_addr:=0x1000000}" errata_force=1 else echo "--target must be one of 'qemu' or 'kvmtool'!" usage fi - - if [ "$earlycon" ]; then - IFS=, read -r name type_addr addr <<<"$earlycon" - if [ "$name" != "uart" ] && [ "$name" != "uart8250" ] && - [ "$name" != "pl011" ]; then - echo "unknown earlycon name: $name" - usage - fi - - if [ "$name" = "pl011" ]; then - if [ -z "$addr" ]; then - addr=$type_addr - else - if [ "$type_addr" != "mmio32" ]; then - echo "unknown $name earlycon type: $type_addr" - usage - fi - fi - else - if [ "$type_addr" != "mmio" ]; then - echo "unknown $name earlycon type: $type_addr" - usage - fi - fi - - if [ -z "$addr" ]; then - echo "missing $name earlycon address" - usage - fi - if [[ $addr =~ ^0(x|X)[0-9a-fA-F]+$ ]] || - [[ $addr =~ ^[0-9]+$ ]]; then - arm_uart_early_addr=$addr - else - echo "invalid $name earlycon address: $addr" - usage - fi - fi elif [ "$arch" = "ppc64" ]; then testdir=powerpc firmware="$testdir/boot_rom.bin"
@@ -351,6 +348,7 @@ elif [ "$arch" = "ppc64" ]; then elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then testdir=riscv arch_libdir=riscv + : "${uart_early_addr:=0x10000000}" elif [ "$arch" = "s390x" ]; then testdir=s390x else
@@ -491,7 +489,7 @@ EOF if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE ${arm_uart_early_addr} +#define CONFIG_UART_EARLY_BASE ${uart_early_addr} #define CONFIG_ERRATA_FORCE ${errata_force} EOF
@@ -506,7 +504,7 @@ EOF elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE 0x10000000 +#define CONFIG_UART_EARLY_BASE ${uart_early_addr} EOF fi
Signature · 1 line
2.48.1
PATCH 2/2 riscv: Introduce MACHINE_OVERRIDE
In reply to Andrew JonesFrom: Andrew Jones <[email protected]>
Allow riscv tests to use QEMU machine types other than virt.
--- riscv/run | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
riscv/run +4 -2
@@ -10,10 +10,12 @@ if [ -z "$KUT_STANDALONE" ]; then fi # Allow user overrides of some config.mak variables +mach=$MACHINE_OVERRIDE processor=$PROCESSOR_OVERRIDE firmware=$FIRMWARE_OVERRIDE [ "$PROCESSOR" = "$ARCH" ] && PROCESSOR="max" +: "${mach:=virt}" : "${processor:=$PROCESSOR}" : "${firmware:=$FIRMWARE}" [ "$firmware" ] && firmware="-bios $firmware"
@@ -23,11 +25,11 @@ set_qemu_accelerator || exit $? acc="-accel $ACCEL$ACCEL_PROPS" qemu=$(search_qemu_binary) || exit $? -if ! $qemu -machine '?' | grep -q 'RISC-V VirtIO board'; then +if [ "$mach" = 'virt' ] && ! $qemu -machine '?' | grep -q 'RISC-V VirtIO board'; then echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting." exit 2 fi -mach='-machine virt' +mach="-machine $mach" command="$qemu -nodefaults -nographic -serial mon:stdio" command+=" $mach $acc $firmware -cpu $processor "
Signature · 1 line
2.48.1
Re: [kvm-unit-tests PATCH 1/2] configure: Allow earlycon for all architectures
In reply to Andrew JonesQuoted 15 lines · Andrew Jones
From: Andrew Jones <[email protected]>
earlycon could be used by any architecture so check it outside the arm block and apply it to riscv right away.
Signed-off-by Andrew Jones <[email protected]>--- configure | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 45 deletions(-)configure +0
-0
configure usage() { · line 83
Quoted 10 lines
configure +3
-4@@ -78,10 +78,9 @@ usage() { 4k [default], 16k, 64k for arm64. 4k [default], 64k for ppc64. --earlycon=EARLYCON - Specify the UART name, type and address (optional, arm and - arm64 only). The specified address will overwrite the UART - address set by the --target option. EARLYCON can be one of - (case sensitive): + Specify the UART name, type and address (optional). + The specified address will overwrite the UART address set by + the --target option. EARLYCON can be one of (case sensitive):
I'll add
(arm/arm64 and riscv32/riscv64 only)
since no other architecture is paying attention to the parameter at this time.
Thanks,
drew
Quoted 128 lines
configure +40
-41uart[8250],mmio,ADDR Specify an 8250 compatible UART at address ADDR. Supported register stride is 8 bit only.@@ -283,6 +282,41 @@ else fi fi +if [ "$earlycon" ]; then + IFS=, read -r name type_addr addr <<<"$earlycon" + if [ "$name" != "uart" ] && [ "$name" != "uart8250" ] && [ "$name" != "pl011" ]; then + echo "unknown earlycon name: $name" + usage + fi + + if [ "$name" = "pl011" ]; then + if [ -z "$addr" ]; then + addr=$type_addr + else + if [ "$type_addr" != "mmio32" ]; then + echo "unknown $name earlycon type: $type_addr" + usage + fi + fi + else + if [ "$type_addr" != "mmio" ]; then + echo "unknown $name earlycon type: $type_addr" + usage + fi + fi + + if [ -z "$addr" ]; then + echo "missing $name earlycon address" + usage + fi + if [[ $addr =~ ^0(x|X)[0-9a-fA-F]+$ ]] || [[ $addr =~ ^[0-9]+$ ]]; then + uart_early_addr=$addr + else + echo "invalid $name earlycon address: $addr" + usage + fi +fi + [ -z "$processor" ] && processor="$arch" if [ "$processor" = "arm64" ]; then@@ -296,51 +330,14 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then testdir=arm if [ "$target" = "qemu" ]; then - arm_uart_early_addr=0x09000000 + : "${uart_early_addr:=0x9000000}" elif [ "$target" = "kvmtool" ]; then - arm_uart_early_addr=0x1000000 + : "${uart_early_addr:=0x1000000}" errata_force=1 else echo "--target must be one of 'qemu' or 'kvmtool'!" usage fi - - if [ "$earlycon" ]; then - IFS=, read -r name type_addr addr <<<"$earlycon" - if [ "$name" != "uart" ] && [ "$name" != "uart8250" ] && - [ "$name" != "pl011" ]; then - echo "unknown earlycon name: $name" - usage - fi - - if [ "$name" = "pl011" ]; then - if [ -z "$addr" ]; then - addr=$type_addr - else - if [ "$type_addr" != "mmio32" ]; then - echo "unknown $name earlycon type: $type_addr" - usage - fi - fi - else - if [ "$type_addr" != "mmio" ]; then - echo "unknown $name earlycon type: $type_addr" - usage - fi - fi - - if [ -z "$addr" ]; then - echo "missing $name earlycon address" - usage - fi - if [[ $addr =~ ^0(x|X)[0-9a-fA-F]+$ ]] || - [[ $addr =~ ^[0-9]+$ ]]; then - arm_uart_early_addr=$addr - else - echo "invalid $name earlycon address: $addr" - usage - fi - fi elif [ "$arch" = "ppc64" ]; then testdir=powerpc firmware="$testdir/boot_rom.bin"@@ -351,6 +348,7 @@ elif [ "$arch" = "ppc64" ]; then elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then testdir=riscv arch_libdir=riscv + : "${uart_early_addr:=0x10000000}" elif [ "$arch" = "s390x" ]; then testdir=s390x else@@ -491,7 +489,7 @@ EOF if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE ${arm_uart_early_addr} +#define CONFIG_UART_EARLY_BASE ${uart_early_addr} #define CONFIG_ERRATA_FORCE ${errata_force} EOF@@ -506,7 +504,7 @@ EOF elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then cat <<EOF >> lib/config.h -#define CONFIG_UART_EARLY_BASE 0x10000000 +#define CONFIG_UART_EARLY_BASE ${uart_early_addr} EOF fiSignature · 1 line
2.48.1
Quoted 5 lines · Andrew Jones
Provide a couple patches allowing a QEMU machine model other than 'virt' to be used. We just need to be able to override 'virt' in the command line and it's also nice to be able to specify a different UART address for any early (pre DT parsing) outputs.
Quoted 10 lines
Andrew Jones (2):
configure: Allow earlycon for all architectures
riscv: IntroduceMACHINE_OVERRIDEconfigure | 88 +++++++++++++++++++++++++++---------------------------- riscv/run | 6 ++-- 2 files changed, 47 insertions(+), 47 deletions(-)Signature · 1 line
2.48.1
Merged.
Thanks,
drew