sdk/emulator/qemu.git
13 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Thu, 8 Sep 2011 14:07:13 +0000 (09:07 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 8 Sep 2011 14:05:14 +0000 (09:05 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging
Anthony Liguori [Thu, 8 Sep 2011 14:03:57 +0000 (09:03 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging

13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 8 Sep 2011 13:59:32 +0000 (08:59 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.26' into staging
Anthony Liguori [Thu, 8 Sep 2011 13:57:33 +0000 (08:57 -0500)]
Merge remote-tracking branch 'kraxel/usb.26' into staging

13 years agoMerge remote-tracking branch 'aneesh/for-upstream-3' into staging
Anthony Liguori [Thu, 8 Sep 2011 13:52:59 +0000 (08:52 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-3' into staging

13 years agoiohandlers: fix issue with qemu_set_fd_handler()
Anthony Liguori [Wed, 7 Sep 2011 18:44:45 +0000 (13:44 -0500)]
iohandlers: fix issue with qemu_set_fd_handler()

As spotted by Aneesh, some users pass a NULL opaque so we need to be more
aggressive in checking whether a user means to unregister.

Also fix a double free caused by tag not being reset to zero after delete.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agousb-musb: Add reset function
Juha Riihimäki [Wed, 31 Aug 2011 20:49:41 +0000 (21:49 +0100)]
usb-musb: Add reset function

Add a separate reset function musb_reset() to the usb-musb interface,
so that users who implement a reset function can also reset usb-musb.
Use this in tusb6010.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-musb: Take a DeviceState* in init function
Peter Maydell [Wed, 31 Aug 2011 20:49:40 +0000 (21:49 +0100)]
usb-musb: Take a DeviceState* in init function

Initialise usb-musb by passing it a DeviceState* and the offset of the
IRQs in its gpio array, rather than a plain pointer to an irq array.
This is simpler for callers and also allows us to pass in a valid parent
to usb_bus_new(), so the USB bus actually appears in the qdev tree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Remove leading underscores from __musb_irq_max
Peter Maydell [Wed, 31 Aug 2011 20:49:39 +0000 (21:49 +0100)]
usb: Remove leading underscores from __musb_irq_max

Identifiers with double leading underscore are reserved, so rename
__musb_irq_max so we don't encroach on reserved namespace.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: tag as unmigratable
Gerd Hoffmann [Wed, 31 Aug 2011 09:44:24 +0000 (11:44 +0200)]
usb-host: tag as unmigratable

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: claim port at device initialization time.
Gerd Hoffmann [Thu, 1 Sep 2011 11:56:37 +0000 (13:56 +0200)]
usb: claim port at device initialization time.

This patch makes qemu assign a port when creating the device, not when
attaching it.  For most usb devices this isn't a noticable difference
because they are in attached state all the time.

The change affects usb-host devices which live in detached state while
the real device is unplugged from the host.  They have a fixed port
assigned all the time now instead of getting grabbing one on attach and
releasing it at detach, i.e. they stop floating around at the usb bus.

The change also allows to simplify usb-hub.  It doesn't need the
handle_attach() callback any more to configure the downstream ports.
This can be done at device initialitation time now.  The changed
initialization order (first grab upstream port, then register downstream
ports) also fixes some icky corner cases.  For example it is not possible
any more to plug the hub into one of its own downstream ports.

The usb host adapters must care too.  USBPort->dev being non-NULL
doesn't imply any more the device is in attached state.  The host
adapters must additionally check the USBPort->dev->attached flag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ccid: remote wakeup support
Gerd Hoffmann [Tue, 30 Aug 2011 10:15:53 +0000 (12:15 +0200)]
usb-ccid: remote wakeup support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ccid: switch to USBDesc*
Gerd Hoffmann [Tue, 30 Aug 2011 09:49:05 +0000 (11:49 +0200)]
usb-ccid: switch to USBDesc*

Switch the smard card emulation to use the USBDesc*
structs for the usb descriptors.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: fix use after free
Gerd Hoffmann [Thu, 25 Aug 2011 14:43:15 +0000 (16:43 +0200)]
usb: fix use after free

The ->complete() callback might have released the USBPacket (uhci
actually does), so we must not touch it after the callback returns.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: parse port in /proc/bus/usb/devices scan
Gerd Hoffmann [Wed, 17 Aug 2011 21:36:46 +0000 (23:36 +0200)]
usb-host: parse port in /proc/bus/usb/devices scan

Unfortunaly this is limited to root ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: constify port
Gerd Hoffmann [Wed, 17 Aug 2011 21:35:45 +0000 (23:35 +0200)]
usb-host: constify port

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: handle siTDs
Gerd Hoffmann [Fri, 26 Aug 2011 12:13:48 +0000 (14:13 +0200)]
usb-ehci: handle siTDs

This patch adds code to do minimal siTD handling, which is basically
just following the next pointer.  This is good enougth to handle the
inactive siTDs used by FreeBSD.  Active siTDs are skipped too as we
don't have split transfer support in qemu, additionally a warning is
printed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: endpoint table fixup
Gerd Hoffmann [Fri, 26 Aug 2011 14:27:41 +0000 (16:27 +0200)]
usb-host: endpoint table fixup

USB Devices can have up to 15 IN and 15 OUT endpoints, not 15 endpoints
total.  Move from one array to two arrays (one IN, one OUT) to maintain
the endpoint state.

13 years agousb-host: claim port
Gerd Hoffmann [Wed, 24 Aug 2011 11:34:17 +0000 (13:34 +0200)]
usb-host: claim port

When configured to pass through a specific host port (using hostbus and
hostport properties), try to claim the port if supported by the kernel.
That will avoid any kernel drivers binding to devices plugged into that
port.  It will not stop any userspace apps (such as usb_modeswitch)
access the device via usbfs though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: fix configuration tracking.
Gerd Hoffmann [Wed, 24 Aug 2011 12:45:07 +0000 (14:45 +0200)]
usb-host: fix configuration tracking.

It is perfectly fine to leave the usb device in unconfigured state
(USBHostDevice->configuration == 0).  Just do that and wait for the
guest to explicitly set a configuration.  This is closer to what real
hardware does and it also simplifies the device initialization.  There
is no need to figure how the device is configured on the host.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: limit open retries
Gerd Hoffmann [Wed, 24 Aug 2011 11:45:06 +0000 (13:45 +0200)]
usb-host: limit open retries

Limit the number of times qemu tries to open host devices to three.
Reset error counter when the device goes away, after un-plugging and
re-plugging the device qemu will try again three times.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: fix halted endpoints
Gerd Hoffmann [Wed, 24 Aug 2011 08:55:40 +0000 (10:55 +0200)]
usb-host: fix halted endpoints

Two fixes for the price of one ;)

First, reinitialize the endpoint table after device reset.
This is needed anyway as the reset might have switched interfaces.
It also clears the endpoint halted state.

Second the CLEAR_HALT ioctl wants a unsigned int passed in as
argument, not uint8_t.

This gets my usb sd card reader (sandisk micromate) going.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: reapurb error report fix
Gerd Hoffmann [Mon, 22 Aug 2011 12:18:21 +0000 (14:18 +0200)]
usb-host: reapurb error report fix

Don't report errors on devices which are in disconnected
and closing state.

13 years agousb-host: start tracing support
Gerd Hoffmann [Mon, 22 Aug 2011 12:13:20 +0000 (14:13 +0200)]
usb-host: start tracing support

Add a bunch of trace points to usb-linux.c  Drop a bunch of DPRINTK's in
favor of the trace points.  Also cleanup error reporting a bit while being
at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoscsi: improve MODE SENSE emulation
Paolo Bonzini [Tue, 6 Sep 2011 10:31:44 +0000 (12:31 +0200)]
scsi: improve MODE SENSE emulation

- do not return extra pages when requesting all pages (PAGE CODE = 0x3f)

- return correct sense code for PC = 3 (saved parameters not supported)

- do not return geometry pages for CD devices

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: fill in additional sense length correctly
Paolo Bonzini [Tue, 6 Sep 2011 10:31:43 +0000 (12:31 +0200)]
scsi: fill in additional sense length correctly

Even though we do not use them, we should include the last three
bytes of sense data in the additional sense length.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix qjson test of solidus encoding
Jan Kiszka [Fri, 26 Aug 2011 17:52:11 +0000 (19:52 +0200)]
Fix qjson test of solidus encoding

"\/" is supposed to be decoded as "/", but there is no need to encode
"/" via escape. Fix the existing test and add a second one expressing
this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoconfigure: Copy test data to build directory
Luiz Capitulino [Fri, 26 Aug 2011 18:00:13 +0000 (15:00 -0300)]
configure: Copy test data to build directory

The QDict unit-tests (check-qdict) will fail when ran on a different
build directory. That's, it only works when ran on the source dir.

This happens because its data file (qdict-test-data.txt) is not
copied to the build dir. Fix it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoscsi: refine constants for READ CAPACITY 16
Paolo Bonzini [Tue, 6 Sep 2011 10:31:42 +0000 (12:31 +0200)]
scsi: refine constants for READ CAPACITY 16

Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
from the 12-byte CDB variant, and add a constant for the subcommand.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: fix accounting of writes
Paolo Bonzini [Mon, 5 Sep 2011 16:11:51 +0000 (18:11 +0200)]
scsi: fix accounting of writes

Writes go through scsi_write_complete at least twice, the first time
to get some data without having actually written anything.  Because
of this, the first time scsi_write_complete is called it will call
bdrv_acct_done and account a read incorrectly.  Fix this by looking
at the aiocb.  I am doing the same in scsi_read_complete for symmetry,
but it is only needed in the (bogus) case of bdrv_aio_readv returning
NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: execute SYNCHRONIZE_CACHE asynchronously
Paolo Bonzini [Tue, 6 Sep 2011 07:08:34 +0000 (09:08 +0200)]
scsi: execute SYNCHRONIZE_CACHE asynchronously

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: bugfix, opening vSphere 4 exported image
Fam Zheng [Fri, 12 Aug 2011 15:19:34 +0000 (23:19 +0800)]
VMDK: bugfix, opening vSphere 4 exported image

The vSphere 4 exported image is streamOptimized extent, which is not
quite correctly handled. Ignore rdgOffset when RGD flag bit not set.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: bugfix, open Haiku vmdk image
Fam Zheng [Fri, 12 Aug 2011 15:19:33 +0000 (23:19 +0800)]
VMDK: bugfix, open Haiku vmdk image

Haiku provides a specially formed vmdk image, which let qemu abort. It a
combination of sparse header and flat data (i.e. with not l1/l2 table at
all). The fix is turn to descriptor when sparse header is zero in field
'capacity'.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: creating streamOptimized subformat
Fam Zheng [Fri, 12 Aug 2011 15:19:32 +0000 (23:19 +0800)]
VMDK: creating streamOptimized subformat

Creating streamOptimized subformat. Added subformat option
'streamOptimized', to create a image with compression enabled and each
cluster with a GrainMarker.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: read/write compressed extent
Fam Zheng [Fri, 12 Aug 2011 15:19:31 +0000 (23:19 +0800)]
VMDK: read/write compressed extent

Add support for reading/writing compressed extent.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: Opening compressed extent.
Fam Zheng [Fri, 12 Aug 2011 15:19:30 +0000 (23:19 +0800)]
VMDK: Opening compressed extent.

Added flags field for compressed/streamOptimized extents, open and save
image configuration.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: separate vmdk_read_extent/vmdk_write_extent
Fam Zheng [Fri, 12 Aug 2011 15:19:29 +0000 (23:19 +0800)]
VMDK: separate vmdk_read_extent/vmdk_write_extent

Factor out read/write extent code, since there will be more things to
take care of once reading/writing compressed clusters is introduced.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: add twoGbMaxExtentSparse support
Fam Zheng [Fri, 12 Aug 2011 15:19:28 +0000 (23:19 +0800)]
VMDK: add twoGbMaxExtentSparse support

Add twoGbMaxExtentSparse support. Introduce vmdk_free_last_extent.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: enable twoGbMaxExtentFlat
Fam Zheng [Fri, 12 Aug 2011 15:19:27 +0000 (23:19 +0800)]
VMDK: enable twoGbMaxExtentFlat

Enable the createType 'twoGbMaxExtentFlat'. The supporting code is
already in.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Declare qemu_blockalign() in block.h, not block_int.h
Markus Armbruster [Wed, 3 Aug 2011 13:08:19 +0000 (15:08 +0200)]
block: Declare qemu_blockalign() in block.h, not block_int.h

Device models should be able to use it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agospitz tosa: Simplify "drive is suitable for microdrive" test
Markus Armbruster [Wed, 3 Aug 2011 13:08:13 +0000 (15:08 +0200)]
spitz tosa: Simplify "drive is suitable for microdrive" test

We try the drive defined with -drive if=ide,index=0 (or equivalent
sugar).  We use it only if (dinfo && bdrv_is_inserted(dinfo->bdrv) &&
!bdrv_is_removable(dinfo->bdrv)).  This is a convoluted way to test
for "drive media can't be removed".

The only way to create such a drive with -drive if=ide is media=cdrom.
And that sets dinfo->media_cd, so just test that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoxen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"
Markus Armbruster [Wed, 3 Aug 2011 13:08:12 +0000 (15:08 +0200)]
xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"

pci_piix3_xen_ide_unplug() unplugs only disks, not CD-ROMs.  It peeks
into the DriveInfo's BlockDriverState to distinguish between the two.
Unclean; use DriveInfo member media_cd, like xen_config_dev_blk().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agosavevm: Include writable devices with removable media
Markus Armbruster [Wed, 3 Aug 2011 13:08:11 +0000 (15:08 +0200)]
savevm: Include writable devices with removable media

savevm and loadvm silently ignore block devices with removable media,
such as floppies and SD cards.  Rolling back a VM to a previous
checkpoint will *not* roll back writes to block devices with removable
media.

Moreover, bdrv_is_removable() is a confused mess, and wrong in at
least one case: it considers "-drive if=xen,media=cdrom -M xenpv"
removable.  It'll be cleaned up later in this series.

Read-only block devices are also ignored, but that's okay.

Fix by ignoring only read-only block devices and empty block devices.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Clean up bdrv_flush_all()
Markus Armbruster [Wed, 3 Aug 2011 13:08:10 +0000 (15:08 +0200)]
block: Clean up bdrv_flush_all()

Change (!bdrv_is_removable(bs) || bdrv_is_inserted(bs)) to just
bdrv_is_inserted().  Rationale:

    The value of bdrv_is_removable(bs) matters only when
    bdrv_is_inserted(bs) is false.

    bdrv_is_inserted(bs) is true when bs is open (bs->drv != NULL) and
    not an empty host drive (CD-ROM or floppy).

    Therefore, bdrv_is_removable(bs) matters only when:

    1. bs is not open
       old: may call bdrv_flush(bs), which does nothing
       new: won't call

    2. bs is an empty host drive
       old: may call bdrv_flush(bs), which calls driver method
            raw_flush(), which calls fdatasync() or equivalent, which
            can't do anything useful while the drive is empty
       new: won't call

Result is bs->drv && !bdrv_is_read_only(bs) && bdrv_is_inserted(bs).
bdrv_is_inserted(bs) implies bs->drv.  Drop the redundant test.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agofdc: Make media change detection more robust
Markus Armbruster [Wed, 3 Aug 2011 13:08:09 +0000 (15:08 +0200)]
fdc: Make media change detection more robust

fdctrl_change_cb() gets called on a virtual media change via monitor.
It would be nice if host device block drivers called it on physical
media change, but they don't.

bdrv_media_changed() lets you poll for media change, but it returns
"don't know" except with block driver "host_floppy".

FDrive member media_changed gets set on device initialization and by
fdctrl_change_cb(), and cleared by fdctrl_media_changed().  Thus, it's
set on first entry to fdctrl_media_changed() since device
initialization or virtual media change.

fdctrl_media_changed() ignores media_changed unless
bdrv_media_changed() returns "don't know".  If we change media via
monitor (setting media_changed), and the new media's block driver
returns 0, we lose.  Fortunately, "host_floppy" always returns 1 on
first call.  Brittle.  Clean it up not to rely on it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Leave tracking media change to device models
Markus Armbruster [Wed, 3 Aug 2011 13:08:08 +0000 (15:08 +0200)]
block: Leave tracking media change to device models

hw/fdc.c is the only one that cares.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/raw: Fix to forward method bdrv_media_changed()
Markus Armbruster [Wed, 3 Aug 2011 13:08:07 +0000 (15:08 +0200)]
block/raw: Fix to forward method bdrv_media_changed()

Block driver "raw" forwards most methods to the underlying block
driver.  However, it doesn't implement method bdrv_media_changed().
Makes bdrv_media_changed() always return -ENOTSUP.

I believe -fda /dev/fd0 gives you raw over host_floppy, and disk
change detection (fdc register 7 bit 7) is broken.  Testing my theory
requires a computer museum, though.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Give vmstate structs internal linkage where possible
Markus Armbruster [Wed, 3 Aug 2011 13:08:04 +0000 (15:08 +0200)]
ide: Give vmstate structs internal linkage where possible

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Clean up case label indentation in ide_exec_cmd()
Markus Armbruster [Wed, 3 Aug 2011 13:07:44 +0000 (15:07 +0200)]
ide: Clean up case label indentation in ide_exec_cmd()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Update command code definitions as per ACS-2 Table B.2
Markus Armbruster [Wed, 3 Aug 2011 13:07:43 +0000 (15:07 +0200)]
ide: Update command code definitions as per ACS-2 Table B.2

Drop WIN_SRST, it has the same value as WIN_DEVICE_RESET.

Drop unused WIN_RESTORE, it has the same value as WIN_RECAL.

Drop codes that are not implemented and long obsolete: WIN_READ_LONG,
WIN_READ_LONG_ONCE, WIN_WRITE_LONG, WIN_WRITE_LONG_ONCE, WIN_FORMAT
(all obsolete since ATA4), WIN_ACKMEDIACHANGE, WIN_POSTBOOT,
WIN_PREBOOT (obsolete since ATA3), WIN_WRITE_SAME (obsolete since
ATA3, code reused for something else in ACS2), WIN_IDENTIFY_DMA
(obsolete since ATA4).

Drop codes that are not implemented and vendor-specific:
EXABYTE_ENABLE_NEST, DISABLE_SEAGATE.

Drop WIN_INIT, it isn't implemented, its value used to be reserved,
and is used for something else since ATA8.

CFA_IDLEIMMEDIATE isn't specific to CFATA.  ACS-2 shows it as a
defined command in ATA-1, -2 and -3.  Rename to WIN_IDLEIMMEDIATE2.

Mark vendor specific, retired, and obsolete codes.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Split change_cb() into change_media_cb(), resize_cb()
Markus Armbruster [Wed, 3 Aug 2011 13:07:42 +0000 (15:07 +0200)]
block: Split change_cb() into change_media_cb(), resize_cb()

Multiplexing callbacks complicates matters needlessly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Generalize change_cb() to BlockDevOps
Markus Armbruster [Wed, 3 Aug 2011 13:07:41 +0000 (15:07 +0200)]
block: Generalize change_cb() to BlockDevOps

So we can more easily add device model callbacks.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Attach non-qdev devices as well
Markus Armbruster [Wed, 3 Aug 2011 13:07:40 +0000 (15:07 +0200)]
block: Attach non-qdev devices as well

For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()
to bdrv_attach_dev(), bdrv_detach() to bdrv_detach_dev(), and
bdrv_get_attached() to bdrv_get_attached_dev().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoasync: Allow nested qemu_bh_poll calls
Kevin Wolf [Thu, 1 Sep 2011 14:16:10 +0000 (16:16 +0200)]
async: Allow nested qemu_bh_poll calls

qemu may segfault when a BH handler first deletes a BH and then (possibly
indirectly) calls a nested qemu_bh_poll(). This is because the inner instance
frees the BH and deletes it from the list that the outer one processes.

This patch deletes BHs only in the outermost qemu_bh_poll instance.

Commit 7887f620 already tried to achieve the same, but it assumed that the BH
handler would only delete its own BH. With a nested qemu_bh_poll(), this isn't
guaranteed, so that commit wasn't enough. Hope this one fixes it for real.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Fix error cases to run depedent requests
Kevin Wolf [Thu, 1 Sep 2011 13:02:13 +0000 (15:02 +0200)]
qcow2: Fix error cases to run depedent requests

Requests depending on a failed request would end up waiting forever. This fixes
the error path to continue dependent requests even when the request has failed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Properly initialise QcowL2Meta
Kevin Wolf [Thu, 1 Sep 2011 13:00:42 +0000 (15:00 +0200)]
qcow2: Properly initialise QcowL2Meta

Dependency list pointers filled with random garbage from the stack aren't a
good idea.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agolinux aio: some comments
Frediano Ziglio [Tue, 30 Aug 2011 07:46:11 +0000 (09:46 +0200)]
linux aio: some comments

Add some notes about Linux AIO explaining why we don't use AIO in
some situations.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agomips: Support the MT TCStatus IXMT irq disable flag
Edgar E. Iglesias [Mon, 29 Aug 2011 22:44:28 +0000 (00:44 +0200)]
mips: Support the MT TCStatus IXMT irq disable flag

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Add SMP support to the Malta board
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:41 +0000 (23:07 +0200)]
mips: Add SMP support to the Malta board

No change to the CPU kinds, so SMP will only work if
manually changing the cpu to 34Kf:

-cpu 34Kf -smp 2

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Add MT halting and waking of VPEs
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:40 +0000 (23:07 +0200)]
mips: Add MT halting and waking of VPEs

+ some partial support for TC's.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Initialize MT state at reset
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:39 +0000 (23:07 +0200)]
mips: Initialize MT state at reset

Only TC0 on VPE0 is active after reset. All other VPEs and
TCs start in sleep.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Default to using one VPE and one TC.
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:38 +0000 (23:07 +0200)]
mips: Default to using one VPE and one TC.

Boards can override the setup if needed.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Enable VInt interrupt mode for the 34Kf
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:37 +0000 (23:07 +0200)]
mips: Enable VInt interrupt mode for the 34Kf

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Correct VInt vector generation
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:36 +0000 (23:07 +0200)]
mips: Correct VInt vector generation

