sdk/emulator/qemu.git
15 years agosparc64: really initialize irq
Igor Kovalenko [Sun, 12 Jul 2009 07:43:00 +0000 (07:43 +0000)]
sparc64: really initialize irq

Allocate irq just before passing it to pci bridge initialization
and actually use it to initialize pci bridge.

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

15 years agosparc64: unify mmu tag matching code
Igor Kovalenko [Sun, 12 Jul 2009 07:41:42 +0000 (07:41 +0000)]
sparc64: unify mmu tag matching code

This patch extracts common part of sparc64 tag
matching code used by IMMU and DMMU lookups.

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

15 years agosparc64: mmu bypass mode correction
Igor Kovalenko [Sun, 12 Jul 2009 07:41:42 +0000 (07:41 +0000)]
sparc64: mmu bypass mode correction

This Implement physical address truncation in mmu bypass mode.
IMMU bypass is also active when cpu enters RED_STATE

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

15 years agoFix PCI IRQ breakage
Paul Brook [Sat, 11 Jul 2009 21:46:05 +0000 (22:46 +0100)]
Fix PCI IRQ breakage

Zero initialize the PCI bus irq count.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoRevert "Fix the PCI header type of APB"
Blue Swirl [Sat, 11 Jul 2009 08:38:39 +0000 (08:38 +0000)]
Revert "Fix the PCI header type of APB"

This reverts commit e8d2a88755b849bdadaf80d19e342eade3c017bc.

15 years agoFix APB by reverting 16eaedf2668e9b347a59d73346fcc4c764c58348 partially
Blue Swirl [Sat, 11 Jul 2009 08:20:24 +0000 (08:20 +0000)]
Fix APB by reverting 16eaedf2668e9b347a59d73346fcc4c764c58348 partially

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoIndent ac97 and es1370 according to audio formatting
Anthony Liguori [Fri, 10 Jul 2009 20:32:03 +0000 (15:32 -0500)]
Indent ac97 and es1370 according to audio formatting

For the sake of consistency.  I pulled in the wrong patches from Gerd when
he did the qdev conversion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock: Clean up after deleting BHs
Avi Kivity [Tue, 23 Jun 2009 13:20:36 +0000 (16:20 +0300)]
block: Clean up after deleting BHs

Commit 6a7ad299 ("Call qemu_bh_delete at bdrv_aio_bh_cb") deletes emulated
aio bottom halves to prevent endless accumulation.  However, it leaves a
stale ->bh pointer, which is then waited on when the aio is reused.

Zeroing the pointer fixes the issue, allowing vmdk format images to be used.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoflush pending aio requests
Glauber Costa [Mon, 6 Jul 2009 13:32:09 +0000 (09:32 -0400)]
flush pending aio requests

When we finish migration, there may be pending async io requests
in flight. If we don't flush it before stage3 starting, it might be
the case that the guest loses it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Work around borken MSR_GET_INDEX_LIST
Jan Kiszka [Thu, 2 Jul 2009 20:04:48 +0000 (22:04 +0200)]
kvm: Work around borken MSR_GET_INDEX_LIST

Allocate enough memory for KVM_GET_MSR_INDEX_LIST as older kernels shot
far beyond their limits, corrupting user space memory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/virtio: mark msi vectors used on load
Michael S. Tsirkin [Sun, 5 Jul 2009 13:02:34 +0000 (16:02 +0300)]
qemu/virtio: mark msi vectors used on load

Usage of msi vectors is controlled by the guest and so needs to be
restored on load. Do this for msi vectors used by the virtio device.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/msi: missing braces
Michael S. Tsirkin [Sun, 5 Jul 2009 12:58:52 +0000 (15:58 +0300)]
qemu/msi: missing braces

MSIX present bit is tested incorrectly, and only happens to work because
the bit we are testing is 0x1.  Add braces to fix this.

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/msi: clean used vectors state on load
Michael S. Tsirkin [Sun, 5 Jul 2009 12:58:44 +0000 (15:58 +0300)]
qemu/msi: clean used vectors state on load

