Amit Shah [Fri, 9 Sep 2011 09:00:39 +0000 (14:30 +0530)]
balloon: Disassociate handlers from balloon device on unplug
When a balloon device gets unplugged, allow the balloon handlers to be
freed.
Reported-by: Shaolong Hu <shu@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Thomas Huth [Fri, 9 Sep 2011 05:58:37 +0000 (15:58 +1000)]
tcg/ppc64: Fix zero extension code generation bug for ppc64 host
The ppc64 code generation backend uses an rldicr (Rotate Left Double
Immediate and Clear Right) instruction to implement zero extension of
a 32 bit quantity to a 64 bit quantity (INDEX_op_ext32u_i64). However
this is wrong - this instruction clears specified low bits of the
value, instead of high bits as we require for a zero extension. It
should instead use an rldicl (Rotate Left Double Immediate and Clear
Left) instruction.
Presumably amongst other things, this causes the SLOF firmware image
used with -M pseries to not boot on a ppc64 host.
It appears this bug was exposed by commit
0bf1dbdcc935dfc220a93cd990e947e90706aec6 (tcg/ppc64: fix 16/32 mixup)
which enabled the use of the op_ext32u_i64 operation on the ppc64
backend.
Signed-off-by: Thomas Huth <thuth@de.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: malc <av1474@comtv.ru>
Anthony Liguori [Thu, 8 Sep 2011 14:25:36 +0000 (09:25 -0500)]
Merge remote-tracking branch 'origin/master' into staging
Richard Henderson [Thu, 8 Sep 2011 08:23:11 +0000 (09:23 +0100)]
target-i386: Compute all flag data inside %cl != 0 test.
The (x << (cl - 1)) quantity is only used if CL != 0. Move the
computation of that quantity nearer its use.
This avoids the creation of undefined TCG operations when the
constant propagation optimization proves that CL == 0, and thus
CL-1 is outside the range [0-wordsize).
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
Anthony Liguori [Thu, 8 Sep 2011 14:07:57 +0000 (09:07 -0500)]
Merge remote-tracking branch 'spice/spice.v42' into staging
Anthony Liguori [Thu, 8 Sep 2011 14:07:13 +0000 (09:07 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Thu, 8 Sep 2011 14:05:14 +0000 (09:05 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' 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
Anthony Liguori [Thu, 8 Sep 2011 13:59:32 +0000 (08:59 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 8 Sep 2011 13:57:33 +0000 (08:57 -0500)]
Merge remote-tracking branch 'kraxel/usb.26' 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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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.
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>
Gerd Hoffmann [Fri, 2 Sep 2011 13:03:28 +0000 (15:03 +0200)]
spice: workaround a spice server bug.
spice server might call the channel_event callback from spice server
thread context. Detect that and aquire iothread lock if needed,
Yonit Halperin [Mon, 5 Sep 2011 14:39:50 +0000 (17:39 +0300)]
spice: set qxl->ssd.running=true before telling spice to start, RHBZ #733993
If qxl->ssd.running=true is set after telling spice to start, the spice server
thread can call qxl_send_events while qxl->ssd.running is still false. This leads to
assert(d->ssd.running).
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Yonit Halperin [Mon, 5 Sep 2011 05:45:59 +0000 (08:45 +0300)]
qxl: s/qxl_set_irq/qxl_update_irq/
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Yonit Halperin [Mon, 5 Sep 2011 05:45:58 +0000 (08:45 +0300)]
qxl: send interrupt after migration in case ram->int_pending != 0, RHBZ #732949
if qxl_send_events was called from spice server context, and then
migration had completed before a call to pipe_read, the target
guest qxl driver didn't get the interrupt. In addition,
qxl_send_events ignored further interrupts of the same kind, since
ram->int_pending was set. As a result, the guest driver was stacked
or very slow (when the waiting for the interrupt was with timeout).
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Peter Maydell [Sat, 3 Sep 2011 13:48:25 +0000 (14:48 +0100)]
hw/qxl: Fix format string errors
Fix format string errors causing compile failure on 32 bit hosts
when spice is enabled.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Peter Maydell [Tue, 9 Aug 2011 22:04:35 +0000 (23:04 +0100)]
spice-qemu-char.c: Use correct printf format char for ssize_t
Use the correct printf format string character (%z) for ssize_t.
This fixes a compile failure on 32 bit Linux with spice enabled.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>