1. The pending need to pass the Status IM gating.
2. The priority is from seven (highest prio) down to zero.
   QEMU was doing the opposite.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Correct IntCtl write mask for VInt
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:35 +0000 (23:07 +0200)]
mips: Correct IntCtl write mask for VInt

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Hook in more reg accesses via mttr/mftr
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:34 +0000 (23:07 +0200)]
mips: Hook in more reg accesses via mttr/mftr

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Synchronize CP0 TCSTatus, Status and EntryHi
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:33 +0000 (23:07 +0200)]
mips: Synchronize CP0 TCSTatus, Status and EntryHi

These registers share some of their fields. Writes to these fields
should be visible through the corresponding mirror fields.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomips: Handle TC indexing of other VPEs
Edgar E. Iglesias [Mon, 29 Aug 2011 21:07:32 +0000 (23:07 +0200)]
mips: Handle TC indexing of other VPEs

Introduce mips_cpu_map_tc() to map a global TC index into a VPE nr
and local tc index.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomilkymist: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:42:57 +0000 (21:42 +0300)]
milkymist: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomilkymist-softusb: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:40:35 +0000 (21:40 +0300)]
milkymist-softusb: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomilkymist-minimac2: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:32:25 +0000 (21:32 +0300)]
milkymist-minimac2: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomcf5208: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:21:47 +0000 (21:21 +0300)]
mcf5208: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomainstone: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:08:45 +0000 (21:08 +0300)]
mainstone: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agolm32_boards: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:05:07 +0000 (21:05 +0300)]
lm32_boards: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agodummy_m68k: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 17:44:23 +0000 (20:44 +0300)]
dummy_m68k: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopflash_cfi01/pflash_cfi02: convert to memory API
Avi Kivity [Thu, 4 Aug 2011 12:55:30 +0000 (15:55 +0300)]
pflash_cfi01/pflash_cfi02: convert to memory API