Clean up msix vector usage state on load. Since guest might have control
over it through the device, the device will have to load this state from
file.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Fix L1 table memory allocation
Kevin Wolf [Tue, 7 Jul 2009 16:09:42 +0000 (18:09 +0200)]
qcow2: Fix L1 table memory allocation

Contrary to what one could expect, the size of L1 tables is not cluster
aligned. So as we're writing whole sectors now instead of single entries,
we need to ensure that the L1 table in memory is large enough; otherwise
write would access memory after the end of the L1 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow1: Fix qcow_aio_writev
Kevin Wolf [Tue, 30 Jun 2009 13:37:17 +0000 (15:37 +0200)]
qcow1: Fix qcow_aio_writev

Pass is_write = 1 to qcow_aio_setup when writing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPrefer sysfs for USB host devices
Mark McLoughlin [Fri, 3 Jul 2009 08:28:02 +0000 (09:28 +0100)]
Prefer sysfs for USB host devices

Scanning for devices via /sys/bus/usb/devices/ and using them via the
/dev/bus/usb/<bus>/<device> character devices is the prefered method
on modern kernels, so try that first.

When using SELinux and libvirt, qemu will have access to /sys/bus/usb
but not /proc/bus/usb, so although the current code will work just
fine, it will generate SELinux AVC warnings.

See also:

  https://bugzilla.redhat.com/508326

Reported-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agousb-ohci: Fix endianness issue
Michael Buesch [Wed, 8 Jul 2009 19:54:28 +0000 (21:54 +0200)]
usb-ohci: Fix endianness issue

This fixes a possible endianness issue in the usb-ohci hw module.
hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake sure to mark MCE defines as ULL
Anthony Liguori [Fri, 10 Jul 2009 18:39:34 +0000 (13:39 -0500)]
Make sure to mark MCE defines as ULL

Fixes build on 32-bit

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: fix memory leak
Kevin Wolf [Fri, 10 Jul 2009 11:33:52 +0000 (13:33 +0200)]
qemu-io: fix memory leak

qemu-io leaks the request buffer whenever the read or write function isn't
executed completely down the "normal" code path.

[hch: also fix the aio and vectored variants the same way]

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoqemu-io: add flag to mark files growable
Christoph Hellwig [Fri, 10 Jul 2009 11:33:47 +0000 (13:33 +0200)]
qemu-io: add flag to mark files growable

Add a -g flag to the open command and the main qemu-io command line to
allow opening a file growable.  This is only allowed for protocols,
mirroring the limitation exposed through bdrv_file_open.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
15 years agoqemu-io: better input validation for vector-based commands
Christoph Hellwig [Fri, 10 Jul 2009 11:33:42 +0000 (13:33 +0200)]
qemu-io: better input validation for vector-based commands

Fix up a couple of issues with validating the input of the various
length arguments for the vectored I/O commands:

 - do the alignment check on each length instead the always 0 count argument
 - use a long long varibale for the cvtnum return value so that we can check
   wether it wasn't a number
 - check for a too large argument instead of truncating it

Also refactor it into a common helper for all four calers and avoid parsing
the numbers twice.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
15 years agoqemu-io: small cleanups for the aio code
Christoph Hellwig [Fri, 10 Jul 2009 11:33:38 +0000 (13:33 +0200)]
qemu-io: small cleanups for the aio code

Address a couple of review comments from Kevin.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoDisable kqemu by default at run time
Anthony Liguori [Thu, 9 Jul 2009 22:28:08 +0000 (17:28 -0500)]
Disable kqemu by default at run time

 -no-kqemu -> -enable-kqemu

kqemu is still present at compile time by default

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake sure to only vm_start() a failed migration if we were running to begin
Anthony Liguori [Thu, 9 Jul 2009 18:25:47 +0000 (13:25 -0500)]
Make sure to only vm_start() a failed migration if we were running to begin
with.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAllow setting qemu process name v2
Andi Kleen [Thu, 2 Jul 2009 07:34:17 +0000 (09:34 +0200)]
Allow setting qemu process name v2

