public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture
@ 2008-10-29 18:27 Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>" Hollis Blanchard
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

These patches allow the kvmctl bits (including testcases and libcflat) to be
built for multiple processor types within the same architecture (e.g. 440 and
e500). This is important because PowerPC supervisor mode can contain
significant differences between processors (it's user mode that's more or less
identical).

For example, the data in a TLB entry and how to manipulate the TLB
are a major difference between 440 and e500, which is critical here because
libcflat must create its own mappings and so must know which method to use.

Some of the complexity comes from user/Makefile *not* using the top-level
config.mak, so we have to add some of the same logic to both configure scripts
to generate both config.mak files.

Too much makefile logic depends on ARCH containing only the architecture
name, so it was simpler to create and export a separate PROCESSOR variable.

-Hollis

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

* [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>"
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
       [not found]   ` <f9e70364f32892700c73.1225304869-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  2008-10-29 18:27 ` [PATCH 2 of 7] kvmctl: add --processor option to user/configure Hollis Blanchard
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

Use case/esac instead of multiple if/fi tests, allowing us to use wildcards.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -87,26 +87,21 @@ done
 #set kenel directory
 libkvm_kerneldir=$(readlink -f kernel)
 
-#if arch is an x86 arch set to i386
-if [[ $arch = i?86 ]]; then
-  arch="i386"
-fi
-
-#set parameters compiling
-if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
-    target_exec="x86_64-softmmu"
-    qemu_cflags="$qemu_cflags -DCONFIG_X86"
-fi
-
-if [ "$arch" = "ia64" ]; then
-    target_exec="ia64-softmmu"
-fi
-
-if [ "$arch" = "powerpc" ]; then
-    target_exec="ppcemb-softmmu"
-    qemu_cflags="$qemu_cflags -I $PWD/libfdt"
-    qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
-fi
+case $arch in
+    i?86*|x86_64*)
+        arch=${arch/#i?86/i386}
+        target_exec="x86_64-softmmu"
+        qemu_cflags="$qemu_cflags -DCONFIG_X86"
+        ;;
+    ia64*)
+        target_exec="ia64-softmmu"
+        ;;
+    powerpc*)
+        target_exec="ppcemb-softmmu"
+        qemu_cflags="$qemu_cflags -I $PWD/libfdt"
+        qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
+        ;;
+esac
 
 # see if we have split build and source directories
 if [ -d "$kerneldir/include2" ]; then

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

* [PATCH 2 of 7] kvmctl: add --processor option to user/configure
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>" Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 3 of 7] user: set $PROCESSOR from configure --arch=<arch>-<processor> Hollis Blanchard
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

Use that to export PROCESSOR in user/config.mak.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/user/configure b/user/configure
--- a/user/configure
+++ b/user/configure
@@ -6,6 +6,7 @@ ld=ld
 ld=ld
 objcopy=objcopy
 arch=`uname -m | sed -e s/i.86/i386/`
+processor="$arch"
 cross_prefix=
 
 usage() {
@@ -40,6 +41,9 @@ while [[ "$1" = -* ]]; do
         --arch)
 	    arch="$arg"
 	    ;;
+        --processor)
+	    processor="$arg"
+	    ;;
 	--cross-prefix)
 	    cross_prefix="$arg"
 	    ;;
@@ -62,6 +66,7 @@ PREFIX=$prefix
 PREFIX=$prefix
 KERNELDIR=$(readlink -f $kerneldir)
 ARCH=$arch
+PROCESSOR=$processor
 CC=$cross_prefix$cc
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy

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

* [PATCH 3 of 7] user: set $PROCESSOR from configure --arch=<arch>-<processor>
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>" Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 2 of 7] kvmctl: add --processor option to user/configure Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 4 of 7] kvmctl: rename config-powerpc-44x.mak Hollis Blanchard
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

Export PROCESSOR in config.mak, and call user/configure with the --processor
option.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -103,6 +103,9 @@ case $arch in
         ;;
 esac
 
+processor=${arch#*-}
+arch=${arch%%-*}
+
 # see if we have split build and source directories
 if [ -d "$kerneldir/include2" ]; then
     kernelsourcedir=${kerneldir%/*}/source
@@ -110,7 +113,7 @@ fi
 
 #configure user dir
 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
-          --arch="$arch" \
+          --arch="$arch" --processor="$processor" \
           ${cross_prefix:+"--cross-prefix=$cross_prefix"})
 
 #configure qemu
@@ -128,6 +131,7 @@ fi
 
 cat <<EOF > config.mak
 ARCH=$arch
+PROCESSOR=$processor
 PREFIX=$prefix
 KERNELDIR=$kerneldir
 KERNELSOURCEDIR=$kernelsourcedir

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

* [PATCH 4 of 7] kvmctl: rename config-powerpc-44x.mak
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
                   ` (2 preceding siblings ...)
  2008-10-29 18:27 ` [PATCH 3 of 7] user: set $PROCESSOR from configure --arch=<arch>-<processor> Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 5 of 7] kvmctl: ppc: use $PROCESSOR to set configuration options Hollis Blanchard
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

This will make for a more user-friendly "configure --arch=powerpc-440" instead
of "configure --arch=powerpc-44x". There aren't any other PowerPC 44x anyways
(model numbers are already in the 460s).

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/user/config-powerpc-44x.mak b/user/config-powerpc-440.mak
rename from user/config-powerpc-44x.mak
rename to user/config-powerpc-440.mak
diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak
--- a/user/config-powerpc.mak
+++ b/user/config-powerpc.mak
@@ -1,4 +1,4 @@ platform := 44x
-platform := 44x
+platform := 440
 
 CFLAGS += -m32
 CFLAGS += -D__powerpc__

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

* [PATCH 5 of 7] kvmctl: ppc: use $PROCESSOR to set configuration options
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
                   ` (3 preceding siblings ...)
  2008-10-29 18:27 ` [PATCH 4 of 7] kvmctl: rename config-powerpc-44x.mak Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 6 of 7] user: ppc: remove build flags Hollis Blanchard
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

PowerPC variants are different enough that they require a different libcflat
build and different testcases.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak
--- a/user/config-powerpc.mak
+++ b/user/config-powerpc.mak
@@ -1,5 +1,3 @@ platform := 440
-platform := 440
-
 CFLAGS += -m32
 CFLAGS += -D__powerpc__
 CFLAGS += -I $(KERNELDIR)/include
@@ -23,7 +21,7 @@ tests := \
 tests := \
 	test/powerpc/exit.bin
 
-include config-powerpc-$(platform).mak
+include config-powerpc-$(PROCESSOR).mak
 
 
 all: kvmtrace kvmctl $(libcflat) $(simpletests) $(tests)

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

* [PATCH 6 of 7] user: ppc: remove build flags
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
                   ` (4 preceding siblings ...)
  2008-10-29 18:27 ` [PATCH 5 of 7] kvmctl: ppc: use $PROCESSOR to set configuration options Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-29 18:27 ` [PATCH 7 of 7] user: define and use AR in configure scripts and Makefiles Hollis Blanchard
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

Remove -m32 build flag. Although necessary when building for a 32-bit target
with a biarch toolchain that defaults to 64-bit output, it naturally breaks
64-bit builds.

Also remove -D__powerpc__. I'm not sure why I added that in the first place;
that is automatically defined by GCC (for both 32- and 64-bit targets).

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/libkvm/config-powerpc.mak b/libkvm/config-powerpc.mak
--- a/libkvm/config-powerpc.mak
+++ b/libkvm/config-powerpc.mak
@@ -1,6 +1,4 @@
 
 LIBDIR := /lib
-CFLAGS += -m32
-CFLAGS += -D__powerpc__
 
 libkvm-$(ARCH)-objs := libkvm-powerpc.o
diff --git a/user/config-powerpc.mak b/user/config-powerpc.mak
--- a/user/config-powerpc.mak
+++ b/user/config-powerpc.mak
@@ -1,5 +1,3 @@ CFLAGS += -m32
-CFLAGS += -m32
-CFLAGS += -D__powerpc__
 CFLAGS += -I $(KERNELDIR)/include
 CFLAGS += -Wa,-mregnames -I test/lib
 

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

* [PATCH 7 of 7] user: define and use AR in configure scripts and Makefiles
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
                   ` (5 preceding siblings ...)
  2008-10-29 18:27 ` [PATCH 6 of 7] user: ppc: remove build flags Hollis Blanchard
@ 2008-10-29 18:27 ` Hollis Blanchard
  2008-10-30 12:57 ` [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Christian Ehrhardt
       [not found] ` <patchbomb.1225304868-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  8 siblings, 0 replies; 11+ messages in thread
From: Hollis Blanchard @ 2008-10-29 18:27 UTC (permalink / raw)
  To: avi; +Cc: kvm, kvm-ppc

libkvm/Makefile uses $(AR), but it's not defined by the top-level configure.
The problem is that when cross-compiling for a 64-bit target on a 32-bit host,
32-bit ar will be used and the 64-bit code will fail to link.

user/Makefile has the same problem, and even uses plain "ar".

Add AR to configure and user/configure, and use it in the Makefiles.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -6,6 +6,7 @@ cc=gcc
 cc=gcc
 ld=ld
 objcopy=objcopy
+ar=ar
 want_module=1
 qemu_cflags=
 qemu_ldflags=
@@ -141,6 +142,7 @@ CC=$cross_prefix$cc
 CC=$cross_prefix$cc
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
+AR=$cross_prefix$ar
 EOF
 
 cat <<EOF > kernel/config.kbuild
diff --git a/user/Makefile b/user/Makefile
--- a/user/Makefile
+++ b/user/Makefile
@@ -48,7 +48,7 @@ kvmtrace: $(kvmtrace_objs)
 	$(CC) $(LDFLAGS) $^ -o $@
 
 $(libcflat): $(cflatobjs)
-	ar rcs $@ $^
+	$(AR) rcs $@ $^
 
 %.o: %.S
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $^
diff --git a/user/configure b/user/configure
--- a/user/configure
+++ b/user/configure
@@ -5,6 +5,7 @@ cc=gcc
 cc=gcc
 ld=ld
 objcopy=objcopy
+ar=ar
 arch=`uname -m | sed -e s/i.86/i386/`
 processor="$arch"
 cross_prefix=
@@ -70,4 +71,5 @@ CC=$cross_prefix$cc
 CC=$cross_prefix$cc
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
+AR=$cross_prefix$ar
 EOF

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

* Re: [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture
  2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
                   ` (6 preceding siblings ...)
  2008-10-29 18:27 ` [PATCH 7 of 7] user: define and use AR in configure scripts and Makefiles Hollis Blanchard
@ 2008-10-30 12:57 ` Christian Ehrhardt
       [not found] ` <patchbomb.1225304868-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  8 siblings, 0 replies; 11+ messages in thread
From: Christian Ehrhardt @ 2008-10-30 12:57 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: avi, kvm, kvm-ppc

Hollis Blanchard wrote:
> These patches allow the kvmctl bits (including testcases and libcflat) to be
> built for multiple processor types within the same architecture (e.g. 440 and
> e500). This is important because PowerPC supervisor mode can contain
> significant differences between processors (it's user mode that's more or less
> identical).
>
> For example, the data in a TLB entry and how to manipulate the TLB
> are a major difference between 440 and e500, which is critical here because
> libcflat must create its own mappings and so must know which method to use.
>
> Some of the complexity comes from user/Makefile *not* using the top-level
> config.mak, so we have to add some of the same logic to both configure scripts
> to generate both config.mak files.
>
> Too much makefile logic depends on ARCH containing only the architecture
> name, so it was simpler to create and export a separate PROCESSOR variable.
>
> -Hollis
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   
Unfortunately there is too often no "really nice" way to do Makefile 
magic :-)
I know you started with the arch-platform-os-compiler after our discussion,
but I like the $PROCESSOR solution for our *powerpc* Makefiles too.
And a good catch with that AR usage in patch 7.

(full series)
Acked-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization


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

* Re: [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>"
       [not found]   ` <f9e70364f32892700c73.1225304869-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-11-02  9:03     ` Avi Kivity
  0 siblings, 0 replies; 11+ messages in thread
From: Avi Kivity @ 2008-11-02  9:03 UTC (permalink / raw)
  To: Hollis Blanchard
  Cc: avi-atKUWr5tajBWk0Htik3J/w, kvm-u79uwXL29TY76Z2rM5mHXA,
	kvm-ppc-u79uwXL29TY76Z2rM5mHXA

Hollis Blanchard wrote:
> Use case/esac instead of multiple if/fi tests, allowing us to use wildcards.
>   

Just a note:

if/fi allows wildcards as well:

  if "$reply" = y*; then
     # assume user can't spell
     ...
  fi

though case is better in this esac.

(I can't believe I used the word 'better' in the context of bash)

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture
       [not found] ` <patchbomb.1225304868-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-11-02  9:06   ` Avi Kivity
  0 siblings, 0 replies; 11+ messages in thread
From: Avi Kivity @ 2008-11-02  9:06 UTC (permalink / raw)
  To: Hollis Blanchard
  Cc: avi-atKUWr5tajBWk0Htik3J/w, kvm-u79uwXL29TY76Z2rM5mHXA,
	kvm-ppc-u79uwXL29TY76Z2rM5mHXA

Hollis Blanchard wrote:
> These patches allow the kvmctl bits (including testcases and libcflat) to be
> built for multiple processor types within the same architecture (e.g. 440 and
> e500). This is important because PowerPC supervisor mode can contain
> significant differences between processors (it's user mode that's more or less
> identical).
>
> For example, the data in a TLB entry and how to manipulate the TLB
> are a major difference between 440 and e500, which is critical here because
> libcflat must create its own mappings and so must know which method to use.
>
> Some of the complexity comes from user/Makefile *not* using the top-level
> config.mak, so we have to add some of the same logic to both configure scripts
> to generate both config.mak files.
>
> Too much makefile logic depends on ARCH containing only the architecture
> name, so it was simpler to create and export a separate PROCESSOR variable.
>   

All applied, thanks.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2008-11-02  9:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 18:27 [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Hollis Blanchard
2008-10-29 18:27 ` [PATCH 1 of 7] user: consolidate $arch tests and allow $arch to be "<arch>-<processor>" Hollis Blanchard
     [not found]   ` <f9e70364f32892700c73.1225304869-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-11-02  9:03     ` Avi Kivity
2008-10-29 18:27 ` [PATCH 2 of 7] kvmctl: add --processor option to user/configure Hollis Blanchard
2008-10-29 18:27 ` [PATCH 3 of 7] user: set $PROCESSOR from configure --arch=<arch>-<processor> Hollis Blanchard
2008-10-29 18:27 ` [PATCH 4 of 7] kvmctl: rename config-powerpc-44x.mak Hollis Blanchard
2008-10-29 18:27 ` [PATCH 5 of 7] kvmctl: ppc: use $PROCESSOR to set configuration options Hollis Blanchard
2008-10-29 18:27 ` [PATCH 6 of 7] user: ppc: remove build flags Hollis Blanchard
2008-10-29 18:27 ` [PATCH 7 of 7] user: define and use AR in configure scripts and Makefiles Hollis Blanchard
2008-10-30 12:57 ` [PATCH 0 of 7] kvm-userspace: support multiple processors in the same architecture Christian Ehrhardt
     [not found] ` <patchbomb.1225304868-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-11-02  9:06   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox