Skip to contentSkip to conversation

configure and Makefile cleanup

PATCH Applied Juan Quintela 7 participants 53 messages Sep 18, 2009 – Oct 6, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover configure and Makefile cleanup

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(-)
#1 lore raw

PATCH 1/24 Don't disable werror unconditionally

---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 97292d9..e6252a2 100755
@@ -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
Signature · 1 line
1.6.2.5
#2 lore raw

Re: [PATCH 01/24] Don't disable werror unconditionally

Quoted 11 lines · Juan Quintela
---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -0
index 97292d9..e6252a2 100755

configure if test -z "$werror" ; then · line 1763

Quoted 8 lines
configure +0 -2
@@ -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.

#3 lore raw

Re: [PATCH 01/24] Don't disable werror unconditionally

Quoted 19 lines · Marcelo Tosatti
Quoted 17 lines · Juan Quintela
---
  configure |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 97292d9..e6252a2 100755
@@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
      else
          werror="no"
      fi
-    # disable default werror for kvm
-    werror="no"
  fi
 
Quoted 4 lines

configure if test -z "$werror" ; then · line 1763

Quoted 2 lines
configure +0 -0
  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.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#4 lore raw

Re: [PATCH 01/24] Don't disable werror unconditionally

Quoted 20 lines · Avi Kivity
Quoted 19 lines · Marcelo Tosatti
Quoted 17 lines · Juan Quintela
---
  configure |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 97292d9..e6252a2 100755
@@ -1758,8 +1758,6 @@ if test -z "$werror" ; then
      else
          werror="no"
      fi
-    # disable default werror for kvm
-    werror="no"
  fi
 
Quoted 9 lines
Quoted 4 lines

configure if test -z "$werror" ; then · line 1763

Quoted 2 lines
configure +0 -0
  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

#5 lore raw

Re: [PATCH 01/24] Don't disable werror unconditionally

Quoted 26 lines · Jan Kiszka
Quoted 25 lines · Avi Kivity
Quoted 23 lines · Marcelo Tosatti
Quoted 11 lines · Juan Quintela
---
  configure |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -0
index 97292d9..e6252a2 100755

configure if test -z "$werror" ; then · line 1763

Quoted 8 lines
configure +0 -2
@@ -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.

Quoted 7 lines
Quoted 4 lines

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.

#6 lore raw

PATCH 2/24 extboot.bin is a generated file

In reply to Juan Quintela
---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
index 13c967e..59a0244 100644
@@ -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-*
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH 3/24 Remove merge artifacts

In reply to Juan Quintela

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

---
 Makefile.target |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
Makefile.target +0 -8
index a08e432..5fad812 100644
@@ -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)
Signature · 1 line
1.6.2.5
#8 lore raw

PATCH 4/24 piix4_dev is not used for pc's

In reply to Juan Quintela

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

---
 Makefile.target |    2 +-
 hw/piix_pci.c   |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)
Makefile.target +1 -1
index 5fad812..58f8b9e 100644
@@ -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
hw/piix_pci.c +0 -3
index 26e00db..d177e97 100644
@@ -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;
 }
 
Signature · 1 line
1.6.2.5
#9 lore raw

Re: [PATCH 04/24] piix4_dev is not used for pc's

Quoted 28 lines · Juan Quintela

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

---
 Makefile.target |    2 +-
 hw/piix_pci.c   |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)
Makefile.target +1 -1
index 5fad812..58f8b9e 100644
@@ -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
hw/piix_pci.c +0 -0
index 26e00db..d177e97 100644

hw/piix_pci.c int piix_get_irq(int pin) · line 295

Quoted 8 lines
hw/piix_pci.c +0 -3
@@ -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.

#10 lore raw

Re: [PATCH 04/24] piix4_dev is not used for pc's

Quoted 32 lines · Marcelo Tosatti
Quoted 31 lines · Juan Quintela

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

---
 Makefile.target |    2 +-
 hw/piix_pci.c   |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)
