sdk/emulator/qemu.git
14 years agoqcow2: Return real error code in load_refcount_block
Kevin Wolf [Fri, 4 Jun 2010 09:27:08 +0000 (11:27 +0200)]
qcow2: Return real error code in load_refcount_block

This fixes load_refcount_block which completely ignored the return value of
write_refcount_block and always returned -EIO for bdrv_pwrite failure.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Allow alloc_clusters_noref to return errors
Kevin Wolf [Fri, 4 Jun 2010 09:22:39 +0000 (11:22 +0200)]
qcow2: Allow alloc_clusters_noref to return errors

Currently it would consider blocks for which get_refcount fails used. However,
it's unlikely that get_refcount would succeed for the next cluster, so it's not
really helpful. Return an error instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Allow get_refcount to return errors
Kevin Wolf [Fri, 4 Jun 2010 09:16:11 +0000 (11:16 +0200)]
qcow2: Allow get_refcount to return errors

get_refcount might need to load a refcount block from disk, so errors may
happen. Return the error code instead of assuming a refcount of 1 and change
the callers to respect error return values.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovpc: Read/write multiple sectors at once
Kevin Wolf [Fri, 4 Jun 2010 07:49:04 +0000 (09:49 +0200)]
vpc: Read/write multiple sectors at once

This changes the vpc block driver (for VHD) to read/write multiple sectors at
once instead of doing a request for each single sector.

Before this, running qemu-iotests for VPC took ages, now it's actually quite
reasonable to run it always (down from ~1 hour to 40 seconds for me).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoAdd exit notifiers.
Gerd Hoffmann [Fri, 4 Jun 2010 12:08:07 +0000 (14:08 +0200)]
Add exit notifiers.

Hook up any cleanup work which needs to be done here.  Advantages over
using atexit(3):

  (1) You get passed in a pointer to the notifier.  If you embed that
      into your state struct you can use container_of() to get get your
      state info.
  (2) You can unregister, say when un-plugging a device.

