kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/24] configure and Makefile cleanup
@ 2009-09-18 11:41 Juan Quintela
  2009-09-18 11:41 ` [PATCH 01/24] Don't disable werror unconditionally Juan Quintela
                   ` (24 more replies)
  0 siblings, 25 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

This series:
- werror is not disabled unconditoanally, you can disable it with
  --disable-werror.
- clean configure and Makefile* of mis-merges
- sync such files to qemu upstream
- kvm options are detected and configured _after_ detecting kvm, not
  the other way around
- add command line options and change styse so kvm-cap-pit and
  kvm-cap-device-assignment looks like the other options.  Bring command
  line flags to enable/disable them, and fix code to compile.
- CONFIG_CPU_EMULATION is back, and it works (it is still a hack, proper
  fix means moving code to new files and other conditional compilation, better
  to do it at qemu upstream.
- Why do we define "-D__user=" for gcc?  Nothing uses it (/me guess sparse
  missmerge)

What I didn't touch:
- kvm-kmod.
- CFLAGS += $(KVM_CFLAGS)
  on Makefile.target, only 4-5 files need them.  Didn't investigate too much
  into it.
- I only tested it on x86_64, i386 should work. powerpc/ia64 -> dunno.

For upstream:
- kvm_cflags reorganization: make sense
- KVM_CAP_PIT: haven't looked how much support is missing there
- DEVICE_ASSIGNMENT: idem
- CONFIG_CPU_EMULATION: Proper implementation is not trivial. What is in
  qemu-kvm is a hack, proper integration requires moving code back and forth.
  Not sure how important is to have this option.

Comments?

Juan Quintela (24):
  Don't disable werror unconditionally
  extboot.bin is a generated file
  Remove merge artifacts
  piix4_dev is not used for pc's
  compatfd is included before, and it is compiled unconditionally
  Use common style for signalfd
  One CONFIG_EVENTFD should be enough
  Bring ia64 to current arch selection code
  Use configure way of enabling kvm
  Prin kvm options values as everything else
  KVM temp hack not needed anymore
  Introduce libs_softmmu to device assignment code
  Use compile_prog function in thee missing compilations
  Test for libpci, not only for header
  Rename USE_KVM_* to CONFIG_KVM_*
  Move kvm specific tests after main kvm test
  Add kvm-cap-pit command line flags
  Add kvm-cap-device-assignment command line flags
  Fix compilation without device assignment
  Only print kvm options when kvm is enabled
  __user is not used anywhere in qemu sources
  fix mis-merge (we define pkgversion 3 lines above
  Get CONFIG_CPU_EMULATION back to life
  Remove build-targets-* rules that are always empty

 .gitignore              |    1 +
 Makefile                |   11 --
 Makefile.target         |   31 ++-----
 compatfd.c              |    4 +-
 configure               |  237 +++++++++++++++++++++++------------------------
 create_config           |    3 -
 exec.c                  |    2 +
 hw/ipf.c                |    4 +-
 hw/pc.c                 |    6 +-
 hw/pci-hotplug.c        |   14 ++--
 hw/pci.c                |    4 +-
 hw/pcspk.c              |    2 +-
 hw/piix_pci.c           |    3 -
 qemu-kvm-x86.c          |    2 +
 qemu-kvm.c              |   10 +-
 qemu-kvm.h              |    2 +-
 target-i386/fake-exec.c |    4 -
 vl.c                    |    2 +-
 18 files changed, 154 insertions(+), 188 deletions(-)


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

* [PATCH 01/24] Don't disable werror unconditionally
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 19:02   ` Marcelo Tosatti
  2009-09-18 11:41 ` [PATCH 02/24] extboot.bin is a generated file Juan Quintela
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 97292d9..e6252a2 100755
--- a/configure
+++ b/configure
@@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
     else
         werror="no"
     fi
-    # disable default werror for kvm
-    werror="no"
 fi

 if test "$werror" = "yes" ; then
-- 
1.6.2.5


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

* [PATCH 02/24] extboot.bin is a generated file
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
  2009-09-18 11:41 ` [PATCH 01/24] Don't disable werror unconditionally Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 03/24] Remove merge artifacts Juan Quintela
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 13c967e..59a0244 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,4 +44,5 @@ pc-bios/bios-pq/status
 pc-bios/vgabios-pq/status
 pc-bios/optionrom/multiboot.bin
 pc-bios/optionrom/multiboot.raw
+pc-bios/optionrom/extboot.bin
 .stgit-*
-- 
1.6.2.5


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

* [PATCH 03/24] Remove merge artifacts
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
  2009-09-18 11:41 ` [PATCH 01/24] Don't disable werror unconditionally Juan Quintela
  2009-09-18 11:41 ` [PATCH 02/24] extboot.bin is a generated file Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 04/24] piix4_dev is not used for pc's Juan Quintela
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

CFLAGS and LDFLAGS are defined on config.mak
LDFLAGS_BASE is not used anywhere
DEPLIBS are not defined anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index a08e432..5fad812 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -1,13 +1,8 @@
 # -*- Mode: makefile -*-

-CFLAGS=
-LDFLAGS=
-
 include config.mak
 include $(SRC_PATH)/rules.mak

-LDFLAGS_BASE:=$(LDFLAGS)
-
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
 QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
@@ -347,9 +342,6 @@ monitor.o: qemu-monitor.h

 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)

-$(QEMU_PROG): ARLIBS += $(DEPLIBS)
-$(QEMU_PROG): $(DEPLIBS)
-
 endif # CONFIG_SOFTMMU

 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
-- 
1.6.2.5


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

* [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (2 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 03/24] Remove merge artifacts Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 19:05   ` Marcelo Tosatti
  2009-09-18 11:41 ` [PATCH 05/24] compatfd is included before, and it is compiled unconditionally Juan Quintela
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

And mips still don't have pci assignment support :)

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target |    2 +-
 hw/piix_pci.c   |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 5fad812..58f8b9e 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -209,9 +209,9 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
 obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
 obj-i386-y += extboot.o
-obj-i386-y += piix4.o
 obj-i386-y += ne2000-isa.o
 obj-i386-y += testdev.o
+
 ifeq ($(USE_KVM_PIT), 1)
 obj-i386-y += i8254-kvm.o
 endif
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 26e00db..d177e97 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -291,9 +291,6 @@ int piix_get_irq(int pin)
 {
     if (piix3_dev)
         return piix3_dev->dev.config[0x60+pin];
-    if (piix4_dev)
-        return piix4_dev->config[0x60+pin];
-
     return 0;
 }

-- 
1.6.2.5


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

* [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (3 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 04/24] piix4_dev is not used for pc's Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-22 13:19   ` Christoph Hellwig
  2009-09-18 11:41 ` [PATCH 06/24] Use common style for signalfd Juan Quintela
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 6a9ca7c..88b39bd 100644
--- a/Makefile
+++ b/Makefile
@@ -78,10 +78,6 @@ block-nested-$(CONFIG_CURL) += curl.o

 block-obj-y +=  $(addprefix block/, $(block-nested-y))

-ifdef CONFIG_AIO
-block-obj-y += compatfd.o
-endif
-
 ######################################################################
 # libqemu_common.a: Target independent part of system emulation. The
 # long term path is to suppress *all* target specific code in case of
-- 
1.6.2.5


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

* [PATCH 06/24] Use common style for signalfd
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (4 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 05/24] compatfd is included before, and it is compiled unconditionally Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 07/24] One CONFIG_EVENTFD should be enough Juan Quintela
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

s/CONFIG_signalfd/CONFIG_SIGNALFD/

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 compatfd.c |    2 +-
 configure  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compatfd.c b/compatfd.c
index 36e37e5..8c78597 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -100,7 +100,7 @@ static int qemu_signalfd_compat(const sigset_t *mask)

 int qemu_signalfd(const sigset_t *mask)
 {
-#if defined(CONFIG_signalfd)
+#if defined(CONFIG_SIGNALFD)
     int ret;

     ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8);
diff --git a/configure b/configure
index e6252a2..298a60b 100755
--- a/configure
+++ b/configure
@@ -234,7 +234,6 @@ kerneldir=""
 aix="no"
 blobs="yes"
 pkgversion=" ($(kvm_version))"
-signalfd="no"
 eventfd="no"
 cpu_emulation="yes"
 kvm_kmod="no"
@@ -1608,6 +1607,7 @@ fi

 ##########################################
 # signalfd probe
+signalfd="no"
 cat > $TMPC << EOF
 #define _GNU_SOURCE
 #include <unistd.h>
@@ -2051,7 +2051,7 @@ if test "$fdt" = "yes" ; then
   echo "CONFIG_FDT=y" >> $config_host_mak
 fi
 if test "$signalfd" = "yes" ; then
-  echo "CONFIG_signalfd=y" >> $config_host_mak
+  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
 fi
 if test "$eventfd" = "yes" ; then
   echo "CONFIG_eventfd=y" >> $config_host_mak
-- 
1.6.2.5


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

* [PATCH 07/24] One CONFIG_EVENTFD should be enough
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (5 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 06/24] Use common style for signalfd Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 08/24] Bring ia64 to current arch selection code Juan Quintela
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 compatfd.c |    2 +-
 configure  |    4 ----
 qemu-kvm.c |    2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/compatfd.c b/compatfd.c
index 8c78597..594e4af 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -113,7 +113,7 @@ int qemu_signalfd(const sigset_t *mask)

 int qemu_eventfd(int *fds)
 {
-#if defined(CONFIG_eventfd)
+#if defined(CONFIG_EVENTFD)
     int ret;

     ret = syscall(SYS_eventfd, 0);
diff --git a/configure b/configure
index 298a60b..bbb0c9d 100755
--- a/configure
+++ b/configure
@@ -234,7 +234,6 @@ kerneldir=""
 aix="no"
 blobs="yes"
 pkgversion=" ($(kvm_version))"
-eventfd="no"
 cpu_emulation="yes"
 kvm_kmod="no"
 pkgversion=""
@@ -2053,12 +2052,9 @@ fi
 if test "$signalfd" = "yes" ; then
   echo "CONFIG_SIGNALFD=y" >> $config_host_mak
 fi
-if test "$eventfd" = "yes" ; then
-  echo "CONFIG_eventfd=y" >> $config_host_mak
 if test "$need_offsetof" = "yes" ; then
   echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
 fi
-fi

 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
diff --git a/qemu-kvm.c b/qemu-kvm.c
index bff11e8..aaaafd7 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1448,7 +1448,7 @@ int kvm_assign_set_msix_entry(kvm_context_t kvm,
 }
 #endif

-#if defined(KVM_CAP_IRQFD) && defined(CONFIG_eventfd)
+#if defined(KVM_CAP_IRQFD) && defined(CONFIG_EVENTFD)

 #include <sys/eventfd.h>

-- 
1.6.2.5


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

* [PATCH 08/24] Bring ia64 to current arch selection code
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (6 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 07/24] One CONFIG_EVENTFD should be enough Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 09/24] Use configure way of enabling kvm Juan Quintela
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index bbb0c9d..7806456 100755
--- a/configure
+++ b/configure
@@ -2262,9 +2262,6 @@ case "$target_arch2" in
     target_phys_bits=64
   ;;
   ia64)
-    echo "TARGET_ARCH=ia64" >> $config_host_mak
-    echo "#define TARGET_ARCH \"ia64\"" >> $config_host_h
-    echo "#define TARGET_IA64 1" >> $config_host_h
     target_phys_bits=64
   ;;
   alpha)
-- 
1.6.2.5


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

* [PATCH 09/24] Use configure way of enabling kvm
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (7 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 08/24] Bring ia64 to current arch selection code Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 10/24] Prin kvm options values as everything else Juan Quintela
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 7806456..4512686 100755
--- a/configure
+++ b/configure
@@ -362,19 +362,14 @@ AIX)
   usb="linux"
   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     audio_possible_drivers="$audio_possible_drivers fmod"
-    kvm="yes"
   fi
   if [ "$cpu" = "ia64" ] ; then
-     kvm="yes"
      xen="no"
      target_list="ia64-softmmu"
      cpu_emulation="no"
      gdbstub="no"
      slirp="no"
   fi
-  if [ "$cpu" = "powerpc" ]; then
-      kvm="yes"
-  fi
 ;;
 esac

@@ -926,7 +921,7 @@ esac

 kvm_cflags=""

-if test "$kvm" = "yes" ; then
+if test "$kvm" != "no" ; then

 kvm_cflags="-I$source_path/kvm/include"
 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
-- 
1.6.2.5


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

* [PATCH 10/24] Prin kvm options values as everything else
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (8 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 09/24] Use configure way of enabling kvm Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 11/24] KVM temp hack not needed anymore Juan Quintela
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |   32 +++++++++-----------------------
 1 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/configure b/configure
index 4512686..22d393b 100755
--- a/configure
+++ b/configure
@@ -2050,6 +2050,9 @@ fi
 if test "$need_offsetof" = "yes" ; then
   echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
 fi
+if test $cpu_emulation = "no"; then
+  echo "NO_CPU_EMULATION=1" >> $config_host_mak
+fi

 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
@@ -2222,28 +2225,6 @@ interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
 echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
 gdb_xml_files=""

-disable_cpu_emulation() {
-  if test $cpu_emulation = "no"; then
-    echo "#define NO_CPU_EMULATION 1" >> $config_host_h
-    echo "NO_CPU_EMULATION=1" >> $config_host_mak
-  fi
-}
-
-configure_kvm() {
-  if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
-          \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
-    echo "CONFIG_KVM=y" >> $config_mak
-    echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
-    if test $kvm_cap_pit = "yes" ; then
-	echo "USE_KVM_PIT=1" >> $config_mak
-    fi
-    if test $kvm_cap_device_assignment = "yes" ; then
-	echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
-    fi
-    disable_cpu_emulation
-  fi
-}
-
 TARGET_ARCH="$target_arch2"
 TARGET_BASE_ARCH=""
 TARGET_ABI_DIR=""
@@ -2386,7 +2367,12 @@ case "$target_arch2" in
       \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
       echo "CONFIG_KVM=y" >> $config_mak
       echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
-      configure_kvm
+      if test $kvm_cap_pit = "yes" ; then
+        echo "USE_KVM_PIT=1" >> $config_mak
+      fi
+      if test $kvm_cap_device_assignment = "yes" ; then
+        echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
+      fi
     fi
 esac
 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
-- 
1.6.2.5


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

* [PATCH 11/24] KVM temp hack not needed anymore
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (9 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 10/24] Prin kvm options values as everything else Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 12/24] Introduce libs_softmmu to device assignment code Juan Quintela
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 22d393b..c4ee415 100755
--- a/configure
+++ b/configure
@@ -2074,11 +2074,6 @@ bsd)
 ;;
 esac

-# this is a temp hack needed for kvm
-if test "$kvm" = "yes" ; then
-    echo "KVM_CFLAGS=$kvm_cflags" >> $config_host_mak
-fi
-
 echo "KVM_KMOD=$kvm_kmod" >> $config_host_mak

 tools=
-- 
1.6.2.5


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

* [PATCH 12/24] Introduce libs_softmmu to device assignment code
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (10 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 11/24] KVM temp hack not needed anymore Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 13/24] Use compile_prog function in thee missing compilations Juan Quintela
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target |    2 --
 configure       |    2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 58f8b9e..525a8c2 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -217,7 +217,6 @@ obj-i386-y += i8254-kvm.o
 endif
 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
 obj-i386-y += device-assignment.o
-LIBS+=-lpci
 endif

 # Hardware support
@@ -228,7 +227,6 @@ obj-ia64-y += usb-uhci.o

 ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
 obj-ia64-y += device-assignment.o
-LIBS+=-lpci
 endif

 # shared objects
diff --git a/configure b/configure
index c4ee415..930e450 100755
--- a/configure
+++ b/configure
@@ -964,7 +964,7 @@ cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
-        :
+        libs_softmmu="-lpci $libs_softmmu"
     else
         echo
         echo "Error: libpci check failed"
-- 
1.6.2.5


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

* [PATCH 13/24] Use compile_prog function in thee missing compilations
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (11 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 12/24] Introduce libs_softmmu to device assignment code Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 14/24] Test for libpci, not only for header Juan Quintela
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 930e450..8c69894 100755
--- a/configure
+++ b/configure
@@ -936,7 +936,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-    if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
+    if compile_prog $kvm_cflags ""; then
 	kvm_cap_pit="yes"
     fi

@@ -949,7 +949,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-    if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
+    if compile_prog $kvm_cflags "" ; then
 	kvm_cap_device_assignment="yes"
     fi
 fi
@@ -963,7 +963,7 @@ cat > $TMPC << EOF
 #endif
 int main(void) { return 0; }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
+    if compile_prog "" "" ; then
         libs_softmmu="-lpci $libs_softmmu"
     else
         echo
-- 
1.6.2.5


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

* [PATCH 14/24] Test for libpci, not only for header
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (12 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 13/24] Use compile_prog function in thee missing compilations Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 15/24] Rename USE_KVM_* to CONFIG_KVM_* Juan Quintela
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 8c69894..fc067a4 100755
--- a/configure
+++ b/configure
@@ -961,9 +961,9 @@ cat > $TMPC << EOF
 #ifndef PCI_VENDOR_ID
 #error NO LIBPCI
 #endif
-int main(void) { return 0; }
+int main(void) { struct pci_access a; pci_init(&a); return 0; }
 EOF
-    if compile_prog "" "" ; then
+    if compile_prog "" "-lpci" ; then
         libs_softmmu="-lpci $libs_softmmu"
     else
         echo
-- 
1.6.2.5


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

* [PATCH 15/24] Rename USE_KVM_* to CONFIG_KVM_*
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (13 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 14/24] Test for libpci, not only for header Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 16/24] Move kvm specific tests after main kvm test Juan Quintela
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

Once there, simplify Makefile.target with new syntax

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target  |   13 +++----------
 configure        |    4 ++--
 create_config    |    3 ---
 hw/ipf.c         |    4 ++--
 hw/pc.c          |    6 +++---
 hw/pci-hotplug.c |   14 +++++++-------
 hw/pci.c         |    4 ++--
 hw/pcspk.c       |    2 +-
 qemu-kvm.c       |    8 ++++----
 qemu-kvm.h       |    2 +-
 10 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 525a8c2..4a5352b 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -212,22 +212,15 @@ obj-i386-y += extboot.o
 obj-i386-y += ne2000-isa.o
 obj-i386-y += testdev.o

-ifeq ($(USE_KVM_PIT), 1)
-obj-i386-y += i8254-kvm.o
-endif
-ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
-obj-i386-y += device-assignment.o
-endif
+obj-i386-$(CONFIG_KVM_PIT) += i8254-kvm.o
+obj-i386-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o

 # Hardware support
 obj-ia64-y += ide.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 obj-ia64-y += fdc.o mc146818rtc.o serial.o i8259.o ipf.o
 obj-ia64-y += cirrus_vga.o parallel.o acpi.o piix_pci.o
 obj-ia64-y += usb-uhci.o
-
-ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1)
-obj-ia64-y += device-assignment.o
-endif
+obj-ia64-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o

 # shared objects
 obj-ppc-y = ppc.o ide/core.o ide/isa.o ide/pci.o ide/macio.o
diff --git a/configure b/configure
index fc067a4..ef7d03d 100755
--- a/configure
+++ b/configure
@@ -2363,10 +2363,10 @@ case "$target_arch2" in
       echo "CONFIG_KVM=y" >> $config_mak
       echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
       if test $kvm_cap_pit = "yes" ; then
-        echo "USE_KVM_PIT=1" >> $config_mak
+        echo "CONFIG_KVM_PIT=y" >> $config_mak
       fi
       if test $kvm_cap_device_assignment = "yes" ; then
-        echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
+        echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_mak
       fi
     fi
 esac
diff --git a/create_config b/create_config
index 8d265d1..5bc8fb6 100755
--- a/create_config
+++ b/create_config
@@ -85,9 +85,6 @@ case $line in
     value=${line#*=}
     echo "#define $name $value"
     ;;
- USE_KVM_*)
-    echo "#define $(echo "$line" | sed 's/=/ /')"
-    ;;
 esac

 done # read
diff --git a/hw/ipf.c b/hw/ipf.c
index 04b7b2c..21cff72 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -636,10 +636,10 @@ static void ipf_init1(ram_addr_t ram_size,
 	}
     }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     if (kvm_enabled())
 	add_assigned_devices(pci_bus, assigned_devices, assigned_devices_index);
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */

 }

diff --git a/hw/pc.c b/hw/pc.c
index 5f892c7..7e2a502 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1344,7 +1344,7 @@ static void pc_init1(ram_addr_t ram_size,
         isa_irq_state->ioapic = ioapic_init();
         ioapic_irq_hack = isa_irq;
     }
-#ifdef USE_KVM_PIT
+#ifdef CONFIG_KVM_PIT
     if (kvm_enabled() && qemu_kvm_pit_in_kernel())
 	pit = kvm_pit_init(0x40, isa_reserve_irq(0));
     else
@@ -1468,12 +1468,12 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     if (kvm_enabled()) {
         add_assigned_devices(pci_bus, assigned_devices, assigned_devices_index);
         assigned_dev_load_option_roms(pci_option_rom_offset);
     }
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
 }

 static void pc_init_pci(ram_addr_t ram_size,
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index b8ea9ae..eab0756 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -155,7 +155,7 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
     return dev;
 }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
 static PCIDevice *qemu_pci_hot_assign_device(Monitor *mon,
                                              const char *devaddr,
                                              const char *opts)
@@ -192,7 +192,7 @@ static void qemu_pci_hot_deassign_device(Monitor *mon, AssignedDevInfo *adev)
                    "(\"%s\") from guest\n",
                    adev->bus, adev->dev, adev->func, adev->name);
 }
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */

 void pci_device_hot_add(Monitor *mon, const QDict *qdict)
 {
@@ -217,10 +217,10 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict)
         dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);
     else if (strcmp(type, "storage") == 0)
         dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);
-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     else if (strcmp(type, "host") == 0)
         dev = qemu_pci_hot_assign_device(mon, pci_addr, opts);
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
     else
         monitor_printf(mon, "invalid type: %s\n", type);

@@ -274,7 +274,7 @@ void pci_device_hot_remove_success(int pcibus, int slot)
 {
     PCIDevice *d = pci_find_device(pcibus, slot, 0);
     int class_code;
-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     AssignedDevInfo *adev;
 #endif

@@ -283,13 +283,13 @@ void pci_device_hot_remove_success(int pcibus, int slot)
         return;
     }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     adev = get_assigned_device(pcibus, slot);
     if (adev) {
         qemu_pci_hot_deassign_device(cur_mon, adev);
         return;
     }
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */

     class_code = d->config_read(d, PCI_CLASS_DEVICE+1, 1);

diff --git a/hw/pci.c b/hw/pci.c
index 9c22a67..3da5ade 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -650,12 +650,12 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
         d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
     }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     if (kvm_enabled() && qemu_kvm_irqchip_in_kernel() &&
         addr >= PIIX_CONFIG_IRQ_ROUTE &&
 	addr < PIIX_CONFIG_IRQ_ROUTE + 4)
         assigned_dev_update_irqs();
-#endif /* USE_KVM_DEVICE_ASSIGNMENT */
+#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */

     if (memcmp(orig + PCI_BASE_ADDRESS_0, d->config + PCI_BASE_ADDRESS_0, 24)
         || ((orig[PCI_COMMAND] ^ d->config[PCI_COMMAND])
diff --git a/hw/pcspk.c b/hw/pcspk.c
index 3d3eba4..128836b 100644
--- a/hw/pcspk.c
+++ b/hw/pcspk.c
@@ -50,7 +50,7 @@ typedef struct {
 static const char *s_spk = "pcspk";
 static PCSpkState pcspk_state;

-#ifdef USE_KVM_PIT
+#ifdef CONFIG_KVM_PIT
 static void kvm_get_pit_ch2(PITState *pit,
                             struct kvm_pit_state *inkernel_state)
 {
diff --git a/qemu-kvm.c b/qemu-kvm.c
index aaaafd7..5d8d8e2 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -66,7 +66,7 @@ static CPUState *kvm_debug_cpu_requested;

 static uint64_t phys_ram_size;

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
 /* The list of ioperm_data */
 static QLIST_HEAD(, ioperm_data) ioperm_head;
 #endif
@@ -1831,7 +1831,7 @@ static void *ap_main_loop(void *_env)
 {
     CPUState *env = _env;
     sigset_t signals;
-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     struct ioperm_data *data = NULL;
 #endif

@@ -1841,7 +1841,7 @@ static void *ap_main_loop(void *_env)
     sigprocmask(SIG_BLOCK, &signals, NULL);
     env->kvm_cpu_state.vcpu_ctx = kvm_create_vcpu(env, env->cpu_index);

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
     /* do ioperm for io ports of assigned devices */
     QLIST_FOREACH(data, &ioperm_head, entries)
         on_vcpu(env, kvm_arch_do_ioperm, data);
@@ -2424,7 +2424,7 @@ void kvm_mutex_lock(void)
     cpu_single_env = NULL;
 }

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
 void kvm_add_ioperm_data(struct ioperm_data *data)
 {
     QLIST_INSERT_HEAD(&ioperm_head, data, entries);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 0091a16..ac150d6 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -1060,7 +1060,7 @@ int kvm_arch_init_irq_routing(void);
 int kvm_mmio_read(void *opaque, uint64_t addr, uint8_t * data, int len);
 int kvm_mmio_write(void *opaque, uint64_t addr, uint8_t * data, int len);

-#ifdef USE_KVM_DEVICE_ASSIGNMENT
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
 struct ioperm_data;

 void kvm_ioperm(CPUState *env, void *data);
-- 
1.6.2.5


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

* [PATCH 16/24] Move kvm specific tests after main kvm test
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (14 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 15/24] Rename USE_KVM_* to CONFIG_KVM_* Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 17/24] Add kvm-cap-pit command line flags Juan Quintela
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |  140 ++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 69 insertions(+), 71 deletions(-)

diff --git a/configure b/configure
index ef7d03d..73ba095 100755
--- a/configure
+++ b/configure
@@ -905,76 +905,6 @@ EOF
 fi

 ##########################################
-# KVM probe
-
-case "$cpu" in
-    i386 | x86_64)
-	kvm_arch="x86"
-	;;
-    ppc)
-        kvm_arch="powerpc"
-        ;;
-    *)
-	kvm_arch="$cpu"
-	;;
-esac
-
-kvm_cflags=""
-
-if test "$kvm" != "no" ; then
-
-kvm_cflags="-I$source_path/kvm/include"
-kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
-kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
-
-# test for KVM_CAP_PIT
-
-cat > $TMPC <<EOF
-#include <linux/kvm.h>
-#ifndef KVM_CAP_PIT
-#error "kvm no pit capability"
-#endif
-int main(void) { return 0; }
-EOF
-    if compile_prog $kvm_cflags ""; then
-	kvm_cap_pit="yes"
-    fi
-
-# test for KVM_CAP_DEVICE_ASSIGNMENT
-
-cat > $TMPC <<EOF
-#include <linux/kvm.h>
-#ifndef KVM_CAP_DEVICE_ASSIGNMENT
-#error "kvm no device assignment capability"
-#endif
-int main(void) { return 0; }
-EOF
-    if compile_prog $kvm_cflags "" ; then
-	kvm_cap_device_assignment="yes"
-    fi
-fi
-
-# libpci probe for kvm_cap_device_assignment
-if test $kvm_cap_device_assignment = "yes" ; then
-cat > $TMPC << EOF
-#include <pci/pci.h>
-#ifndef PCI_VENDOR_ID
-#error NO LIBPCI
-#endif
-int main(void) { struct pci_access a; pci_init(&a); return 0; }
-EOF
-    if compile_prog "" "-lpci" ; then
-        libs_softmmu="-lpci $libs_softmmu"
-    else
-        echo
-        echo "Error: libpci check failed"
-        echo "Disable KVM Device Assignment capability."
-        echo
-        kvm_cap_device_assignment="no"
-    fi
-fi
-
-##########################################
 # zlib check

 cat > $TMPC << EOF
@@ -1372,7 +1302,23 @@ fi
 ##########################################
 # kvm probe
 if test "$kvm" != "no" ; then
-    cat > $TMPC <<EOF
+  case "$cpu" in
+  i386 | x86_64)
+    kvm_arch="x86"
+    ;;
+  ppc)
+    kvm_arch="powerpc"
+    ;;
+  *)
+    kvm_arch="$cpu"
+    ;;
+  esac
+
+  kvm_cflags="-I$source_path/kvm/include"
+  kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
+  kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
+
+  cat > $TMPC <<EOF
 #include <linux/kvm.h>
 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
 #error Invalid KVM version
@@ -1410,6 +1356,58 @@ EOF
 fi

 ##########################################
+# test for KVM_CAP_PIT
+
+if test "$kvm" != "no" ; then
+  cat > $TMPC <<EOF
+#include <linux/kvm.h>
+#ifndef KVM_CAP_PIT
+#error "kvm no pit capability"
+#endif
+int main(void) { return 0; }
+EOF
+  if compile_prog $kvm_cflags ""; then
+    kvm_cap_pit=yes
+  fi
+fi
+
+##########################################
+# test for KVM_CAP_DEVICE_ASSIGNMENT
+if test "$kvm" != "no" ; then
+  cat > $TMPC <<EOF
+#include <linux/kvm.h>
+#ifndef KVM_CAP_DEVICE_ASSIGNMENT
+#error "kvm no device assignment capability"
+#endif
+int main(void) { return 0; }
+EOF
+  if compile_prog $kvm_cflags "" ; then
+    kvm_cap_device_assignment=yes
+  fi
+fi
+
+##########################################
+# libpci probe for kvm_cap_device_assignment
+if test $kvm_cap_device_assignment = "yes" ; then
+  cat > $TMPC << EOF
+#include <pci/pci.h>
+#ifndef PCI_VENDOR_ID
+#error NO LIBPCI
+#endif
+int main(void) { struct pci_access a; pci_init(&a); return 0; }
+EOF
+  if compile_prog "" "-lpci" ; then
+    libs_softmmu="-lpci $libs_softmmu"
+  else
+    echo
+    echo "Error: libpci check failed"
+    echo "Disable KVM Device Assignment capability."
+    echo
+    kvm_cap_device_assignment=no
+  fi
+fi
+
+##########################################
 # pthread probe
 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"

-- 
1.6.2.5


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

* [PATCH 17/24] Add kvm-cap-pit command line flags
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (15 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 16/24] Move kvm specific tests after main kvm test Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 18/24] Add kvm-cap-device-assignment " Juan Quintela
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 73ba095..df45cd4 100755
--- a/configure
+++ b/configure
@@ -228,7 +228,7 @@ uname_release=""
 io_thread="no"
 mixemu="no"
 kvm_trace="no"
-kvm_cap_pit="no"
+kvm_cap_pit=""
 kvm_cap_device_assignment="no"
 kerneldir=""
 aix="no"
@@ -494,6 +494,10 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
+  --disable-kvm-cap-pit) kvm_cap_pit="no"
+  ;;
+  --enable-kvm-cap-pit) kvm_cap_pit="yes"
+  ;;
   --enable-profiler) profiler="yes"
   ;;
   --enable-cocoa)
@@ -700,6 +704,8 @@ echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --enable-bluez           enable bluez stack connectivity"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --enable-kvm             enable KVM acceleration support"
+echo "  --disable-cap-kvm-pit    disable KVM pit support"
+echo "  --enable-cap-kvm-pit     enable KVM pit support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-nptl            disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1358,7 +1364,10 @@ fi
 ##########################################
 # test for KVM_CAP_PIT

-if test "$kvm" != "no" ; then
+if test "$kvm_cap_pit" != "no" ; then
+  if test "$kvm" = "no" -a "$kvm_cap_pit" = "yes" ; then
+      feature_not_found "kvm_cap_pit (kvm is not enabled)"
+  fi
   cat > $TMPC <<EOF
 #include <linux/kvm.h>
 #ifndef KVM_CAP_PIT
@@ -1368,6 +1377,11 @@ int main(void) { return 0; }
 EOF
   if compile_prog $kvm_cflags ""; then
     kvm_cap_pit=yes
+  else
+    if test "$kvm_cap_pit" = "yes" ; then
+      feature_not_found "kvm_cap_pit"
+    fi
+    kvm_cap_pit=no
   fi
 fi

@@ -1852,6 +1866,7 @@ echo "IO thread         $io_thread"
 echo "Linux AIO support $linux_aio"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
+echo "KVM PIT support   $kvm_cap_pit"
 echo "KVM trace support $kvm_trace"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
-- 
1.6.2.5


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

* [PATCH 18/24] Add kvm-cap-device-assignment command line flags
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (16 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 17/24] Add kvm-cap-pit command line flags Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 19/24] Fix compilation without device assignment Juan Quintela
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index df45cd4..9598331 100755
--- a/configure
+++ b/configure
@@ -229,7 +229,7 @@ io_thread="no"
 mixemu="no"
 kvm_trace="no"
 kvm_cap_pit=""
-kvm_cap_device_assignment="no"
+kvm_cap_device_assignment=""
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -498,6 +498,10 @@ for opt do
   ;;
   --enable-kvm-cap-pit) kvm_cap_pit="yes"
   ;;
+  --disable-kvm-cap-device-assignment) kvm_cap_device_assignment="no"
+  ;;
+  --enable-kvm-cap-device-assignment) kvm_cap_device_assignment="yes"
+  ;;
   --enable-profiler) profiler="yes"
   ;;
   --enable-cocoa)
@@ -706,6 +710,8 @@ echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --enable-kvm             enable KVM acceleration support"
 echo "  --disable-cap-kvm-pit    disable KVM pit support"
 echo "  --enable-cap-kvm-pit     enable KVM pit support"
+echo "  --disable-cap-device-assigmment    disable KVM device assignemnt"
+echo "  --enable-cap-device-assigmment     enable KVM device assignemnt"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-nptl            disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1387,7 +1393,11 @@ fi

 ##########################################
 # test for KVM_CAP_DEVICE_ASSIGNMENT
-if test "$kvm" != "no" ; then
+
+if test "$kvm_cap_device_assignment" != "no" ; then
+  if test "$kvm" = "no" -a "$kvm_cap_device_assignment" = "yes" ; then
+      feature_not_found "kvm_cap_device_assignment (kvm is not enabled)"
+  fi
   cat > $TMPC <<EOF
 #include <linux/kvm.h>
 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
@@ -1397,6 +1407,11 @@ int main(void) { return 0; }
 EOF
   if compile_prog $kvm_cflags "" ; then
     kvm_cap_device_assignment=yes
+  else
+    if test "$kvm_cap_device_assignment" = "yes" ; then
+      feature_not_found "kvm_cap_device_assigment"
+    fi
+    kvm_cap_device_assignment=no
   fi
 fi

@@ -1867,6 +1882,7 @@ echo "Linux AIO support $linux_aio"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
 echo "KVM PIT support   $kvm_cap_pit"
+echo "KVM device assig. $kvm_cap_device_assignment"
 echo "KVM trace support $kvm_trace"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
-- 
1.6.2.5


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

* [PATCH 19/24] Fix compilation without device assignment
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (17 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 18/24] Add kvm-cap-device-assignment " Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 20/24] Only print kvm options when kvm is enabled Juan Quintela
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 qemu-kvm-x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index f80d82b..cdf4ebe 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1632,11 +1632,13 @@ void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
 }
 #endif

+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
 void kvm_arch_do_ioperm(void *_data)
 {
     struct ioperm_data *data = _data;
     ioperm(data->start_port, data->num, data->turn_on);
 }
+#endif

 /*
  * Setup x86 specific IRQ routing
-- 
1.6.2.5


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

* [PATCH 20/24] Only print kvm options when kvm is enabled
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (18 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 19/24] Fix compilation without device assignment Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 19:42   ` Marcelo Tosatti
  2009-09-18 11:41 ` [PATCH 21/24] __user is not used anywhere in qemu sources Juan Quintela
                   ` (4 subsequent siblings)
  24 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 9598331..91246a1 100755
--- a/configure
+++ b/configure
@@ -1881,9 +1881,11 @@ echo "IO thread         $io_thread"
 echo "Linux AIO support $linux_aio"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
-echo "KVM PIT support   $kvm_cap_pit"
-echo "KVM device assig. $kvm_cap_device_assignment"
-echo "KVM trace support $kvm_trace"
+if test "$kvm" = "yes" ; then
+  echo "  PIT support       $kvm_cap_pit"
+  echo "  device assignment $kvm_cap_device_assignment"
+  echo "  trace support     $kvm_trace"
+fi
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"

-- 
1.6.2.5


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

* [PATCH 21/24] __user is not used anywhere in qemu sources
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (19 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 20/24] Only print kvm options when kvm is enabled Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 22/24] fix mis-merge (we define pkgversion 3 lines above Juan Quintela
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 91246a1..23a3dfb 100755
--- a/configure
+++ b/configure
@@ -1785,8 +1785,6 @@ if test "$werror" = "yes" ; then
     QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
 fi

-QEMU_CFLAGS="-D__user= $QEMU_CFLAGS"
-
 if test "$solaris" = "no" ; then
     if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
         LDFLAGS="-Wl,--warn-common $LDFLAGS"
-- 
1.6.2.5


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

* [PATCH 22/24] fix mis-merge (we define pkgversion 3 lines above
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (20 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 21/24] __user is not used anywhere in qemu sources Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 11:41 ` [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life Juan Quintela
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 23a3dfb..289459a 100755
--- a/configure
+++ b/configure
@@ -236,7 +236,6 @@ blobs="yes"
 pkgversion=" ($(kvm_version))"
 cpu_emulation="yes"
 kvm_kmod="no"
-pkgversion=""
 check_utests="no"
 user_pie="no"

-- 
1.6.2.5


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

* [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (21 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 22/24] fix mis-merge (we define pkgversion 3 lines above Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 19:54   ` Marcelo Tosatti
  2009-09-18 11:41 ` [PATCH 24/24] Remove build-targets-* rules that are always empty Juan Quintela
  2009-09-18 19:57 ` [PATCH 00/24] configure and Makefile cleanup Marcelo Tosatti
  24 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm

Code compile with --disable-cpu-emulation, and that don't compile
tcg.  This is the minimal set of changes to get it working

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target         |    6 ++++--
 configure               |    6 ++++--
 exec.c                  |    2 ++
 target-i386/fake-exec.c |    4 ----
 vl.c                    |    2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 4a5352b..6846451 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -33,8 +33,10 @@ all: $(PROGS)

 #########################################################
 # cpu emulator library
-libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
-libobj-y += tcg/tcg.o tcg/tcg-runtime.o
+libobj-y = exec.o cpu-exec.o host-utils.o
+libobj-$(CONFIG_NO_CPU_EMULATION) += fake-exec.o
+libobj-$(CONFIG_CPU_EMULATION) += translate-all.o translate.o
+libobj-$(CONFIG_CPU_EMULATION) += tcg/tcg.o tcg/tcg-runtime.o
 libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
 libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
 libobj-y += op_helper.o helper.o
diff --git a/configure b/configure
index 289459a..ee37ea1 100755
--- a/configure
+++ b/configure
@@ -2078,8 +2078,10 @@ fi
 if test "$need_offsetof" = "yes" ; then
   echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
 fi
-if test $cpu_emulation = "no"; then
-  echo "NO_CPU_EMULATION=1" >> $config_host_mak
+if test $cpu_emulation = "yes"; then
+  echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
+else
+  echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
 fi

 # XXX: suppress that
diff --git a/exec.c b/exec.c
index dd8881c..aff9ec8 100644
--- a/exec.c
+++ b/exec.c
@@ -3795,7 +3795,9 @@ void dump_exec_info(FILE *f,
     cpu_fprintf(f, "TB flush count      %d\n", tb_flush_count);
     cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
     cpu_fprintf(f, "TLB flush count     %d\n", tlb_flush_count);
+#ifdef CONFIG_PROFILER
     tcg_dump_info(f, cpu_fprintf);
+#endif
 }

 #if !defined(CONFIG_USER_ONLY)
diff --git a/target-i386/fake-exec.c b/target-i386/fake-exec.c
index 737286d..dfa202d 100644
--- a/target-i386/fake-exec.c
+++ b/target-i386/fake-exec.c
@@ -45,10 +45,6 @@ int cpu_x86_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr
     return 0;
 }

-void flush_icache_range(unsigned long start, unsigned long stop)
-{
-}
-
 void optimize_flags_init(void)
 {
 }
diff --git a/vl.c b/vl.c
index 88bd3eb..5d4e18f 100644
--- a/vl.c
+++ b/vl.c
@@ -5627,7 +5627,7 @@ int main(int argc, char **argv, char **envp)

         ret = kvm_init(smp_cpus);
         if (ret < 0) {
-#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
+#if defined(KVM_UPSTREAM) || defined(CONFIG_NO_CPU_EMULATION)
             fprintf(stderr, "failed to initialize KVM\n");
             exit(1);
 #endif
-- 
1.6.2.5


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

* [PATCH 24/24] Remove build-targets-* rules that are always empty
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (22 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life Juan Quintela
@ 2009-09-18 11:41 ` Juan Quintela
  2009-09-18 19:57 ` [PATCH 00/24] configure and Makefile cleanup Marcelo Tosatti
  24 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 11:41 UTC (permalink / raw)
  To: kvm


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 88b39bd..1e09953 100644
--- a/Makefile
+++ b/Makefile
@@ -386,10 +386,3 @@ tarbin:

 # Include automatically generated dependency files
 -include $(wildcard *.d audio/*.d slirp/*.d block/*.d)
-
-build-targets-i386 = $(build-targets-x86)
-build-targets-x86_64 = $(build-targets-x86)
-build-targets-x86  =
-build-targets-ia64 =
-
-all: $(build-targets-$(ARCH))
-- 
1.6.2.5


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

* Re: [PATCH 01/24] Don't disable werror unconditionally
  2009-09-18 11:41 ` [PATCH 01/24] Don't disable werror unconditionally Juan Quintela
@ 2009-09-18 19:02   ` Marcelo Tosatti
  2009-09-19 10:13     ` Avi Kivity
  0 siblings, 1 reply; 53+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 19:02 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

On Fri, Sep 18, 2009 at 01:41:10PM +0200, Juan Quintela wrote:
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  configure |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 97292d9..e6252a2 100755
> --- a/configure
> +++ b/configure
> @@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
>      else
>          werror="no"
>      fi
> -    # disable default werror for kvm
> -    werror="no"
>  fi
> 
>  if test "$werror" = "yes" ; then

Don't know why Avi added this.


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

* Re: [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-18 11:41 ` [PATCH 04/24] piix4_dev is not used for pc's Juan Quintela
@ 2009-09-18 19:05   ` Marcelo Tosatti
  2009-09-18 21:42     ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 19:05 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

On Fri, Sep 18, 2009 at 01:41:13PM +0200, Juan Quintela wrote:
> And mips still don't have pci assignment support :)
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  Makefile.target |    2 +-
>  hw/piix_pci.c   |    3 ---
>  2 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile.target b/Makefile.target
> index 5fad812..58f8b9e 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -209,9 +209,9 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
>  obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
>  obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
>  obj-i386-y += extboot.o
> -obj-i386-y += piix4.o
>  obj-i386-y += ne2000-isa.o
>  obj-i386-y += testdev.o
> +
>  ifeq ($(USE_KVM_PIT), 1)
>  obj-i386-y += i8254-kvm.o
>  endif
> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> index 26e00db..d177e97 100644
> --- a/hw/piix_pci.c
> +++ b/hw/piix_pci.c
> @@ -291,9 +291,6 @@ int piix_get_irq(int pin)
>  {
>      if (piix3_dev)
>          return piix3_dev->dev.config[0x60+pin];
> -    if (piix4_dev)
> -        return piix4_dev->config[0x60+pin];
> -
>      return 0;
>  }

Not applying because its dead code with the current state of pc.c
configuration but this prevents one to use piix4.


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

* Re: [PATCH 20/24] Only print kvm options when kvm is enabled
  2009-09-18 11:41 ` [PATCH 20/24] Only print kvm options when kvm is enabled Juan Quintela
@ 2009-09-18 19:42   ` Marcelo Tosatti
  2009-09-18 21:43     ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 19:42 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

On Fri, Sep 18, 2009 at 01:41:31PM +0200, Juan Quintela wrote:
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  configure |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 9598331..91246a1 100755
> --- a/configure
> +++ b/configure
> @@ -1881,9 +1881,11 @@ echo "IO thread         $io_thread"
>  echo "Linux AIO support $linux_aio"
>  echo "Install blobs     $blobs"
>  echo "KVM support       $kvm"
> -echo "KVM PIT support   $kvm_cap_pit"
> -echo "KVM device assig. $kvm_cap_device_assignment"
> -echo "KVM trace support $kvm_trace"
> +if test "$kvm" = "yes" ; then
> +  echo "  PIT support       $kvm_cap_pit"
> +  echo "  device assignment $kvm_cap_device_assignment"
> +  echo "  trace support     $kvm_trace"
> +fi

"KVM xxx support" is informative.


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

* Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life
  2009-09-18 11:41 ` [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life Juan Quintela
@ 2009-09-18 19:54   ` Marcelo Tosatti
  2009-09-18 21:44     ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 19:54 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

On Fri, Sep 18, 2009 at 01:41:34PM +0200, Juan Quintela wrote:
> Code compile with --disable-cpu-emulation, and that don't compile
> tcg.  This is the minimal set of changes to get it working

Better see this upstreamed (and perhaps remove support from qemu-kvm, 
unless someone disagrees).

> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  Makefile.target         |    6 ++++--
>  configure               |    6 ++++--
>  exec.c                  |    2 ++
>  target-i386/fake-exec.c |    4 ----
>  vl.c                    |    2 +-
>  5 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/Makefile.target b/Makefile.target
> index 4a5352b..6846451 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -33,8 +33,10 @@ all: $(PROGS)
> 
>  #########################################################
>  # cpu emulator library
> -libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
> -libobj-y += tcg/tcg.o tcg/tcg-runtime.o
> +libobj-y = exec.o cpu-exec.o host-utils.o
> +libobj-$(CONFIG_NO_CPU_EMULATION) += fake-exec.o
> +libobj-$(CONFIG_CPU_EMULATION) += translate-all.o translate.o
> +libobj-$(CONFIG_CPU_EMULATION) += tcg/tcg.o tcg/tcg-runtime.o
>  libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
>  libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
>  libobj-y += op_helper.o helper.o
> diff --git a/configure b/configure
> index 289459a..ee37ea1 100755
> --- a/configure
> +++ b/configure
> @@ -2078,8 +2078,10 @@ fi
>  if test "$need_offsetof" = "yes" ; then
>    echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
>  fi
> -if test $cpu_emulation = "no"; then
> -  echo "NO_CPU_EMULATION=1" >> $config_host_mak
> +if test $cpu_emulation = "yes"; then
> +  echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
> +else
> +  echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
>  fi
> 
>  # XXX: suppress that
> diff --git a/exec.c b/exec.c
> index dd8881c..aff9ec8 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3795,7 +3795,9 @@ void dump_exec_info(FILE *f,
>      cpu_fprintf(f, "TB flush count      %d\n", tb_flush_count);
>      cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
>      cpu_fprintf(f, "TLB flush count     %d\n", tlb_flush_count);
> +#ifdef CONFIG_PROFILER
>      tcg_dump_info(f, cpu_fprintf);
> +#endif
>  }
> 
>  #if !defined(CONFIG_USER_ONLY)
> diff --git a/target-i386/fake-exec.c b/target-i386/fake-exec.c
> index 737286d..dfa202d 100644
> --- a/target-i386/fake-exec.c
> +++ b/target-i386/fake-exec.c
> @@ -45,10 +45,6 @@ int cpu_x86_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr
>      return 0;
>  }
> 
> -void flush_icache_range(unsigned long start, unsigned long stop)
> -{
> -}
> -
>  void optimize_flags_init(void)
>  {
>  }
> diff --git a/vl.c b/vl.c
> index 88bd3eb..5d4e18f 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -5627,7 +5627,7 @@ int main(int argc, char **argv, char **envp)
> 
>          ret = kvm_init(smp_cpus);
>          if (ret < 0) {
> -#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
> +#if defined(KVM_UPSTREAM) || defined(CONFIG_NO_CPU_EMULATION)
>              fprintf(stderr, "failed to initialize KVM\n");
>              exit(1);
>  #endif
> -- 
> 1.6.2.5
> 
> --
> 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

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

* Re: [PATCH 00/24] configure and Makefile cleanup
  2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
                   ` (23 preceding siblings ...)
  2009-09-18 11:41 ` [PATCH 24/24] Remove build-targets-* rules that are always empty Juan Quintela
@ 2009-09-18 19:57 ` Marcelo Tosatti
  24 siblings, 0 replies; 53+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 19:57 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

On Fri, Sep 18, 2009 at 01:41:08PM +0200, Juan Quintela wrote:
> This series:
> - werror is not disabled unconditoanally, you can disable it with
>   --disable-werror.
> - clean configure and Makefile* of mis-merges
> - sync such files to qemu upstream
> - kvm options are detected and configured _after_ detecting kvm, not
>   the other way around
> - add command line options and change styse so kvm-cap-pit and
>   kvm-cap-device-assignment looks like the other options.  Bring command
>   line flags to enable/disable them, and fix code to compile.
> - CONFIG_CPU_EMULATION is back, and it works (it is still a hack, proper
>   fix means moving code to new files and other conditional compilation, better
>   to do it at qemu upstream.
> - Why do we define "-D__user=" for gcc?  Nothing uses it (/me guess sparse
>   missmerge)
> 
> What I didn't touch:
> - kvm-kmod.
> - CFLAGS += $(KVM_CFLAGS)
>   on Makefile.target, only 4-5 files need them.  Didn't investigate too much
>   into it.
> - I only tested it on x86_64, i386 should work. powerpc/ia64 -> dunno.
> 
> For upstream:
> - kvm_cflags reorganization: make sense
> - KVM_CAP_PIT: haven't looked how much support is missing there
> - DEVICE_ASSIGNMENT: idem
> - CONFIG_CPU_EMULATION: Proper implementation is not trivial. What is in
>   qemu-kvm is a hack, proper integration requires moving code back and forth.
>   Not sure how important is to have this option.
> 
> Comments?

Juan,

Thanks for doing this.

I've applied all patches except those replied to.


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

* Re: [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-18 19:05   ` Marcelo Tosatti
@ 2009-09-18 21:42     ` Juan Quintela
  2009-09-21  9:10       ` Avi Kivity
  0 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 21:42 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

Marcelo Tosatti <mtosatti@redhat.com> wrote:
> On Fri, Sep 18, 2009 at 01:41:13PM +0200, Juan Quintela wrote:
>> And mips still don't have pci assignment support :)
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  Makefile.target |    2 +-
>>  hw/piix_pci.c   |    3 ---
>>  2 files changed, 1 insertions(+), 4 deletions(-)
>> 
>> diff --git a/Makefile.target b/Makefile.target
>> index 5fad812..58f8b9e 100644
>> --- a/Makefile.target
>> +++ b/Makefile.target
>> @@ -209,9 +209,9 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
>>  obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
>>  obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
>>  obj-i386-y += extboot.o
>> -obj-i386-y += piix4.o
>>  obj-i386-y += ne2000-isa.o
>>  obj-i386-y += testdev.o
>> +
>>  ifeq ($(USE_KVM_PIT), 1)
>>  obj-i386-y += i8254-kvm.o
>>  endif
>> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
>> index 26e00db..d177e97 100644
>> --- a/hw/piix_pci.c
>> +++ b/hw/piix_pci.c
>> @@ -291,9 +291,6 @@ int piix_get_irq(int pin)
>>  {
>>      if (piix3_dev)
>>          return piix3_dev->dev.config[0x60+pin];
>> -    if (piix4_dev)
>> -        return piix4_dev->config[0x60+pin];
>> -
>>      return 0;
>>  }
>
> Not applying because its dead code with the current state of pc.c
> configuration but this prevents one to use piix4.

piix4 is not used for pci irq assignement in pc.  It is only used on
mips.  I am the one that split the file in qemu upstream.  piix4 and
piix3 are the same from the irq point of view.

next pc chipset is not going to be piix4 :)

Later, Juan.

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

* Re: [PATCH 20/24] Only print kvm options when kvm is enabled
  2009-09-18 19:42   ` Marcelo Tosatti
@ 2009-09-18 21:43     ` Juan Quintela
  0 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 21:43 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

Marcelo Tosatti <mtosatti@redhat.com> wrote:
> On Fri, Sep 18, 2009 at 01:41:31PM +0200, Juan Quintela wrote:
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  configure |    8 +++++---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>> 
>> diff --git a/configure b/configure
>> index 9598331..91246a1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1881,9 +1881,11 @@ echo "IO thread         $io_thread"
>>  echo "Linux AIO support $linux_aio"
>>  echo "Install blobs     $blobs"
>>  echo "KVM support       $kvm"
>> -echo "KVM PIT support   $kvm_cap_pit"
>> -echo "KVM device assig. $kvm_cap_device_assignment"
>> -echo "KVM trace support $kvm_trace"
>> +if test "$kvm" = "yes" ; then
>> +  echo "  PIT support       $kvm_cap_pit"
>> +  echo "  device assignment $kvm_cap_device_assignment"
>> +  echo "  trace support     $kvm_trace"
>> +fi
>
> "KVM xxx support" is informative.

It is indented under KVM support entry.  Problem here is that device
assignment is too long :(

Later, Juan.

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

* Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life
  2009-09-18 19:54   ` Marcelo Tosatti
@ 2009-09-18 21:44     ` Juan Quintela
  2009-09-21  9:13       ` Avi Kivity
  0 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-18 21:44 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

Marcelo Tosatti <mtosatti@redhat.com> wrote:
> On Fri, Sep 18, 2009 at 01:41:34PM +0200, Juan Quintela wrote:
>> Code compile with --disable-cpu-emulation, and that don't compile
>> tcg.  This is the minimal set of changes to get it working
>
> Better see this upstreamed (and perhaps remove support from qemu-kvm, 
> unless someone disagrees).

I am told it is needed for ia64 support.  But as ia64 port is not being
too active, it don't matter too much.

Later, Juan.

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

* Re: [PATCH 01/24] Don't disable werror unconditionally
  2009-09-18 19:02   ` Marcelo Tosatti
@ 2009-09-19 10:13     ` Avi Kivity
  2009-09-19 11:14       ` Jan Kiszka
  0 siblings, 1 reply; 53+ messages in thread
From: Avi Kivity @ 2009-09-19 10:13 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Juan Quintela, kvm

On 09/18/2009 10:02 PM, Marcelo Tosatti wrote:
> On Fri, Sep 18, 2009 at 01:41:10PM +0200, Juan Quintela wrote:
>    
>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>> ---
>>   configure |    2 --
>>   1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 97292d9..e6252a2 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
>>       else
>>           werror="no"
>>       fi
>> -    # disable default werror for kvm
>> -    werror="no"
>>   fi
>>
>>   if test "$werror" = "yes" ; then
>>      
> Don't know why Avi added this.
>    

The merge which introduced this also introduced warnings into qemu-kvm.  
If the warnings are gone, it's better to restore -Werror to upstream 
behaviour.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 01/24] Don't disable werror unconditionally
  2009-09-19 10:13     ` Avi Kivity
@ 2009-09-19 11:14       ` Jan Kiszka
  2009-09-19 11:41         ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Jan Kiszka @ 2009-09-19 11:14 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, Juan Quintela, kvm

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

Avi Kivity wrote:
> On 09/18/2009 10:02 PM, Marcelo Tosatti wrote:
>> On Fri, Sep 18, 2009 at 01:41:10PM +0200, Juan Quintela wrote:
>>   
>>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>>> ---
>>>   configure |    2 --
>>>   1 files changed, 0 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 97292d9..e6252a2 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
>>>       else
>>>           werror="no"
>>>       fi
>>> -    # disable default werror for kvm
>>> -    werror="no"
>>>   fi
>>>
>>>   if test "$werror" = "yes" ; then
>>>      
>> Don't know why Avi added this.
>>    
> 
> The merge which introduced this also introduced warnings into qemu-kvm. 
> If the warnings are gone, it's better to restore -Werror to upstream
> behaviour.
> 

--disable-kvm builds will fail, but maybe this motivates to clean up the
related code.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [PATCH 01/24] Don't disable werror unconditionally
  2009-09-19 11:14       ` Jan Kiszka
@ 2009-09-19 11:41         ` Juan Quintela
  0 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-19 11:41 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

Jan Kiszka <jan.kiszka@web.de> wrote:
> Avi Kivity wrote:
>> On 09/18/2009 10:02 PM, Marcelo Tosatti wrote:
>>> On Fri, Sep 18, 2009 at 01:41:10PM +0200, Juan Quintela wrote:
>>>   
>>>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>>>> ---
>>>>   configure |    2 --
>>>>   1 files changed, 0 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 97292d9..e6252a2 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
>>>>       else
>>>>           werror="no"
>>>>       fi
>>>> -    # disable default werror for kvm
>>>> -    werror="no"
>>>>   fi
>>>>
>>>>   if test "$werror" = "yes" ; then
>>>>      
>>> Don't know why Avi added this.
>>>    
>> 
>> The merge which introduced this also introduced warnings into qemu-kvm. 
>> If the warnings are gone, it's better to restore -Werror to upstream
>> behaviour.
>> 
>
> --disable-kvm builds will fail, but maybe this motivates to clean up the
> related code.

Failure is not -Werror related.  msix.o, i8254-kvm.o and I stopped looking
after that.

Later, Juan.

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

* Re: [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-18 21:42     ` Juan Quintela
@ 2009-09-21  9:10       ` Avi Kivity
  2009-09-21  9:37         ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Avi Kivity @ 2009-09-21  9:10 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Marcelo Tosatti, kvm

On 09/19/2009 12:42 AM, Juan Quintela wrote:
>
>> Not applying because its dead code with the current state of pc.c
>> configuration but this prevents one to use piix4.
>>      
> piix4 is not used for pci irq assignement in pc.  It is only used on
> mips.  I am the one that split the file in qemu upstream.  piix4 and
> piix3 are the same from the irq point of view.
>
> next pc chipset is not going to be piix4 :)
>    

I agree with Marcelo - even if mips never gains device assignment or pc 
never uses piix4, the code is more complete the way it is.

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


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

* Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life
  2009-09-18 21:44     ` Juan Quintela
@ 2009-09-21  9:13       ` Avi Kivity
  2009-09-21  9:36         ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Avi Kivity @ 2009-09-21  9:13 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Marcelo Tosatti, kvm

On 09/19/2009 12:44 AM, Juan Quintela wrote:
> Marcelo Tosatti<mtosatti@redhat.com>  wrote:
>    
>> On Fri, Sep 18, 2009 at 01:41:34PM +0200, Juan Quintela wrote:
>>      
>>> Code compile with --disable-cpu-emulation, and that don't compile
>>> tcg.  This is the minimal set of changes to get it working
>>>        
>> Better see this upstreamed (and perhaps remove support from qemu-kvm,
>> unless someone disagrees).
>>      
> I am told it is needed for ia64 support.  But as ia64 port is not being
> too active, it don't matter too much.
>    

Applied, but can you look at upstreaming this?  Thanks.

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


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

* Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life
  2009-09-21  9:13       ` Avi Kivity
@ 2009-09-21  9:36         ` Juan Quintela
  0 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2009-09-21  9:36 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

Avi Kivity <avi@redhat.com> wrote:
> On 09/19/2009 12:44 AM, Juan Quintela wrote:
>> Marcelo Tosatti<mtosatti@redhat.com>  wrote:
>>    
>>> On Fri, Sep 18, 2009 at 01:41:34PM +0200, Juan Quintela wrote:
>>>      
>>>> Code compile with --disable-cpu-emulation, and that don't compile
>>>> tcg.  This is the minimal set of changes to get it working
>>>>        
>>> Better see this upstreamed (and perhaps remove support from qemu-kvm,
>>> unless someone disagrees).
>>>      
>> I am told it is needed for ia64 support.  But as ia64 port is not being
>> too active, it don't matter too much.
>>    
>
> Applied, but can you look at upstreaming this?  Thanks.

Yeap, but upstream would not agree with this half-done implementation.
Will took at upstreaming the proper fix, but it will take a while.

Later, Juan.

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

* Re: [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-21  9:10       ` Avi Kivity
@ 2009-09-21  9:37         ` Juan Quintela
  2009-09-21  9:45           ` Avi Kivity
  0 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-21  9:37 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

Avi Kivity <avi@redhat.com> wrote:
> On 09/19/2009 12:42 AM, Juan Quintela wrote:
>>
>>> Not applying because its dead code with the current state of pc.c
>>> configuration but this prevents one to use piix4.
>>>      
>> piix4 is not used for pci irq assignement in pc.  It is only used on
>> mips.  I am the one that split the file in qemu upstream.  piix4 and
>> piix3 are the same from the irq point of view.
>>
>> next pc chipset is not going to be piix4 :)
>>    
>
> I agree with Marcelo - even if mips never gains device assignment or
> pc never uses piix4, the code is more complete the way it is.

Ok, it forces to compile back piix4.o in a pc.  In qemu upstream piix4.o
is only compiled for MIPS.  That is the reason why I noticed. (Yes, I am
the one that did the split).

Later, Juan.

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

* Re: [PATCH 04/24] piix4_dev is not used for pc's
  2009-09-21  9:37         ` Juan Quintela
@ 2009-09-21  9:45           ` Avi Kivity
  0 siblings, 0 replies; 53+ messages in thread
From: Avi Kivity @ 2009-09-21  9:45 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Marcelo Tosatti, kvm

On 09/21/2009 12:37 PM, Juan Quintela wrote:
> Avi Kivity<avi@redhat.com>  wrote:
>    
>> On 09/19/2009 12:42 AM, Juan Quintela wrote:
>>      
>>>        
>>>> Not applying because its dead code with the current state of pc.c
>>>> configuration but this prevents one to use piix4.
>>>>
>>>>          
>>> piix4 is not used for pci irq assignement in pc.  It is only used on
>>> mips.  I am the one that split the file in qemu upstream.  piix4 and
>>> piix3 are the same from the irq point of view.
>>>
>>> next pc chipset is not going to be piix4 :)
>>>
>>>        
>> I agree with Marcelo - even if mips never gains device assignment or
>> pc never uses piix4, the code is more complete the way it is.
>>      
> Ok, it forces to compile back piix4.o in a pc.  In qemu upstream piix4.o
> is only compiled for MIPS.  That is the reason why I noticed. (Yes, I am
> the one that did the split).
>    

Ah, in that case it's better to apply the patch.  Thanks.

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


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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-09-18 11:41 ` [PATCH 05/24] compatfd is included before, and it is compiled unconditionally Juan Quintela
@ 2009-09-22 13:19   ` Christoph Hellwig
  2009-09-22 13:25     ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Christoph Hellwig @ 2009-09-22 13:19 UTC (permalink / raw)
  To: Juan Quintela; +Cc: kvm

Btw, what's the state of getting compatfd upstream?  It's a pretty
annoying difference between qemu upstream and qemu-kvm.


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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-09-22 13:19   ` Christoph Hellwig
@ 2009-09-22 13:25     ` Juan Quintela
  2009-09-22 13:34       ` Christoph Hellwig
  0 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2009-09-22 13:25 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kvm

Christoph Hellwig <hch@infradead.org> wrote:
> Btw, what's the state of getting compatfd upstream?  It's a pretty
> annoying difference between qemu upstream and qemu-kvm.

I haven't tried.  I can try to send a patch.  Do you have any use case
that will help the cause?

Later, Juan.

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-09-22 13:25     ` Juan Quintela
@ 2009-09-22 13:34       ` Christoph Hellwig
  2009-10-01 11:58         ` Juan Quintela
  0 siblings, 1 reply; 53+ messages in thread
From: Christoph Hellwig @ 2009-09-22 13:34 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Christoph Hellwig, kvm

On Tue, Sep 22, 2009 at 03:25:13PM +0200, Juan Quintela wrote:
> Christoph Hellwig <hch@infradead.org> wrote:
> > Btw, what's the state of getting compatfd upstream?  It's a pretty
> > annoying difference between qemu upstream and qemu-kvm.
> 
> I haven't tried.  I can try to send a patch.  Do you have any use case
> that will help the cause?

Well, the eventfd compat is used in the thread pool AIO code.  I don't
know what difference it makes, but I really hate this code beeing
different in both trees.  I want to see compatfd used either in both or
none.


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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-09-22 13:34       ` Christoph Hellwig
@ 2009-10-01 11:58         ` Juan Quintela
  2009-10-01 12:05           ` Christoph Hellwig
  2009-10-01 14:23           ` Anthony Liguori
  0 siblings, 2 replies; 53+ messages in thread
From: Juan Quintela @ 2009-10-01 11:58 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kvm

Christoph Hellwig <hch@infradead.org> wrote:
> On Tue, Sep 22, 2009 at 03:25:13PM +0200, Juan Quintela wrote:
>> Christoph Hellwig <hch@infradead.org> wrote:
>> > Btw, what's the state of getting compatfd upstream?  It's a pretty
>> > annoying difference between qemu upstream and qemu-kvm.
>> 
>> I haven't tried.  I can try to send a patch.  Do you have any use case
>> that will help the cause?
>
> Well, the eventfd compat is used in the thread pool AIO code.  I don't
> know what difference it makes, but I really hate this code beeing
> different in both trees.  I want to see compatfd used either in both or
> none.

Discused with Anthony about it.  signalfd is complicated for qemu
upstream (too difficult to use properly), and eventfd ...  The current
eventfd emulation is worse than the pipe code that it substitutes.

His suggestion here was to create a new abstraction with an API like:

push_notify()

pop_notify()

and then you can implement it with eventfd() pipes/whatever.

What was missing for you of compatfd: qemu_eventfd/qemu_signalfd?
Do a push_notify()/pop_notify() work for you?

Later, Juan.

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 11:58         ` Juan Quintela
@ 2009-10-01 12:05           ` Christoph Hellwig
  2009-10-01 14:24             ` Anthony Liguori
  2009-10-01 14:23           ` Anthony Liguori
  1 sibling, 1 reply; 53+ messages in thread
From: Christoph Hellwig @ 2009-10-01 12:05 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Christoph Hellwig, kvm

On Thu, Oct 01, 2009 at 01:58:10PM +0200, Juan Quintela wrote:
> Discused with Anthony about it.  signalfd is complicated for qemu
> upstream (too difficult to use properly), and eventfd ...  The current
> eventfd emulation is worse than the pipe code that it substitutes.
> 
> His suggestion here was to create a new abstraction with an API like:
> 
> push_notify()
> 
> pop_notify()
> 
> and then you can implement it with eventfd() pipes/whatever.
> 
> What was missing for you of compatfd: qemu_eventfd/qemu_signalfd?
> Do a push_notify()/pop_notify() work for you?

I don't desperately want to use it myself anyway.  I just want to get
rid of the highly annoyind spurious differences in the AIO code due
to use of compatfd.  I would be perfectly fine with just killing this
use of eventfd in qemu-kvm.

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 11:58         ` Juan Quintela
  2009-10-01 12:05           ` Christoph Hellwig
@ 2009-10-01 14:23           ` Anthony Liguori
  2009-10-01 14:44             ` Avi Kivity
  1 sibling, 1 reply; 53+ messages in thread
From: Anthony Liguori @ 2009-10-01 14:23 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Christoph Hellwig, kvm

Juan Quintela wrote:
> Discused with Anthony about it.  signalfd is complicated for qemu
> upstream (too difficult to use properly),

It's not an issue of being difficult.

To emulate signalfd, we need to create a thread that writes to a pipe 
from a signal handler.  The problem is that a write() can return a 
partial result and following the partial result, we can end up getting 
an EAGAIN.  We have no way to queue signals beyond that point and we 
have no sane way to deal with partial writes.

Instead, how we do this in upstream QEMU is that we install a signal 
handler and write one byte to the fd.  If we get EAGAIN, that's fine 
because all we care about is that at least one byte exists in the fd's 
buffer.  This requires that we use an fd-per-signal which means we end 
up with a different model than signalfd.

The reason to use signalfd over what we do in upstream QEMU is that 
signalfd can allow us to mask the signals which means less EINTRs.  I 
don't think that's a huge advantage and the inability to do backwards 
compatibility in a sane way means that emulated signalfd is not workable.

We could possibly introduce a higher level interface that only required 
one fd per signal and that had a function that drained the signals from 
the fd without returning any special information.

The same is generally true for eventfd.

Regards,

Anthony Liguori

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 12:05           ` Christoph Hellwig
@ 2009-10-01 14:24             ` Anthony Liguori
  0 siblings, 0 replies; 53+ messages in thread
From: Anthony Liguori @ 2009-10-01 14:24 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Juan Quintela, kvm

Christoph Hellwig wrote:
> On Thu, Oct 01, 2009 at 01:58:10PM +0200, Juan Quintela wrote:
>   
>> Discused with Anthony about it.  signalfd is complicated for qemu
>> upstream (too difficult to use properly), and eventfd ...  The current
>> eventfd emulation is worse than the pipe code that it substitutes.
>>
>> His suggestion here was to create a new abstraction with an API like:
>>
>> push_notify()
>>
>> pop_notify()
>>
>> and then you can implement it with eventfd() pipes/whatever.
>>
>> What was missing for you of compatfd: qemu_eventfd/qemu_signalfd?
>> Do a push_notify()/pop_notify() work for you?
>>     
>
> I don't desperately want to use it myself anyway.  I just want to get
> rid of the highly annoyind spurious differences in the AIO code due
> to use of compatfd.  I would be perfectly fine with just killing this
> use of eventfd in qemu-kvm.
>   

That's what I'd suggest.  The use of eventfd in qemu-kvm is wrong 
because the compat function is not implemented correctly.

Regards,

Anthony Liguori

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 14:23           ` Anthony Liguori
@ 2009-10-01 14:44             ` Avi Kivity
  2009-10-01 16:50               ` Anthony Liguori
  0 siblings, 1 reply; 53+ messages in thread
From: Avi Kivity @ 2009-10-01 14:44 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Juan Quintela, Christoph Hellwig, kvm

On 10/01/2009 04:23 PM, Anthony Liguori wrote:
> Juan Quintela wrote:
>> Discused with Anthony about it.  signalfd is complicated for qemu
>> upstream (too difficult to use properly),
>
> It's not an issue of being difficult.
>
> To emulate signalfd, we need to create a thread that writes to a pipe 
> from a signal handler.  The problem is that a write() can return a 
> partial result and following the partial result, we can end up getting 
> an EAGAIN.  We have no way to queue signals beyond that point and we 
> have no sane way to deal with partial writes.

pipe buffers are multiples of of the signalfd size.  As long as we read 
and write signalfd-sized blocks, we won't get partial writes.  It's true 
that depending on an implementation detail is bad practice, but this is 
emulation code, and if helps simplifying everything else, I think it's 
fine to use it.

hmm, pipe(7) says writes smaller than the pipe buffer size are atomic:

        O_NONBLOCK enabled, n <= PIPE_BUF
               If there is room to write n bytes to the pipe, then 
write(2) succeeds immediately, writing all n bytes;
               otherwise write(2) fails, with errno set to EAGAIN.

so it seems this practice has been blessed by posix.

> Instead, how we do this in upstream QEMU is that we install a signal 
> handler and write one byte to the fd.  If we get EAGAIN, that's fine 
> because all we care about is that at least one byte exists in the fd's 
> buffer.  This requires that we use an fd-per-signal which means we end 
> up with a different model than signalfd.
>
> The reason to use signalfd over what we do in upstream QEMU is that 
> signalfd can allow us to mask the signals which means less EINTRs.  I 
> don't think that's a huge advantage and the inability to do backwards 
> compatibility in a sane way means that emulated signalfd is not workable.

signalfd is several microseconds faster than signals + pipes.  Do we 
have so much performance we can throw some of it away?

> The same is generally true for eventfd.

eventfd emulation will also never get partial writes.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 14:44             ` Avi Kivity
@ 2009-10-01 16:50               ` Anthony Liguori
  2009-10-01 17:00                 ` Avi Kivity
  2009-10-05 20:48                 ` KVM Support for windows Saksena, Abhishek
  0 siblings, 2 replies; 53+ messages in thread
From: Anthony Liguori @ 2009-10-01 16:50 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Juan Quintela, Christoph Hellwig, kvm

Avi Kivity wrote:
> On 10/01/2009 04:23 PM, Anthony Liguori wrote:
>> Juan Quintela wrote:
>>> Discused with Anthony about it.  signalfd is complicated for qemu
>>> upstream (too difficult to use properly),
>>
>> It's not an issue of being difficult.
>>
>> To emulate signalfd, we need to create a thread that writes to a pipe 
>> from a signal handler.  The problem is that a write() can return a 
>> partial result and following the partial result, we can end up 
>> getting an EAGAIN.  We have no way to queue signals beyond that point 
>> and we have no sane way to deal with partial writes.
>
> pipe buffers are multiples of of the signalfd size.  As long as we 
> read and write signalfd-sized blocks, we won't get partial writes.  
> It's true that depending on an implementation detail is bad practice, 
> but this is emulation code, and if helps simplifying everything else, 
> I think it's fine to use it.

That's a pretty hairy detail to rely upon..

>> Instead, how we do this in upstream QEMU is that we install a signal 
>> handler and write one byte to the fd.  If we get EAGAIN, that's fine 
>> because all we care about is that at least one byte exists in the 
>> fd's buffer.  This requires that we use an fd-per-signal which means 
>> we end up with a different model than signalfd.
>>
>> The reason to use signalfd over what we do in upstream QEMU is that 
>> signalfd can allow us to mask the signals which means less EINTRs.  I 
>> don't think that's a huge advantage and the inability to do backwards 
>> compatibility in a sane way means that emulated signalfd is not 
>> workable.
>
> signalfd is several microseconds faster than signals + pipes.  Do we 
> have so much performance we can throw some of it away?

Do we have any indication that this difference is actually observable?  
This seems like very premature optimization.

>> The same is generally true for eventfd.
>
> eventfd emulation will also never get partial writes.

But you cannot emulate eventfd faithfully because eventfd is supposed to 
be additive.  If you write 1 50x to eventfd, you should be able to read 
a set of integers that add up to 50.  If you hit EAGAIN in a signal 
handler, you have no way of handling that.

As I said earlier, the better thing to do is have a higher level 
interface that has a subset of the behavior of eventfd/signalfd that we 
can emulate correctly.

Regards,

Anthony Liguori

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

* Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally
  2009-10-01 16:50               ` Anthony Liguori
@ 2009-10-01 17:00                 ` Avi Kivity
  2009-10-05 20:48                 ` KVM Support for windows Saksena, Abhishek
  1 sibling, 0 replies; 53+ messages in thread
From: Avi Kivity @ 2009-10-01 17:00 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Juan Quintela, Christoph Hellwig, kvm

On 10/01/2009 06:50 PM, Anthony Liguori wrote:
> Avi Kivity wrote:
>> On 10/01/2009 04:23 PM, Anthony Liguori wrote:
>>> Juan Quintela wrote:
>>>> Discused with Anthony about it.  signalfd is complicated for qemu
>>>> upstream (too difficult to use properly),
>>>
>>> It's not an issue of being difficult.
>>>
>>> To emulate signalfd, we need to create a thread that writes to a 
>>> pipe from a signal handler.  The problem is that a write() can 
>>> return a partial result and following the partial result, we can end 
>>> up getting an EAGAIN.  We have no way to queue signals beyond that 
>>> point and we have no sane way to deal with partial writes.
>>
>> pipe buffers are multiples of of the signalfd size.  As long as we 
>> read and write signalfd-sized blocks, we won't get partial writes.  
>> It's true that depending on an implementation detail is bad practice, 
>> but this is emulation code, and if helps simplifying everything else, 
>> I think it's fine to use it.
>
> That's a pretty hairy detail to rely upon..

Well, it's a posix detail, as I quoted below.  I'm not in love with it 
but it should work.

>
>>> Instead, how we do this in upstream QEMU is that we install a signal 
>>> handler and write one byte to the fd.  If we get EAGAIN, that's fine 
>>> because all we care about is that at least one byte exists in the 
>>> fd's buffer.  This requires that we use an fd-per-signal which means 
>>> we end up with a different model than signalfd.
>>>
>>> The reason to use signalfd over what we do in upstream QEMU is that 
>>> signalfd can allow us to mask the signals which means less EINTRs.  
>>> I don't think that's a huge advantage and the inability to do 
>>> backwards compatibility in a sane way means that emulated signalfd 
>>> is not workable.
>>
>> signalfd is several microseconds faster than signals + pipes.  Do we 
>> have so much performance we can throw some of it away?
>
> Do we have any indication that this difference is actually 
> observable?  This seems like very premature optimization.

Multiply the signal rate by "a few microseconds", if you get more than 
0.1% cpu it's worthwhile in my opinion.  The code is localized, and 
signalfd is a better interface than signals.

>
>>> The same is generally true for eventfd.
>>
>> eventfd emulation will also never get partial writes.
>
> But you cannot emulate eventfd faithfully because eventfd is supposed 
> to be additive.  If you write 1 50x to eventfd, you should be able to 
> read a set of integers that add up to 50.  If you hit EAGAIN in a 
> signal handler, you have no way of handling that.

We never rely on the count anyway.  You can simply ignore EAGAIN.

> As I said earlier, the better thing to do is have a higher level 
> interface that has a subset of the behavior of eventfd/signalfd that 
> we can emulate correctly.

Sure, but it's more work.  Copying an existing interface is easier.  
It's not like there's no other work in qemu left to be done.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* KVM Support for windows
  2009-10-01 16:50               ` Anthony Liguori
  2009-10-01 17:00                 ` Avi Kivity
@ 2009-10-05 20:48                 ` Saksena, Abhishek
  2009-10-06 10:51                   ` Avi Kivity
  1 sibling, 1 reply; 53+ messages in thread
From: Saksena, Abhishek @ 2009-10-05 20:48 UTC (permalink / raw)
  To: kvm


I would like to know is there a plan for KVM to be supported under Windows(host OS)? If yes, by when?


-Thanks
Abhishek

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

* Re: KVM Support for windows
  2009-10-05 20:48                 ` KVM Support for windows Saksena, Abhishek
@ 2009-10-06 10:51                   ` Avi Kivity
  0 siblings, 0 replies; 53+ messages in thread
From: Avi Kivity @ 2009-10-06 10:51 UTC (permalink / raw)
  To: Saksena, Abhishek; +Cc: kvm

On 10/05/2009 10:48 PM, Saksena, Abhishek wrote:
> I would like to know is there a plan for KVM to be supported under Windows(host OS)?
>    

Not that I know of.

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


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

end of thread, other threads:[~2009-10-06 10:51 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-18 11:41 [PATCH 00/24] configure and Makefile cleanup Juan Quintela
2009-09-18 11:41 ` [PATCH 01/24] Don't disable werror unconditionally Juan Quintela
2009-09-18 19:02   ` Marcelo Tosatti
2009-09-19 10:13     ` Avi Kivity
2009-09-19 11:14       ` Jan Kiszka
2009-09-19 11:41         ` Juan Quintela
2009-09-18 11:41 ` [PATCH 02/24] extboot.bin is a generated file Juan Quintela
2009-09-18 11:41 ` [PATCH 03/24] Remove merge artifacts Juan Quintela
2009-09-18 11:41 ` [PATCH 04/24] piix4_dev is not used for pc's Juan Quintela
2009-09-18 19:05   ` Marcelo Tosatti
2009-09-18 21:42     ` Juan Quintela
2009-09-21  9:10       ` Avi Kivity
2009-09-21  9:37         ` Juan Quintela
2009-09-21  9:45           ` Avi Kivity
2009-09-18 11:41 ` [PATCH 05/24] compatfd is included before, and it is compiled unconditionally Juan Quintela
2009-09-22 13:19   ` Christoph Hellwig
2009-09-22 13:25     ` Juan Quintela
2009-09-22 13:34       ` Christoph Hellwig
2009-10-01 11:58         ` Juan Quintela
2009-10-01 12:05           ` Christoph Hellwig
2009-10-01 14:24             ` Anthony Liguori
2009-10-01 14:23           ` Anthony Liguori
2009-10-01 14:44             ` Avi Kivity
2009-10-01 16:50               ` Anthony Liguori
2009-10-01 17:00                 ` Avi Kivity
2009-10-05 20:48                 ` KVM Support for windows Saksena, Abhishek
2009-10-06 10:51                   ` Avi Kivity
2009-09-18 11:41 ` [PATCH 06/24] Use common style for signalfd Juan Quintela
2009-09-18 11:41 ` [PATCH 07/24] One CONFIG_EVENTFD should be enough Juan Quintela
2009-09-18 11:41 ` [PATCH 08/24] Bring ia64 to current arch selection code Juan Quintela
2009-09-18 11:41 ` [PATCH 09/24] Use configure way of enabling kvm Juan Quintela
2009-09-18 11:41 ` [PATCH 10/24] Prin kvm options values as everything else Juan Quintela
2009-09-18 11:41 ` [PATCH 11/24] KVM temp hack not needed anymore Juan Quintela
2009-09-18 11:41 ` [PATCH 12/24] Introduce libs_softmmu to device assignment code Juan Quintela
2009-09-18 11:41 ` [PATCH 13/24] Use compile_prog function in thee missing compilations Juan Quintela
2009-09-18 11:41 ` [PATCH 14/24] Test for libpci, not only for header Juan Quintela
2009-09-18 11:41 ` [PATCH 15/24] Rename USE_KVM_* to CONFIG_KVM_* Juan Quintela
2009-09-18 11:41 ` [PATCH 16/24] Move kvm specific tests after main kvm test Juan Quintela
2009-09-18 11:41 ` [PATCH 17/24] Add kvm-cap-pit command line flags Juan Quintela
2009-09-18 11:41 ` [PATCH 18/24] Add kvm-cap-device-assignment " Juan Quintela
2009-09-18 11:41 ` [PATCH 19/24] Fix compilation without device assignment Juan Quintela
2009-09-18 11:41 ` [PATCH 20/24] Only print kvm options when kvm is enabled Juan Quintela
2009-09-18 19:42   ` Marcelo Tosatti
2009-09-18 21:43     ` Juan Quintela
2009-09-18 11:41 ` [PATCH 21/24] __user is not used anywhere in qemu sources Juan Quintela
2009-09-18 11:41 ` [PATCH 22/24] fix mis-merge (we define pkgversion 3 lines above Juan Quintela
2009-09-18 11:41 ` [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life Juan Quintela
2009-09-18 19:54   ` Marcelo Tosatti
2009-09-18 21:44     ` Juan Quintela
2009-09-21  9:13       ` Avi Kivity
2009-09-21  9:36         ` Juan Quintela
2009-09-18 11:41 ` [PATCH 24/24] Remove build-targets-* rules that are always empty Juan Quintela
2009-09-18 19:57 ` [PATCH 00/24] configure and Makefile cleanup Marcelo Tosatti

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).