cfi02 is annoying in that is ignores some address bits; we probably
want explicit support in the memory API for that.

In order to get the correct opaque into the MemoryRegion object, the
allocation scheme is changed so that the flash emulation code allocates
memory, instead of the caller.  This clears a FIXME in the flash code.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoMakefile.hw: allow hw/ files to include glib headers
Avi Kivity [Wed, 3 Aug 2011 15:55:00 +0000 (18:55 +0300)]
Makefile.hw: allow hw/ files to include glib headers

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopiix_pci: wrap memory update in a transaction
Avi Kivity [Mon, 1 Aug 2011 08:04:39 +0000 (11:04 +0300)]
piix_pci: wrap memory update in a transaction

The code will remap all PAMs, even if just one is updated, resulting
in reduced performance.  Wrap in a transaction to detect that those
other PAMs have not changed.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agocirrus: wrap memory update in a transaction
Avi Kivity [Mon, 1 Aug 2011 08:03:42 +0000 (11:03 +0300)]
cirrus: wrap memory update in a transaction

This prevents spurious unmapping and remapping of the vga windows,
which reduces performance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoleon3: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 12:07:22 +0000 (15:07 +0300)]
leon3: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agointegratorcp: convert to memory API (RAM/flash only)
Avi Kivity [Mon, 25 Jul 2011 12:03:19 +0000 (15:03 +0300)]
integratorcp: convert to memory API (RAM/flash only)

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosysbus: add sysbus_add_memory_overlap()
Avi Kivity [Mon, 25 Jul 2011 12:02:17 +0000 (15:02 +0300)]
sysbus: add sysbus_add_memory_overlap()

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoaxis_dev88: convert to memory API (RAM only)
Avi Kivity [Mon, 25 Jul 2011 11:32:34 +0000 (14:32 +0300)]
axis_dev88: convert to memory API (RAM only)

Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoarmv7m: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 11:27:01 +0000 (14:27 +0300)]
armv7m: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoan5206: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 11:14:31 +0000 (14:14 +0300)]
an5206: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoReadWriteHandler: remove
Avi Kivity [Sun, 24 Jul 2011 16:27:24 +0000 (19:27 +0300)]
ReadWriteHandler: remove