Set the Linux process name to the name argument specified with name. I find
this useful to see which guests are taking CPU time in top.

This doesn't affect ps, which checks argv[0], but rewriting the
environment uses much more code, so I only used this simple way.

v2: Use separate process= argument, no prefixes.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoconfigure: Append extra cflags and ldflags
Jan Kiszka [Tue, 30 Jun 2009 19:29:03 +0000 (21:29 +0200)]
configure: Append extra cflags and ldflags

In order to allow overriding flags that are set by configure, we have to
append them instead of prepending as it is done so far.

v2: Clarify documentation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu: remove control vector save
Michael S. Tsirkin [Wed, 1 Jul 2009 13:28:06 +0000 (16:28 +0300)]
qemu: remove control vector save

control vector is saved/restored by virtio-pci,
it does not belong in virtio.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix segfault in msix_save
Michael S. Tsirkin [Wed, 1 Jul 2009 13:28:00 +0000 (16:28 +0300)]
fix segfault in msix_save

This fixes segfault reported by Kevin Wolf,
and simplifies the code in msix_save.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUnregister savevm callback in eeprom93xx_free()
Mark McLoughlin [Wed, 1 Jul 2009 22:06:19 +0000 (23:06 +0100)]
Unregister savevm callback in eeprom93xx_free()

Otherwise if you hot remove an eepro100 NIC and then migrate,
you get:

  Unknown savevm section or instance 'eeprom' 0

on the destination side.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoDon't leak VLANClientState on PCI hot remove
Mark McLoughlin [Wed, 1 Jul 2009 15:46:38 +0000 (16:46 +0100)]
Don't leak VLANClientState on PCI hot remove

destroy_nic() requires that NICInfo::private by a PCIDevice pointer,
but then goes on to require that the same pointer matches
VLANClientState::opaque.

That is no longer the case for virtio-net since qdev and wasn't
previously the case for rtl8139, ne2k_pci or eepro100.

Make the situation a lot more clear by maintaining a VLANClientState
pointer in NICInfo.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoDon't abort if TUNSETSNDBUF fails where no sndbuf= arg is supplied
Mark McLoughlin [Wed, 1 Jul 2009 15:45:30 +0000 (16:45 +0100)]
Don't abort if TUNSETSNDBUF fails where no sndbuf= arg is supplied

If no tap,sndbuf= arg is supplied, we use a default value. If
TUNSETSNDBUF fails in this case, we should not abort.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute O_DSYNC with O_SYNC or O_FSYNC when needed.
G 3 [Wed, 1 Jul 2009 17:28:32 +0000 (13:28 -0400)]
Substitute O_DSYNC with O_SYNC or O_FSYNC when needed.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAllow adjustment of http block device's readahead size, via a new
Nolan [Thu, 2 Jul 2009 00:16:52 +0000 (17:16 -0700)]
Allow adjustment of http block device's readahead size, via a new
":readahead=###:" suffix.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoconsolidate user cpu_{in, out}[bwl] into ioport-user.c
Isaku Yamahata [Thu, 2 Jul 2009 10:32:10 +0000 (19:32 +0900)]
consolidate user cpu_{in, out}[bwl] into ioport-user.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoioport: consolidate duplicated logic in register_ioport_{read, write}().
Isaku Yamahata [Thu, 2 Jul 2009 10:32:08 +0000 (19:32 +0900)]
ioport: consolidate duplicated logic in register_ioport_{read, write}().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agouse constant IOPORTS_MASK instead of 0xffff.
Isaku Yamahata [Thu, 2 Jul 2009 10:32:07 +0000 (19:32 +0900)]
use constant IOPORTS_MASK instead of 0xffff.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosplit out ioport related stuffs from vl.c into ioport.c.
Isaku Yamahata [Thu, 2 Jul 2009 10:32:06 +0000 (19:32 +0900)]
split out ioport related stuffs from vl.c into ioport.c.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoReplace signrom with shell script v3
Alexander Graf [Wed, 1 Jul 2009 20:08:21 +0000 (22:08 +0200)]
Replace signrom with shell script v3

