Re: [kvm-devel] [RFC] let kvm be compiled with gcc4 and prevent users to shoot themselves in the foot while doing so (was Re: [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work)

2007-10-07 Thread Carlo Marcelo Arenas Belon
On Sun, Oct 07, 2007 at 06:18:27PM -0400, Jim Paris wrote:
> > +  if test $check_gcc = "no" ; then
> > +if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
> > +  echo "#define USE_GCC4 1" >> $config_h
> > +fi
> > +  fi
> 
> Something like
> 
> #if __GNUC__ >= 4
> 
> in the code would be simpler.

really good idea; and also as a side effect makes the patches independent as
there is no need to have that qemu's configure glue anymore.

Carlo

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 4/5] Add user/config-i386.mak

2007-10-07 Thread Jerone Young
This patch adds file user/config-i386.mak. This file contains i386
specific make rules.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
diff -r 1ec77d7c5e51 user/config-i386.mak
--- /dev/null	Thu Jan 01 00:00:00 1970 +
+++ b/user/config-i386.mak	Thu Oct 04 08:33:37 2007 -0500
@@ -0,0 +1,7 @@
+LIBDIR = /lib
+cstart.o = test/cstart.o
+bits = 32
+ldarch = elf32-i386
+CFLAGS += -m32
+
+flatfiles=
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 3/5] Enable Makefile in user directory for cross compile

2007-10-07 Thread Jerone Young
This patch enables the Makefile in "user" directory for cross compile.
It also adds new feature of having architecture specific make rules
split into their own respective files.


Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
diff -r dc203848af90 user/Makefile
--- a/user/Makefile	Sun Oct 07 23:11:14 2007 -0500
+++ b/user/Makefile	Sun Oct 07 23:19:31 2007 -0500
@@ -1,5 +1,10 @@
 
 include config.mak
+
+DESTDIR :=
+
+#include architecure specific make rules
+include config-$(ARCH).mak
 
 # cc-option
 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
@@ -8,7 +13,7 @@ cc-option = $(shell if $(CC) $(1) -S -o 
   > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
 CFLAGS = -I $(KERNELDIR)/include $(autodepend-flags) -g -fomit-frame-pointer \
-	-Wall -m$(bits)
+	-Wall
 CFLAGS += $(call cc-option, -fno-stack-protector, "")
 CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
 
@@ -17,20 +22,6 @@ CXXFLAGS = $(autodepend-flags)
 CXXFLAGS = $(autodepend-flags) 
 
 autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
-
-DESTDIR = 
-
-ifeq ($(shell uname -m), x86_64)
-LIBDIR = /lib64
-cstart.o = test/cstart64.o
-bits = 64
-ldarch = elf64-x86-64
-else
-LIBDIR = /lib
-cstart.o = test/cstart.o
-bits = 32
-ldarch = elf32-i386
-endif
 
 all: kvmctl libkvm.a flatfiles
 
@@ -45,11 +36,7 @@ libkvm.a: kvmctl.o
 
 flatfiles-common = test/bootstrap test/vmexit.flat test/smp.flat
 
-flatfiles-32 =
-
-flatfiles-64 = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat
-
-flatfiles: $(flatfiles-common) $(flatfiles-$(bits))
+flatfiles: $(flatfiles-common) $(flatfiles)
 
 install:
 	install -D kvmctl.h $(DESTDIR)/$(PREFIX)/include/kvmctl.h
@@ -60,13 +47,13 @@ install:
 	install -D libkvm.a $(DESTDIR)/$(PREFIX)/$(LIBDIR)/libkvm.a
 
 %.flat: %.o
-	gcc $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^
+	$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^
 
 test/bootstrap: test/bootstrap.o
-	gcc -nostdlib -o $@ -Wl,-T,bootstrap.lds $^
+	$(CC) -nostdlib -o $@ -Wl,-T,bootstrap.lds $^
 
 %.o: %.S
-	gcc $(CFLAGS) -c -nostdlib -o $@ $^
+	$(CC) $(CFLAGS) -c -nostdlib -o $@ $^
 
 test/irq.flat: test/print.o
 
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 5/5] Add user/config-x86-64.mak

2007-10-07 Thread Jerone Young
This patch adds file user/config-x86-64.mak. This file contains x86-64
specific make rules.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
diff -r cd1ff95ab7c4 user/config-x86_64.mak
--- /dev/null	Thu Jan 01 00:00:00 1970 +
+++ b/user/config-x86_64.mak	Thu Oct 04 08:35:56 2007 -0500
@@ -0,0 +1,7 @@
+LIBDIR = /lib64
+cstart.o = test/cstart64.o
+bits = 64
+ldarch = elf64-x86-64
+CFLAGS += -m64
+
+flatfiles = test/access.flat test/irq.flat test/sieve.flat test/simple.flat test/stringio.flat test/memtest1.flat
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/5] Enable top level configure script for cross compile

2007-10-07 Thread Jerone Young
This patch adds cross compile capability to the top level configure
script.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

diff -r f48e521e0add configure
--- a/configure	Wed Oct 03 21:00:03 2007 -0500
+++ b/configure	Thu Oct 04 14:59:16 2007 -0500
@@ -5,13 +5,17 @@ want_module=1
 want_module=1
 qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
 disable_gcc_check=
+cross_prefix=
+arch=`uname -m`
+target_cpu=
 
 usage() {
 cat <<-EOF
 	Usage: $0 [options]
 
 	Options include:
-
+	--arch=ARCHarchitecture to compile for ($arch)
+	--cross-prefix=PREFIX  prefix for cross compiler
 	--prefix=PREFIXwhere to install things ($prefix)
 	--with-patched-kernel  don't use external module
 	--kerneldir=DIRkernel build directory ($kerneldir)
@@ -53,6 +57,15 @@ while [[ "$1" = -* ]]; do
 	--disable-gcc-check)
 	disable_gcc_check=1
 	;;
