]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agoqemu-nbd: print error messages from the daemon through a pipe
Paolo Bonzini [Fri, 4 Nov 2011 14:51:22 +0000 (15:51 +0100)]
qemu-nbd: print error messages from the daemon through a pipe

In order to get nice error messages, keep the qemu-nbd process running
until before issuing NBD_DO_IT and connected to the daemon with a pipe.
This lets the qemu-nbd process relay error messages from the daemon and
exit with a nonzero status if appropriate.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-nbd: move client to a thread
Paolo Bonzini [Fri, 4 Nov 2011 14:51:21 +0000 (15:51 +0100)]
qemu-nbd: move client to a thread

This avoids that qemu-nbd uses both forking and threads, which do
not behave well together.

qemu-nbd is already Unix only, and there is no qemu_thread_join,
so for now use pthreads.

Since the parent and child no longer have separate file descriptors,
we can open the NBD device before daemonizing, instead of checking
with access(2) and restricting the open to the client only.

Reported-by: Pierre Riteau <pierre.riteau@irisa.fr>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-nbd: rename socket variable
Paolo Bonzini [Fri, 4 Nov 2011 14:51:20 +0000 (15:51 +0100)]
qemu-nbd: rename socket variable

It will be moved to a global variable by the next patch, and it
would conflict with the socket function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-nbd: trap SIGTERM
Paolo Bonzini [Fri, 4 Nov 2011 14:51:19 +0000 (15:51 +0100)]
qemu-nbd: trap SIGTERM

The client process right now uses SIGTERM to interrupt the server side.
This does not affect the exit status of "qemu-nbd -v -c" because the
server is a child process.  This will change when both sides will be
in the same process, and anyway cleaning up things nicely upon SIGTERM
is good practice.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agonbd: treat EPIPE from NBD_DO_IT as success
Paolo Bonzini [Fri, 4 Nov 2011 14:51:18 +0000 (15:51 +0100)]
nbd: treat EPIPE from NBD_DO_IT as success

This can be seen with "qemu-nbd -v -c", which returns 1 instead of 0
when you disconnect with "qemu-nbd -d".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: implement eject requests
Paolo Bonzini [Tue, 25 Oct 2011 10:53:40 +0000 (12:53 +0200)]
scsi-disk: implement eject requests

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoatapi: implement eject requests
Paolo Bonzini [Tue, 25 Oct 2011 10:53:39 +0000 (12:53 +0200)]
atapi: implement eject requests

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add eject request callback
Paolo Bonzini [Mon, 7 Nov 2011 16:50:13 +0000 (17:50 +0100)]
block: add eject request callback

Recent versions of udev always keep the tray locked so that the kernel
can observe "eject request" events (aka tray button presses) even on
discs that aren't mounted.  Add support for these events in the ATAPI
and SCSI cd drive device models.

To let management cope with the behavior of udev, an event should also
be added for "tray opened/closed".  This way, after issuing an "eject"
command, management can poll until the guests actually reacts to the
command.  They can then issue the "change" command after the tray has been
opened, or try with "eject -f" after a (configurable?) timeout.  However,
with this patch and the corresponding support in the device models,
at least it is possible to do a manual two-step eject+change sequence.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: Fix read-write mode
Kevin Wolf [Tue, 8 Nov 2011 09:50:12 +0000 (10:50 +0100)]
vvfat: Fix read-write mode

vvfat used to directly call into the qcow2 block driver instead of using the
block.c wrappers. With the coroutine conversion, this stopped working.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agohw/lan9118.c: Add missing 'break' to fix buffer overrun
Peter Maydell [Wed, 9 Nov 2011 18:59:54 +0000 (18:59 +0000)]
hw/lan9118.c: Add missing 'break' to fix buffer overrun