In order to not execute code we just compiled, let's replace signrom
with a shell script that does the same thing while staying compatible
to pretty much every system available.

This should make cross-compilation for windows easier.

aliguori: fix build when objdir != srcdir

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRevert "support colon in filenames"
Anthony Liguori [Thu, 2 Jul 2009 13:12:26 +0000 (08:12 -0500)]
Revert "support colon in filenames"

This reverts commit 707c0dbc97cddfe8d2441b8259c6c526d99f2dd8.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix build for ESD audio
Anthony Liguori [Wed, 1 Jul 2009 15:07:16 +0000 (10:07 -0500)]
Fix build for ESD audio

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Make cache=writethrough default
Kevin Wolf [Tue, 30 Jun 2009 11:06:04 +0000 (13:06 +0200)]
qcow2: Make cache=writethrough default

The performance of qcow2 has improved meanwhile, so we don't need to
special-case it any more. Switch the default to write-through caching
like all other block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agonet: set a default value for sndbuf=
Mark McLoughlin [Tue, 30 Jun 2009 09:02:57 +0000 (10:02 +0100)]
net: set a default value for sndbuf=

On reflection, perhaps it does make sense to set a default value for
the sndbuf= tap parameter.

For best effect, sndbuf= should be set to just below the capacity of
the physical NIC.

Setting it higher will cause packets to be dropped before the limit
is hit. Setting it much lower will not cause any problems unless
you set it low enough such that the guest cannot queue up new packets
before the NIC has emptied its queue.

In Linux, txqueuelen=1000 by default for ethernet NICs. Given a 1500
byte MTU, 1Mb is a good choice for sndbuf.

If it turns out that txqueuelen is actually much lower than this, then
sndbuf is essentially disabled. In the event that txqueuelen is much
higher, it's unlikely that the NIC will be able to empty a 1Mb queue.

Thanks to Herbert Xu for this logic.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Herbert Xu <herbert.xu@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoconfigure: detect xen with --extra-cflags / --extra-ldflags
Christoph Egger [Tue, 30 Jun 2009 12:59:38 +0000 (14:59 +0200)]
configure: detect xen with --extra-cflags / --extra-ldflags

Attached patch lets configure find xen headers and xen libs
when called with --extra-cflags and --extra-ldflags options.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoQEMU: MCE: Add MCE simulation to qemu/tcg
Huang Ying [Tue, 23 Jun 2009 02:05:14 +0000 (10:05 +0800)]
QEMU: MCE: Add MCE simulation to qemu/tcg

- MCE features are initialized when VCPU is intialized according to CPUID.
- A monitor command "mce" is added to inject a MCE.
- A new interrupt mask: CPU_INTERRUPT_MCE is added to inject the MCE.

aliguori: fix build for linux-user

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMerge commit 'linux-user/linux-user-for-upstream' into tmp-staging
Anthony Liguori [Thu, 9 Jul 2009 20:09:27 +0000 (15:09 -0500)]
Merge commit 'linux-user/linux-user-for-upstream' into tmp-staging

15 years agoMIPS signal handling fix
Paul Brook [Thu, 9 Jul 2009 17:40:15 +0000 (18:40 +0100)]
MIPS signal handling fix

Add explicit padding to MIPS signal frame structures.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoEnable MIPS NPTL
Paul Brook [Thu, 9 Jul 2009 16:56:24 +0000 (17:56 +0100)]
Enable MIPS NPTL

Enable NPTL support for MIPS usermode emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoMIPS atomic instructions
Paul Brook [Thu, 9 Jul 2009 16:45:17 +0000 (17:45 +0100)]
MIPS atomic instructions