No longer used.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopci_host: convert conf index and data ports to memory API
Avi Kivity [Sun, 24 Jul 2011 14:47:18 +0000 (17:47 +0300)]
pci_host: convert conf index and data ports to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosysbus: add helpers to add and delete memory regions to the system bus
Avi Kivity [Sun, 24 Jul 2011 14:12:11 +0000 (17:12 +0300)]
sysbus: add helpers to add and delete memory regions to the system bus

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agostellaris_enet: convert to memory API
Avi Kivity [Mon, 18 Jul 2011 08:58:50 +0000 (11:58 +0300)]
stellaris_enet: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomips_fulong2e: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:46:13 +0000 (21:46 +0300)]
mips_fulong2e: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoapb_pci: convert PCI space to memory API
Blue Swirl [Sat, 3 Sep 2011 16:38:02 +0000 (16:38 +0000)]
apb_pci: convert PCI space to memory API

Add a new memory space for PCI instead of using system memory.

This also fixes a bug where VGA region vga.chain4 is
accidentally mapped to 0xa0000 instead of 0x1ff000a0000.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agofw_cfg: fix crash if FW_CFG_WRITE_CHANNEL is used incorrectly
Blue Swirl [Fri, 26 Aug 2011 18:43:18 +0000 (18:43 +0000)]
fw_cfg: fix crash if FW_CFG_WRITE_CHANNEL is used incorrectly