+	--arch)
+	arch="$arg"
+	;;
+	--cross-prefix)
+	cross_prefix="$arg"
+;;
+	--target-cpu)
+	target_cpu="$arg"
+	;; 
 	--help)
 	usage
 	;;
@@ -62,7 +75,7 @@ while [[ "$1" = -* ]]; do
 esac
 done
 
-if [[ -z "$qemu_cc" ]]; then
+if [[ -z "$qemu_cc" ]] && [[ -z "$cross_prefix" ]]; then
 echo "$0: cannot locate gcc 3.x. please install it or specify with --qemu-cc"
 exit 1
 fi
@@ -72,29 +85,48 @@ if (( want_module )); then
 libkvm_kerneldir=$(readlink -f kernel)
 fi
 
-target_cpu() {
-if [[ $(uname -m) = i?86 ]]; then
-	echo x86_64
-else
-	uname -m
+#if arch is an x86 arch set to i386
+if [[ $arch = i?86 ]]; then
+  arch="i386"
+fi
+
+#see if using a cross compiler or not
+compiler=
+qemu_opts=
+user_opts=
+if [[ -z $cross_prefix ]]; then
+qemu_opts+=" --cc=$qemu_cc"
+user_opts+=" --cc=$qemu_cc"
+else
+qemu_opts+=" --cross-prefix=$cross_prefix"
+user_opts+=" --cross-prefix=$cross_prefix"
+fi
+
+#set parameters compiling
+if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
+if [[ -z $target_cpu ]]; then
+target_cpu="x86_64"
 fi
-}
+qemu_opts+=" --enable-alsa"
+fi
 
-(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir")
-(cd qemu; ./configure --target-list=$(target_cpu)-softmmu --cc="$qemu_cc" \
+#configure user dir
+(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
+  $user_opts --arch="$arch")
+(cd qemu; ./configure --target-list=$target_cpu-softmmu \
 --disable-kqemu --extra-cflags="-I $PWD/../user" \
 --extra-ldflags="-L $PWD/../user" \
 --enable-kvm --kernel-path="$libkvm_kerneldir" \
---enable-alsa \
 ${disable_gcc_check:+"--disable-gcc-check"} \
---prefix="$prefix"
+--prefix="$prefix" \
+$qemu_opts --cpu="$arch"
 )
 
 
-
 cat < config.mak
+ARCH=$arch
 PREFIX=$prefix
 KERNELDIR=$kerneldir
 WANT_MODULE=$want_module
+CC=$cross_prefix$qemu_cc
 EOF
-
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/5] Enable configure script in user directory for cross compile

2007-10-07 Thread Jerone Young
This patch enables configure script in "user" directory fro cross
compile.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
diff -r 7c1e3915d77c configure
--- a/configure	Thu Oct 04 14:33:18 2007 -0500
+++ b/configure	Thu Oct 04 14:34:26 2007 -0500
@@ -20,6 +20,7 @@ usage() {
 	--with-patched-kernel  don't use external module
 	--kerneldir=DIRkernel build directory ($kerneldir)
 	--qemu-cc="$qemu_cc"   compiler for qemu (needs gcc3.x) ($qemu_cc)
+	--target-cpu	   target cpu model for qemu
 	--disable-gcc-checkdon't insist on gcc-3.x
- this will break running without kvm
 EOF
diff -r 7c1e3915d77c user/configure
--- a/user/configure	Thu Oct 04 14:33:18 2007 -0500
+++ b/user/configure	Thu Oct 04 14:33:18 2007 -0500
@@ -2,13 +2,20 @@
 
 prefix=/usr/local
 kerneldir=/lib/modules/$(uname -r)/build
+cc=gcc
+ld=ld
+arch=`uname -m | sed -e s/i.86/i386/`
+cross_prefix=
 
 usage() {
 cat <<-EOF
 	Usage: $0 [options]
 
 	Options include:
-
+	--arch=ARCHarchitecture to compile for ($arch)
+	--cc=CC		   c compiler to use ($cc)
+--cross-prefix=PREFIX  cross compiler prefix
+	--ld=LD		   ld linker to use ($ld)
 	--prefix=PREFIXwhere to install things ($prefix)
 	--kerneldir=DIRkernel build directory for kvm.h ($kerneldir)
 EOF
@@ -29,6 +36,18 @@ while [[ "$1" = -* ]]; do
 	--kerneldir)
 	kerneldir="$arg"
 	;;
+--arch)
+	arch="$arg"
+	;;
+	--cc)
+	cc="$arg"
+	;;
+	--ld)
+	ld="$arg"
+	;;
+	--cross-prefix)
+cross_prefix="$arg"
+	;;
 	--help)
 	usage
 	;;
@@ -41,4 +60,7 @@ cat < config.mak
 cat < config.mak
 PREFIX=$prefix
 KERNELDIR=$(readlink -f $kerneldir)
+ARCH=$arch
+CC=$cross_prefix$cc
+LD=$cross_prefix$ld
 EOF
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [RFC] KVM Source layout Proposal to accommodate newCPU architecture

2007-10-07 Thread Zhang, Xiantao
Hollis Blanchard wrote:
> On Mon, 2007-10-08 at 10:36 +0800, Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>>> Zhang, Xiantao wrote:
 Avi Kivity wrote:
 
> Zhang, Xiantao wrote:
> 
>> Zhang, Xiantao wrote:
>> 
>> 
 Hi Avi,