Implement MIPS ll/sc instructions using atomic compare+exchange.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoMIPS usermode TLS register
Paul Brook [Thu, 9 Jul 2009 14:07:57 +0000 (15:07 +0100)]
MIPS usermode TLS register

Implement cpu_set_tls for MIPS.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoFix MIPS sys_clone
Paul Brook [Thu, 9 Jul 2009 12:11:52 +0000 (13:11 +0100)]
Fix MIPS sys_clone

The clone syscall takes 6 args.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoqdev: convert ac97.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:13 +0000 (14:12 +0200)]
qdev: convert ac97.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: convert es1370.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:12 +0000 (14:12 +0200)]
qdev: convert es1370.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev/pci: misc fixes.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:11 +0000 (14:12 +0200)]
qdev/pci: misc fixes.

* fix secondary bus setup.
 * use base->name instead of "FIXME" for device name.
   Yes, the device name is redundant.  Only for drivers converted
   to qdev already though.  Once all drivers are converted we can
   and should kill it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: remove DeviceType
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:09 +0000 (14:12 +0200)]
qdev: remove DeviceType

The only purpose DeviceType serves is creating a linked list of
DeviceInfo structs.  This removes DeviceType and add a next field to
DeviceInfo instead, so the DeviceInfo structs can be changed that way.
Elimitates a pointless extra level of indirection.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: replace bus_type enum with bus_info struct.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:08 +0000 (14:12 +0200)]
qdev: replace bus_type enum with bus_info struct.

BusInfo is filled with name and size (pretty much like I did for
DeviceInfo as well).  There is also a function pointer to print
bus-specific device information to the monitor.  sysbus is hooked
up there, I've also added a print function for PCI.

Device creation is slightly modified as well:  The device type search
loop now also checks the bus type while scanning the list instead of
complaining thereafter in case of a mismatch.  This effectively gives
each bus a private namespace for device names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoqdev: update pci device registration.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:07 +0000 (14:12 +0200)]
qdev: update pci device registration.

Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunch
of parameters.  Also adds config_read and config_write callbacks to
PCIDeviceInfo, so drivers needing these can be converted to the qdev
device API too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoRemove SDL/ prefix
malc [Wed, 8 Jul 2009 14:25:37 +0000 (18:25 +0400)]
Remove SDL/ prefix

15 years agoAdd out of memory and zero size argument checks to be consistent with
malc [Wed, 8 Jul 2009 14:24:05 +0000 (18:24 +0400)]
Add out of memory and zero size argument checks to be consistent with
the qemu_malloc routines

15 years agogetrlimit conversion mix-up
Ulrich Hecht [Fri, 3 Jul 2009 15:09:30 +0000 (17:09 +0200)]
getrlimit conversion mix-up

Fixes getrlimit implementation that overwrote the result of the syscall
instead of converting it

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agowrap path for access syscall
Ulrich Hecht [Fri, 3 Jul 2009 15:09:29 +0000 (17:09 +0200)]
wrap path for access syscall

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years ago64-bit clean socketcall syscall
Ulrich Hecht [Fri, 3 Jul 2009 15:09:28 +0000 (17:09 +0200)]
64-bit clean socketcall syscall

makes socketcall 64-bit clean so it works on 64-bit big-endian systems

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agopipe argument should not be signed
Ulrich Hecht [Fri, 3 Jul 2009 15:09:26 +0000 (17:09 +0200)]
pipe argument should not be signed

pipedes is an address, it should not be signed (breaks for addresses
> 0x80000000)

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agoconfigure: remove bogus linux-user check
Riku Voipio [Mon, 29 Jun 2009 14:26:11 +0000 (17:26 +0300)]
configure: remove bogus linux-user check

linux-user=yes is not a reliable identifier that linux-user targets
have been selected. user targets can be selected via --target-list
as well.

15 years agolinux-user/syscall.c: remove warning: ‘array’ may be used uninitialized in this function
vibi sreenivasan [Fri, 19 Jun 2009 08:04:39 +0000 (13:34 +0530)]
linux-user/syscall.c: remove warning: ‘array’ may be used uninitialized in this function

