kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v3] configure: arm: Replace --vmm with --target
@ 2021-04-29 14:12 Alexandru Elisei
  2021-04-29 14:41 ` Andrew Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandru Elisei @ 2021-04-29 14:12 UTC (permalink / raw)
  To: drjones, kvm, kvmarm; +Cc: pbonzini

The --vmm configure option was added to distinguish between the two virtual
machine managers that kvm-unit-tests supports for the arm and arm64
architectures, qemu or kvmtool. There are plans to make kvm-unit-tests work
as an EFI app, which will require changes to the way tests are compiled.
Instead of adding a new configure option specifically for EFI and have it
coexist with --vmm, or overloading the semantics of the existing --vmm
option, let's replace --vmm with the more generic name --target.

Since --target is only valid for arm and arm64, reject the option when it's
specified for another architecture, which is how --vmm should have behaved
from the start.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
Changes in v3:

* Using --target for any architecture other than arm and arm64 generates an
  error.
* Don't generate the TARGET variable in config.mak for other architectures.
* Cosmetic changes to the commit message.

Changes in v2:

* Removed the RFC tag and cover letter.
* Removed --vmm entirely.

 configure | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 01a0b262a9f2..d5d223fe3a90 100755
--- a/configure
+++ b/configure
@@ -21,7 +21,7 @@ pretty_print_stacks=yes
 environ_default=yes
 u32_long=
 wa_divide=
-vmm="qemu"
+target=
 errata_force=0
 erratatxt="$srcdir/errata.txt"
 host_key_document=
@@ -35,8 +35,8 @@ usage() {
 	Options include:
 	    --arch=ARCH            architecture to compile for ($arch)
 	    --processor=PROCESSOR  processor to compile for ($arch)
-	    --vmm=VMM              virtual machine monitor to compile for (qemu
-	                           or kvmtool, default is qemu) (arm/arm64 only)
+	    --target=TARGET        target platform that the tests will be running on (qemu or
+	                           kvmtool, default is qemu) (arm/arm64 only)
 	    --cross-prefix=PREFIX  cross compiler prefix
 	    --cc=CC		   c compiler to use ($cc)
 	    --ld=LD		   ld linker to use ($ld)
@@ -58,7 +58,7 @@ usage() {
 	    --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 --vmm option. EARLYCON can be one of
+	                           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
@@ -88,8 +88,8 @@ while [[ "$1" = -* ]]; do
         --processor)
 	    processor="$arg"
 	    ;;
-	--vmm)
-	    vmm="$arg"
+	--target)
+	    target="$arg"
 	    ;;
 	--cross-prefix)
 	    cross_prefix="$arg"
@@ -146,6 +146,15 @@ arch_name=$arch
 [ "$arch" = "aarch64" ] && arch="arm64"
 [ "$arch_name" = "arm64" ] && arch_name="aarch64"
 
+if [ -z "$target" ]; then
+    target="qemu"
+else
+    if [ "$arch" != "arm64" ] && [ "$arch" != "arm" ]; then
+        echo "--target is not supported for $arch"
+        usage
+    fi
+fi
+
 if [ -z "$page_size" ]; then
     [ "$arch" = "arm64" ] && page_size="65536"
     [ "$arch" = "arm" ] && page_size="4096"
@@ -177,13 +186,13 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
     testdir=x86
 elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
     testdir=arm
-    if [ "$vmm" = "qemu" ]; then
+    if [ "$target" = "qemu" ]; then
         arm_uart_early_addr=0x09000000
-    elif [ "$vmm" = "kvmtool" ]; then
+    elif [ "$target" = "kvmtool" ]; then
         arm_uart_early_addr=0x3f8
         errata_force=1
     else
-        echo '--vmm must be one of "qemu" or "kvmtool"!'
+        echo '--target must be one of "qemu" or "kvmtool"!'
         usage
     fi
 
@@ -318,6 +327,11 @@ WA_DIVIDE=$wa_divide
 GENPROTIMG=${GENPROTIMG-genprotimg}
 HOST_KEY_DOCUMENT=$host_key_document
 EOF
+if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
+cat <<EOF >> config.mak
+TARGET=$target
+EOF
+fi
 
 cat <<EOF > lib/config.h
 #ifndef CONFIG_H
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kvm-unit-tests PATCH v3] configure: arm: Replace --vmm with --target
  2021-04-29 14:12 [kvm-unit-tests PATCH v3] configure: arm: Replace --vmm with --target Alexandru Elisei
@ 2021-04-29 14:41 ` Andrew Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jones @ 2021-04-29 14:41 UTC (permalink / raw)
  To: Alexandru Elisei; +Cc: kvm, kvmarm, pbonzini