[ v2: move code out of #ifndef _WIN32 ]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoacpi_piix4: save gpe and pci hotplug slot status
Alex Williamson [Wed, 2 Jun 2010 16:58:29 +0000 (10:58 -0600)]
acpi_piix4: save gpe and pci hotplug slot status

PCI hotplug currently doesn't work after a migration because
we don't migrate the enable bits of the GPE state.  Pull hotplug
structs into vmstate.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-option: Reject anti-social IDs
Markus Armbruster [Tue, 8 Jun 2010 11:54:26 +0000 (13:54 +0200)]
qemu-option: Reject anti-social IDs

Restrict IDs to letters, digits, '-', '.', '_', starting with a
letter.

This takes care of '/' in qdev IDs breaking qbus_find().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Revert the hack to let -net nic and pci_add set qdev ID
Markus Armbruster [Tue, 8 Jun 2010 11:54:04 +0000 (13:54 +0200)]
qdev: Revert the hack to let -net nic and pci_add set qdev ID

Setting the ID in pci_nic_init() is a blatant violation of the
DeviceState abstraction.  Which even carries a comment advising
against this:

/* This structure should not be accessed directly.  We declare it here
   so that it can be embedded in individual device state structures.  */

What's worse, it bypasses the code ensuring unique qdev IDs: "-device
virtio-net-pci,id=foo -net nic,id=foo -net nic,name=foo" happily
creates three qdevs with ID "foo".  That's because qdev relies on
qemu_opts_create() to ensure unique IDs, but -net nic uses a different
QemuOptsList, which means id is in a different namespace.  And its
name is not checked for uniqueness at all.

-net nic and pci_add are legacy.  Use -device and device_add if you
want a NIC with a qdev ID.

This reverts what's still left of commit eb54b6dc "qdev: add id=
support for pci nics."

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoClarify error message when a PCI slot is already in use (v2)
Daniel P. Berrange [Tue, 8 Jun 2010 14:24:25 +0000 (15:24 +0100)]
Clarify error message when a PCI slot is already in use (v2)

When mistakenly configuring two devices in the same PCI slot,
QEMU gives a not entirely obvious message about a 'devfn' being
in use:

$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,addr=0x3: PCI: devfn 24 not available for virtio-balloon-pci, in use by rtl8139

The user does not configure 'devfn' numbers, they use slot+function.
Thus the error messages should be reported back to the user with that
same terminology rather than the internal QEMU terminology. This
patch makes it report:

$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
qemu: -device virtio-balloon-pci,bus=pci.0,addr=0x3.7: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by rtl8139

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-blk: simplify multiwrite calling conventions
Christoph Hellwig [Tue, 8 Jun 2010 16:26:07 +0000 (18:26 +0200)]
virtio-blk: simplify multiwrite calling conventions

Pass the MultiReqBuffer structure down all the way to the I/O submission
instead of takin it apart.  Also mark num_writes unsigned as it can't
go negative, and take the check for any pending I/O requests into the
submission function.  Last but not least rename do_multiwrite to
virtio_submit_multiwrite to fit the general naming scheme and make clear
what it does.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-blk: stop tracking old_bs
Christoph Hellwig [Tue, 8 Jun 2010 16:25:54 +0000 (18:25 +0200)]
virtio-blk: stop tracking old_bs

There is a 1:1 relation between VirtIOBlock and BlockDriverState instances,
no need to track it because it won't change.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoun-register kbd driver in case of USB kbd unplug.
Jes Sorensen [Tue, 8 Jun 2010 13:12:18 +0000 (15:12 +0200)]
un-register kbd driver in case of USB kbd unplug.

If a USB keyboard is unplugged, the keyboard eventhandler is never
removed, and events will continue to be passed through to the device,
causing crashes or memory corruption.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomake qemu_thread_create block all signals
Paolo Bonzini [Thu, 3 Jun 2010 13:20:32 +0000 (15:20 +0200)]
make qemu_thread_create block all signals

All signals will thus be routed through the IO thread.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration-tcp: call migrate_fd_error() instead of close() and free().
Yoshiaki Tamura [Wed, 9 Jun 2010 21:50:10 +0000 (06:50 +0900)]
migration-tcp: call migrate_fd_error() instead of close() and free().

This patch fixes the following error report.  When changing
migration-tcp.c to call migrate_fd_error() instead of close() and
free() by itself, monitor is resumed, and returns allocated mig_state
is set to current_migration in migration.c allows us to print "info
migrate".

Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration: use qemu_free() instead of free().
Yoshiaki Tamura [Wed, 9 Jun 2010 05:44:31 +0000 (14:44 +0900)]
migration: use qemu_free() instead of free().

Although there is no difference, other migration related code use
qemu_free(), and it should be better to be consistent.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoetrax-ser: Support the uart rx fifo.
Edgar E. Iglesias [Mon, 14 Jun 2010 16:41:12 +0000 (18:41 +0200)]
etrax-ser: Support the uart rx fifo.

Add support for the rx fifo to speed up bulk transfers.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
14 years agoram_blocks: Convert to a QLIST
Alex Williamson [Fri, 11 Jun 2010 17:11:42 +0000 (11:11 -0600)]
ram_blocks: Convert to a QLIST

This makes the RAM block list easier to manipulate.  Also incorporate
relevant variables into the RAMList struct.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Chris Wright <chrisw@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMake netdev_del delete the netdev even when it's in use
Markus Armbruster [Fri, 11 Jun 2010 12:21:34 +0000 (14:21 +0200)]
Make netdev_del delete the netdev even when it's in use

To hot-unplug guest and host part of a network device, you do:

    device_del NIC-ID
    netdev_del NETDEV-ID

For PCI devices, device_del merely tells ACPI to unplug the device.
The device goes away for real only after the guest processed the ACPI
unplug event.

You have to wait until then (e.g. by polling info pci) before you can
unplug the netdev.  Not good.

Fix by removing the "in use" check from do_netdev_del().  Deleting a
netdev while it's in use is safe; packets simply get routed to the bit
bucket.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopass info about hpets to seabios.]
Gleb Natapov [Mon, 14 Jun 2010 08:29:28 +0000 (11:29 +0300)]
pass info about hpets to seabios.]