Removes the following warning

CC    i386-linux-user/syscall.o
cc1: warnings being treated as errors
/media/nfs/qemu/linux-user/syscall.c: In function ‘do_syscall’:
/media/nfs/qemu/linux-user/syscall.c:2219: warning: ‘array’ may be used uninitialized in this function

Signed-off-by: Vibi Sreenivasan <vibi_sreenivasan@cms.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agolinux-user: check some parameters for some socket syscalls.
Arnaud Patard [Fri, 19 Jun 2009 07:44:45 +0000 (10:44 +0300)]
linux-user: check some parameters for some socket syscalls.

This patch is fixing following issues :

- commit 8fea36025b9d6d360ff3b78f88a84ccf221807e8 was applied to
  do_getsockname instead of do_accept.
- Some syscalls were not checking properly the memory addresses passed
  as argument
- Add check before syscalls made for cases like do_getpeername() where
  we're using the address parameter after doing the syscall
- Fix do_accept to return EINVAL instead of EFAULT when parameters
  invalid to match with linux behaviour

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agolinux-user: increment MAX_ARG_PAGES
Arnaud Patard [Fri, 19 Jun 2009 07:39:36 +0000 (10:39 +0300)]
linux-user: increment MAX_ARG_PAGES

There's a error When doing something like that :
find / -type f -print0 | xargs -0 echo

[ done in a arm chroot with qemu-arm and linux binfmt stuff or with
find / -type f -print0 | qemu-arm -L <path> <path>/usr/bin/xargs -0
echo ]

Doing this outsite qemu is fine. The problem was the huge number of
parameters. Increasing MAX_ARG_PAGES is fixing that.

While I was at it, I've modified linux-user/main.c to report error code
of loader_exec. It helps to debug/know what's wrong.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agoFix the PCI header type of APB
Blue Swirl [Sun, 5 Jul 2009 20:33:02 +0000 (20:33 +0000)]
Fix the PCI header type of APB

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoUpdate OpenBIOS images to r505
Blue Swirl [Sun, 5 Jul 2009 18:50:32 +0000 (18:50 +0000)]
Update OpenBIOS images to r505

For Sparc64, this fixes the PCI bridge configuration bugs revealed by the
improved bridge handling (b7ee1603c16c1feb0d439d2ddf6cf824119d0aab).

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix Sparse warning
Blue Swirl [Sun, 5 Jul 2009 08:11:39 +0000 (08:11 +0000)]
Fix Sparse warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoWork around Solaris gas problem
Blue Swirl [Fri, 3 Jul 2009 19:25:29 +0000 (19:25 +0000)]
Work around Solaris gas problem

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoRename target_cpu to target_arch2
Blue Swirl [Fri, 3 Jul 2009 17:44:00 +0000 (17:44 +0000)]
Rename target_cpu to target_arch2

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agomonitor: Fix typo in documentation
Jan Kiszka [Fri, 3 Jul 2009 06:46:05 +0000 (08:46 +0200)]
monitor: Fix typo in documentation

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
15 years agotarget-mips: fix MADD and MSUB/MSUBU instructions
Nathan Froyd [Wed, 1 Jul 2009 17:52:22 +0000 (10:52 -0700)]
target-mips: fix MADD and MSUB/MSUBU instructions

MADD was not correctly writing to HI.

MSUB/MSUBU are specified as `HI||LO - product', not `product - HI||LO'.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoFix hxtool.
Stefan Weil [Wed, 1 Jul 2009 21:13:34 +0000 (23:13 +0200)]
Fix hxtool.

When converting from hx to texi format, hxtool (or to be
more precise sh which interprets hxtool) used standard
shell expansion of wildcards while writing lines to the
output.

Thus, something like "Password: ********"
looked very different in the generated documentation.