So you mean IA64 can adopt the similar method as well?
 
 
>> 
>>> What method do you mean exactly?
>>> 
>>> 
>> Put all arch-specific files into arch/ia64/kvm as you described
>> in future KVM infrastructure. 
>> 
>> 
>>> The powerpc people had some patches to make kvm_main arch
>>> independent. We should work on that base. To avoid a dependency
>>> on the x86 merge, we can start by working withing drivers/kvm/,
>>> for example creating drivers/kvm/x86.c and drivers/kvm/ia64.c.
>>> Later patches can move these to arch/*/.
>>> 
>>> 
>> It may work on x86 side. But for IA64, we have several source
>> files and assembly files to implement a VMM module, which
>> contains the virtualization logic of CPU, MMU and other platform
>> devices. (In KVM forum, Anthony had presented IA64/KVM
>> architecture which is a bit different with x86 side due to
>> different approaches for VT.).If we put all such these
>> arch-specific files in one directory, it looks very strange!
>> 
>> 
> ia64/ subdirectory is also fine.
> 
 
 But even so , we have to split current code to be arch-independent,
 and to support IA64 and other architectures.
 So, why not add an more subdirectory x86 in drivers kvm to hold
 X86-arch code? 
 
>>> 
>>> Sure, that's not an issue.
>> 
>> Could you help to open a branch from master tree for this work? We
>> are very willing to contribute to it:)
> 
> Do you really need a new branch? Why not just submit patches?

Due to big changes to current source structure, maybe a new branch would
help to work, and doesn't
impact existing quality of KVM.  If it is convenient for you to submit
patches directly, also we are glad to do in that way.
Xiantao

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [RFC] KVM Source layout Proposal to accommodate new CPU architecture

2007-10-07 Thread Hollis Blanchard
On Mon, 2007-10-08 at 10:36 +0800, Zhang, Xiantao wrote:
> Avi Kivity wrote:
> > Zhang, Xiantao wrote:
> >> Avi Kivity wrote:
> >> 
> >>> Zhang, Xiantao wrote:
> >>> 
>  Zhang, Xiantao wrote:
>  
>  
> >> Hi Avi,
> >>So you mean IA64 can adopt the similar method as well?
> >> 
> >> 
>  
> > What method do you mean exactly?
> > 
> > 
>  Put all arch-specific files into arch/ia64/kvm as you described in
>  future KVM infrastructure. 
>  
>  
> > The powerpc people had some patches to make kvm_main arch
> > independent. We should work on that base. To avoid a dependency on
> > the x86 merge, we can start by working withing drivers/kvm/, for
> > example creating drivers/kvm/x86.c and drivers/kvm/ia64.c. Later
> > patches can move these to arch/*/.
> > 
> > 
>  It may work on x86 side. But for IA64, we have several source files
>  and assembly files to implement a VMM module, which contains the
>  virtualization logic of CPU, MMU and other platform devices. (In
>  KVM forum, Anthony had presented IA64/KVM architecture which is a
>  bit different with x86 side due to different approaches for
>  VT.).If we put all such these arch-specific files in one
>  directory, it looks very strange! 
>  
>  
> >>> ia64/ subdirectory is also fine.
> >>> 
> >> 
> >> But even so , we have to split current code to be arch-independent,
> >> and to support IA64 and other architectures.
> >> So, why not add an more subdirectory x86 in drivers kvm to hold
> >> X86-arch code? 
> >> 
> > 
> > Sure, that's not an issue.
> 
> Could you help to open a branch from master tree for this work? We are
> very willing to contribute to it:)

Do you really need a new branch? Why not just submit patches?

-- 
Hollis Blanchard
IBM Linux Technology Center


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [RFC] KVM Source layout Proposal to accommodate new CPU architecture

2007-10-07 Thread Zhang, Xiantao
Avi Kivity wrote:
> Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>> 
>>> Zhang, Xiantao wrote:
>>> 
 Zhang, Xiantao wrote:
 
 
>> Hi Avi,
>>  So you mean IA64 can adopt the similar method as well?
>> 
>> 
 
> What method do you mean exactly?
> 
> 
 Put all arch-specific files into arch/ia64/kvm as you described in
 future KVM infrastructure. 
 
 
> The powerpc people had some patches to make kvm_main arch
> independent. We should work on that base. To avoid a dependency on
> the x86 merge, we can start by working withing drivers/kvm/, for
> example creating drivers/kvm/x86.c and drivers/kvm/ia64.c. Later
> patches can move these to arch/*/.
> 
> 
 It may work on x86 side. But for IA64, we have several source files
 and assembly files to implement a VMM module, which contains the
 virtualization logic of CPU, MMU and other platform devices. (In
 KVM forum, Anthony had presented IA64/KVM architecture which is a
 bit different with x86 side due to different approaches for
 VT.).If we put all such these arch-specific files in one
 directory, it looks very strange! 
 
 
>>> ia64/ subdirectory is also fine.
>>> 
>> 
>> But even so , we have to split current code to be arch-independent,
>> and to support IA64 and other architectures.
>> So, why not add an more subdirectory x86 in drivers kvm to hold
>> X86-arch code? 
>> 
> 
> Sure, that's not an issue.

Could you help to open a branch from master tree for this work? We are
very willing to 
contribute to it:)

>> And it should also conform with with future infrastructure in Linux.
>> Maybe we can borrow the idea from UML code structure.
>> Do you think so ?
> 
> Eventually I'd like to see the code in arch/*/kvm.  That's probably
> not easily doable right now because modules cannot span directories,
> but once that's solved, we'll do that as this is most consistent with
> the rest of the kernel.

Agree. Maybe we can investigate the issue at the same time.
Xiantao

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] [2/2] Split arch specific makefile code out