Makefile.target +1 -1
index 5fad812..58f8b9e 100644
@@ -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
hw/piix_pci.c +0 -0
index 26e00db..d177e97 100644
@@ -291,9 +291,6 @@ int piix_get_irq(int pin)
 {
     if (piix3_dev)
         return piix3_dev->dev.config[0x60+pin];
Quoted 8 lines

hw/piix_pci.c int piix_get_irq(int pin) · line 295

Quoted 5 lines
hw/piix_pci.c +0 -3
-    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.

#11 lore raw

Re: [PATCH 04/24] piix4_dev is not used for pc's

Quoted 10 lines · Juan Quintela
Quoted 4 lines

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.

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw

Re: [PATCH 04/24] piix4_dev is not used for pc's

Quoted 9 lines · Avi Kivity
Quoted 8 lines · Juan Quintela
Quoted 4 lines

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.

Quoted 5 lines
Quoted 2 lines

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.

#13 lore raw

Re: [PATCH 04/24] piix4_dev is not used for pc's

Quoted 16 lines · Juan Quintela
Quoted 14 lines · Avi Kivity
Quoted 12 lines · Juan Quintela
Quoted 5 lines

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

Quoted 7 lines
Quoted 3 lines

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.

Signature · 1 line
error compiling committee.c: too many arguments to function
#14 lore raw

PATCH 5/24 compatfd is included before, and it is compiled unconditionally

In reply to Juan Quintela
---
 Makefile |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
Makefile +0 -4
index 6a9ca7c..88b39bd 100644
@@ -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
Signature · 1 line
1.6.2.5
#15 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

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

#16 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 2 lines · Christoph Hellwig

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.

#17 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 6 lines · Juan Quintela
Quoted 2 lines · Christoph Hellwig

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.

#18 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Juan Quintela
Quoted 2 lines · Christoph Hellwig

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

Quoted 7 lines
Quoted 2 lines

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.

#19 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 6 lines · Juan Quintela

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:

Quoted 8 lines

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.

#20 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 14 lines · Christoph Hellwig
Quoted 12 lines · Juan Quintela

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.

Quoted 9 lines
Quoted 3 lines

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

#21 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

In reply to Juan Quintela
Quoted 2 lines · Juan Quintela

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

#22 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 7 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela

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.

Quoted 3 lines

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?

Quoted 1 line

The same is generally true for eventfd.

eventfd emulation will also never get partial writes.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#23 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 10 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela

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

Quoted 5 lines
Quoted 3 lines

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.

Quoted 3 lines
Quoted 1 line

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

#24 lore raw

Re: [PATCH 05/24] compatfd is included before, and it is compiled unconditionally

Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 4 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela

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

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 1 line

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.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#26 lore raw

Re: KVM Support for windows

Quoted 2 lines · Abhishek

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

Not that I know of.

Signature · 1 line
error compiling committee.c: too many arguments to function
#27 lore raw

PATCH 6/24 Use common style for signalfd

In reply to Juan Quintela

s/CONFIG_signalfd/CONFIG_SIGNALFD/

---
 compatfd.c |    2 +-
 configure  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
compatfd.c +1 -1
index 36e37e5..8c78597 100644
@@ -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);
configure +2 -2
index e6252a2..298a60b 100755
@@ -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
Signature · 1 line
1.6.2.5
#28 lore raw

PATCH 7/24 One CONFIG_EVENTFD should be enough

In reply to Juan Quintela
---
 compatfd.c |    2 +-
 configure  |    4 ----
 qemu-kvm.c |    2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)
compatfd.c +1 -1
index 8c78597..594e4af 100644
@@ -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);
configure +0 -4
index 298a60b..bbb0c9d 100755
@@ -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
qemu-kvm.c +1 -1
index bff11e8..aaaafd7 100644
@@ -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>
 
Signature · 1 line
1.6.2.5
#29 lore raw

PATCH 8/24 Bring ia64 to current arch selection code

In reply to Juan Quintela
---
 configure |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
configure +0 -3
index bbb0c9d..7806456 100755
@@ -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)
Signature · 1 line
1.6.2.5
#30 lore raw

PATCH 9/24 Use configure way of enabling kvm

In reply to Juan Quintela
---
 configure |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
configure +1 -6
index 7806456..4512686 100755
@@ -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"
Signature · 1 line
1.6.2.5
#31 lore raw

PATCH 10/24 Prin kvm options values as everything else

In reply to Juan Quintela
---
 configure |   32 +++++++++-----------------------
 1 files changed, 9 insertions(+), 23 deletions(-)