Avoid a crash if the guest combines FW_CFG_WRITE_CHANNEL with
a wrong value.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosoftfloat: Use uint32 consistently
Andreas Färber [Sun, 28 Aug 2011 18:24:34 +0000 (20:24 +0200)]
softfloat: Use uint32 consistently

Prepares for uint32 replacement.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosoftfloat: Use uint16 consistently
Andreas Färber [Sun, 28 Aug 2011 18:24:33 +0000 (20:24 +0200)]
softfloat: Use uint16 consistently

Prepares for uint16 replacement.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAllow overriding the location of Samba's smbd.
Brad [Fri, 2 Sep 2011 20:53:28 +0000 (16:53 -0400)]
Allow overriding the location of Samba's smbd.

Allow overriding the location of Samba's smbd.

Pretty much every OS I look at has some means of
changing this path (patching) so lets just make
it easier for OS developers creating packages
and/or end users to override the location.

Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoUse new macro QEMU_PACKED for packed structures
Stefan Weil [Wed, 31 Aug 2011 10:38:01 +0000 (12:38 +0200)]
Use new macro QEMU_PACKED for packed structures

Most changes were made using these commands:

git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__((__packed__))'|xargs perl -pi -e 's/__attribute__\(\(__packed__\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((__packed__))'|xargs perl -pi -e 's/__attribute__ \(\(__packed__\)\)/QEMU_PACKED/'
git grep -la '__attribute((packed))'|xargs perl -pi -e 's/__attribute\(\(packed\)\)/QEMU_PACKED/'

Whitespace in linux-user/syscall_defs.h was fixed manually
to avoid warnings from scripts/checkpatch.pl.

Manual changes were also applied to hw/pc.c.

I did not fix indentation with tabs in block/vvfat.c.
The patch will show 4 errors with scripts/checkpatch.pl.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoAdd new macro QEMU_PACKED for packed C structures
Stefan Weil [Wed, 31 Aug 2011 10:38:00 +0000 (12:38 +0200)]
Add new macro QEMU_PACKED for packed C structures

A packed struct needs different gcc attributes for compilations
with MinGW compilers because glib-2.0 adds compiler flag
-mms-bitfields which modifies the packing algorithm.

Attribute gcc_struct reverses the negative effects of -mms-bitfields.
QEMU_PACKED sets this attribute and must be used for any packed
struct which is affected by -mms-bitfields.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agorename qemu_malloc and related to glib names for coherence
Frediano Ziglio [Wed, 31 Aug 2011 07:25:35 +0000 (09:25 +0200)]
rename qemu_malloc and related to glib names for coherence

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoFix install(1) usage to be compatible with OpenBSD's install(1).
Brad [Sun, 28 Aug 2011 08:01:33 +0000 (04:01 -0400)]
Fix install(1) usage to be compatible with OpenBSD's install(1).

Fix install(1) usage to be compatible with OpenBSD's install(1).

When creating a directory via the -d flag the -p flag cannot be
used at the same time. Also in the context of installing QEMU it
doesn't make sense to use the -p flag anyway so use the [default]
-c flag instead.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>