2007-10-07 Thread Jerone Young
On Sun, 2007-10-07 at 13:50 +0200, Avi Kivity wrote:
> Jerone Young wrote:
> > This patch makes things better for cross compiling. It also makes adding
> > a new architecture to the current make system much easier.
> >   
> 
> > +CFLAGS += -I $(KERNELDIR)/include $(autodepend-flags) -g 
> > -fomit-frame-pointer \
> > +   -Wall
> > +CFLAGS += -m32
> > +CFLAGS += -m64
Hmm.. if this is in my patch this is probably a mistake on my part.
Shouldn't be adding -m32 & -m64 on the same CFLAGS.
> >   
> 
> Nowhere is CFLAGS defined, that I can see.  This means that a stray 
> CFLAGS environment variable will affect the build (this is the cause of 
> my dislike to ?= as well).

I believe I was thinking that you might for a specific arch in
config-$ARCH first declare any CFLAGS that other architectures wouldn't
use. So probably a better way to do this is to have CFLAGS declaration
begin at the point you describe, and then include config-$ARCH after
this point.


I'll submit some new patches shortly.
> 
> Please change so that make variables cannot be affected by the environment.



> 


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 3/3] Remove gratuitous casts from lapic.c

2007-10-07 Thread Rusty Russell
Since vcpu->apic is of the correct type, there's not need to cast.
Perhaps this will be required in future?

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index 27e6249..68aa9e4 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -172,7 +172,7 @@ static inline int apic_find_highest_irr(struct kvm_lapic 
*apic)
 
 int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu)
 {
-   struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
+   struct kvm_lapic *apic = vcpu->apic;
int highest_irr;
 
if (!apic)
@@ -760,7 +760,7 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu)
 
 void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8)
 {
-   struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
+   struct kvm_lapic *apic = vcpu->apic;
 
if (!apic)
return;
@@ -769,7 +769,7 @@ void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long 
cr8)
 
 u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu)
 {
-   struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
+   struct kvm_lapic *apic = vcpu->apic;
u64 tpr;
 
if (!apic)
@@ -782,7 +782,7 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_cr8);
 
 void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
 {
-   struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
+   struct kvm_lapic *apic = vcpu->apic;
 
if (!apic) {
value |= MSR_IA32_APICBASE_BSP;
@@ -859,7 +859,7 @@ EXPORT_SYMBOL_GPL(kvm_lapic_reset);
 
 int kvm_lapic_enabled(struct kvm_vcpu *vcpu)
 {
-   struct kvm_lapic *apic = (struct kvm_lapic *)vcpu->apic;
+   struct kvm_lapic *apic = vcpu->apic;
int ret = 0;
 
if (!apic)

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/3] Hoist kvm_create_lapic() into kvm_vcpu_init()

2007-10-07 Thread Rusty Russell
Move kvm_create_lapic() into kvm_vcpu_init(), rather than having svm
and vmx do it.  And make it return the error rather than a fairly
random -ENOMEM.

This also solves the problem that neither svm.c nor vmx.c actually
handles the error path properly.

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index f82b5ad..47f6015 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -275,14 +275,22 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, 
unsigned id)
if (r < 0)
goto fail_free_pio_data;
 
+   if (irqchip_in_kernel(kvm)) {
+   r = kvm_create_lapic(vcpu);
+   if (r < 0)
+   goto fail_mmu_destroy;
+   }
+
return 0;
 
+fail_mmu_destroy:
+   kvm_mmu_destroy(vcpu);
 fail_free_pio_data:
free_page((unsigned long)vcpu->pio_data);
 fail_free_run:
free_page((unsigned long)vcpu->run);
 fail:
-   return -ENOMEM;
+   return r;
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_init);
 
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index a533088..e713f73 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -580,12 +580,6 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, 
unsigned int id)
if (err)
goto free_svm;
 
-   if (irqchip_in_kernel(kvm)) {
-   err = kvm_create_lapic(&svm->vcpu);
-   if (err < 0)
-   goto free_svm;
-   }
-
page = alloc_page(GFP_KERNEL);
if (!page) {
err = -ENOMEM;
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 8606a5a..820f687 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -2426,12 +2426,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, 
unsigned int id)
if (err)
goto free_vcpu;
 
-   if (irqchip_in_kernel(kvm)) {
-   err = kvm_create_lapic(&vmx->vcpu);
-   if (err < 0)
-   goto free_vcpu;
-   }
-
vmx->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!vmx->guest_msrs) {
err = -ENOMEM;

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/3] kvm_free_lapic() to pair with kvm_create_lapic()

2007-10-07 Thread Rusty Russell
Instead of the asymetry of kvm_free_apic, implement kvm_free_lapic().
And guess what?  I found a minor bug: we don't need to hrtimer_cancel()
from kvm_main.c, because we do that in kvm_free_apic().

Also:
1) kvm_vcpu_uninit should be the reverse order from kvm_vcpu_init.
2) Don't set apic->regs_page to zero before freeing apic.

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index 11fc014..508280e 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -139,7 +139,7 @@ int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu);
 int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu);
 int kvm_create_lapic(struct kvm_vcpu *vcpu);
 void kvm_lapic_reset(struct kvm_vcpu *vcpu);
-void kvm_free_apic(struct kvm_lapic *apic);
+void kvm_free_lapic(struct kvm_vcpu *vcpu);
 u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu);
 void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8);
 void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value);
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 2c3986f..f82b5ad 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -288,10 +288,8 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_init);
 
 void kvm_vcpu_uninit(struct kvm_vcpu *vcpu)
 {
+   kvm_free_lapic(vcpu);
kvm_mmu_destroy(vcpu);
-   if (vcpu->apic)
-   hrtimer_cancel(&vcpu->apic->timer.dev);
-   kvm_free_apic(vcpu->apic);
free_page((unsigned long)vcpu->pio_data);
free_page((unsigned long)vcpu->run);
 }
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index 6e0f7e5..27e6249 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -739,19 +739,17 @@ static int apic_mmio_range(struct kvm_io_device *this, 
gpa_t addr)
return ret;
 }
 