The patch disables this unwanted wildcard expansion.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
15 years agoUse ctz64 in favor of ffsll
Jan Kiszka [Thu, 2 Jul 2009 07:11:37 +0000 (09:11 +0200)]
Use ctz64 in favor of ffsll

Not all host platforms support ffsll.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
15 years agoRespect the standard
malc [Thu, 2 Jul 2009 14:19:31 +0000 (18:19 +0400)]
Respect the standard

15 years agoUse pstrcpy and pstrcat to avoid OpenBSD linker warning
Blue Swirl [Wed, 1 Jul 2009 20:29:39 +0000 (20:29 +0000)]
Use pstrcpy and pstrcat to avoid OpenBSD linker warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSuppress a GCC warning
Blue Swirl [Wed, 1 Jul 2009 19:30:50 +0000 (19:30 +0000)]
Suppress a GCC warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix breakage by obsolete _P() for good
Blue Swirl [Wed, 1 Jul 2009 19:11:17 +0000 (19:11 +0000)]
Fix breakage by obsolete _P() for good

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix sdl_zoom compile problems on OpenBSD
Blue Swirl [Wed, 1 Jul 2009 18:49:34 +0000 (18:49 +0000)]
Fix sdl_zoom compile problems on OpenBSD

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix missing strnlen problems
Blue Swirl [Wed, 1 Jul 2009 18:24:44 +0000 (18:24 +0000)]
Fix missing strnlen problems

Fix missing strnlen (a GNU extension) problems by using qemu_strnlen
used for user emulators also for system emulators.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix typo
malc [Tue, 30 Jun 2009 14:46:46 +0000 (18:46 +0400)]
Fix typo

Signed-off-by: malc <av1474@comtv.ru>
15 years agoRemove bogus -Werror
Paul Brook [Tue, 30 Jun 2009 11:10:52 +0000 (12:10 +0100)]
Remove bogus -Werror

Revert rules.mak changes from aba800a.  These should not have been here
to start with.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoReplace -no-virtio-balloon by -balloon
Markus Armbruster [Fri, 26 Jun 2009 17:15:14 +0000 (19:15 +0200)]
Replace -no-virtio-balloon by -balloon

We want to do (at least) two things to the virtio-balloon device:
suppress it, and control its PCI address.  Option -no-virtio-balloon
lets us do only the former.  To get the latter, replace
-no-virtio-balloon with

    -balloon none   disable balloon device
    -balloon virtio[,addr=str]
                    enable virtio balloon device (default)

Syntax suggested by Anthony Liguori.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: tftp: Relax filename format check
Jan Kiszka [Mon, 29 Jun 2009 06:47:30 +0000 (08:47 +0200)]
slirp: tftp: Relax filename format check

[ Applies on top of my recently posted slirp series. ]

Allow tftp requests with filenames that do not start with a slash.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosdl: Fix memory leakage
Jan Kiszka [Sat, 27 Jun 2009 07:59:40 +0000 (09:59 +0200)]
sdl: Fix memory leakage

Valgrind was so kind to remark that no one bothers to release keycodes
after use and that something is fishy about cleaning up the requested
keyboard descriptor. With this patch applied, we no longer leak about
12k during startup.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoKVM: x86: Refactor persistent CPU state
Jan Kiszka [Sat, 27 Jun 2009 07:27:22 +0000 (09:27 +0200)]
KVM: x86: Refactor persistent CPU state

This patch aligns the KVM-related layout and encoding of the CPU state
to be saved to disk or migrated with qemu-kvm. The major differences are
reordering of fields and a compressed interrupt_bitmap into a single
number as there can be no more than one pending IRQ at a time.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: Factor out pc_new_cpu
Jan Kiszka [Thu, 25 Jun 2009 06:23:39 +0000 (08:23 +0200)]
x86: Factor out pc_new_cpu

At this point, this refactoring looks like overkill. But we will need it
for CPU hotplugging, and qemu-kvm already carries it. Merging it early
would help qemu-kvm when rebasing against upstream.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Refactor acl commnds
Jan Kiszka [Thu, 25 Jun 2009 06:22:08 +0000 (08:22 +0200)]
monitor: Refactor acl commnds