configure +9 -23
index 4512686..22d393b 100755
@@ -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
Signature · 1 line
1.6.2.5
#32 lore raw

PATCH 11/24 KVM temp hack not needed anymore

In reply to Juan Quintela
---
 configure |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
configure +0 -5
index 22d393b..c4ee415 100755
@@ -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=
Signature · 1 line
1.6.2.5
#33 lore raw

PATCH 12/24 Introduce libs_softmmu to device assignment code

In reply to Juan Quintela
---
 Makefile.target |    2 --
 configure       |    2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)
Makefile.target +0 -2
index 58f8b9e..525a8c2 100644
@@ -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
configure +1 -1
index c4ee415..930e450 100755
@@ -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"
Signature · 1 line
1.6.2.5
#34 lore raw

PATCH 13/24 Use compile_prog function in thee missing compilations

In reply to Juan Quintela
---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
index 930e450..8c69894 100755
@@ -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
Signature · 1 line
1.6.2.5
#35 lore raw

PATCH 14/24 Test for libpci, not only for header

In reply to Juan Quintela
---
 configure |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index 8c69894..fc067a4 100755
@@ -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
Signature · 1 line
1.6.2.5
#36 lore raw

PATCH 15/24 Rename USE_KVM_* to CONFIG_KVM_*

In reply to Juan Quintela

Once there, simplify Makefile.target with new syntax

---
 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(-)
Makefile.target +3 -10
index 525a8c2..4a5352b 100644
@@ -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
configure +2 -2
index fc067a4..ef7d03d 100755
@@ -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
create_config +0 -3
index 8d265d1..5bc8fb6 100755
@@ -85,9 +85,6 @@ case $line in
     value=${line#*=}
     echo "#define $name $value"
     ;;
- USE_KVM_*)
-    echo "#define $(echo "$line" | sed 's/=/ /')"
-    ;;
 esac
 
 done # read
hw/ipf.c +2 -2
index 04b7b2c..21cff72 100644
@@ -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 */
 
 }
 
hw/pc.c +3 -3
index 5f892c7..7e2a502 100644
@@ -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,
hw/pci-hotplug.c +7 -7
index b8ea9ae..eab0756 100644
@@ -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);
 
hw/pci.c +2 -2
index 9c22a67..3da5ade 100644
@@ -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])
hw/pcspk.c +1 -1
index 3d3eba4..128836b 100644
@@ -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)
 {
qemu-kvm.c +4 -4
index aaaafd7..5d8d8e2 100644
@@ -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);
qemu-kvm.h +1 -1
index 0091a16..ac150d6 100644
@@ -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);
Signature · 1 line
1.6.2.5
#37 lore raw

PATCH 16/24 Move kvm specific tests after main kvm test

In reply to Juan Quintela
---
 configure |  140 ++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 69 insertions(+), 71 deletions(-)
configure +69 -71
index ef7d03d..73ba095 100755
@@ -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"
 
Signature · 1 line
1.6.2.5
#38 lore raw

PATCH 17/24 Add kvm-cap-pit command line flags

In reply to Juan Quintela
---
 configure |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
configure +17 -2
index 73ba095..df45cd4 100755
@@ -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"
Signature · 1 line
1.6.2.5
#39 lore raw

PATCH 18/24 Add kvm-cap-device-assignment command line flags

In reply to Juan Quintela
---
 configure |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
configure +18 -2
index df45cd4..9598331 100755
@@ -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"
Signature · 1 line
1.6.2.5
#40 lore raw

PATCH 19/24 Fix compilation without device assignment

In reply to Juan Quintela
---
 qemu-kvm-x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
qemu-kvm-x86.c +2 -0
index f80d82b..cdf4ebe 100644
@@ -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
Signature · 1 line
1.6.2.5
#41 lore raw

PATCH 20/24 Only print kvm options when kvm is enabled

In reply to Juan Quintela
---
 configure |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
configure +5 -3
index 9598331..91246a1 100755
@@ -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"
 
Signature · 1 line
1.6.2.5
#42 lore raw

Re: [PATCH 20/24] Only print kvm options when kvm is enabled

Quoted 12 lines · Juan Quintela
---
 configure |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
