sdk/emulator/qemu.git
15 years agoCalculate sdl_libs and sdl_flags and use them everywhere
Juan Quintela [Mon, 27 Jul 2009 14:13:11 +0000 (16:13 +0200)]
Calculate sdl_libs and sdl_flags and use them everywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosdl_config value was always sdl-config
Juan Quintela [Mon, 27 Jul 2009 14:13:10 +0000 (16:13 +0200)]
sdl_config value was always sdl-config

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agothe else part of this test is obsolete We are testing for sdl = yes inside the else...
Juan Quintela [Mon, 27 Jul 2009 14:13:09 +0000 (16:13 +0200)]
the else part of this test is obsolete We are testing for sdl = yes inside the else part of the test if sdl = yes

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse CONFIG_POSIX to simplify Makefile
Juan Quintela [Mon, 27 Jul 2009 14:13:08 +0000 (16:13 +0200)]
Use CONFIG_POSIX to simplify Makefile

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd CONFIG_POSIX
Juan Quintela [Mon, 27 Jul 2009 14:13:07 +0000 (16:13 +0200)]
Add CONFIG_POSIX

We need a way to define posix-like (a.k.a. no win32)

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN
Juan Quintela [Mon, 27 Jul 2009 14:13:06 +0000 (16:13 +0200)]
rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename DEBUG_EXEC to CONFIG_DEBUG_EXEC
Juan Quintela [Mon, 27 Jul 2009 14:13:05 +0000 (16:13 +0200)]
rename DEBUG_EXEC to CONFIG_DEBUG_EXEC

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename DEBUG_TCG to CONFIG_DEBUG_TCG
Juan Quintela [Mon, 27 Jul 2009 14:13:04 +0000 (16:13 +0200)]
rename DEBUG_TCG to CONFIG_DEBUG_TCG

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_BYTESWAP_H to CONFIG_BYTESWAP_H
Juan Quintela [Mon, 27 Jul 2009 14:13:03 +0000 (16:13 +0200)]
rename HAVE_BYTESWAP_H to CONFIG_BYTESWAP_H

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_GPROF to TARGET_GPROF
Juan Quintela [Mon, 27 Jul 2009 14:13:02 +0000 (16:13 +0200)]
rename HAVE_GPROF to TARGET_GPROF