Currently HPET ACPI table is created regardless of whether qemu actually
created hpet device. This may confuse some guests that don't check that
hpet is functional before using it. Solve this by passing info about
hpets in qemu to seabios via fw config interface. Additional benefit is
that seabios no longer uses hard coded hpet configuration. Proposed
interface supports up to 8 hpets. This is the number defined by hpet
spec.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agohpet: Init capability register only once
Jan Kiszka [Mon, 14 Jun 2010 06:40:29 +0000 (08:40 +0200)]
hpet: Init capability register only once

The capability register is read-only from guest POV, so we do not need
to update it on reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-option: Fix uninitialized value in append_option_parameter
Kevin Wolf [Fri, 11 Jun 2010 08:19:41 +0000 (10:19 +0200)]
qemu-option: Fix uninitialized value in append_option_parameter

When dest is NULL, i.e. a new copy of the list is created, we don't get a
properly terminated list after the realloc. Initialize it as an empty list.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoChange #define DEBUG to #define E1000_DEBUG in hw/e1000.c
Jes Sorensen [Mon, 14 Jun 2010 15:05:17 +0000 (17:05 +0200)]
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c

Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c to make
it possible to build QEMU with -DDEBUG

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRemove unused DEBUG defines from hw/msix.c
Jes Sorensen [Mon, 14 Jun 2010 15:05:16 +0000 (17:05 +0200)]
Remove unused DEBUG defines from hw/msix.c

