]> git.proxmox.com Git - qemu.git/log
qemu.git
14 years agoImprove error reporting on file access
Justin M. Forbes [Thu, 1 Oct 2009 14:42:56 +0000 (09:42 -0500)]
Improve error reporting on file access

By making the error reporting include strerror(errno), it gives the user
a bit more indication as to why qemu failed.  This is particularly
important for people running qemu as a non root user.

Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoWin32: Fix vnc support.
Stefan Weil [Thu, 1 Oct 2009 18:53:12 +0000 (20:53 +0200)]
Win32: Fix vnc support.

Without this patch, qemu on windows crashes as soon
as a vnc client connects.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: fix miss merge
Juan Quintela [Mon, 5 Oct 2009 18:30:32 +0000 (20:30 +0200)]
x86: fix miss merge

There was a missmerge, and then we got a tail recursive call to cpu_post_load
without case base :)

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRename pci_create_noinit() to pci_create()
Markus Armbruster [Fri, 25 Sep 2009 01:53:53 +0000 (03:53 +0200)]
Rename pci_create_noinit() to pci_create()

It's qdev_create() specialized for PCI, so name it accordingly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_create() is now unused, remove it
Markus Armbruster [Fri, 25 Sep 2009 01:53:52 +0000 (03:53 +0200)]
pci_create() is now unused, remove it

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix pci_add nic not to exit on bad model
Markus Armbruster [Fri, 25 Sep 2009 01:53:51 +0000 (03:53 +0200)]
Fix pci_add nic not to exit on bad model

Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to
create the NIC.  When MODEL is unknown or "?", this prints to stderr
and terminates the program.

Change pci_nic_init() not to treat "?" specially, and to return NULL
on failure.  Switch uses during startup to new convenience wrapper
pci_nic_init_nofail(), which behaves just like pci_nic_init() used to
do.

Bonus bug fix: we now check for qdev_init() failing there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMake it obvious that pci_nic_init() can't fail
Markus Armbruster [Fri, 25 Sep 2009 01:53:50 +0000 (03:53 +0200)]
Make it obvious that pci_nic_init() can't fail

Before this patch, pci_nic_init() returns NULL when it can't find the
model in pci_nic_models[].  Except this can't happen, because
qemu_check_nic_model_list() just searched for model in
pci_nic_models[], and terminated the program on failure.

Repeating the search here is pointless.  Instead, change
qemu_check_nic_model_list() to return the model's array index.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix pci_add storage not to exit on bad first argument
Markus Armbruster [Fri, 25 Sep 2009 01:53:49 +0000 (03:53 +0200)]
Fix pci_add storage not to exit on bad first argument

Monitor command "pci_add ADDR storage ..." does its work in
qemu_pci_hot_add_nic().  It called pci_create(..., ADDR) to create the
device.  That's wrong, because pci_create() terminates the program
when ADDR is invalid.

Use pci_get_bus_devfn() and pci_create_noinit() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix pci_vga_init() not to ignore bus argument
Markus Armbruster [Fri, 25 Sep 2009 01:53:48 +0000 (03:53 +0200)]
Fix pci_vga_init() not to ignore bus argument

Commit a414c306 converted all VGA devices to qdev.  It used
pci_create_simple() for all devices, except for this one it used
pci_create().  That's wrong, because it uses PCI bus#0 regardless of
the bus argument.  Fix by switching to pci_create_noinit().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoset correct CS seg limit and flags on sipi
Gleb Natapov [Sun, 13 Sep 2009 08:19:51 +0000 (11:19 +0300)]
set correct CS seg limit and flags on sipi

TCG works with incorrect values somehow.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoSet revision in eeprom correctly for 82557 versions.
=?UTF-8?q?Reimar=20D=C3=B6ffinger?= [Sat, 12 Sep 2009 13:42:01 +0000 (15:42 +0200)]
Set revision in eeprom correctly for 82557 versions.

This is necessary to make FreeBSD recognize the device as 82557 - otherwise its
driver will use unsupported features and fail to work.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorestore CFLAGS check for conflict and fix recursive CFLAGS issue
Thomas Monjalon [Fri, 11 Sep 2009 16:45:40 +0000 (18:45 +0200)]
restore CFLAGS check for conflict and fix recursive CFLAGS issue

cc-option uses more make-syntax to replace the shell "if/else".

Issue with recursive += is fixed by doing the first assignment
simply-expanded, as explained in
http://www.gnu.org/software/make/manual/html_node/Appending.html

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-pci: return error if virtio_console_init fails
Amit Shah [Tue, 29 Sep 2009 10:21:04 +0000 (15:51 +0530)]
virtio-pci: return error if virtio_console_init fails

Currently only one virtio_console device is supported. Trying to add
multiple devices fails and such failure should be reported back to the
qdev init functions.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: show name of device that fails init
Amit Shah [Tue, 29 Sep 2009 10:21:03 +0000 (15:51 +0530)]
qdev: show name of device that fails init

When initialising a device fails, show the name of the failing device.

The current behaviour is to silently exit on such errors.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: Set invalid buffer pointers to NULL
Stefan Weil [Sat, 19 Sep 2009 19:00:09 +0000 (21:00 +0200)]
vnc: Set invalid buffer pointers to NULL

After qemu_free, the pointers for input and output
buffers are no longer valid, so set them to NULL
(most other calls of qemu_free in vnc.c use this
pattern, too).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoeepro100: Don't allow guests to fail assertions
Kevin Wolf [Wed, 23 Sep 2009 15:42:42 +0000 (17:42 +0200)]
eepro100: Don't allow guests to fail assertions

The idea of using assert() for input validation is rather questionable.
Let's remove it from eepro100, so that guests need to find more interesting
ways if they want to crash qemu.

This patch replaces asserts that are directly dependent on guest-accessible
data by other means of error handling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Increase maximum cluster size to 2 MB
Kevin Wolf [Tue, 15 Sep 2009 10:30:43 +0000 (12:30 +0200)]
qcow2: Increase maximum cluster size to 2 MB

This patch increases the maximum qcow2 cluster size to 2 MB. Starting with 128k
clusters, L2 tables span 2 GB or more of virtual disk space, causing 32 bit
truncation and wraparound of signed integers. Therefore some variables need to
use a larger data type.

While being at reviewing data types, change some integers that are used for
array indices to unsigned. In some places they were checked against some upper
limit but not for negative values. This could avoid potential segfaults with
corrupted qcow2 images.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/virtio-pci: remove unnecessary check
Michael S. Tsirkin [Tue, 22 Sep 2009 10:35:28 +0000 (13:35 +0300)]
qemu/virtio-pci: remove unnecessary check

it's safe to call msix_write_config if msix
is disabled, so call it unconditionally on
pci config write.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu: clean up target page usage in msix
Michael S. Tsirkin [Tue, 29 Sep 2009 16:53:26 +0000 (18:53 +0200)]
qemu: clean up target page usage in msix

Since cpu_register_phys_memory does not require size to be a multiple of
target page size, simply make msix page size 0x1000.  Do this in msix,
reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no
longer have to pass target page around.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix comment on cpu_register_physical_memory_offset
Michael S. Tsirkin [Tue, 29 Sep 2009 16:53:16 +0000 (18:53 +0200)]
fix comment on cpu_register_physical_memory_offset

We don't require full pages in cpu_register_physical_memory,
except for RAM.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/pci: reset device registers on bus reset
Michael S. Tsirkin [Wed, 16 Sep 2009 10:41:09 +0000 (13:41 +0300)]
qemu/pci: reset device registers on bus reset

Reset BARs and a couple of other registers on bus reset, as per PCI
spec.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/pci: refactor code/symbolic constants
Michael S. Tsirkin [Wed, 16 Sep 2009 10:40:57 +0000 (13:40 +0300)]
qemu/pci: refactor code/symbolic constants

refactor code slightly, adding symbolic constants and functions, and
using macros where possible.  This will also make following reset
patches easier.

No functional changes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/virtio: fix reset with device removal
Michael S. Tsirkin [Wed, 16 Sep 2009 10:40:37 +0000 (13:40 +0300)]
qemu/virtio: fix reset with device removal

virtio pci registers its own reset handler, but fails to unregister it,
which will lead to crashes after device removal.  Solve this problem by
switching to qdev reset handler, which is automatically unregistered.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/qdev: type safety in reset handler
Michael S. Tsirkin [Wed, 16 Sep 2009 10:40:27 +0000 (13:40 +0300)]
qemu/qdev: type safety in reset handler

Add type safety to qdev reset handlers, by declaring them as
DeviceState * rather than void *.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoserial: convert isa to qdev
Gerd Hoffmann [Tue, 22 Sep 2009 11:53:21 +0000 (13:53 +0200)]
serial: convert isa to qdev

Everything using standard isa I/O ports and IRQ windup is considerd
being an actual isa device.  That are all serial_init() users except
mips_mipssim() which seems to have a non-standard IRQ windup.

baud rate is fixed at 115200 now as no caller passed in something else.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: don't crash on unset drive properties.
Gerd Hoffmann [Tue, 22 Sep 2009 11:53:20 +0000 (13:53 +0200)]
qdev: don't crash on unset drive properties.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofloppy: move dma setup + drive connect to fdctrl_init_common()
Gerd Hoffmann [Tue, 22 Sep 2009 11:53:19 +0000 (13:53 +0200)]
floppy: move dma setup + drive connect to fdctrl_init_common()

isa-fdc is completely qdev-ified with this patch applied, all
configuration uses properties.

sysbus-fdc needs dma_channel config fixed.  There is only one user
(mips_jazz) which uses dma channel 0.  Can anyone knowing this
platform suggest how to deal with it?  Is hardcoding fine?

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofloppy: add drive properties.
Gerd Hoffmann [Tue, 22 Sep 2009 11:53:18 +0000 (13:53 +0200)]
floppy: add drive properties.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agostore a pointer to QemuOpts in DeviceState, release it when zapping a device.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:49 +0000 (21:42 +0200)]
store a pointer to QemuOpts in DeviceState, release it when zapping a device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoallow if=none for drive_add
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:48 +0000 (21:42 +0200)]
allow if=none for drive_add

Allow adding unconnected host drives by specifying if=none like it is
possible with -drive.  They can be put in use with drive attributes,
like this:

  drive_add dummy if=none,id=mydisk,file=/some/disk.img
  device_add virtio-blk-pci,drive=mydisk

which is the monitor aequivalent to these command line switches:

  -drive if=none,id=mydisk,file=/some/disk.img
  -device virtio-blk-pci,drive=mydisk

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorefactor drive_hot_add
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:47 +0000 (21:42 +0200)]
refactor drive_hot_add

move pci device lookup into the "case IF_SCSI" section, so we
can do something else for other interface types.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodrive cleanup fixes.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:46 +0000 (21:42 +0200)]
drive cleanup fixes.

Changes:
  * drive_uninit() wants a DriveInfo now.
  * drive_uninit() also calls bdrv_delete(),
    so callers don't need to do that.
  * drive_uninit() calls are moved over to the ->exit()
    callbacks, destroy_bdrvs() is zapped.
  * setting bdrv->private is not needed any more as the
    only user (destroy_bdrvs) is gone.
  * usb-storage needs no drive_uninit, scsi-disk will
    handle that.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: windup acpi-based hotplug
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:45 +0000 (21:42 +0200)]
pci: windup acpi-based hotplug

Switch over acpi-based PCI hotplug for pc over to the new
qdev-based pci hotplugging.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: hotplug windup
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:44 +0000 (21:42 +0200)]
pci: hotplug windup

Create qdev infrastructure for pci hotplug.  PCI bus implementations
must register a handler for hotplug.  Creating a new PCI device will
automagically hot-plug it in case the PCI bus in question supports this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: hotplug windup
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:43 +0000 (21:42 +0200)]
scsi: hotplug windup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb: hotplug windup
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:42 +0000 (21:42 +0200)]
usb: hotplug windup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev hotplug: infrastructure and monitor commands.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:41 +0000 (21:42 +0200)]
qdev hotplug: infrastructure and monitor commands.

Adds device_add and device_del commands.  device_add accepts accepts
the same syntax like the -device command line switch.  device_del
expects a device id.  So you should tag your devices with ids if you
want to remove them later on, like this:

  device_add pci-ohci,id=ohci
  device_del ohci

Unplugging via pci_del or usb_del works too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoswitch qemu-config to qemu_error
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:40 +0000 (21:42 +0200)]
switch qemu-config to qemu_error

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb: hook unplug into qdev, cleanups + fixes.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:39 +0000 (21:42 +0200)]
usb: hook unplug into qdev, cleanups + fixes.

Hook into DeviceInfo->exit().

handle_destroy() must not free the state struct, this is handled
by the new usb_qdev_exit() function now.

qdev_free(usb_device) works now.

Fix usb hub to qdev_free() all connected devices on unplug.
Unplugging a usb hub works now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: move unregister from PCIDevice to PCIDeviceInfo
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:38 +0000 (21:42 +0200)]
pci: move unregister from PCIDevice to PCIDeviceInfo

One more cleanup while being at it ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use qdev for device destruction.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:37 +0000 (21:42 +0200)]
pci: use qdev for device destruction.

pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoImplement scsi device destruction
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:36 +0000 (21:42 +0200)]
Implement scsi device destruction

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd exit callback to DeviceInfo.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:35 +0000 (21:42 +0200)]
Add exit callback to DeviceInfo.

This adds a exit callback for device destruction to DeviceInfo, so
we can hook cleanups into qdev device destruction.

Followup patches will put that into use.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: device free fixups.
Gerd Hoffmann [Fri, 25 Sep 2009 19:42:34 +0000 (21:42 +0200)]
qdev: device free fixups.

Two bug fixes:
 * When freeing a device we unregister even stuff we didn't register in
   the first place because the ->init() callback failed.
 * When freeing a device with child busses attached, we fail to zap the
   child bus (and the devices attached to it).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoparallel: convert isa to qdev
Gerd Hoffmann [Tue, 22 Sep 2009 11:53:22 +0000 (13:53 +0200)]
parallel: convert isa to qdev

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoupdate pc-bios/bios.bin
Gerd Hoffmann [Tue, 22 Sep 2009 09:47:40 +0000 (11:47 +0200)]
update pc-bios/bios.bin

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoupdate pcbios submodule to current master
Gerd Hoffmann [Tue, 22 Sep 2009 09:47:39 +0000 (11:47 +0200)]
update pcbios submodule to current master

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopiix_pci: kill PIIX3IrqState
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:33 +0000 (22:25 +0200)]
piix_pci: kill PIIX3IrqState

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoconvert pci bridge to qdev
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:32 +0000 (22:25 +0200)]
convert pci bridge to qdev

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosupport inplace allocation for pci bus, split irq init.
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:31 +0000 (22:25 +0200)]
support inplace allocation for pci bus, split irq init.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoswitch ide bus to inplace allocation.
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:30 +0000 (22:25 +0200)]
switch ide bus to inplace allocation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoswitch usb bus to inplace allocation.
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:29 +0000 (22:25 +0200)]
switch usb bus to inplace allocation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoswitch scsi bus to inplace allocation.
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:28 +0000 (22:25 +0200)]
switch scsi bus to inplace allocation.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoallow qdev busses allocations be inplace
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:27 +0000 (22:25 +0200)]
allow qdev busses allocations be inplace

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotemporary fix for on_vcpu
Glauber Costa [Thu, 17 Sep 2009 18:10:06 +0000 (20:10 +0200)]
temporary fix for on_vcpu

Recent changes made on_vcpu hit the abort() path, even with the IO thread
disabled. This is because cpu_single_env is no longer set when we call this
function. Although the correct fix is a little bit more complicated that that,
the recent thread in which I proposed qemu_queue_work (which fixes that, btw),
is likely to go on a quite different direction.

So for the benefit of those using guest debugging, I'm proposing this simple
fix in the interim.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokvm: Fix guest single-stepping
Jan Kiszka [Thu, 17 Sep 2009 18:05:58 +0000 (20:05 +0200)]
kvm: Fix guest single-stepping

Hopefully the last regression of 4c0960c0: KVM_SET_GUEST_DEBUG requires
properly synchronized guest registers (on x86: eflags) on entry.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agogdbstub: x86: Switch 64/32 bit registers dynamically
Jan Kiszka [Thu, 17 Sep 2009 16:14:13 +0000 (18:14 +0200)]
gdbstub: x86: Switch 64/32 bit registers dynamically

Commit 56aebc891674cd2d07b3f64183415697be200084 changed gdbstub in way
that debugging 32 or 16-bit guest code is no longer possible with qemu
for x86_64 guest CPUs. Since that commit, qemu only provides registers
sets for 64-bit, forcing current and foreseeable gdb to also switch its
architecture to 64-bit. And this breaks if the inferior is 32 or 16 bit.

No question, this is a gdb issue. But, as it was confirmed in several
discusssions with gdb people, it is a non-trivial thing to fix. So until
qemu finds a gdb version attach with a rework x86 support, we have to
work around it by switching the register layout as the guest switches
its execution mode between 16/32 and 64 bit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoEnable host-clock-based RTC
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Enable host-clock-based RTC

Switch RTC emulations to the new host_clock instead of vm_clock by
default. This has the advantage that the emulated RTC will follow
automatically the host time while it might be tuned via NTP. vm_clock
can still be selected by passing '-rtc clock=vm' on the command line.

Note that some RTC emulations (at least M48T59) already use the host
time unconditionally while others (namely MC146818) do not. This patch
introduces the required infrastructure for selecting the base clock but
only converts MC146818 for now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRefactor RTC command line switches
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Refactor RTC command line switches

Deprecate -localtime, -setdate and -rtc-td-hack in favor of a new
unified command line switch:

    -rtc [base=utc|localtime|date][,driftfix=none|slew]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoIntroduce QEMU_CLOCK_HOST
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Introduce QEMU_CLOCK_HOST

Despite its name QEMU_CLOCK_REALTIME is (normally) not using
CLOCK_REALTIME / the host system time as base. In order to allow also
non-trivial RTC emulations (MC146818) to follow the host time instead of
the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It
is unconditionally based on CLOCK_REALTIME, thus will follow system time
changes of the host.

The only limitation of its current implementation is that pending
host_clock timers may not fire early if the host time is pushed forward
beyond their expiry. So far no urgent need to overcome this limitation
was identified, so it's left as simple as it is (expiry on next alarm
timer tick).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agowin32: Drop dead dyntick timer code
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
win32: Drop dead dyntick timer code

nearest_delta_us is calculated but not used. Drop it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRename QEMU_TIMER_* to QEMU_CLOCK_*
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Rename QEMU_TIMER_* to QEMU_CLOCK_*

These constants select clocks, not timers. And init_timers initializes
clocks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix exit on 'pci_add' Monitor command
Luiz Capitulino [Thu, 24 Sep 2009 14:16:01 +0000 (11:16 -0300)]
Fix exit on 'pci_add' Monitor command

If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error.

This function is used by the startup code, where it makes
sense to exit on error, but in the Monitor it doesn't.

Changing qemu_check_nic_model_list() to not exit on error
is not possible though, as it's used by the board init
code (the PC one), where all board specific code must have
void return.

The way I've chosen to fix this was to introduce a new function
called pci_nic_supported(), which checks if the NIC is supported
and returns true or false accordingly.

The new function is used only by the Monitor, it performs the
necessary check and returns an error in case the NIC is not
supported, thus qemu_check_nic_model_list()'s exit is never trigged.

The following should be observed:

1. Only the specified NIC is checked, the default one is assumed
to be supported

2. The NIC query command (model=?) won't work with pci_add, the
right way to do this with the Monitor is to add a new command

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoCorrectly free nd structure
Glauber Costa [Thu, 17 Sep 2009 20:53:39 +0000 (16:53 -0400)]
Correctly free nd structure

When we "free" a NICInfo structure, we can leak pointers, since we don't do
much more than setting used = 0.

We free() the model parameter, but we don't set it to NULL. This means that
a new user of this structure will see garbage in there. It was not noticed
before because reusing a NICInfo is not that common, but it can be, for
users of device pci hotplug.

A user hit it, described at https://bugzilla.redhat.com/show_bug.cgi?id=524022

This patch memset's the whole structure, guaranteeing that anyone reusing it
will see a fresh NICinfo. Also, we free some other strings that are currently
leaking.

This codebase is quite old, so this patch should feed all stable trees.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodo proper cpu_self check
Glauber Costa [Mon, 28 Sep 2009 18:27:44 +0000 (15:27 -0300)]
do proper cpu_self check

Currently, our check for qemu_cpu_self only checks if there is a cpu
currently in execution (represented by cpu_single_env being set). While
this might be okay for tcg, it is certainly not okay for kvm, since multiple
cpus might be executing.

Instead, I propose we use pthread primitives to test if the caller thread is
the same as env->thread.

For tcg, it will have the same semantics as before, since all CPUStates will
point to the same thread, and we'll only have one in execution at a time.

Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agobdf: Remove last users of FALSE/TRUE
Juan Quintela [Tue, 29 Sep 2009 23:10:56 +0000 (01:10 +0200)]
bdf: Remove last users of FALSE/TRUE

This brings bfd_boolean to the wonderful world of <stdbool.h>, it is needed
because it defines bdf_boolean as an enum with values true and false,
and some architectures use TRUE, FALSE and give problems when you try to use
<stdbool.h>

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd -Wold-style-* flags
Juan Quintela [Tue, 29 Sep 2009 23:10:55 +0000 (01:10 +0200)]
Add -Wold-style-* flags

This time, I add them in configure only if target compiler supports it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoslirp: It needs to use QEMU_CFLAGS not CFLAGS
Juan Quintela [Tue, 29 Sep 2009 23:10:54 +0000 (01:10 +0200)]
slirp: It needs to use QEMU_CFLAGS not CFLAGS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Add VMState support
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Add VMState support

Register all relevant fields of Musicpal device states with the VMState
framework. This involves a few type changes of state variables.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Make PIT emulation more robust
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Make PIT emulation more robust

Stop the periodic timers of the PIT on reset, disabling via the control
register and invalid parameters.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: True reset support for audio device
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: True reset support for audio device

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: True reset support for GPIO
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: True reset support for GPIO

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Coding style fixes
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Coding style fixes

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Clean up typecasts
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Clean up typecasts

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Rework GPIO input events
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Rework GPIO input events

The qdev_gpio conversion of 343ec8e caused come polarity mismatch of key
event pins and left an overly complex solution behind. Take this chance
and refactor the GPIO input system of the Musicpal, moving it closer to
reality:
 - Instantiate all 32 GPIO input pins and do the routing only via
   qdev_connect_gpio_out.
 - Implement IMR and IER registers. They manage the GPIO pin IRQ. IMR
   seems to enable IRQs on rising edges, IER on falling ones. At least
   this matches what the Musicpal fireware require.
 - Move key pin logic inversion from the GPIO layer to musicpal_key.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomusicpal: Catch null TX qeueues
Jan Kiszka [Fri, 18 Sep 2009 18:51:22 +0000 (20:51 +0200)]
musicpal: Catch null TX qeueues

They likely represent invalid queues that should be skipped. We already
do this for RX queues. Wish I had a spec...

Credits go to malc for analyzing the issue and suggesting this fix.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: port cpu to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:08 +0000 (22:49 +0200)]
x86: port cpu to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmstate: Add suppot for field_exist() test
Juan Quintela [Tue, 29 Sep 2009 20:49:07 +0000 (22:49 +0200)]
vmstate: Add suppot for field_exist() test

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: factor out cpu_get/put_fpreg()
Juan Quintela [Tue, 29 Sep 2009 20:49:06 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_fpreg()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: factor out cpu_get/put_mttr_var()
Juan Quintela [Tue, 29 Sep 2009 20:49:05 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_mttr_var()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: factor out cpu_get/put_xmm_reg()
Juan Quintela [Tue, 29 Sep 2009 20:49:04 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_xmm_reg()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: factor out cpu_pre/post_load()
Juan Quintela [Tue, 29 Sep 2009 20:49:03 +0000 (22:49 +0200)]
x86: factor out cpu_pre/post_load()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: factor out cpu_pre_save()
Juan Quintela [Tue, 29 Sep 2009 20:49:02 +0000 (22:49 +0200)]
x86: factor out cpu_pre_save()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: port segments to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:01 +0000 (22:49 +0200)]
x86: port segments to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd *TL functions to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:00 +0000 (22:49 +0200)]
Add *TL functions to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: split MTRRVar union
Juan Quintela [Tue, 29 Sep 2009 20:48:59 +0000 (22:48 +0200)]
x86: split MTRRVar union

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: split FPReg union
Juan Quintela [Tue, 29 Sep 2009 20:48:58 +0000 (22:48 +0200)]
x86: split FPReg union

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: mcg_cap is never 0
Juan Quintela [Tue, 29 Sep 2009 20:48:57 +0000 (22:48 +0200)]
x86: mcg_cap is never 0

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: send mce_banks as an array
Juan Quintela [Tue, 29 Sep 2009 20:48:56 +0000 (22:48 +0200)]
x86: send mce_banks as an array

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: mce_banks always have the same size
Juan Quintela [Tue, 29 Sep 2009 20:48:55 +0000 (22:48 +0200)]
x86: mce_banks always have the same size

mce_banks is always MCE_BANKS_DEF * 4 in size, value never change

CC: Huang Ying <ying.huang@intel.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: add fpregs_format_vmstate
Juan Quintela [Tue, 29 Sep 2009 20:48:54 +0000 (22:48 +0200)]
x86: add fpregs_format_vmstate

Don't even ask, being able to load/save between 64<->80bit floats should be forbidden

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: add pending_irq_vmstate to the state
Juan Quintela [Tue, 29 Sep 2009 20:48:53 +0000 (22:48 +0200)]
x86: add pending_irq_vmstate to the state

It is needed to save the interrupt_bitmap

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: add fptag_vmstate to the state
Juan Quintela [Tue, 29 Sep 2009 20:48:52 +0000 (22:48 +0200)]
x86: add fptag_vmstate to the state

It is needed to store fptags

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: fpus is uint16_t not unsigned int
Juan Quintela [Tue, 29 Sep 2009 20:48:51 +0000 (22:48 +0200)]
x86: fpus is uint16_t not unsigned int

We save more that fpus on that 16 bits (fpstt), we need an additional field

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: fpuc is uint16_t not unsigned int
Juan Quintela [Tue, 29 Sep 2009 20:48:50 +0000 (22:48 +0200)]
x86: fpuc is uint16_t not unsigned int

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: make a20_mask int32_t
Juan Quintela [Tue, 29 Sep 2009 20:48:49 +0000 (22:48 +0200)]
x86: make a20_mask int32_t

This makes the savevm code correct, and sign extensins gives us exactly
what we need (namely, sign extend to 64 bits when used with 64bit addresess.

Once there, change 0x100000 for 1 << 20, that maks all a20 use the same syntax.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agox86: hflags is not modified at all, just save it directly
Juan Quintela [Tue, 29 Sep 2009 20:48:48 +0000 (22:48 +0200)]
x86: hflags is not modified at all, just save it directly

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmstate: remove i2c_slave_load/save
Juan Quintela [Tue, 29 Sep 2009 20:48:44 +0000 (22:48 +0200)]
vmstate: remove i2c_slave_load/save

All its users moved to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmstate: port lm832x device
Juan Quintela [Tue, 29 Sep 2009 20:48:43 +0000 (22:48 +0200)]
vmstate: port lm832x device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolm832x: make fields to have the same types that they are saved/loaded
Juan Quintela [Tue, 29 Sep 2009 20:48:42 +0000 (22:48 +0200)]
lm832x: make fields to have the same types that they are saved/loaded

They were saved as uint8_t already.  To make things simpler, I just
reg == -1 used to indicate an error, I create LM832x_GENERAL_ERROR
with vale 0xff to represet it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>