Use was not consistent, in Makefile was TARGET_GPROF and in *h HAVE_GPROF

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_MACHINE_BSWAP_H to CONFIG_MACHINE_BSWAP_H
Juan Quintela [Mon, 27 Jul 2009 14:13:01 +0000 (16:13 +0200)]
rename HAVE_MACHINE_BSWAP_H to CONFIG_MACHINE_BSWAP_H

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_FNMATCH_H to CONFIG_FNMATCH
Juan Quintela [Mon, 27 Jul 2009 14:13:00 +0000 (16:13 +0200)]
rename HAVE_FNMATCH_H to CONFIG_FNMATCH

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_IOVEC to CONFIG_IOVEC
Juan Quintela [Mon, 27 Jul 2009 14:12:59 +0000 (16:12 +0200)]
rename HAVE_IOVEC to CONFIG_IOVEC

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HAVE_PREADV to CONFIG_PREADV
Juan Quintela [Mon, 27 Jul 2009 14:12:58 +0000 (16:12 +0200)]
rename HAVE_PREADV to CONFIG_PREADV

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agodefine MAP_ANONYMOUS if it is not defined in qemu-common.h
Juan Quintela [Mon, 27 Jul 2009 14:12:57 +0000 (16:12 +0200)]
define MAP_ANONYMOUS if it is not defined in qemu-common.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agorename HOST_BSD to CONFIG_BSD
Juan Quintela [Mon, 27 Jul 2009 14:12:56 +0000 (16:12 +0200)]
rename HOST_BSD to CONFIG_BSD

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoO_LARGEFILE is already set in qemu-common.h
Juan Quintela [Mon, 27 Jul 2009 14:12:55 +0000 (16:12 +0200)]
O_LARGEFILE is already set in qemu-common.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix indententation
Juan Quintela [Mon, 27 Jul 2009 14:12:54 +0000 (16:12 +0200)]
fix indententation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRefactor code to remove one #ifdef CONFIG_FDT
Juan Quintela [Mon, 27 Jul 2009 14:12:53 +0000 (16:12 +0200)]
Refactor code to remove one #ifdef CONFIG_FDT

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename HAVE_FDT to CONFIG_FDT and define it also in Makefile
Juan Quintela [Mon, 27 Jul 2009 14:12:52 +0000 (16:12 +0200)]
Rename HAVE_FDT to CONFIG_FDT and define it also in Makefile

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd -static in configure if needed
Juan Quintela [Mon, 27 Jul 2009 14:12:51 +0000 (16:12 +0200)]
Add -static in configure if needed

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomore specific config.mak can overwrote more general config.mak
Juan Quintela [Mon, 27 Jul 2009 14:12:50 +0000 (16:12 +0200)]
more specific config.mak can overwrote more general config.mak

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomove printing of config-host.mak variables to end of generation
Juan Quintela [Mon, 27 Jul 2009 14:12:49 +0000 (16:12 +0200)]
move printing of config-host.mak variables to end of generation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomake oss use OSS_LIBS
Juan Quintela [Mon, 27 Jul 2009 14:12:48 +0000 (16:12 +0200)]
make oss use OSS_LIBS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomake fmod also use FMOD_{LIBS,CFLAGS}
Juan Quintela [Mon, 27 Jul 2009 14:12:47 +0000 (16:12 +0200)]
make fmod also use FMOD_{LIBS,CFLAGS}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoremove CONFIG_ from BLUEZ_{LIBS,FLAGS}
Juan Quintela [Mon, 27 Jul 2009 14:12:46 +0000 (16:12 +0200)]
remove CONFIG_ from BLUEZ_{LIBS,FLAGS}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoremove CONFIG_ from VNC_SASL_{LIBS, FLAGS}
Juan Quintela [Mon, 27 Jul 2009 14:12:45 +0000 (16:12 +0200)]
remove CONFIG_ from VNC_SASL_{LIBS, FLAGS}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agouse same algorithm for testing and
Juan Quintela [Mon, 27 Jul 2009 14:12:44 +0000 (16:12 +0200)]
use same algorithm for testing and

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoremove CONFIG_ from VNC_TLS_{LIBS, FLAGS}
Juan Quintela [Mon, 27 Jul 2009 14:12:43 +0000 (16:12 +0200)]
remove CONFIG_ from VNC_TLS_{LIBS, FLAGS}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotarget_arch2 is redefined unconditionally later
Juan Quintela [Mon, 27 Jul 2009 14:12:42 +0000 (16:12 +0200)]
target_arch2 is redefined unconditionally later

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove SP_CFLAGS and SP_LDFLAGS
Juan Quintela [Mon, 27 Jul 2009 14:12:41 +0000 (16:12 +0200)]
Remove SP_CFLAGS and SP_LDFLAGS

SP_CFLAGS and SP_LDFLAGS are only used as initial values for ARCH_CFLAGS/ARCH_LDFLAGS.  Call it directly ARCH_*.  Once there, use the same indentantion that the rest of the file

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agochange HOST_SOLARIS to CONFIG_SOLARIS{_VERSION}
Juan Quintela [Mon, 27 Jul 2009 14:12:40 +0000 (16:12 +0200)]
change HOST_SOLARIS to CONFIG_SOLARIS{_VERSION}

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoEnable USE_DIRECT_JUMP on Win32.
Filip Navara [Mon, 27 Jul 2009 15:02:07 +0000 (10:02 -0500)]
Enable USE_DIRECT_JUMP on Win32.

Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove special Win32 code in vl.c that's no longer needed.
Filip Navara [Mon, 27 Jul 2009 15:02:05 +0000 (10:02 -0500)]
Remove special Win32 code in vl.c that's no longer needed.

Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32
Filip Navara [Mon, 27 Jul 2009 15:02:04 +0000 (10:02 -0500)]
Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32

On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them.

Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove useless Win32 include files and unused function in net.c.
Filip Navara [Mon, 27 Jul 2009 15:02:02 +0000 (10:02 -0500)]
Remove useless Win32 include files and unused function in net.c.

Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotap-win32: Use correct headers.
Filip Navara [Mon, 27 Jul 2009 15:02:01 +0000 (10:02 -0500)]
tap-win32: Use correct headers.