-void kvm_free_apic(struct kvm_lapic *apic)
+void kvm_free_lapic(struct kvm_vcpu *vcpu)
 {
-   if (!apic)
+   if (!vcpu->apic)
return;
 
-   hrtimer_cancel(&apic->timer.dev);
+   hrtimer_cancel(&vcpu->apic->timer.dev);
 
-   if (apic->regs_page) {
-   __free_page(apic->regs_page);
-   apic->regs_page = 0;
-   }
+   if (vcpu->apic->regs_page)
+   __free_page(vcpu->apic->regs_page);
 
-   kfree(apic);
+   kfree(vcpu->apic);
 }
 
 /*
@@ -939,7 +937,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
if (apic->regs_page == NULL) {
printk(KERN_ERR "malloc apic regs error for vcpu %x\n",
   vcpu->vcpu_id);
-   goto nomem;
+   goto nomem_free_apic;
}
apic->regs = page_address(apic->regs_page);
memset(apic->regs, 0, PAGE_SIZE);
@@ -957,8 +955,9 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
apic->dev.private = apic;
 
return 0;
+nomem_free_apic:
+   kfree(apic);
 nomem:
-   kvm_free_apic(apic);
return -ENOMEM;
 }
 EXPORT_SYMBOL_GPL(kvm_create_lapic);

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [RFC] let kvm be compiled with gcc4 and prevent users to shoot themselves in the foot while doing so (was Re: [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work)

2007-10-07 Thread Jim Paris
Carlo Marcelo Arenas Belon wrote:
> And considering also there might be other yet unknown bugs because of gcc4, it
> is most likely better to stick to use gcc-3.x, unless there is really no other
> option.
> 
> For cases where no compat-gcc package is provided (like in OpenSUSE) then the
> following is IMHO the next best approach to force users to get gcc-3.x
> compiler installed from source just to be able to compile kvm.

This will probably become more of a problem over time.  GCC 3 is
slated to be removed from the next Debian release:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440425
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440430

> PS. please let me know what you think about it and if interested so I can
> provide the 3 patches (or more if more changes are needed) in a [PATCH] 
> series for easy git-am'ing
> 
> +  if test $check_gcc = "no" ; then
> +if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
> +  echo "#define USE_GCC4 1" >> $config_h
> +fi
> +  fi

Something like

#if __GNUC__ >= 4

in the code would be simpler.

-jim

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [RFC] let kvm be compiled with gcc4 and prevent users to shoot themselves in the foot while doing so (was Re: [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work)

2007-10-07 Thread Carlo Marcelo Arenas Belon
On Thu, Oct 04, 2007 at 04:39:30PM -0400, Gregory Haskins wrote:
> On Thu, 2007-10-04 at 21:49 +0200, Farkas Levente wrote:
> > 
> > here i mean that packaging kvm for fedora/redhat/centos using gcc-4.x in
> > stead of gcc-3.x. if currently there is no reason to use gcc-3.x than i
> > change all of my spec file.
> 
> You *could*, sure.  I have done this for local builds here.  But if you
> go that route I would recommend making a patch to KVM so it doesn't fall
> back into QEMU mode automatically (today if it can't open the kvm module
> it will assume "-no-kvm" like behavior).  Otherwise you will have a
> bunch of support calls about why its not working properly should someone
> cause the system to fall back.

And considering also there might be other yet unknown bugs because of gcc4, it
is most likely better to stick to use gcc-3.x, unless there is really no other
option.

For cases where no compat-gcc package is provided (like in OpenSUSE) then the
following is IMHO the next best approach to force users to get gcc-3.x
compiler installed from source just to be able to compile kvm.

Carlo

PS. please let me know what you think about it and if interested so I can
provide the 3 patches (or more if more changes are needed) in a [PATCH] 
series for easy git-am'ing

---
diff --git a/configure b/configure
index d9292fe..33a56d2 100755
--- a/configure
+++ b/configure
@@ -63,8 +63,12 @@ while [[ "$1" = -* ]]; do
 done
 
 if [[ -z "$qemu_cc" ]]; then
-echo "$0: cannot locate gcc 3.x. please install it or specify with 
--qemu-cc"
-exit 1
+if [[ -z "$disable_gcc_check" ]]; then
+echo "$0: cannot locate gcc 3.x. please install it or specify with 
--qemu-cc"
+exit 1
+else
+qemu_cc=gcc
+fi
 fi
 
 libkvm_kerneldir="$kerneldir"
diff --git a/qemu/configure b/qemu/configure
index fc1e59a..15549e3 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -1022,6 +1022,11 @@ if test "$target_cpu" = "i386" ; then
   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
 echo "#define USE_KQEMU 1" >> $config_h
   fi
+  if test $check_gcc = "no" ; then
+if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
+  echo "#define USE_GCC4 1" >> $config_h
+fi
+  fi
   configure_kvm
 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
   echo "TARGET_ARCH=arm" >> $config_mak
@@ -1059,6 +1064,11 @@ elif test "$target_cpu" = "x86_64" ; then
   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; 
then
 echo "#define USE_KQEMU 1" >> $config_h
   fi
+  if test $check_gcc = "no" ; then
+if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
+  echo "#define USE_GCC4 1" >> $config_h
+fi
+  fi
   configure_kvm
 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
   echo "TARGET_ARCH=mips" >> $config_mak
diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..2f78955 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8421,8 +8421,13 @@ int main(int argc, char **argv)
 #endif
 #ifdef USE_KVM
case QEMU_OPTION_no_kvm:
+#ifdef USE_GCC4
+   fprintf(stderr, "Can't run without kvm if compiled with 
gcc4\n");
+   exit(1);
+#else
kvm_allowed = 0;
break;
+#endif
case QEMU_OPTION_no_kvm_irqchip:
kvm_irqchip = 0;
break;
@@ -8552,8 +8557,13 @@ int main(int argc, char **argv)
 #if USE_KVM
 if (kvm_allowed) {
if (kvm_qemu_init() < 0) {
+#if USE_GCC4
+   fprintf(stderr, "Could not initialize KVM, can't run without kvm if 
compiled with gcc4\n");
+   exit(1);
+#else
fprintf(stderr, "Could not initialize KVM, will disable KVM 
support\n");
kvm_allowed = 0;
+#endif
}
 }
 #endif

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] Virtual Samba server using kvm

2007-10-07 Thread Franco Spinelli
Is KVM the correct choice for using in a virtual Samba server?

Virtual server read from an ISCSI storage (2xGb network) and serve a LAN 
on a 100 Mb network

I am not a list subscriber

Regards
Franco Spinelli

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] out of memory page request

2007-10-07 Thread David Brown
> Can you run 'gdb /path/to/kvm.ko' and post the output of 'disassemble
> ioapic_mmio_write' please?
>

Sorry for not getting back sooner.

(gdb) disassemble ioapic_mmio_write
Dump of assembler code for function ioapic_mmio_write:
0xf540 :   mov%edx,%r8d
0xf543 :   cmp$0x4,%edx
0xf546 :   mov0x20(%rdi),%rdi
0xf54a :  sete   %dl
0xf54d :  cmp$0x8,%r8d
0xf551 :  sete   %al
0xf554 :  or %al,%dl
0xf556 :  je 0xf570

0xf558 :  mov%rsi,%rax
0xf55b :  mov(%rcx),%ecx
0xf55d :  and$0xff,%eax
0xf562 :  jne0xf568

0xf564 :  mov%ecx,0x8(%rdi)
0xf567 :  retq
0xf568 :  cmp$0x10,%rax
0xf56c :  je 0xf581

0xf56e :  repz retq
0xf570 :  mov%r8d,%esi
0xf573 :  mov$0x0,%rdi
---Type  to continue, or q  to quit---
0xf57a :  xor%eax,%eax
0xf57c :  jmpq   0xf581

0xf581 :  mov0x8(%rdi),%eax
0xf584 :  test   %eax,%eax
0xf586 :  je 0xf5b0

0xf588 :  cmp$0x2,%eax
0xf58b :  jbe0xf5ba

0xf58d :  lea
0xfff0(%rax),%esi
0xf590 :  shr%esi
0xf592 :  test   $0x1,%al
0xf594 :  je 0xf5bc

0xf596 :  movslq %esi,%rax
0xf599 :  mov%ecx,0x1c(%rdi,%rax,8)
0xf59d :  mov$0x1,%eax
0xf5a2 :  mov%esi,%ecx
0xf5a4 : shl%cl,%eax
0xf5a6 : test   %eax,0x10(%rdi)
0xf5a9 : je 0xf56e
 to continue, or q  to
quit---
+46>
0xf5ab : jmpq   0xf460 
0xf5b0 : shr$0x18,%ecx
0xf5b3 : and$0xf,%ecx
0xf5b6 : mov%ecx,0xc(%rdi)
0xf5b9 : retq
0xf5ba : repz retq
0xf5bc : movslq %esi,%rax
0xf5bf : mov$0x,%rdx
0xf5c9 : mov%ecx,%ecx
0xf5cb : and0x18(%rdi,%rax,8),%rdx
0xf5d0 : or %rcx,%rdx
0xf5d3 : mov%rdx,0x18(%rdi,%rax,8)
0xf5d8 : andb   $0xbf,0x19(%rdi,%rax,8)
0xf5dd : jmp0xf59d

End of assembler dump.
(gdb)

I'm using gcc 4.1.2 and glibc kernel headers for 2.6.22.6 currently.

Thanks,
- David Brown

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [ kvm-Bugs-1808970 ] CDROM eject doesn't work via Qemu Monitor

2007-10-07 Thread SourceForge.net
Bugs item #1808970, was opened at 2007-10-07 16:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1808970&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Technologov (technologov)
Assigned to: Nobody/Anonymous (nobody)
Summary: CDROM eject doesn't work via Qemu Monitor

Initial Comment:
When ejecting CD/DVD via Qemu monitor, then inserting another CD, the first CD 
is always shown, instead of the newly inserted one, unless I eject the CD from 
the guest.

This bug prevents setup of Windows XP Tablet Edition, because this OS requires 
2 CDs to install, and since this is Windows there are no workarounds.

Guest: any Windows, especially Windows XP Tablet Edition.

Host: Fedora7, 64-bit, Intel CPU, KVM-45.

Other KVM versions and -no-kvm didn't help.

-Alexey Technologov. 7.oct.2007.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1808970&group_id=180599

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] User feedback

2007-10-07 Thread Anthony Liguori
Wolfram Gloger wrote:
> Anthony Liguori writes:
>
>   
>> http://kvm.qumranet.com/kvmwiki/AnthonyLiguori/Networking
>>
>> This is for Ubuntu but it probably works in Debian too. It uses NAT
>> instead of bridging and it is what I use on my desktop.
>> 
>
> Good advice, but why use a bridge interface _at all_ in this case?
>   

Because sometimes I launch more than one VM and I also wanted to be able 
to use dhcp in the guest.  But yeah, you're right, you could just 
preconfigure a bunch of tapN devices and that would solve the problem too.

Regards,

Anthony Liguori

> I have the following in /etc/network/interfaces:
>
> iface tap0 inet static
> address 192.168.0.1
> netmask 255.255.255.0
>   pre-up iptables-setup-for-masq
>
> and in my qemu-ifup (or rather kvm-ifup):
>
> #!/bin/sh
> /sbin/ifconfig $1 0.0.0.0 up
> /sbin/ifup $1
> exit 0
>
> and that is all..  No more need for any bridging.
>
> BTW I think it would be an important feature to also have
> a qemu-ifdown / kvm-ifdown script to remove the iptables
> rules after the tap device disappears.
>
> Regards,
> Wolfram.
>
> -
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ___
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] x86 -cpu option: Take 4

2007-10-07 Thread Dan Kenigsberg
Hi,

Due to comments on "Take 3", I rewrote the feature name list according
to Intel's and AMD's specs in order not to contaminate target-i386 with
GPL code. More importantly - the "host" cpu type is dropped. It will be
added, as a kvm-specific code, in a future patch.

I'd be happy to hear if patch is applicable in its current minimalistic
form this, or that more changes should be made.

Thanks,

Dan.

Index: vl.c
===
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.346
diff -u -p -r1.346 vl.c
--- vl.c5 Oct 2007 13:08:34 -   1.346
+++ vl.c7 Oct 2007 12:34:45 -
@@ -7696,6 +7696,8 @@ int main(int argc, char **argv)
 mips_cpu_list(stdout, &fprintf);
 #elif defined(TARGET_SPARC)
 sparc_cpu_list(stdout, &fprintf);
+#elif defined(TARGET_I386)
+x86_cpu_list(stdout, &fprintf);
 #endif
 exit(0);
 } else {
Index: hw/pc.c
===
RCS file: /sources/qemu/qemu/hw/pc.c,v
retrieving revision 1.86
diff -u -p -r1.86 pc.c
--- hw/pc.c 5 Oct 2007 13:08:35 -   1.86
+++ hw/pc.c 7 Oct 2007 12:34:46 -
@@ -666,7 +666,7 @@ static void pc_init1(int ram_size, int v
  DisplayState *ds, const char **fd_filename, int snapshot,
  const char *kernel_filename, const char *kernel_cmdline,
  const char *initrd_filename,
- int pci_enabled)
+ int pci_enabled, const char *cpu_model)
 {
 char buf[1024];
 int ret, linux_boot, i;
@@ -682,6 +682,13 @@ static void pc_init1(int ram_size, int v
 linux_boot = (kernel_filename != NULL);
 
 /* init CPUs */