Add a missing 'break' statement to fix a buffer overrun when
executing the EEPROM write-all command. Spotted by Coverity
(see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agox86/cpuid: Fix crash on -cpu ""
Markus Armbruster [Tue, 8 Nov 2011 14:36:50 +0000 (15:36 +0100)]
x86/cpuid: Fix crash on -cpu ""

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agox86/cpuid: Plug memory leak in cpudef_setfield()
Markus Armbruster [Tue, 8 Nov 2011 14:36:49 +0000 (15:36 +0100)]
x86/cpuid: Plug memory leak in cpudef_setfield()

To reproduce the leak, put two name options into the same [cpudef]
section of target-x86_64.conf.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agox86/cpuid: Convert remaining strdup() to g_strdup()
Markus Armbruster [Tue, 8 Nov 2011 14:36:48 +0000 (15:36 +0100)]
x86/cpuid: Convert remaining strdup() to g_strdup()

Fixes missing error checking.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoui/vnc: Convert sasl.mechlist to g_malloc() & friends
Markus Armbruster [Tue, 8 Nov 2011 12:45:21 +0000 (13:45 +0100)]
ui/vnc: Convert sasl.mechlist to g_malloc() & friends

Fixes protocol_client_auth_sasl_mechname() not to crash when malloc()
fails.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqdev: Fix crash on -device '?=x'
Markus Armbruster [Tue, 8 Nov 2011 10:00:38 +0000 (11:00 +0100)]
qdev: Fix crash on -device '?=x'

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Show --cpu option on the help list
陳韋任 [Mon, 7 Nov 2011 09:42:05 +0000 (17:42 +0800)]
configure: Show --cpu option on the help list

Signed-off-by: Chen Wen-Ren (陳韋任) <chenwj@iis.sinica.edu.tw>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-tech.texi: Update default code cache size
陳韋任 [Fri, 4 Nov 2011 17:14:44 +0000 (01:14 +0800)]
qemu-tech.texi: Update default code cache size

  Update the document since the default code cache size is 32 MB now.

Signed-off-by: chenwj <chenwj@cs.nctu.edu.tw>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agohpet: fix infinite loop in qemu_run_timers with -icount enabled
Max Filippov [Wed, 9 Nov 2011 01:18:09 +0000 (05:18 +0400)]
hpet: fix infinite loop in qemu_run_timers with -icount enabled

hpet_timer timer callback rearms itself based on difference between
current HPET tick counter and comparator value. Difference calculated by
the hpet_calculate_diff function is limited to non-negative values.

cur_tick is calculated via hpet_get_ticks that uses qemu_get_clock_ns(vm_clock).

With -icount enabled vm_clock doesn't advance during qemu_run_timers
loop thus once difference is zero, qemu_run_timers loops forever
handling hpet_timer.

Limit hpet_calculate_diff results to positive only values to avoid that
infinite loop.

This fixes the following qemu-system-x86_64 hang when it reaches
timer_irq_works() in the linux bootup:

[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 1000.054 MHz processor.
[    0.000031] Calibrating delay loop (skipped), value calculated using timer frequency.. 2000.10 BogoMIPS (lpj=10000540)
[    0.000404] pid_max: default: 32768 minimum: 301
[    0.001138] Mount-cache hash table entries: 256
[    0.003883] Initializing cgroup subsys ns
[    0.004035] Initializing cgroup subsys cpuacct
[    0.004280] Initializing cgroup subsys freezer
[    0.004790] Performance Events: AMD PMU driver.
[    0.004985] ... version:                0
[    0.005134] ... bit width:              48
[    0.005285] ... generic registers:      4
[    0.005437] ... value mask:             0000ffffffffffff
[    0.005625] ... max period:             00007fffffffffff
[    0.005807] ... fixed-purpose events:   0
[    0.005957] ... event mask:             000000000000000f
[    0.006275] SMP alternatives: switching to UP code

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agohw/omap_gpmc.c: Add missing 'break's to fix 8 bit NAND writes
Peter Maydell [Wed, 9 Nov 2011 17:42:23 +0000 (17:42 +0000)]
hw/omap_gpmc.c: Add missing 'break's to fix 8 bit NAND writes

Add missing 'break' statements which would have meant that writing
to an 8 bit NAND device was broken. Spotted by Coverity (see bug
887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agohw/omap_dss.c: Fix !-vs-~ bug in handling DISPC_CONTROL
Peter Maydell [Wed, 9 Nov 2011 17:20:06 +0000 (17:20 +0000)]
hw/omap_dss.c: Fix !-vs-~ bug in handling DISPC_CONTROL

Fix a bug revealed by a coverity scan (see bug 887883) which meant
that we would never print the warning about unpredictable behaviour
if a nonexistent overlay is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoi386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUID
Avi Kivity [Wed, 9 Nov 2011 13:44:36 +0000 (15:44 +0200)]
i386: derive '-cpu host' from KVM_GET_SUPPORTED_CPUID

The fact that a host cpu supports a feature doesn't mean that QEMU and KVM
will also support it, yet -cpuid host brings host features wholesale.

We need to whitelist each feature separately to make sure we support it.
This patch adds KVM whitelisting (by simply using KVM_GET_SUPPORTED_CPUID
instead of the CPUID instruction).

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: fix detection for xattr.h on modern distributions
Avi Kivity [Wed, 9 Nov 2011 12:44:52 +0000 (14:44 +0200)]
configure: fix detection for xattr.h on modern distributions

Modern distributions place xattr.h in /usr/include/sys, and fold
libattr.so into libc.  They also don't have an ENOATTR.

Make configure detect this, and add a qemu-xattr.h file that
directs the #include to the right place.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoClean up assertion in get_boot_devices_list()
Markus Armbruster [Tue, 8 Nov 2011 09:58:00 +0000 (10:58 +0100)]
Clean up assertion in get_boot_devices_list()

g_strdup() can't fail, remove assertion.  Assert its argument can't be
null, because that's not obvious (add_boot_device_path() ensures it).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoReplace WriteFileEx with WriteFile in qemu_create_pidfile
Fabien Chouteau [Mon, 7 Nov 2011 14:36:14 +0000 (15:36 +0100)]
Replace WriteFileEx with WriteFile in qemu_create_pidfile

The function that writes pidfile for win32 uses WriteFileEx which is an
asynchronous IO function. The arguments given to WriteFileEx are allocated on
the stack and one of them is "in out". When the IO operation is actually
executed the calling function has already returned, so the arguments are no
longer allocated or allocated to another frame.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agowin32: remove broken timers
Paolo Bonzini [Wed, 9 Nov 2011 11:46:56 +0000 (12:46 +0100)]
win32: remove broken timers

The non-dynticks timer variations are broken, so they can be
removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtex: Remove memset of clk_setup
Edgar E. Iglesias [Mon, 7 Nov 2011 23:00:55 +0000 (00:00 +0100)]
virtex: Remove memset of clk_setup

clk_setup is now a function. Fixes a segfault.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoUpdate version for v1.0-rc1 v1.0-rc1
Anthony Liguori [Mon, 7 Nov 2011 16:57:45 +0000 (10:57 -0600)]
Update version for v1.0-rc1

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconsole: Fix rendering of VGA underline
Markus Armbruster [Fri, 4 Nov 2011 09:38:29 +0000 (10:38 +0100)]
console: Fix rendering of VGA underline

vga_putcharxy()'s underline code sets font_data to 0xffff instead of
0xff.  vga_putcharxy() then reads dmask16[0xffff >> 4] and
dmask4[0xffff >> 6].  In practice, these out-of-bounds subscripts
"only" put a few crap bits into the display surface.

For 32 bit pixels, there's no array access.  font_data's extra bits go
straight into the display surface.

Broken when commit 6d6f7c28 implemented underline.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu_timedate_diff() shouldn't modify its argument.
Gleb Natapov [Sun, 6 Nov 2011 16:00:22 +0000 (18:00 +0200)]
qemu_timedate_diff() shouldn't modify its argument.

The caller of qemu_timedate_diff() does not expect that tm it passes to
the function will be modified, but mktime() is destructive and modifies
its argument. Pass a copy of tm to it and set tm_isdst so that mktime()
will not rely on it since its value may be outdated.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoreenable vm_clock when resuming all vcpus
Wen Congyang [Fri, 4 Nov 2011 02:45:58 +0000 (10:45 +0800)]
reenable vm_clock when resuming all vcpus

We disable vm_clock when pausing all vcpus, but we forget to
reenable it when resuming all vcpus. It will cause that the
guest can not be rebooted.

Tested-by: Zhi Yong Wu <zwu.kernel@gmai.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqxl: fix vga port initialization.
Gerd Hoffmann [Thu, 3 Nov 2011 17:21:54 +0000 (18:21 +0100)]
qxl: fix vga port initialization.

Commit 0a039dc70096b768d3810afa50ba1d214768aaf4 broke vga modes for
qxl-vga by loosing vga_ioport_read windup.  qxl needs to hook into
vga port writes only and used to realize that by letting vga_init() do
the work for both reads and writes, then overwrite the write function.
That little detail was missed while doing the conversion ...

This patch fixes it.  It also switch qxl vga ioport registration to
portio lists while being at it.

Cc: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoac97: don't override the pci subsystem id
Gerd Hoffmann [Mon, 7 Nov 2011 15:33:09 +0000 (16:33 +0100)]
ac97: don't override the pci subsystem id

This patch removes the code lines which set the subsystem id for the
emulated ac97 card to 8086:0000.  Due to the device id being zero the
subsystem id isn't vaild anyway.  With the patch applied the sound card
gets the default qemu subsystem id (1af4:1100) instead.

[ v2: old & broken id is maintained for -M pc-$oldqemuversion ]

Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc: add 1.0 machine type
Gerd Hoffmann [Mon, 7 Nov 2011 15:33:08 +0000 (16:33 +0100)]
pc: add 1.0 machine type

This patch adds a pc-1.0 machine type.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agodisable automatic loading of sgabios when -nographic
Paolo Bonzini [Thu, 3 Nov 2011 15:00:22 +0000 (16:00 +0100)]
disable automatic loading of sgabios when -nographic

sgabios hasn't gotten a lot of coverage since it was not shipped.  For 1.0,
let's disable the automatic loading of the option ROM in -nographic
mode.  We can put it back for 1.1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd sgabios blob and submodule
Paolo Bonzini [Thu, 3 Nov 2011 14:14:00 +0000 (15:14 +0100)]
add sgabios blob and submodule

The rom was not added together with the sgabios device and is
not installed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 7 Nov 2011 16:57:27 +0000 (10:57 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 7 Nov 2011 16:56:38 +0000 (10:56 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoxen-platform: Fix IO port read/write functions
Anthony PERARD [Fri, 4 Nov 2011 15:35:11 +0000 (15:35 +0000)]
xen-platform: Fix IO port read/write functions

Somehow, the read/write functions handle an offset that does not exist anymore.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoreadline: Fix buffer overrun on re-add to history
Markus Armbruster [Fri, 4 Nov 2011 10:10:01 +0000 (11:10 +0100)]
readline: Fix buffer overrun on re-add to history

readline_hist_add() moves the history entry to the end of history.  It
uses memmove() to move rs->history[idx + 1..] to rs->history[idx..].
However, its size argument is off by two array elements, so it writes
one element beyond rs->history[], and reads two.

On my system, this clobbers rs->hist_entry and the hole right after
it.  Since the function assigns to rs->hist_entry in time, the bug has
no ill effects for me.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocmd: Fix potential memory leak
Pavel Borzenkov [Mon, 31 Oct 2011 18:53:38 +0000 (22:53 +0400)]
cmd: Fix potential memory leak

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocmd: Fix potential NULL pointer dereference
Pavel Borzenkov [Mon, 31 Oct 2011 18:53:37 +0000 (22:53 +0400)]
cmd: Fix potential NULL pointer dereference

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocmd: Fix coding style in cmd.c
Pavel Borzenkov [Mon, 31 Oct 2011 18:53:36 +0000 (22:53 +0400)]
cmd: Fix coding style in cmd.c

Before the next patches, fix coding style of the affected functions.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoarm_gic: handle banked enable bits for per-cpu interrupts
Rabin Vincent [Sun, 6 Nov 2011 16:01:08 +0000 (16:01 +0000)]
arm_gic: handle banked enable bits for per-cpu interrupts

The first enable set/clear register (which controls the PPIs and SGIs)
is supposed to be banked for each processor.  Currently it is just
handled globally and this prevents recent SMP Linux kernels from
booting, because CPU0 stops receiving localtimer interrupts when CPU1
disables them locally.

To fix this, allow the enable bits to be enabled per-cpu.  For SPIs,
always enable/disable ALL_CPU_MASK.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agovvfat: reorganize computation of disk geometry
Paolo Bonzini [Fri, 4 Nov 2011 16:21:53 +0000 (17:21 +0100)]
vvfat: reorganize computation of disk geometry

First determine FAT12/16/32, then compute geometry from that for both
FDD and HDD.  For 1.44MB floppies, and 2.88MB floppies using FAT16,
change to 1 sector/cluster.  The default remains 2.88MB with FAT12
and 2 sectors/cluster.  Both DOS and mkdosfs by default format a 2.88MB
floppy as FAT12.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: do not hardcode sector counts in error message
Paolo Bonzini [Wed, 5 Oct 2011 07:12:07 +0000 (09:12 +0200)]
vvfat: do not hardcode sector counts in error message

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: unify and correct computation of sector count
Paolo Bonzini [Wed, 5 Oct 2011 07:12:06 +0000 (09:12 +0200)]
vvfat: unify and correct computation of sector count

The sector count is stored in the partition and hence must not include the
sectors before its start.  At the same time, remove the useless special
casing for 1.44 MB floppies.  This fixes fsck on VVFAT hard disks,
which otherwise tries to seek past the end of the disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: need to use first_sectors_number to distinguish fdd/hdd
Paolo Bonzini [Wed, 5 Oct 2011 07:12:05 +0000 (09:12 +0200)]
vvfat: need to use first_sectors_number to distinguish fdd/hdd

This is consistent with what "real" floppies have, so file(1)
now actually recognizes the VVFAT image as a 1.44 MB floppy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: do not fail if the disk has spare sectors
Paolo Bonzini [Wed, 5 Oct 2011 07:12:04 +0000 (09:12 +0200)]
vvfat: do not fail if the disk has spare sectors

If the number of "faked sectors" + the number of sectors that are
part of a cluster does not sum up to the total number of sectors,
qemu-img convert fails.  Read these spare sectors as all zeros.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: fix out of bounds array_get usage
Paolo Bonzini [Wed, 5 Oct 2011 07:12:03 +0000 (09:12 +0200)]
vvfat: fix out of bounds array_get usage

When reading the address of the first free entry, you cannot
use array_get without first marking all entries as occupied.

This is visible if you change the sectors per cluster on a
floppy from 2 to 1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock/cloop: Use g_free instead of free
Dong Xu Wang [Wed, 2 Nov 2011 08:36:21 +0000 (16:36 +0800)]
block/cloop: Use g_free instead of free

Fix mismatching allocation and deallocation: g_free should be used to pair with
g_malloc.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed_by: Ray Wang <raywang@linux.vnet.ibm.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock/cloop: Fix coding style
Dong Xu Wang [Wed, 2 Nov 2011 08:36:20 +0000 (16:36 +0800)]
block/cloop: Fix coding style

Fix coding style in block/cloop.c.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed_by: Ray Wang <raywang@linux.vnet.ibm.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agodma: Avoid reentrancy in DMA transfer handlers
Kevin Wolf [Fri, 28 Oct 2011 09:28:13 +0000 (05:28 -0400)]
dma: Avoid reentrancy in DMA transfer handlers

With the conversion of the block layer to coroutines, bdrv_read/write
have changed to run a nested event loop that calls qemu_bh_poll.
Consequently a scheduled BH can be called while a DMA transfer handler
runs and this means that DMA_run becomes reentrant.

Devices haven't been designed to cope with that, so instead of running a
nested transfer handler just wait for the next invocation of the BH from the
main loop.

This fixes some problems with the floppy device.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: Fix multiwrite_f error handling
Kevin Wolf [Mon, 31 Oct 2011 10:49:21 +0000 (11:49 +0100)]
qemu-io: Fix multiwrite_f error handling

Without this fix, some qiovs can be leaked if an error occurs. Also a semicolon
at the end of the command line would make the code walk beyond the end of argv.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: Handle create_iovec errors
Kevin Wolf [Mon, 31 Oct 2011 10:36:32 +0000 (11:36 +0100)]
qemu-io: Handle create_iovec errors

Callers of create_iovec() didn't check for failure and continued with
uninitialised data in error cases. This patch adds checks to each call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMerge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
Blue Swirl [Wed, 2 Nov 2011 20:52:23 +0000 (20:52 +0000)]
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa

* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  xtensa_lx60: fix build date code and change memory region names
  xtensa_lx60: pass kernel arguments from -append
  xtensa_lx60: add FLASH support
  target-xtensa: raise an exception for invalid and reserved opcodes
  target-xtensa: handle cache options in the overlay tool
  target-xtensa: mask out undefined bits of WINDOWSTART SR

12 years agoMerge branch 'tci' of git://qemu.weilnetz.de/qemu
Blue Swirl [Wed, 2 Nov 2011 20:52:13 +0000 (20:52 +0000)]
Merge branch 'tci' of git://qemu.weilnetz.de/qemu

* 'tci' of git://qemu.weilnetz.de/qemu:
  tcg: Add tcg interpreter to configure / make
  tcg: Add tci disassembler
  tcg: Add interpreter for bytecode
  tcg: Add bytecode generator for tcg interpreter
  tcg: Make ARRAY_SIZE(tcg_op_defs) globally available
  tcg: TCG targets may define tcg_qemu_tb_exec

12 years agoMerge remote-tracking branch 'aneesh/for-upstream-8' into staging
Anthony Liguori [Wed, 2 Nov 2011 17:30:00 +0000 (12:30 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-8' into staging

12 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/int128' into staging
Anthony Liguori [Wed, 2 Nov 2011 17:28:59 +0000 (12:28 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/int128' into staging

12 years agoFix X86 CPU topology in KVM mode
Bharata B Rao [Wed, 2 Nov 2011 08:46:08 +0000 (14:16 +0530)]
Fix X86 CPU topology in KVM mode

apic id returned to guest kernel in ebx for cpuid(function=1) depends on
CPUX86State->cpuid_apic_id which gets populated after the cpuid information
is cached in the host kernel. This results in broken CPU topology in guest.

Fix this by setting cpuid_apic_id before cpuid information is passed to
the host kernel. This is done by moving the setting of cpuid_apic_id
to cpu_x86_init() where it will work for both KVM as well as TCG modes.

Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Bharata B Rao <bharata.rao@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agointel-hda: fix stream search
Gerd Hoffmann [Wed, 2 Nov 2011 11:56:14 +0000 (12:56 +0100)]
intel-hda: fix stream search

commit ba43d28916c4f51c19bd7366089155ce81bee058 introduces a bug:
The stream-not-found case doesn't error out any more, instead the
code silently uses the first stream.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio-blk: pass full status to the guest
Paolo Bonzini [Wed, 2 Nov 2011 12:19:40 +0000 (13:19 +0100)]
virtio-blk: pass full status to the guest

When SCSI passthrough is being used by the guest with virtio-blk, the
guest is not able to detect disk failures.  This is because the status
field is expected by the guest driver to include also the msg_status,
host_status and driver_status fields, but the device is only passing
down the SCSI status.

The patch fixes this, and also makes sure that the guest always sees a
CHECK_CONDITION status when there is valid sense data.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agohw/9pfs: use g_vasprintf() instead of rolling our own
Stefan Hajnoczi [Wed, 2 Nov 2011 07:27:15 +0000 (12:57 +0530)]
hw/9pfs: use g_vasprintf() instead of rolling our own

Markus Armbruster <armbru@redhat.com> sent fixes for va_list vararg
issues in v9fs_string_alloc_printf().  It turns out the function
duplicates g_vasprintf() and can therefore be eliminated entirely.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoxtensa_lx60: fix build date code and change memory region names
Max Filippov [Sun, 30 Oct 2011 17:18:27 +0000 (21:18 +0400)]
xtensa_lx60: fix build date code and change memory region names

Fix date code to uses MMDDYYYY notation.
Change memory region names to reflect specification that defines them.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoxtensa_lx60: pass kernel arguments from -append
Max Filippov [Sun, 30 Oct 2011 17:24:26 +0000 (21:24 +0400)]
xtensa_lx60: pass kernel arguments from -append

Create boot parameters in the end of SRAM region, insert kernel
arguments specified in -append there.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoxtensa_lx60: add FLASH support
Max Filippov [Sun, 30 Oct 2011 17:21:15 +0000 (21:21 +0400)]
xtensa_lx60: add FLASH support

LX60 carry 4 Mbyte FLASH and 128 Kbyte SRAM, LX200 carry 16 Mbyte FLASH
and 32 Mbyte SRAM. Either of these memories may be mapped to the system
ROM region.

Select boot from FLASH if -kernel option is not specified, otherwise
boot from SRAM.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: raise an exception for invalid and reserved opcodes
Max Filippov [Tue, 25 Oct 2011 14:24:09 +0000 (18:24 +0400)]
target-xtensa: raise an exception for invalid and reserved opcodes

This includes opcodes from disabled features and those marked reserved in the ISA.
Also end TB on opcodes that definitely generate an exception: illegal
instructions, syscall and privileged instructions.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: handle cache options in the overlay tool
Max Filippov [Mon, 24 Oct 2011 00:22:47 +0000 (04:22 +0400)]
target-xtensa: handle cache options in the overlay tool

Cache options must be enabled for the cores that have cache to avoid
illegal instruction exceptions.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: mask out undefined bits of WINDOWSTART SR
Max Filippov [Mon, 31 Oct 2011 21:51:02 +0000 (01:51 +0400)]
target-xtensa: mask out undefined bits of WINDOWSTART SR

According to ISA, table 5-156, bits 32:NAREG/4 of the WINDOWSTART SR
must be zero.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoBump version to 1.0-rc0 v1.0-rc0
Anthony Liguori [Wed, 2 Nov 2011 00:37:01 +0000 (19:37 -0500)]
Bump version to 1.0-rc0

Look out 1.0, here we come!

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "virtio: Add PCI memory BAR in addition to PIO BAR"
Anthony Liguori [Wed, 2 Nov 2011 00:32:21 +0000 (19:32 -0500)]
Revert "virtio: Add PCI memory BAR in addition to PIO BAR"

This reverts commit 46d95bfec7f9429d5228078219413d7e33496d65.

12 years agoMerge remote-tracking branch 'afaerber/cocoa-for-upstream' into staging
Anthony Liguori [Tue, 1 Nov 2011 22:29:24 +0000 (17:29 -0500)]
Merge remote-tracking branch 'afaerber/cocoa-for-upstream' into staging

12 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Tue, 1 Nov 2011 22:16:34 +0000 (02:16 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

12 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Tue, 1 Nov 2011 22:14:19 +0000 (02:14 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

12 years agotcg: Fix whitespace in tcg-op.h.
Richard Henderson [Tue, 1 Nov 2011 22:06:43 +0000 (15:06 -0700)]
tcg: Fix whitespace in tcg-op.h.

Removing the only tabs in the file.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
12 years agotcg: Fix regression in tcg_gen_deposit_i64.
Richard Henderson [Tue, 1 Nov 2011 22:06:42 +0000 (15:06 -0700)]
tcg: Fix regression in tcg_gen_deposit_i64.

The error being caused by the failure to copy the other half of
the input to the output after having narrowed the deposit operation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
12 years agopcnet: Add link state support
Jan Kiszka [Fri, 7 Oct 2011 10:27:25 +0000 (12:27 +0200)]
pcnet: Add link state support

Update lnkst on link state changes so that guests can obtain this
information via reading back the LED output pin. Works for Linux but
not for guests that depend on the missing PHY.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopcnet-pci: Fix PIO word access to PROM
Jan Kiszka [Mon, 26 Sep 2011 17:01:45 +0000 (19:01 +0200)]
pcnet-pci: Fix PIO word access to PROM

Implement the various IO access widths according to the spec. This
specifically unbreaks word and dword access to the PROM area that is
mapped into IO space. It also drops redundant upper limit checks and
spurious "return void".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopcnet: Move BCR defines to header
Jan Kiszka [Mon, 26 Sep 2011 17:01:44 +0000 (19:01 +0200)]
pcnet: Move BCR defines to header

This moves BCR defines to the common header and immediately makes use of
them to add BCR_APROMWE, replacing the open-coded write check in
pcnet_aprom_writeb.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoSort the help info shown in monitor at runtime
Wayne Xia [Wed, 12 Oct 2011 03:32:41 +0000 (11:32 +0800)]
Sort the help info shown in monitor at runtime

This patch would try sort the command list in monitor at runtime. As a result,
command help and help info would show a more friendly sorted command list.
For eg:
(qemu)help
acl_add
acl_policy
acl_remove
acl_reset
acl_show
balloon
block_passwd
...
the command list is sorted.

v3: using qsort function to sort the command list.

Tested-by: Wenyi Gao <wenyi@linux.vnet.ibm.com>
Signed-off-by: Wayne Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoevent_notifier: move to top-level directory
Avi Kivity [Tue, 27 Sep 2011 14:26:23 +0000 (17:26 +0300)]
event_notifier: move to top-level directory

Has no business in hw/.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMove filedescriptor parsing code from net.c into qemu_parse_fd()
Stefan Berger [Wed, 28 Sep 2011 10:41:32 +0000 (06:41 -0400)]
Move filedescriptor parsing code from net.c into qemu_parse_fd()

Move the parsing of a filedescriptor into a common function
qemu_parse_fd() so others can use it as well. Have net.c call this
function.

v2:
 - moving qemu_parse_fd into cutils.c

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: Suppress messages from pkg_config probe for check
Peter Maydell [Tue, 1 Nov 2011 18:32:55 +0000 (18:32 +0000)]
configure: Suppress messages from pkg_config probe for check

Suppress confusing messages from pkg_config when probing for
'check' by sending them to /dev/null as we do with other
similar probes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovirtio: Add PCI memory BAR in addition to PIO BAR
David Gibson [Fri, 30 Sep 2011 05:26:16 +0000 (15:26 +1000)]
virtio: Add PCI memory BAR in addition to PIO BAR

Currently, virtio devices are usually presented to the guest as an
emulated PCI device, virtio_pci.  Although the actual IO operations
are done through system memory, the configuration of the virtio device
is done through the one PCI IO space BAR that virtio_pci presents.

But PCI IO space (aka PIO) is deprecated for modern PCI devices, and
on some systems with many PCI domains accessing PIO space can be
problematic.  For example on the existing PowerVM implementation of
the PAPR spec, PCI PIO access is not supported at all.  We're hoping
that our KVM implementation will support PCI PIO (once we support PCI
at all), but it will probably have some irritating limitations.

This patch, therefore, extends the virtio_pci device to have a PCI
memory space (MMIO) BAR as well as the IO BAR.  The MMIO BAR contains
exactly the same registers, in exactly the same layout as the existing
PIO BAR.

Because the PIO BAR is still present, existing guest drivers should
still work fine.  With this change in place, future guest drivers can
check for an MMIO BAR and use that if present (falling back to PIO
when possible to support older qemu versions).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-uhci: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:58 +0000 (17:06 +1100)]
usb-uhci: Use PCI DMA stub functions

This updates the usb-uhci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-ehci: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:57 +0000 (17:06 +1100)]
usb-ehci: Use PCI DMA stub functions

This updates the usb-ehci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoPCI IDE: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:56 +0000 (17:06 +1100)]
PCI IDE: Use PCI DMA stub functions

This updates the PCI IDE device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agointel-hda: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:55 +0000 (17:06 +1100)]
intel-hda: Use PCI DMA stub functions

This updates the intel-hda device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopcnet-pci: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:54 +0000 (17:06 +1100)]
pcnet-pci: Use PCI DMA stub functions

This updates the pcnet-pci device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agolsi53c895a: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:53 +0000 (17:06 +1100)]
lsi53c895a: Use PCI DMA stub functions

This updates the lsi53c895a device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoe1000: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:52 +0000 (17:06 +1100)]
e1000: Use PCI DMA stub functions

This updates the e1000 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoes1370: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:51 +0000 (17:06 +1100)]
es1370: Use PCI DMA stub functions

This updates the es1370 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoac97: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:50 +0000 (17:06 +1100)]
ac97: Use PCI DMA stub functions

This updates the ac97 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoeepro100: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:49 +0000 (17:06 +1100)]
eepro100: Use PCI DMA stub functions

This updates the eepro100 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agortl8139: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:48 +0000 (17:06 +1100)]
rtl8139: Use PCI DMA stub functions

This updates the rtl8139 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd stub functions for PCI device models to do PCI DMA
David Gibson [Mon, 31 Oct 2011 06:06:47 +0000 (17:06 +1100)]
Add stub functions for PCI device models to do PCI DMA

This patch adds functions to pci.[ch] to perform PCI DMA operations.
At present, these are just stubs which perform directly cpu physical
memory accesses.  Stubs are included which are analogous to
cpu_physical_memory_{read,write}(), the stX_phys() and ldX_phys()
functions and cpu_physical_memory_{map,unmap}().

In addition, a wrapper around qemu_sglist_init() is provided, which
also takes a PCIDevice *.  It's assumed that _init() is the only
sglist function which will need wrapping, the idea being that once we
have IOMMU support whatever IOMMU context handle the wrapper derives
from the PCI device will be stored within the sglist structure for
later use.

Using these stubs, however, distinguishes PCI device DMA transactions from
other accesses to physical memory, which will allow PCI IOMMU support to
be added in one place, rather than updating every PCI driver at that time.

That is, it allows us to update individual PCI drivers to support an IOMMU
without having yet determined the details of how the IOMMU emulation will
operate.  This will let us remove the most bitrot-sensitive part of an
IOMMU patch in advance.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoUse dma_addr_t type for scatter/gather code
David Gibson [Mon, 31 Oct 2011 06:06:46 +0000 (17:06 +1100)]
Use dma_addr_t type for scatter/gather code

This patch uses the newly created dma_addr_t type throughout the
scatter/gather handling code in dma-helpers.c whenever we need to
represent a dma bus address.  This makes a better distinction as to
what is a bus address and what is a cpu physical address.  Since we
don't support IOMMUs yet, they can't be very different for now, but
that will change in future, and this preliminary helps clarify what's
going on.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoDefine DMA address and direction types
David Gibson [Mon, 31 Oct 2011 06:06:45 +0000 (17:06 +1100)]
Define DMA address and direction types

As a preliminary to adding more extensive DMA and IOMMU infrastructure
support into qemu, this patch defines a dma_addr_t for storing DMA bus
addresses and a DMADirection enum which describes whether a DMA is
from an external device to main memory or from main memory to an
external device.

For now dma_addr_t is just defined to be target_phys_addr_t, but in
future, we can change this to support machines where we have bus
addresses which don't necessarily have the same format as CPU physical
addresses.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agops2: migrate ledstate
Christophe Fergeau [Mon, 17 Oct 2011 11:37:34 +0000 (13:37 +0200)]
ps2: migrate ledstate

Make the ps2 device track its ledstate so that we can migrate it.
Otherwise it gets lost across migration, and spice-server gets
confused about the actual keyboard state and sends bogus
caps/scroll/num key events. This fixes RH bug #729294

We only need to migrate the state when it is different of the default
one (0).

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoui/vnc: Fix use of free() instead of g_free()
Stefan Weil [Fri, 7 Oct 2011 19:15:20 +0000 (21:15 +0200)]
ui/vnc: Fix use of free() instead of g_free()

Please note that mechlist still uses malloc / strdup / free.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocheckpatch: remove rule on non-indented labels
Paolo Bonzini [Fri, 7 Oct 2011 13:59:01 +0000 (15:59 +0200)]
checkpatch: remove rule on non-indented labels

There are 508 non-indented (non-default) labels, and 511 that are
indented.  So the rule is debatable at least.  Actually, in the
common case of labels at the outermost scope, there is really just
one place where to put the label, so the rule is just wrong IMHO.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>