Remove unused DEBUG defines from hw/msix.c to avoid having anything
define the word DEBUG without any additions such as MSIX_DEBUG.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 14 Jun 2010 15:33:36 +0000 (10:33 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

Conflicts:
hw/pc.c

14 years agoMerge remote branch 'qmp/for-anthony' into staging
Anthony Liguori [Mon, 14 Jun 2010 14:39:01 +0000 (09:39 -0500)]
Merge remote branch 'qmp/for-anthony' into staging

14 years agoOHCI address decoding fix
Paul Brook [Sun, 13 Jun 2010 22:37:31 +0000 (23:37 +0100)]
OHCI address decoding fix

Ignore high address bits when PCI memory window is not mapped on a page
boundary.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoMove stdbool.h
Paul Brook [Sun, 13 Jun 2010 18:00:50 +0000 (19:00 +0100)]
Move stdbool.h

Move inclusion of stdbool.h to common header files, instead of including
in an ad-hoc manner.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agomonitor/QMP: Drop info hpet / query-hpet
Jan Kiszka [Sun, 13 Jun 2010 12:15:46 +0000 (14:15 +0200)]
monitor/QMP: Drop info hpet / query-hpet

This command was of minimal use before, now it is useless as the hpet
become a qdev device and is thus easily discoverable. We should
definitely not set query-hpet in QMP's stone, and there is also no good
reason to keep it for the interactive monitor.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Add MSI support
Jan Kiszka [Sun, 13 Jun 2010 12:15:45 +0000 (14:15 +0200)]
hpet: Add MSI support

This implements the HPET capability of routing IRQs to the front-side
bus, aka MSI support. This feature can be enabled via the qdev property
"msi" and is off by default.

Note that switching it on can cause guests (at least Linux) to use the
HPET as timer instead of the LAPIC. KVM users should recall that only
the latter is currently available as fast in-kernel model.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Make number of timers configurable
Jan Kiszka [Sun, 13 Jun 2010 12:15:44 +0000 (14:15 +0200)]
hpet: Make number of timers configurable

One HPET block supports up to 32 timers. Allow to instantiate more than
the recommended and implemented minimum of 3. The number is configured
via the qdev property "timers". It is also saved/restored so that it
need not match between migration peers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovmstate: Add VMSTATE_STRUCT_VARRAY_UINT8
Jan Kiszka [Sun, 13 Jun 2010 12:15:43 +0000 (14:15 +0200)]
vmstate: Add VMSTATE_STRUCT_VARRAY_UINT8

Required for hpet.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Add support for level-triggered interrupts
Jan Kiszka [Sun, 13 Jun 2010 12:15:42 +0000 (14:15 +0200)]
hpet: Add support for level-triggered interrupts

By implementing this feature we can also remove a nasty way to kill qemu
(by trying to enable level-triggered hpet interrupts).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Drop static state
Jan Kiszka [Sun, 13 Jun 2010 12:15:41 +0000 (14:15 +0200)]
hpet: Drop static state

Instead of keeping a static reference around, pass the state to
hpet_enabled and hpet_get_ticks. All callers now have it at hand. Will
once allow to instantiate the HPET more than a single time.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet/rtc: Rework RTC IRQ replacement by HPET
Jan Kiszka [Sun, 13 Jun 2010 12:15:40 +0000 (14:15 +0200)]
hpet/rtc: Rework RTC IRQ replacement by HPET

Allow the intercept the RTC IRQ for the HPET legacy mode. Then push
routing to IRQ8 completely into the HPET. This allows to turn
hpet_in_legacy_mode() into a private function. Furthermore, this stops
the RTC from clearing IRQ8 even if the HPET is in control.

This patch comes with a side effect: The RTC timers will no longer be
stoppend when there is no IRQ consumer, possibly causing a minor
performance degration. But as the guest may want to redirect the RTC to
the SCI in that mode, it should normally disable unused IRQ source
anyway.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Start/stop timer when HPET_TN_ENABLE is modified
Jan Kiszka [Sun, 13 Jun 2010 12:15:39 +0000 (14:15 +0200)]
hpet: Start/stop timer when HPET_TN_ENABLE is modified

We have to update the qemu timer when the per-timer enable bit is
toggled, just like for HPET_CFG_ENABLE changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Convert to qdev
Jan Kiszka [Sun, 13 Jun 2010 12:15:38 +0000 (14:15 +0200)]
hpet: Convert to qdev

Register the HPET as a sysbus device and create it that way. As it can
route its IRQs to any ISA IRQ, we need to connect it to all 24 of them.
Once converted to qdev, we can move reset handler and vmstate
registration into its hands as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Move static timer field initialization
Jan Kiszka [Sun, 13 Jun 2010 12:15:37 +0000 (14:15 +0200)]
hpet: Move static timer field initialization

Properly initialize HPETTimer::tn and HPETTimer::state once during
hpet_init instead of (re-)writing them on every reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Silence warning on write to running main counter
Jan Kiszka [Sun, 13 Jun 2010 12:15:36 +0000 (14:15 +0200)]
hpet: Silence warning on write to running main counter

Setting the main counter while the HPET is enabled may not be a good
idea of the guest, but it is supported and should, thus, not spam the
host console with warnings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Coding style cleanups and some refactorings
Jan Kiszka [Sun, 13 Jun 2010 12:15:35 +0000 (14:15 +0200)]
hpet: Coding style cleanups and some refactorings

This moves the private HPET structures into the C module, simplifies
some helper functions and fixes most coding style issues (biggest chunk
was improper switch-case indention). No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohpet: Catch out-of-bounds timer access
Jan Kiszka [Sun, 13 Jun 2010 12:15:34 +0000 (14:15 +0200)]
hpet: Catch out-of-bounds timer access

Also prevent out-of-bounds write access to the timers but don't spam the
host console if it triggers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoconfigure: Fix evaluation of config-host.mak in create_config
Jan Kiszka [Fri, 11 Jun 2010 20:58:29 +0000 (22:58 +0200)]
configure: Fix evaluation of config-host.mak in create_config

Only match on true dir variable assignments, avoid generating garbage
due to the "# Configured with: ..." line which may contain "*dir=" as
well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-s390: correctly detect s390 with a 64-bit kernel
Aurelien Jarno [Sun, 13 Jun 2010 10:28:21 +0000 (12:28 +0200)]
tcg-s390: correctly detect s390 with a 64-bit kernel

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoCompile OS specific files only once for all targets
Blue Swirl [Sat, 12 Jun 2010 05:49:30 +0000 (05:49 +0000)]
Compile OS specific files only once for all targets

OS specific files are not target dependent, so they can be compiled
once for all targets.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove set_proc_name() to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:31 +0000 (11:42 +0200)]
Move set_proc_name() to OS specific files.