+if (cpu_model == NULL)
+cpu_model = "basic";
+
+if (x86_find_cpu_by_name(cpu_model)) {
+fprintf(stderr, "Unable to find x86 CPU definition\n");
+exit(1);
+}
 for(i = 0; i < smp_cpus; i++) {
 env = cpu_init();
 if (i != 0)
@@ -950,7 +957,7 @@ static void pc_init_pci(int ram_size, in
 pc_init1(ram_size, vga_ram_size, boot_device,
  ds, fd_filename, snapshot,
  kernel_filename, kernel_cmdline,
- initrd_filename, 1);
+ initrd_filename, 1, cpu_model);
 }
 
 static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device,
@@ -964,7 +971,7 @@ static void pc_init_isa(int ram_size, in
 pc_init1(ram_size, vga_ram_size, boot_device,
  ds, fd_filename, snapshot,
  kernel_filename, kernel_cmdline,
- initrd_filename, 0);
+ initrd_filename, 0, cpu_model);
 }
 
 QEMUMachine pc_machine = {
Index: target-i386/cpu.h
===
RCS file: /sources/qemu/qemu/target-i386/cpu.h,v
retrieving revision 1.50
diff -u -p -r1.50 cpu.h
--- target-i386/cpu.h   27 Sep 2007 16:44:31 -  1.50
+++ target-i386/cpu.h   7 Oct 2007 12:34:46 -
@@ -274,23 +274,56 @@
 #define CPUID_CMOV (1 << 15)
 #define CPUID_PAT  (1 << 16)
 #define CPUID_PSE36   (1 << 17)
+#define CPUID_PN   (1 << 18)
 #define CPUID_CLFLUSH (1 << 19)
-/* ... */
+#define CPUID_DTS (1 << 21)
+#define CPUID_ACPI (1 << 22)
 #define CPUID_MMX  (1 << 23)
 #define CPUID_FXSR (1 << 24)
 #define CPUID_SSE  (1 << 25)
 #define CPUID_SSE2 (1 << 26)
+#define CPUID_SS (1 << 27)
+#define CPUID_HT (1 << 28)
+#define CPUID_TM (1 << 29)
+#define CPUID_IA64 (1 << 30)
+#define CPUID_PBE (1 << 31)
 
 #define CPUID_EXT_SSE3 (1 << 0)
 #define CPUID_EXT_MONITOR  (1 << 3)
+#define CPUID_EXT_DSCPL(1 << 4)
+#define CPUID_EXT_VMX  (1 << 5)
+#define CPUID_EXT_SMX  (1 << 6)
+#define CPUID_EXT_EST  (1 << 7)
+#define CPUID_EXT_TM2  (1 << 8)
+#define CPUID_EXT_SSSE3(1 << 9)
+#define CPUID_EXT_CID  (1 << 10)
 #define CPUID_EXT_CX16 (1 << 13)
+#define CPUID_EXT_XTPR (1 << 14)
+#define CPUID_EXT_DCA  (1 << 17)
+#define CPUID_EXT_POPCNT   (1 << 22)
 
 #define CPUID_EXT2_SYSCALL (1 << 11)
+#define CPUID_EXT2_MP  (1 << 19)
 #define CPUID_EXT2_NX  (1 << 20)
+#define CPUID_EXT2_MMXEXT  (1 << 22)
 #define CPUID_EXT2_FFXSR   (1 << 25)
+#define CPUID_EXT2_PDPE1GB (1 << 26)
+#define CPUID_EXT2_RDTSCP  (1 << 27)
 #define CPUID_EXT2_LM  (1 << 29)
+#define CPUID_EXT2_3DNOWEXT (1 << 30)
+#define CPUID_EXT2_3DNOW   (1 << 31)
 
+#define CPUID_EXT3_LAHF_LM (1 << 0)
+#define CPUID_EXT3_CMP_LEG (1 << 1)
 #define CPUID_EXT3_SVM (1 << 2)
+#define CPUID_EXT3_EXTAPIC (1 << 3)
+#define CPUID_EXT3_CR8LEG  (1 << 4)
+#define CPUID_EXT3_ABM (1 << 5)
+#define CPUID_EXT3_SSE4A   (1 << 6)
+#define CPUID_EXT3_MISALIGNSSE (1 << 7)
+#define CPUID_EXT3_3DNOWPREFETCH (1 << 8)
+#define CPUID_EXT3_OSVW(1 << 9)
+#define CPUID_EXT3_IBS (1 << 10)
 
 #define EXCP00_DIVZ0
 #define EXCP01_SSTP1
@@ -564,6 +597,9 @@ typedef struct CPUX86State {
 CPUX86St

[kvm-devel] Good project!

2007-10-07 Thread www . qqywj . com
http://www.qqywj.com
MSN: [EMAIL PROTECTED]
  Email: [EMAIL PROTECTED]
  skype: qqywj1
TEL: +86 15938829425
If you think we are excellent, please contact us.We will serve for you will all 
our effort.>{}-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] User feedback

2007-10-07 Thread Wolfram Gloger
Anthony Liguori writes:

>http://kvm.qumranet.com/kvmwiki/AnthonyLiguori/Networking
>
>This is for Ubuntu but it probably works in Debian too. It uses NAT
>instead of bridging and it is what I use on my desktop.

Good advice, but why use a bridge interface _at all_ in this case?
I have the following in /etc/network/interfaces:

iface tap0 inet static
address 192.168.0.1
netmask 255.255.255.0
pre-up iptables-setup-for-masq

and in my qemu-ifup (or rather kvm-ifup):

#!/bin/sh
/sbin/ifconfig $1 0.0.0.0 up
/sbin/ifup $1
exit 0

and that is all..  No more need for any bridging.

BTW I think it would be an important feature to also have
a qemu-ifdown / kvm-ifdown script to remove the iptables
rules after the tap device disappears.

Regards,
Wolfram.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] [1/2] Update user configure script