Replace the usage of DDK headers with the SDK counterpart "winioctl.h".

Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix broken migration
Glauber Costa [Fri, 24 Jul 2009 20:20:23 +0000 (16:20 -0400)]
fix broken migration

While fixing migration with -S, commit
89befdd1a6b18215153b8976682d57b7d03d5782 broke the rest of us. Poor
glommer, with a poor family, spare him his life from this monstruosity.

Since the unconditional vm_start, not autostart was the villain, I'm putting
back autostart. Let me know if you prefer other solutions, it doesn't really matter,
doesn't really matter to me.

Any way the wind blows...

Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix broken build
Luiz Capitulino [Wed, 22 Jul 2009 18:32:52 +0000 (15:32 -0300)]
Fix broken build

The only caller of on_vcpu() is protected by ifdef
KVM_CAP_SET_GUEST_DEBUG, so protect on_vcpu() too otherwise QEMU
may not to build.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Use monotonic clock if available (v2)
Ed Swierk [Thu, 23 Jul 2009 21:13:34 +0000 (14:13 -0700)]
slirp: Use monotonic clock if available (v2)

Calling gettimeofday() to compute a time interval can cause problems if
the system clock jumps forwards or backwards; replace updtime() with
qemu_get_clock(rt_clock), which calls clock_gettime(CLOCK_MONOTONIC) if
it is available.

Also remove some useless macros.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Remove UDP protocol emulation (talk, cuseeme)
Ed Swierk [Thu, 23 Jul 2009 00:53:15 +0000 (17:53 -0700)]
slirp: Remove UDP protocol emulation (talk, cuseeme)

The UDP emulation code for talk has been commented out since the
beginning of time, and unless someone who runs CU-SeeMe on qemu with
user-mode networking can vouch that the special magic (a) is necessary
and (b) works, let's get rid of the code.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu: msix nit: clear msix_entries_nr on error
Michael S. Tsirkin [Wed, 22 Jul 2009 15:51:14 +0000 (18:51 +0300)]
qemu: msix nit: clear msix_entries_nr on error

I don't think it's critical to do this, but it's
best to keep uninit and error recovery consistent.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoQEMU BOCHS bios patches to use maxcpus value.
Jes Sorensen [Thu, 23 Jul 2009 15:03:43 +0000 (17:03 +0200)]
QEMU BOCHS bios patches to use maxcpus value.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoIntroduce -smp , maxcpus= flag to specify maximum number of CPUS.
Jes Sorensen [Thu, 23 Jul 2009 15:03:42 +0000 (17:03 +0200)]
Introduce -smp , maxcpus= flag to specify maximum number of CPUS.

Follow on patch will use it to determine the size of the MADT and
other BIOS tables.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse Little Endian for Dirty Log
Alexander Graf [Mon, 27 Jul 2009 10:49:56 +0000 (12:49 +0200)]
Use Little Endian for Dirty Log

We currently use host endian long types to store information
in the dirty bitmap.

This works reasonably well on Little Endian targets, because the
u32 after the first contains the next 32 bits. On Big Endian this
breaks completely though, forcing us to be inventive here.

So Ben suggested to always use Little Endian, which looks reasonable.

We only have dirty bitmap implemented in Little Endian targets so far
and since PowerPC would be the first Big Endian platform, we can just
as well switch to Little Endian always with little effort without
breaking existing targets.

This is the userspace part of the patch. It shouldn't change anything
for existing targets, but help PowerPC.

It replaces my older patch called "Use 64bit pointer for dirty log".

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse 64bit pointer for dirty log
Alexander Graf [Fri, 24 Jul 2009 23:16:44 +0000 (01:16 +0200)]
Use 64bit pointer for dirty log

Dirty logs currently get written with native "long" size. On little endian
it doesn't matter if we use uint64_t instead though, because we'd still end
up using the right bytes.

On big endian, this does become a bigger problem, so we need to ensure that
kernel and userspace talk the same language, which means getting rid of "long"
and using a defined size instead.

So I decided to use 64 bit types at all times. This doesn't break existing
targets but will in conjunction with a patch I'll send to the KVM ML make
dirty logs work with 32 bit userspace on 64 kernel with big endian.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoHPET fixes for reg writes
Beth Kon [Fri, 24 Jul 2009 16:26:59 +0000 (12:26 -0400)]
HPET fixes for reg writes

This patch addresses the problems found by Andriy Gapon:

- The code was incorrectly overwriting the high order 32
  bits of the timer and hpet config registers. This didn't show up
  in testing because linux and windows use hpet in legacy mode,
  where the high order 32 bits (advertising available interrupts)
  of the timer config register are ignored, and the high order 32
  bits of the hpet config register are reserved and unused.

- The mask for level-triggered interrupts was off by a bit. (hpet
  doesn't currently support level-triggered interrupts).

In addition, I removed some unused #defines, and corrected the ioapic
interrupt values advertised. I'd set this up early in hpet development
and never went back to correct it, and no bugs resulted since linux and
windows use hpet in legacy mode where available interrupts are ignored.

Signed-off-by: Beth Kon <eak@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Fix guestfwd for incoming data
Jan Kiszka [Wed, 22 Jul 2009 15:03:52 +0000 (17:03 +0200)]
slirp: Fix guestfwd for incoming data

Unless a virtual server address was explicitly defined (which is
impossible with the legacy -net channel format), guestfwd did not
properly forwarded host->guest packets. This patch fixes it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoswitch -drive to QemuOpts.
Gerd Hoffmann [Wed, 22 Jul 2009 14:43:04 +0000 (16:43 +0200)]
switch -drive to QemuOpts.

Demo QemuOpts in action ;)

Implementing a alternative way to specify the filename should be
just a few lines of code now once we decided how the cmd line syntax
should look like.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoQemuOpts: framework for storing and parsing options.
Gerd Hoffmann [Wed, 22 Jul 2009 14:43:03 +0000 (16:43 +0200)]
QemuOpts: framework for storing and parsing options.

This stores device parameters in a better way than unparsed strings.

New types:
  QemuOpt       -  one key-value pair.
  QemuOpts      -  group of key-value pairs, belonging to one
                   device, i.e. one drive.
  QemuOptsList  -  list of some kind of devices, i.e. all drives.

Functions are provided to work with these types.  The plan is that some
day we will pass around QemuOpts pointers instead of strings filled with
"key1=value1,key2=value2".

Check out the next patch to see all this in action ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-option: factor out parse_option_size
Gerd Hoffmann [Wed, 22 Jul 2009 14:43:02 +0000 (16:43 +0200)]
qemu-option: factor out parse_option_size

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-option: factor out parse_option_bool
Gerd Hoffmann [Wed, 22 Jul 2009 14:43:01 +0000 (16:43 +0200)]
qemu-option: factor out parse_option_bool

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomove parser functions from vl.c to qemu-option.c
Gerd Hoffmann [Wed, 22 Jul 2009 14:43:00 +0000 (16:43 +0200)]
move parser functions from vl.c to qemu-option.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokill drives_opt
Gerd Hoffmann [Wed, 22 Jul 2009 14:42:59 +0000 (16:42 +0200)]
kill drives_opt

cleanup pretty simliar to the drives_table removal patch:
 - drop the table and make a linked list out of it.
 - pass around struct pointers instead of table indices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoadd support for drive ids.
Gerd Hoffmann [Wed, 22 Jul 2009 14:42:58 +0000 (16:42 +0200)]
add support for drive ids.

-drive accepts the new id= now, allowing to explicitely name your
drives.  They will show up with that name in "info block" if specified,
otherwise the existing namimg scheme is used to autogenerate one.

There is also a new function to lookup drives by name.  Not used yet.
The plan is to link disk drivers and drives using the drive id instead
of passing around pointers to BlockDriveState.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokill drives_table
Gerd Hoffmann [Wed, 22 Jul 2009 14:42:57 +0000 (16:42 +0200)]
kill drives_table

First step cleaning up the drives handling.  This one does nothing but
removing drives_table[], still it became seriously big.

drive_get_index() is gone and is replaced by drives_get() which hands
out DriveInfo pointers instead of a table index.  This needs adaption in
*tons* of places all over.