Move handling to change process name to POSIX specific files
plus add a better error message to cover the case where the
feature isn't supported.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove line-buffering setup to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:30 +0000 (11:42 +0200)]
Move line-buffering setup to OS specific files.

Move line-buffering setup to OS specific files.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMake os_change_process_uid and os_change_root os-posix.c local
Jes Sorensen [Thu, 10 Jun 2010 09:42:29 +0000 (11:42 +0200)]
Make os_change_process_uid and os_change_root os-posix.c local

os_change_process_uid() and os_change_root() are now only called
from os-posix.c, so no need to keep win32 stubs for them.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove daemonize handling to OS specific files
Jes Sorensen [Thu, 10 Jun 2010 09:42:28 +0000 (11:42 +0200)]
Move daemonize handling to OS specific files

Move daemonize handling from vl.c to OS specific files. Provide dummy
stubs for Win32.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove chroot handling to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:27 +0000 (11:42 +0200)]
Move chroot handling to OS specific files.

Move chroot handling to OS specific files.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove runas handling from vl.c to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:26 +0000 (11:42 +0200)]
Move runas handling from vl.c to OS specific files.

Move code to handle runas, ie. change of user id of QEMU process
to OS specific files and provide dummy stub for Win32.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIntroduce OS specific cmdline argument handling and move SMB arg to os-posix.c
Jes Sorensen [Thu, 10 Jun 2010 09:42:25 +0000 (11:42 +0200)]
Introduce OS specific cmdline argument handling and move SMB arg to os-posix.c

Introduce OS specific cmdline argument handling by calling
os_parse_cmd_args() at the end of switch() statement. Move option
enum to qemu-options.h and have it included from os-posix.c and
os-win32.c in addition to vl.c.

In addition move SMB argument to os-posix.c

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRename qemu-options.h to qemu-options.def
Jes Sorensen [Thu, 10 Jun 2010 09:42:24 +0000 (11:42 +0200)]
Rename qemu-options.h to qemu-options.def

Rename qemu-options.h to qemu-options.def as it is not a header file
for general use and this leaves space for a proper qemu-options.h

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove find_datadir to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:23 +0000 (11:42 +0200)]
Move find_datadir to OS specific files.

This moves the win32 and POSIX versions of find_datadir() to OS
specific files, and removes some #ifdef clutter from vl.c

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove main signal handler setup to os specificfiles.
Jes Sorensen [Thu, 10 Jun 2010 09:42:22 +0000 (11:42 +0200)]
Move main signal handler setup to os specificfiles.

Move main signal handler setup to os specific files.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRename os_setup_signal_handling() to os_setup_early_signal_handling()
Jes Sorensen [Thu, 10 Jun 2010 09:42:21 +0000 (11:42 +0200)]
Rename os_setup_signal_handling() to os_setup_early_signal_handling()

Rename os_setup_signal_handling() to os_setup_early_signal_handling()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove win32 early signal handling setup to os_setup_signal_handling()
Jes Sorensen [Thu, 10 Jun 2010 09:42:20 +0000 (11:42 +0200)]
Move win32 early signal handling setup to os_setup_signal_handling()

Move win32 early signal handling setup to os_setup_signal_handling()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIntroduce os-posix.c and create os_setup_signal_handling()
Jes Sorensen [Thu, 10 Jun 2010 09:42:19 +0000 (11:42 +0200)]
Introduce os-posix.c and create os_setup_signal_handling()

Introcuce os-posix.c and move posix specific signal handling
there.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovl.c: Move host_main_loop_wait() to OS specific files.
Jes Sorensen [Thu, 10 Jun 2010 09:42:18 +0000 (11:42 +0200)]
vl.c: Move host_main_loop_wait() to OS specific files.

Move host_main_loop_wait() to OS specific files. Create
qemu-os-posix.h and provide empty inline for the POSIX case.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIntroduce os-win32.c and move polling functions from vl.c
Jes Sorensen [Thu, 10 Jun 2010 09:42:17 +0000 (11:42 +0200)]
Introduce os-win32.c and move polling functions from vl.c

This introduces os-win32.c. It is meant to carry win32 specific
functions thata are not relevant for all of QEMU as well as win32
versions of various pieces like signal handling etc.

Move win32 polling handler helper functions from vl.c to os-win32.c

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCreate qemu-os-win32.h and move WIN32 specific declarations there
Jes Sorensen [Thu, 10 Jun 2010 09:42:16 +0000 (11:42 +0200)]
Create qemu-os-win32.h and move WIN32 specific declarations there

Create qemu-os-win32.h for WIN32 specific declarations. Move polling
handling declaration into this file from sysemu.h

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovl.c: Remove double include of netinet/in.h for Solaris
Jes Sorensen [Thu, 10 Jun 2010 09:42:15 +0000 (11:42 +0200)]
vl.c: Remove double include of netinet/in.h for Solaris

vl.c: netinet/in.h is already included once above for the

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Andreas Faerber <afaerber@opensolaris.org>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoNEON vldN optimization
Paul Brook [Fri, 11 Jun 2010 19:01:00 +0000 (20:01 +0100)]
NEON vldN optimization

When combining multiple values as part of a NEON array load, do explcit
shift/or rather than using gen_bfi.  This voids redundant mask
operations.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agohxtool: Fix line number reporting on SQMP/EQMP errors
Jan Kiszka [Wed, 2 Jun 2010 07:06:03 +0000 (09:06 +0200)]
hxtool: Fix line number reporting on SQMP/EQMP errors

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoremove unnecessary lookaheads
Paolo Bonzini [Mon, 24 May 2010 07:39:53 +0000 (09:39 +0200)]
remove unnecessary lookaheads

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoimplement optional lookahead in json lexer
Paolo Bonzini [Mon, 24 May 2010 07:39:52 +0000 (09:39 +0200)]
implement optional lookahead in json lexer

Not requiring one extra character when lookahead is not necessary
ensures that clients behave properly even if they, for example,
send QMP requests without a trailing newline.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoadd some tests for invalid JSON
Paolo Bonzini [Mon, 24 May 2010 07:39:51 +0000 (09:39 +0200)]
add some tests for invalid JSON

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agojson-streamer: Don't use qdict_put_obj()
Luiz Capitulino [Wed, 19 May 2010 20:17:05 +0000 (17:17 -0300)]
json-streamer: Don't use qdict_put_obj()

It's not needed, use qobject_put() instead and get a cleaner code.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agojson-lexer: Drop 'buf'
Luiz Capitulino [Mon, 17 May 2010 20:59:00 +0000 (17:59 -0300)]
json-lexer: Drop 'buf'

QString supports adding a single char, 'buf' is unneeded.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agocheck-qjson: Add more escape tests
Luiz Capitulino [Wed, 19 May 2010 20:08:37 +0000 (17:08 -0300)]
check-qjson: Add more escape tests

While there make the fail_unless() calls print error messages.

IMPORTANT: The test for "\/" is failing, don't know why.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoqjson: Handle "\f"
Luiz Capitulino [Wed, 19 May 2010 20:06:15 +0000 (17:06 -0300)]
qjson: Handle "\f"

It's valid JSON and should be handled.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agojson-lexer: Handle missing escapes
Luiz Capitulino [Wed, 19 May 2010 19:57:28 +0000 (16:57 -0300)]
json-lexer: Handle missing escapes

The JSON escape sequence "\/" and "\\" are valid and should be
handled.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agojson-lexer: Initialize 'x' and 'y'
Luiz Capitulino [Mon, 17 May 2010 20:50:01 +0000 (17:50 -0300)]
json-lexer: Initialize 'x' and 'y'

The 'lexer' variable is passed by the caller, it can contain anything
(eg. garbage).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agotcg: fix DEF macro after commit c61aaf7a388c4ad95d8b546fdb9267dc01183317
Aurelien Jarno [Fri, 11 Jun 2010 16:39:47 +0000 (18:39 +0200)]
tcg: fix DEF macro after commit c61aaf7a388c4ad95d8b546fdb9267dc01183317

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-s390: Adjust compilation flags.
Richard Henderson [Fri, 4 Jun 2010 19:14:09 +0000 (12:14 -0700)]
tcg-s390: Adjust compilation flags.