2007-10-07 Thread Avi Kivity
Jerone Young wrote:
> This adds the ability to change CC, ARCH, & LD variables with configure
> script in user directory.
>   

Applied, thanks.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] [2/2] Split arch specific makefile code out

2007-10-07 Thread Avi Kivity
Jerone Young wrote:
> This patch makes things better for cross compiling. It also makes adding
> a new architecture to the current make system much easier.
>   

> +CFLAGS += -I $(KERNELDIR)/include $(autodepend-flags) -g 
> -fomit-frame-pointer \
> + -Wall
> +CFLAGS += -m32
> +CFLAGS += -m64
>   

Nowhere is CFLAGS defined, that I can see.  This means that a stray 
CFLAGS environment variable will affect the build (this is the cause of 
my dislike to ?= as well).

Please change so that make variables cannot be affected by the environment.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] remove duplicate code

2007-10-07 Thread Avi Kivity
Glauber de Oliveira Costa wrote:
> This patch removes duplicate code at vl.c. Once the KVM-only
> part defines how much physicall memory it wants, the rest should
> be the same for everybody.
>
> Signed-off-by: Glauber de Oliveira Costa <[EMAIL PROTECTED]>
> ---
>  qemu/vl.c |   23 +--
>  1 files changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/qemu/vl.c b/qemu/vl.c
> index fe49d2c..4f8cf51 100644
> --- a/qemu/vl.c
> +++ b/qemu/vl.c
> @@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
>   fprintf(stderr, "Could not create KVM context\n");
>   exit(1);
>   }
> -} else {
> - phys_ram_base = qemu_vmalloc(phys_ram_size);
> - if (!phys_ram_base) {
> - fprintf(stderr, "Could not allocate physical memory\n");
> - exit(1);
> - }
> -}
> -#else
> -phys_ram_base = qemu_vmalloc(phys_ram_size);
> -if (!phys_ram_base) {
> -fprintf(stderr, "Could not allocate physical memory\n");
> -exit(1);
> -}
> +} else
>  #endif
> +{
> +  phys_ram_base = qemu_vmalloc(phys_ram_size);
> +  if (!phys_ram_base) {
> +  fprintf(stderr, "Could not allocate physical memory\n");
> +  exit(1);
> +  }
> +}
>  
>  /* we always create the cdrom drive, even if no disk is there */
>  bdrv_init();
>   

This touches original qemu lines, which is likely to cause me pain on 
the next merge.  Maybe a goto after the kvm allocation code can remove 
the need to touch that code.

In any case this code is being worked on to be much more similar to 
regular qemu.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/2] Use getopt() for kvmctl

2007-10-07 Thread Avi Kivity
Anthony Liguori wrote:
> kvmctl does its own parsing of argc/argv.  Other than being hard to maintain,
> the recent --smp addition seems to have broken -32.  This patch switches 
> kvmctl
> to use getopt().  This changes the -32 option to --protected-mode (or -p).
>
> This patch also adds a --help option.
>
>   

Applied both, thanks.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Re: CodingStyle cleanup (Resubmit - fixed DSO)

2007-10-07 Thread Avi Kivity
Mike Day wrote:
> CodingStyle cleanup for kvm.h
>
> Signed-off-by: Mike D. Day <[EMAIL PROTECTED]>
>   

Please resend, the replies got me confused as to which patches are valid 
and which aren't.

This should be done as one patch; there's no need to split a code style 
cleanup per file.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel