[PATCH 0/3] kvm-userspace: kvmppc: fix build for ppc v2

2008-09-30 Thread ehrhardt
From: Christian Ehrhardt [EMAIL PROTECTED]

*update
Short after resending v1 I realized that I forgot to put Avi and
[EMAIL PROTECTED] (for 2/3) on cc. I also updated the header text in 1/3 a
bit and verified my hostlongbits proposal on recent cross toolchain versions
because there was a question about that.

Updating and testing kvm-userspace for ppc after a too long time brought up
some issues fixed in this series.

The patches are small and their description should be comprehendible. Due to
the fact that most of the issues where build time issues I also started to
discuss about/establish some kind of automated build test for us that should
allow us to find such things faster.
Let me know if qumranet has such a process for x86 already and I should help
you to include powerpc.

[patches in series]
[PATCH 1/3] kvm-userspace: kvmppc: fix file header in libkvm-powerpc.c
[PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross 
compiling
[PATCH 3/3] kvm-userspace: kvmppc: fix building userspace for powerpc

---
[diffstat]
 Makefile   |3 ++-
 kernel/powerpc/Makefile.pre|1 +
 kernel/powerpc/hack-module.awk |5 +
 libkvm/libkvm-powerpc.c|   14 +-
 qemu/Makefile.target   |2 +-
 qemu/configure |   13 +++--
 6 files changed, 21 insertions(+), 17 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling

2008-09-30 Thread ehrhardt
From: Christian Ehrhardt [EMAIL PROTECTED]

A recent kvm merge with qemu brought code for 64bit power that broke cross
compilation. The issue is caused by configure trying to execute target
architecture binaries where configure is executed.

I tried to change that detection so that it works withwithout cross
compilation with only a small change and especially without an addtional
configure command line switch. Including the bits/wordsize.h header a platform
usually can check its wordsize and by doing that configure can check the
hostlongbits without executing the binary. Instead it now stops after
preprocessing stage which resolved the __WORDSIZE constant and retrieves
that value.

I don't like my new check style, but it is at least less broken than before.
Another approach that was suggested was that qemu might end up needing
something like asm-offsets in the kernel to manage architecture sizes etc.
Comments and other approaches welcome.
 
Signed-off-by: Christian Ehrhardt [EMAIL PROTECTED]
---

[diffstat]
 configure |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

[diff]

diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -685,14 +685,15 @@
 # ppc specific hostlongbits selection
 if test $cpu = powerpc ; then
 cat  $TMPC EOF
-int main(void){return sizeof(long);}
+#include bits/wordsize.h
+__WORDSIZE
 EOF
 
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2 /dev/null; then
-$TMPE
-case $? in
-4) hostlongbits=32;;
-8) hostlongbits=64;;
+if $cc $ARCH_CFLAGS -E -o $TMPE.E $TMPC 2 /dev/null; then
+wordsize=`tail -n 1 ${TMPE}.E`
+case $wordsize in
+32) hostlongbits=32;;
+64) hostlongbits=64;;
 *) echo Couldn't determine bits per long value; exit 1;;
 esac
 else
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling v2

2008-09-30 Thread malc

On Tue, 30 Sep 2008, [EMAIL PROTECTED] wrote:


From: Christian Ehrhardt [EMAIL PROTECTED]

*update*
further debugging according to some requests revealed that ARCH_CFLAGS does
not contain all CFLAGS that might be needed, especially those supplied via
extra-cflags. Therefore people supplying things via extra-cflags instead of an
environment variable might have had issues.


This part i don't get, there are few more checks before/after 
hostlongbits where no CFLAGS are added to the $cc argument list. What

makes hostlongbits selection special? Do people specify -m32/-m64 via
--extra-cflags?



A recent kvm merge with qemu brought code for 64bit power that broke cross
compilation. The issue is caused by configure trying to execute target
architecture binaries where configure is executed.


Yes, i never thought about cross-compilation, my bad.


I tried to change that detection so that it works withwithout cross
compilation with only a small change and especially without an addtional
configure command line switch. Including the bits/wordsize.h header a platform
usually can check its wordsize and by doing that configure can check the
hostlongbits without executing the binary. Instead it now stops after
preprocessing stage which resolved the __WORDSIZE constant and retrieves
that value.

I don't like my new check style, but it is at least less broken than before.
Another approach that was suggested was that qemu might end up needing
something like asm-offsets in the kernel to manage architecture sizes etc.
Comments and other approaches welcome.



I think Hollis Blanchard's method is sound,

Thank you for bringing this up.

--
mailto:[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html