Force -m31/-m64 based on s390/s390x target.

Force -march=z990.  The TCG backend will always require the
long-displacement facility, so the compiler may as well make
use of that as well.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-s390: Compute is_write in cpu_signal_handler.
Richard Henderson [Fri, 4 Jun 2010 19:14:12 +0000 (12:14 -0700)]
tcg-s390: Compute is_write in cpu_signal_handler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agos390x: Don't use a linker script for user-only.
Richard Henderson [Fri, 4 Jun 2010 19:14:11 +0000 (12:14 -0700)]
s390x: Don't use a linker script for user-only.

The default placement of the application at 0x80000000 is fine,
and will avoid the default placement for most other guests.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agos390x: Avoid _llseek.
Richard Henderson [Fri, 4 Jun 2010 19:14:10 +0000 (12:14 -0700)]
s390x: Avoid _llseek.

There's no _llseek on s390x either.  Replace the existing
test for __x86_64__ with a functional test for __NR_llseek.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-s390: Allocate the code_gen_buffer near the main program.
Richard Henderson [Fri, 4 Jun 2010 19:14:14 +0000 (12:14 -0700)]
tcg-s390: Allocate the code_gen_buffer near the main program.

This allows the use of direct calls to the helpers,
and a direct branch back to the epilogue.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-s390: Icache flush is a no-op.
Richard Henderson [Fri, 4 Jun 2010 19:14:13 +0000 (12:14 -0700)]
tcg-s390: Icache flush is a no-op.

Before gcc 4.2, __builtin___clear_cache doesn't exist, and
afterward the gcc s390 backend implements it as nothing.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: fix andi r, r, 0xff
Aurelien Jarno [Thu, 10 Jun 2010 18:52:47 +0000 (20:52 +0200)]
tcg-i386: fix andi r, r, 0xff

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: remove use of _Bool that slipped code review
Aurelien Jarno [Thu, 10 Jun 2010 18:40:24 +0000 (20:40 +0200)]
tcg-i386: remove use of _Bool that slipped code review

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoesp: lower IRQ on soft reset
Blue Swirl [Thu, 10 Jun 2010 17:57:39 +0000 (17:57 +0000)]
esp: lower IRQ on soft reset

42f1ced228c9b616cfa2b69846025271618e4ef5 removed irq lowering
during reset. However, for chip reset command and DMA reset signal,
its actually the correct thing to do.

Lower IRQ on soft reset only.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoqbus: fix memory leak in qbus_free()
Isaku Yamahata [Thu, 27 May 2010 05:35:58 +0000 (14:35 +0900)]
qbus: fix memory leak in qbus_free()

BusState::name is allocated in qbus_create_inplace().
So it should be freed by qbus_free().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agomultiboot: compilation fix with DEBUG_MULTIBOOT enabled.
Isaku Yamahata [Thu, 27 May 2010 05:37:09 +0000 (14:37 +0900)]
multiboot: compilation fix with DEBUG_MULTIBOOT enabled.

This patch fixes the following compilation errors in multiboot.c
when DEBUG_MULTIBOOT is defined.
Use TARGET_FMT_plx instead of %x for target_phys_addr_t.

  CC    i386-softmmu/multiboot.o
cc1: warnings being treated as errors
qemu/hw/multiboot.c: In function 'mb_add_mod':
qemu/hw/multiboot.c:121: error: format '%08x' expects type 'unsigned int', but argument 4 has type 'target_phys_addr_t'
qemu/hw/multiboot.c:121: error: format '%08x' expects type 'unsigned int', but argument 5 has type 'target_phys_addr_t'
qemu/hw/multiboot.c: In function 'load_multiboot':
qemu/hw/multiboot.c:279: error: format '%#x' expects type 'unsigned int', but argument 5 has type 'target_phys_addr_t'
qemu/hw/multiboot.c:307: error: format '%x' expects type 'unsigned int', but argument 3 has type 'target_phys_addr_t'
qemu/hw/multiboot.c:308: error: format '%x' expects type 'unsigned int', but argument 3 has type 'target_phys_addr_t'
make[1]: *** [multiboot.o] Error 1

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovga-isa-mm: remove one #ifdef CONFIG_BOCHS_VBE.
Isaku Yamahata [Thu, 27 May 2010 05:37:53 +0000 (14:37 +0900)]
vga-isa-mm: remove one #ifdef CONFIG_BOCHS_VBE.