The drives are now maintained as linked list.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev/pci: hook up i440fx.
Gerd Hoffmann [Wed, 22 Jul 2009 13:17:01 +0000 (15:17 +0200)]
qdev/pci: hook up i440fx.

Hook i44fx pcihost into sysbus.
Convert Host bridge and ISA bridge pci devices to qdev.
Tag as no-user.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: add -device command line option.
Gerd Hoffmann [Wed, 15 Jul 2009 11:59:26 +0000 (13:59 +0200)]
qdev: add -device command line option.

The -device switch is the users frontend to the qdev_device_add function
added by the previous patch.

Also adds a linked list where command line options can be saved.
Use it for the new -device and for the -usbdevice and -bt switches.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: bus walker + qdev_device_add()
Gerd Hoffmann [Wed, 15 Jul 2009 11:59:25 +0000 (13:59 +0200)]
qdev: bus walker + qdev_device_add()

This patch implements a parser and qdev tree walker for bus paths and
adds qdev_device_add on top of this.

A bus path can be:
  (1) full path, i.e. /i440FX-pcihost/pci.0/lsi/scsi.0
  (2) bus name, i.e. "scsi.0".  Best used together with id= to make
      sure this is unique.
  (3) relative path starting with a bus name, i.e. "pci.0/lsi/scsi.0"

For the (common) case of a single child bus being attached to a device
it is enougth to specify the device only, i.e. "pci.0/lsi" will be
accepted too.

qdev_device_add() adds devices and accepts bus= parameters to find the
bus the device should be attached to.  Without bus= being specified it
takes the first bus it finds where the device can be attached to (i.e.
first pci bus for pci devices, ...).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: create default bus names.
Gerd Hoffmann [Wed, 15 Jul 2009 11:59:24 +0000 (13:59 +0200)]
qdev: create default bus names.

Create a default bus name if none is passed to qbus_create().

If the parent device has DeviceState->id set it will be used to create
the bus name,. i.e. -device lsi,id=foo will give you a scsi bus named
"foo.0".

If there is no id BusInfo->name (lowercased) will be used instead, i.e.
-device lsi will give you a scsi bus named "scsi.0".

A scsi adapter with two scsi busses would have "scsi.0" and "scsi.1" or
"$id.0" and "$id.1" busses.  The numbers of the child busses are per
device, i.e. when adding two lsi adapters both will have a "*.0" child
bus.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev/pci: use qdev_prop_pci_devfn
Gerd Hoffmann [Wed, 15 Jul 2009 11:59:23 +0000 (13:59 +0200)]
qdev/pci: use qdev_prop_pci_devfn

Put the new property into use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev/prop: add pci devfn property
Gerd Hoffmann [Wed, 15 Jul 2009 11:59:22 +0000 (13:59 +0200)]
qdev/prop: add pci devfn property

So we can parse "$slot.$fn" strings into devfn numbers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd a pc-0.11 machine type and make the pc type an alias
Mark McLoughlin [Wed, 22 Jul 2009 09:02:51 +0000 (10:02 +0100)]
Add a pc-0.11 machine type and make the pc type an alias

The pc-0.11 type allows users of qemu-0.11 to use a machine type which
they know will remain compatible when the upgrade to qemu-0.12.

Management tools may choose to canonicalize the 'pc' machine type to
'pc-0.11' so that if the 'pc' alias changes target in future versions
of qemu, the machine type used will remain compatible.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd machine type aliases
Mark McLoughlin [Wed, 22 Jul 2009 09:02:50 +0000 (10:02 +0100)]
Add machine type aliases

Add an 'alias' field to QEMUMachine and display it in the output of
'qemu -M ?' with an '(aliased to foo)' suffix.

Aliases can change targets in newer versions of qemu, so management tools
may choose canonicalize machine types to ensure that if a user chooses an
alias, that the actual machine type used will remain compatible in
future.

This is intended to mimic a symlink to a machine description file.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd support for fd=name to tap and socket networking
Mark McLoughlin [Wed, 22 Jul 2009 08:11:42 +0000 (09:11 +0100)]
Add support for fd=name to tap and socket networking

This allows a program to initialize a host networking device using a
file descriptor passed over a unix monitor socket.

The program must first pass the file descriptor using SCM_RIGHTS
ancillary data with the getfd monitor command. It then may do
"host_net_add tap fd=name" to use the named file descriptor.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd monitor_get_fd() command for fetching named fds
Mark McLoughlin [Wed, 22 Jul 2009 08:11:41 +0000 (09:11 +0100)]
Add monitor_get_fd() command for fetching named fds

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd getfd and closefd monitor commands
Mark McLoughlin [Wed, 22 Jul 2009 08:11:40 +0000 (09:11 +0100)]
Add getfd and closefd monitor commands

Add monitor commands to support passing file descriptors via
SCM_RIGHTS.

getfd assigns the passed file descriptor a name for use with other
monitor commands.

closefd allows passed file descriptors to be closed. If a monitor
command actually uses a named file descriptor, closefd will not be
required.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd SCM_RIGHTS support to unix socket character devices
Mark McLoughlin [Wed, 22 Jul 2009 08:11:39 +0000 (09:11 +0100)]
Add SCM_RIGHTS support to unix socket character devices

If a file descriptor is passed via a message with SCM_RIGHTS ancillary
data on a unix socket, store the file descriptor for use in the
chr_read() handler. Close the file descriptor if it was not used.

The qemu_chr_get_msgfd() API provides access to the passed descriptor.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake tcp_chr_read() use recvmsg()
Mark McLoughlin [Wed, 22 Jul 2009 08:11:38 +0000 (09:11 +0100)]
Make tcp_chr_read() use recvmsg()

Split out tcp_chr_recv() out of tcp_chr_read() and implement it on
non-win32 using recvmsg(). This is needed for a subsequent patch
which implements SCM_RIGHTS support.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosparc64 really implement itlb/dtlb automatic replacement writes
Igor Kovalenko [Sun, 26 Jul 2009 21:57:39 +0000 (01:57 +0400)]
sparc64 really implement itlb/dtlb automatic replacement writes

- implement "used" bit in tlb translation entry
- mark tlb entry used if qemu code/data translation succeeds
- fold i/d mmu replacement writes code into replace_tlb_1bit_lru which
adds 1bit lru replacement algorithm; previously code tried to replace
first unlocked entry only

- extract more bitmasks to named macros
- add "immu" or "dmmu" type name to debugging output where appropriate

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agosparc64 name mmu registers and general cleanup
Igor Kovalenko [Sun, 26 Jul 2009 21:49:04 +0000 (01:49 +0400)]
sparc64 name mmu registers and general cleanup

- add names to mmu registers, this helps understanding the code which
uses/modifies them.
- fold i/d mmu tlb entries tag and tte arrays into arrays of tlb entries
- extract demap_tlb routine (code duplication)
- extract replace_tlb routine (code duplication)

- flush qemu tlb translations when replacing sparc64 mmu tlb entries

I have no test case which demands flushing qemu translations,
and this patch should have no other visible changes to runtime.

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agoGive the kernel more room
Alexander Graf [Sun, 26 Jul 2009 06:31:32 +0000 (06:31 +0000)]
Give the kernel more room

My self-built PPC kernel doesn't fit in the region reserved for
the kernel, so I can't use -kernel with it.

Let's just extend the region.

Signed-off-by: Alexander Graf <agraf@suse.de>
15 years agoPPC: Round VGA BIOS size to page boundary
Alexander Graf [Sun, 26 Jul 2009 06:31:15 +0000 (06:31 +0000)]
PPC: Round VGA BIOS size to page boundary

When giving KVM a slot of a size not on page boundary, it chokes. So let's
just round up the VGA BIOS size so nobody complains anymore and we don't need
to implement sub-page slots.

Required for booting a PPC guest in KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
15 years agoFix period initialization
malc [Fri, 24 Jul 2009 01:16:12 +0000 (05:16 +0400)]
Fix period initialization

Signed-off-by: malc <av1474@comtv.ru>
15 years agoprovide tests for pit in kernel and irqchip in kernel
Glauber Costa [Tue, 21 Jul 2009 15:26:58 +0000 (12:26 -0300)]
provide tests for pit in kernel and irqchip in kernel

KVM can have an in-kernel pit or irqchip. While we don't implement it
yet, having a way for test for it (that always returns zero) will allow us
to reuse code in qemu-kvm that tests for it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-thread: use pthread_equal
Sebastian Herbszt [Sun, 19 Jul 2009 13:16:09 +0000 (15:16 +0200)]
qemu-thread: use pthread_equal

Fixes

qemu-thread.c: In function `qemu_thread_equal':
qemu-thread.c:161: error: invalid operands to binary ==

Use of pthread_equal suggested by Filip Navara.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoLink bios files when building out of tree
Jan Kiszka [Fri, 17 Jul 2009 09:20:10 +0000 (11:20 +0200)]
Link bios files when building out of tree

When starting a qemu binary directly from the build directory and that
dir is located outside the source files, the search for bios files
fails. Fix this by linking them from the build to the source directory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosignrom.sh: portability fix
Christoph Egger [Fri, 17 Jul 2009 13:23:51 +0000 (15:23 +0200)]
signrom.sh: portability fix

Attached patch makes signrom.sh working on NetBSD.
The output of the 'od' command leads to a syntax error
which breaks the build.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agonotify io_thread at the end of rx handling
Glauber Costa [Mon, 20 Jul 2009 17:07:41 +0000 (13:07 -0400)]
notify io_thread at the end of rx handling

This is a backport from qemu-kvm. Just instead of using kvm's specific
notification mechanism, we use qemu_notify_event()

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agointroduce on_vcpu
Glauber Costa [Thu, 16 Jul 2009 21:55:28 +0000 (17:55 -0400)]
introduce on_vcpu

on_vcpu is a qemu-kvm function that will make sure that a specific
piece of code will run on a requested cpu. We don't need that because
we're restricted to -smp 1 right now, but those days are likely to end soon.

So for the benefit of having qemu-kvm share more code with us, I'm
introducing our own version of on_vcpu(). Right now, we either run
a function on the current cpu, or abort the execution, because it would
mean something is seriously wrong.

As an example code, I "ported" kvm_update_guest_debug to use it,
with some slight differences from qemu-kvm.

This is probably 0.12 material

Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: reject invalid pattern
Christoph Hellwig [Sun, 19 Jul 2009 23:19:25 +0000 (01:19 +0200)]
qemu-io: reject invalid pattern

Replace the use of atoi which is used for pattern parsing currently with
strtol.  Atoi won't parse sedecimal pattern values (it always returns 0),
but qemu-iotests use such pattern values.  Also reject every pattern
that is not a unsigned char as we pass the pattern to memset which
expect a bye value (despite having the pattern argument declared as int).

Based on an earlier patch by Stefan Weil which did not include the
error handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: Rework alloc command
Kevin Wolf [Mon, 20 Jul 2009 14:48:43 +0000 (16:48 +0200)]
qemu-io: Rework alloc command

The alloc command in qemu-io is mostly useless currently. Instead of doing a
single call to bdrv_is_allocated, we must call bdrv_is_allocated in a loop
until we have found out for each requested sector if it is allocated or not
(bdrv_is_allocated returns a number of sectors that are known to be in the same
state as the first one, but it is not required to include all of them)

This changes the output format of the alloc command so that a change to the
expected output of qemu-iotests 019 is necessary once this is included.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqmu-img: fix qemu-img convert to generate a valid image when the source referenced...
Akkarit Sangpetch [Fri, 17 Jul 2009 08:02:15 +0000 (10:02 +0200)]
qmu-img: fix qemu-img convert to generate a valid image when the source referenced a backing file

Make 'qemu-img convert' copies unallocated parts of the source image
when -B option was not specified.

Signed-off-by: Akkarit Sangpetch <asangpet@andrew.cmu.edu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmdk: Fix backing file handling
Kevin Wolf [Fri, 17 Jul 2009 06:20:41 +0000 (08:20 +0200)]
vmdk: Fix backing file handling

Instead of storing the backing file in its own BlockDriverState, VMDK uses the
BlockDriverState of the raw image file it opened. This is wrong and breaks
functions that access the backing file or protocols. This fix replaces all
occurrences of s->hd->backing_* with bs->backing_*.

This fixes qemu-iotests failure in 020 (Commit changes to backing file).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agouse struct initializer for audio.c
Juan Quintela [Mon, 20 Jul 2009 18:57:00 +0000 (20:57 +0200)]
use struct initializer for audio.c

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd save/restore support to the LSI logic SCSI device model.
Nolan [Mon, 20 Jul 2009 21:11:35 +0000 (14:11 -0700)]
Add save/restore support to the LSI logic SCSI device model.

This patch requires "Handle BH's queued by AIO completions in
qemu_aio_flush()" to work reliably.  The combination of those two
patches survived 300+ migrations with heavy IO load running in the
guest.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoHandle BH's queued by AIO completions in qemu_aio_flush()
Nolan [Mon, 20 Jul 2009 21:01:25 +0000 (14:01 -0700)]
Handle BH's queued by AIO completions in qemu_aio_flush()

Without this, the call to qemu_aio_flush during migration doesn't
actually flush all in-flight SCSI IOs.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFake dirty loggin when it's not there
Alexander Graf [Fri, 17 Jul 2009 11:51:48 +0000 (13:51 +0200)]
Fake dirty loggin when it's not there

Some KVM platforms don't support dirty logging yet, like IA64 and PPC,
so in order to still have screen updates on those, we need to fake it.

This patch just tells the getter function for dirty bitmaps, that all
pages within a slot are dirty when the slot has dirty logging enabled.

That way we can implement dirty logging on those platforms sometime when
it drags down performance, but share the rest of the code with dirty
logging capable platforms.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse correct input constant
Alexander Graf [Fri, 17 Jul 2009 11:51:46 +0000 (13:51 +0200)]
Use correct input constant

440 and desktop codes use different input constants for interrupt indication.

Let's use the respective ones for KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix warning in kvm-all.c
Alexander Graf [Fri, 17 Jul 2009 11:51:45 +0000 (13:51 +0200)]
Fix warning in kvm-all.c

This fixes a warning I stumbled across while compiling qemu on PPC64.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSet PVR in sregs
Alexander Graf [Fri, 17 Jul 2009 11:51:43 +0000 (13:51 +0200)]
Set PVR in sregs

We need to tell the kernel about some initial CPU state we don't have yet,
so let's use the "sregs" IOCTL for that and simply put the Processor Version
Register in there.

Now the kernel knows which guest CPU to virtualize.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoEnable PPC KVM for non-embedded
Alexander Graf [Fri, 17 Jul 2009 11:51:42 +0000 (13:51 +0200)]
Enable PPC KVM for non-embedded

We now have KVM on PPC64 too and might get it on PPC32 as well, as soon
as someone writes it.

So let's enable KVM for PPC32 and PPC64 targets.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSparc32: convert Sun4c interrupt controller to qdev
Blue Swirl [Tue, 21 Jul 2009 19:57:32 +0000 (19:57 +0000)]
Sparc32: convert Sun4c interrupt controller to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert SBI to qdev
Blue Swirl [Tue, 21 Jul 2009 19:25:59 +0000 (19:25 +0000)]
Sparc32: convert SBI to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix CONFIG_PROFILER
Blue Swirl [Tue, 21 Jul 2009 12:18:03 +0000 (12:18 +0000)]
Fix CONFIG_PROFILER

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32/64: use 64 bit type for memory size
Blue Swirl [Tue, 21 Jul 2009 11:20:11 +0000 (11:20 +0000)]
Sparc32/64: use 64 bit type for memory size

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoqdev: add 64 bit type
Blue Swirl [Tue, 21 Jul 2009 11:10:41 +0000 (11:10 +0000)]
qdev: add 64 bit type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc64: refactor kernel init
Blue Swirl [Tue, 21 Jul 2009 10:49:47 +0000 (10:49 +0000)]
Sparc64: refactor kernel init

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc64: refactor CPU init
Blue Swirl [Tue, 21 Jul 2009 10:46:23 +0000 (10:46 +0000)]
Sparc64: refactor CPU init

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc64: convert memory to qdev
Blue Swirl [Tue, 21 Jul 2009 10:04:47 +0000 (10:04 +0000)]
Sparc64: convert memory to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>