On Thu, Apr 29, 2021 at 03:12:04PM +0100, Alexandru Elisei wrote:
> The --vmm configure option was added to distinguish between the two virtual
> machine managers that kvm-unit-tests supports for the arm and arm64
> architectures, qemu or kvmtool. There are plans to make kvm-unit-tests work
> as an EFI app, which will require changes to the way tests are compiled.
> Instead of adding a new configure option specifically for EFI and have it
> coexist with --vmm, or overloading the semantics of the existing --vmm
> option, let's replace --vmm with the more generic name --target.
> 
> Since --target is only valid for arm and arm64, reject the option when it's
> specified for another architecture, which is how --vmm should have behaved
> from the start.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> ---
> Changes in v3:
> 
> * Using --target for any architecture other than arm and arm64 generates an
>   error.
> * Don't generate the TARGET variable in config.mak for other architectures.
> * Cosmetic changes to the commit message.
> 
> Changes in v2:
> 
> * Removed the RFC tag and cover letter.
> * Removed --vmm entirely.
> 
>  configure | 32 +++++++++++++++++++++++---------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/configure b/configure
> index 01a0b262a9f2..d5d223fe3a90 100755
> --- a/configure
> +++ b/configure
> @@ -21,7 +21,7 @@ pretty_print_stacks=yes
>  environ_default=yes
>  u32_long=
>  wa_divide=
> -vmm="qemu"
> +target=
>  errata_force=0
>  erratatxt="$srcdir/errata.txt"
>  host_key_document=
> @@ -35,8 +35,8 @@ usage() {
>  	Options include:
>  	    --arch=ARCH            architecture to compile for ($arch)
>  	    --processor=PROCESSOR  processor to compile for ($arch)
> -	    --vmm=VMM              virtual machine monitor to compile for (qemu
> -	                           or kvmtool, default is qemu) (arm/arm64 only)
> +	    --target=TARGET        target platform that the tests will be running on (qemu or
> +	                           kvmtool, default is qemu) (arm/arm64 only)
>  	    --cross-prefix=PREFIX  cross compiler prefix
>  	    --cc=CC		   c compiler to use ($cc)
>  	    --ld=LD		   ld linker to use ($ld)
> @@ -58,7 +58,7 @@ usage() {
>  	    --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 --vmm option. EARLYCON can be one of
> +	                           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
> @@ -88,8 +88,8 @@ while [[ "$1" = -* ]]; do
>          --processor)
>  	    processor="$arg"
>  	    ;;
> -	--vmm)
> -	    vmm="$arg"
> +	--target)
> +	    target="$arg"
>  	    ;;
>  	--cross-prefix)
>  	    cross_prefix="$arg"
> @@ -146,6 +146,15 @@ arch_name=$arch
>  [ "$arch" = "aarch64" ] && arch="arm64"
>  [ "$arch_name" = "arm64" ] && arch_name="aarch64"
>  
> +if [ -z "$target" ]; then
> +    target="qemu"
> +else
> +    if [ "$arch" != "arm64" ] && [ "$arch" != "arm" ]; then
> +        echo "--target is not supported for $arch"
> +        usage
> +    fi
> +fi
> +
>  if [ -z "$page_size" ]; then
>      [ "$arch" = "arm64" ] && page_size="65536"
>      [ "$arch" = "arm" ] && page_size="4096"
> @@ -177,13 +186,13 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
>      testdir=x86
>  elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
>      testdir=arm
> -    if [ "$vmm" = "qemu" ]; then
> +    if [ "$target" = "qemu" ]; then
>          arm_uart_early_addr=0x09000000
> -    elif [ "$vmm" = "kvmtool" ]; then
> +    elif [ "$target" = "kvmtool" ]; then
>          arm_uart_early_addr=0x3f8
>          errata_force=1
>      else
> -        echo '--vmm must be one of "qemu" or "kvmtool"!'
> +        echo '--target must be one of "qemu" or "kvmtool"!'

I switched the quotes from " to ', e.g. 'qemu'.

>          usage
>      fi
>  
> @@ -318,6 +327,11 @@ WA_DIVIDE=$wa_divide
>  GENPROTIMG=${GENPROTIMG-genprotimg}
>  HOST_KEY_DOCUMENT=$host_key_document
>  EOF
> +if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
> +cat <<EOF >> config.mak
> +TARGET=$target
> +EOF

I changed this to

    echo "TARGET=$target" >> config.mak

> +fi
>  
>  cat <<EOF > lib/config.h
>  #ifndef CONFIG_H
> -- 
> 2.31.1
> 

Applied to arm/queue

https://gitlab.com/rhdrjones/kvm-unit-tests/-/commits/arm/queue

Thanks,
drew


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-29 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 14:12 [kvm-unit-tests PATCH v3] configure: arm: Replace --vmm with --target Alexandru Elisei
2021-04-29 14:41 ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).