remove one #ifdef CONFIG_BOCHS_VBE.
Call vga_init_vbe() instead.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agomain: allocate gui_timer only once.
Isaku Yamahata [Thu, 27 May 2010 05:38:47 +0000 (14:38 +0900)]
main: allocate gui_timer only once.

fix memory leak.
there is no need to allocate more than one gui_timer.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Thu, 10 Jun 2010 14:21:43 +0000 (09:21 -0500)]
Merge remote branch 'mst/for_anthony' into staging

14 years agocris: Break out image loading to hw/cris-boot.c.
Edgar E. Iglesias [Thu, 10 Jun 2010 12:45:46 +0000 (14:45 +0200)]
cris: Break out image loading to hw/cris-boot.c.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
14 years agos390: Disassemble some general-instruction-extension insns.
Richard Henderson [Fri, 4 Jun 2010 19:14:17 +0000 (12:14 -0700)]
s390: Disassemble some general-instruction-extension insns.

The full general-instruction-extension facility was added to binutils
after the change to GPLv3.  This is not the entire extension, just
what we're using in TCG.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agos390: Update disassembler to the last GPLv2 from binutils.
Richard Henderson [Fri, 4 Jun 2010 19:14:16 +0000 (12:14 -0700)]
s390: Update disassembler to the last GPLv2 from binutils.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Merge 64-bit generation.
Richard Henderson [Fri, 4 Jun 2010 00:35:17 +0000 (17:35 -0700)]
tcg-i386: Merge 64-bit generation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: display sysconfdir in summary
Aurelien Jarno [Wed, 9 Jun 2010 22:14:02 +0000 (00:14 +0200)]
configure: display sysconfdir in summary

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove computation of tools and roms outside of config-host.mak generation
Paolo Bonzini [Wed, 26 May 2010 14:08:29 +0000 (16:08 +0200)]
move computation of tools and roms outside of config-host.mak generation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: move directory defaults earlier
Paolo Bonzini [Wed, 26 May 2010 14:08:28 +0000 (16:08 +0200)]
configure: move directory defaults earlier

Unify with existing special-purpose configure code for win32.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: ignore unknown --xyzdir options
Paolo Bonzini [Wed, 26 May 2010 14:08:27 +0000 (16:08 +0200)]
configure: ignore unknown --xyzdir options

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: introduce more --xyzdir options
Paolo Bonzini [Wed, 26 May 2010 14:08:26 +0000 (16:08 +0200)]
configure: introduce more --xyzdir options

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: expand ${prefix} in create_config
Paolo Bonzini [Wed, 26 May 2010 14:08:25 +0000 (16:08 +0200)]
configure: expand ${prefix} in create_config

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: move all directory entries in config-host.mak close
Paolo Bonzini [Wed, 26 May 2010 14:08:24 +0000 (16:08 +0200)]
configure: move all directory entries in config-host.mak close

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: unify handling of xyzdir variables
Paolo Bonzini [Wed, 26 May 2010 14:08:23 +0000 (16:08 +0200)]
configure: unify handling of xyzdir variables

Making an xyzdir variable for each directory prepares for the next
patches introducing config-host.h defines and configure options for them.
It also fixes the problem where overriding prefix at "make install"
time did not override it for sysconfdir.

Removes some of the differences between sysconfdir and other variables,
the rest will go away later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agorename CONFIG_QEMU_PREFIX
Paolo Bonzini [Wed, 26 May 2010 14:08:22 +0000 (16:08 +0200)]
rename CONFIG_QEMU_PREFIX

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoconfigure: introduce confdir and confsuffix
Paolo Bonzini [Wed, 26 May 2010 14:08:21 +0000 (16:08 +0200)]
configure: introduce confdir and confsuffix

confsuffix was write-only, flesh it out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>