Refactor the ACL monitor interface to make full use of the monitor
command dispatcher. This also gives proper help formatting and command
completion. Note that 'acl allow' and 'acl deny' were combined to
'acl_add aclname match allow|deny [index]' for consistency reasons.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Add completion for help command
Jan Kiszka [Thu, 25 Jun 2009 06:22:02 +0000 (08:22 +0200)]
monitor: Add completion for help command

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRevert "Introduce reset notifier order"
Jan Kiszka [Sat, 27 Jun 2009 07:25:07 +0000 (09:25 +0200)]
Revert "Introduce reset notifier order"

This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and
updates later added users of qemu_register_reset), we solved the
problem it originally addressed less invasively.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Make pci_add device options truely optional
Jan Kiszka [Thu, 25 Jun 2009 22:04:10 +0000 (00:04 +0200)]
monitor: Make pci_add device options truely optional

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Rework VCPU synchronization
Jan Kiszka [Sat, 27 Jun 2009 07:24:58 +0000 (09:24 +0200)]
kvm: Rework VCPU synchronization

During startup and after reset we have to synchronize user space to the
in-kernel KVM state. Namely, we need to transfer the VCPU registers when
they change due to VCPU as well as APIC reset.

This patch refactors the required hooks so that kvm_init_vcpu registers
its own per-VCPU reset handler and adds a cpu_synchronize_state to the
APIC reset. That way we no longer depend on the new reset order (and can
drop this disliked interface again) and we can even drop a KVM hook in
main().

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Drop pci_addr prefix from hotplug commands
Jan Kiszka [Thu, 25 Jun 2009 22:04:00 +0000 (00:04 +0200)]
monitor: Drop pci_addr prefix from hotplug commands

The "pci_addr=" prefix currently required by pci_add/remove and
drive_add has no practical use. Drop it, but still silently accept it
for backward compatibility.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Cache refcount blocks during snapshot creation
Kevin Wolf [Fri, 26 Jun 2009 18:19:38 +0000 (20:19 +0200)]
qcow2: Cache refcount blocks during snapshot creation

The really time consuming part of snapshotting is to adjust the reference count
of all clusters. Currently after each adjusted cluster the refcount block is
written to disk.

Don't write each single byte immediately to disk but cache all writes to the
refcount block and write them out once we're done with the block.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock-raw: Allow pread beyond the end of growable images
Kevin Wolf [Fri, 26 Jun 2009 17:51:24 +0000 (19:51 +0200)]
block-raw: Allow pread beyond the end of growable images

When using O_DIRECT, qcow2 snapshots didn't work any more for me. In the
process of creating the snapshot, qcow2 tries to pwrite some new information
(e.g. new L1 table) which will often end up being after the old end of the
image file. Now pwrite tries to align things and reads the old contents of the
file, read returns 0 because there is nothing to read after the end of file and
pwrite is stuck in an endless loop.

This patch allows to pread beyond the end of an image file. Whenever the
given offset is after the end of the image file, the read succeeds and fills
the buffer with zeros.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomake tags useful for block drivers and hardaware devices
Juan Quintela [Mon, 29 Jun 2009 11:49:29 +0000 (13:49 +0200)]
make tags useful for block drivers and hardaware devices

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute ifdef CONFIG_FOO by sound-obj-
Juan Quintela [Wed, 24 Jun 2009 22:08:12 +0000 (00:08 +0200)]
Substitute ifdef CONFIG_FOO by sound-obj-

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename SOUND_HW to sound-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:11 +0000 (00:08 +0200)]
Rename SOUND_HW to sound-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute ifdef CONFIG_FOO by obj-
Juan Quintela [Wed, 24 Jun 2009 22:08:10 +0000 (00:08 +0200)]
Substitute ifdef CONFIG_FOO by obj-

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