configure +0 -0
index 9598331..91246a1 100755
@@ -1881,9 +1881,11 @@ echo "IO thread         $io_thread"
 echo "Linux AIO support $linux_aio"

configure echo "IO thread $io_thread" · line 1888

Quoted 10 lines
configure +5 -3
 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.

#43 lore raw

Re: [PATCH 20/24] Only print kvm options when kvm is enabled

Quoted 17 lines · Marcelo Tosatti
Quoted 16 lines · Juan Quintela
---
 configure |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
configure +0 -2
index 9598331..91246a1 100755
@@ -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"
Quoted 8 lines

configure echo "IO thread $io_thread" · line 1888

Quoted 6 lines
configure +5 -1
-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.

#44 lore raw

PATCH 21/24 __user is not used anywhere in qemu sources

In reply to Juan Quintela
---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 91246a1..23a3dfb 100755
@@ -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"
Signature · 1 line
1.6.2.5
#45 lore raw

PATCH 22/24 fix mis-merge (we define pkgversion 3 lines above

In reply to Juan Quintela
---
 configure |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
configure +0 -1
index 23a3dfb..289459a 100755
@@ -236,7 +236,6 @@ blobs="yes"
 pkgversion=" ($(kvm_version))"
 cpu_emulation="yes"
 kvm_kmod="no"
-pkgversion=""
 check_utests="no"
 user_pie="no"
 
Signature · 1 line
1.6.2.5
#46 lore raw

PATCH 23/24 Get CONFIG_CPU_EMULATION back to life

In reply to Juan Quintela

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

---
 Makefile.target         |    6 ++++--
 configure               |    6 ++++--
 exec.c                  |    2 ++
 target-i386/fake-exec.c |    4 ----
 vl.c                    |    2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)
Makefile.target +4 -2
index 4a5352b..6846451 100644
@@ -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
configure +4 -2
index 289459a..ee37ea1 100755
@@ -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
exec.c +2 -0
index dd8881c..aff9ec8 100644
@@ -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)
target-i386/fake-exec.c +0 -4
index 737286d..dfa202d 100644
@@ -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)
 {
 }
vl.c +1 -1
index 88bd3eb..5d4e18f 100644
@@ -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
Signature · 1 line
1.6.2.5
#47 lore raw

Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life

Quoted 2 lines · Juan Quintela

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

Quoted 92 lines
---
 Makefile.target         |    6 ++++--
 configure               |    6 ++++--
 exec.c                  |    2 ++
 target-i386/fake-exec.c |    4 ----
 vl.c                    |    2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)
Makefile.target +4 -2
index 4a5352b..6846451 100644
@@ -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
configure +4 -2
index 289459a..ee37ea1 100755
@@ -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
exec.c +2 -0
index dd8881c..aff9ec8 100644
@@ -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)
target-i386/fake-exec.c +0 -4
index 737286d..dfa202d 100644
@@ -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)
 {
 }
vl.c +1 -1
index 88bd3eb..5d4e18f 100644
@@ -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
Signature · 6 lines
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#48 lore raw

Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life

Quoted 6 lines · Marcelo Tosatti
Quoted 2 lines · Juan Quintela

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.

Applied
#49 lore raw

Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life

Quoted 4 lines · Juan Quintela
Quoted 2 lines · Marcelo Tosatti

On Fri, Sep 18, 2009 at 01:41:34PM +0200, Juan Quintela wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

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.

Signature · 1 line
error compiling committee.c: too many arguments to function
#50 lore raw

Re: [PATCH 23/24] Get CONFIG_CPU_EMULATION back to life

Quoted 8 lines · Avi Kivity
Quoted 7 lines · Juan Quintela
Quoted 5 lines · Marcelo Tosatti
Quoted 3 lines · Juan Quintela

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

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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.

#51 lore raw

PATCH 24/24 Remove build-targets-* rules that are always empty

In reply to Juan Quintela
---
 Makefile |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
Makefile +0 -7
index 88b39bd..1e09953 100644
@@ -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))
Signature · 1 line
1.6.2.5
#52 lore raw
In reply to Juan Quintela
Quoted 31 lines · Juan Quintela

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.

Quoted 1 line

Comments?

Juan,

Thanks for doing this.

I've applied all patches except those replied to.