sdk/emulator/qemu.git
12 years agohw/arm_boot.c: Make ram_size a uint64_t
Peter Maydell [Fri, 20 Jul 2012 12:34:49 +0000 (13:34 +0100)]
hw/arm_boot.c: Make ram_size a uint64_t

Make the RAM size in arm_boot_info a uint64_t so it can express
the larger RAM sizes that may be seen in LPAE systems.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agohw/pl011.c: Avoid crash on read when no chr backend present
Peter Maydell [Fri, 20 Jul 2012 12:34:49 +0000 (13:34 +0100)]
hw/pl011.c: Avoid crash on read when no chr backend present

Add a missing guard that meant we would segfault if the guest read
UARTDR on a PL011 serial device which had no chr backend connected.
(This didn't happen for Linux guests because Linux reads the flags
register and doesn't try to read the UART if it's empty.)

Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoRevert "audio: Make PC speaker audio card available by default"
Anthony Liguori [Thu, 19 Jul 2012 23:25:52 +0000 (18:25 -0500)]
Revert "audio: Make PC speaker audio card available by default"

This reverts commit 504972922da9b562f15e13544d3efca84b46b8fd which broke the
build for ARM.

I don't think this change is necessary.  If I'm wrong, please recommit this
changeset with an appropriate fix for ARM.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoaudio: Make PC speaker audio card available by default
Jan Kiszka [Thu, 19 Jul 2012 15:57:51 +0000 (17:57 +0200)]
audio: Make PC speaker audio card available by default

    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "KOI8-R" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 18 Jul 2012 19:44:50 +0000 (14:44 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (41 commits)
  fdc-test: Clean up a bit
  fdc-test: introduce test_relative_seek
  fdc: fix relative seek
  qemu-iotests: Valgrind support
  coroutine-ucontext: Help valgrind understand coroutines
  qemu-io: Fix memory leaks
  hw/block-common: Factor out fall back to legacy -drive cyls=...
  blockdev: Don't limit DriveInfo serial to 20 characters
  hw/block-common: Factor out fall back to legacy -drive serial=...
  hw/block-common: Move BlockConf & friends from block.h
  Relax IDE CHS limits from 16383,16,63 to 65535,16,255
  blockdev: Drop redundant CHS validation for if=ide
  hd-geometry: Compute BIOS CHS translation in one place
  qtest: Test we don't put hard disk info into CMOS for a CD-ROM
  ide pc: Put hard disk info into CMOS only for hard disks
  block: Geometry and translation hints are now useless, purge them
  qtest: Cover qdev property for BIOS CHS translation
  ide: qdev property for BIOS CHS translation
  qdev: New property type chs-translation
  qdev: Collect private helpers in one place
  ...

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Wed, 18 Jul 2012 19:44:43 +0000 (14:44 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  virtio: move common irqfd handling out of virtio-pci
  virtio: move common ioeventfd handling out of virtio-pci
  event_notifier: add event_notifier_set_handler
  memory: pass EventNotifier, not eventfd
  ivshmem: wrap ivshmem_del_eventfd loops with transaction
  ivshmem: use EventNotifier and memory API
  event_notifier: add event_notifier_init_fd
  event_notifier: remove event_notifier_test
  event_notifier: add event_notifier_set
  apic: Defer interrupt updates to VCPU thread
  apic: Reevaluate pending interrupts on LVT_LINT0 changes
  apic: Resolve potential endless loop around apic_update_irq
  kvm: expose tsc deadline timer feature to guest
  kvm_pv_eoi: add flag support
  kvm: Don't abort on kvm_irqchip_add_msi_route()

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Wed, 18 Jul 2012 19:44:37 +0000 (14:44 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: Convert getfd and closefd
  qapi: input_type_enum(): fix error message
  qmp: dump-guest-memory: improve schema doc

12 years agoMerge remote-tracking branch 'kraxel/bios.2' into staging
Anthony Liguori [Wed, 18 Jul 2012 19:44:32 +0000 (14:44 -0500)]
Merge remote-tracking branch 'kraxel/bios.2' into staging

* kraxel/bios.2:
  Add vgabios build rules to roms/Makefile

12 years agoMerge remote-tracking branch 'kraxel/usb.57' into staging
Anthony Liguori [Wed, 18 Jul 2012 19:44:27 +0000 (14:44 -0500)]
Merge remote-tracking branch 'kraxel/usb.57' into staging

* kraxel/usb.57:
  ehci: improve expire time calculation
  ehci: implement Interrupt Threshold Control support
  ehci: raise irq in the frame timer
  uhci: initialize expire_time when loading v1 vmstate
  usb: add usb attached scsi emulation
  scsi: add free_request callback

12 years agobuild: fix build breakage due to bad merge
Anthony Liguori [Tue, 17 Jul 2012 23:58:20 +0000 (18:58 -0500)]
build: fix build breakage due to bad merge

34bb443ee74df3780d86044dbf6492eb798c5807 broke the build but in a subtle way.
The patch on the ML was actually based on the 1.1.1 stable branch
(accidentally).  When I merged it from the ML, the fuzzing got resolved in a
such a way that the newly introduced Makefile dependency on GENERATED_HEADERS
got lost (that was not in 1.1.1).

The dist bits also got duplicated (but this is just cosmetic).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobuild: add make dist target (v2)
Anthony Liguori [Tue, 17 Jul 2012 18:33:32 +0000 (13:33 -0500)]
build: add make dist target (v2)

Let's stop screwing up releases by having a script do the work that Anthony's
fat fingers can't seem to get right.

Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-options.hx: Fix set_password and expire_password description
Michal Novotny [Mon, 16 Jul 2012 13:54:38 +0000 (15:54 +0200)]
qemu-options.hx: Fix set_password and expire_password description

The description for set_password and expire_password commands is
incomplete. This patch fixes the man page that is being generated
to match the real behaviour of these functions.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-options.hx: Improve -nodefaults description
Michal Novotny [Mon, 16 Jul 2012 12:35:10 +0000 (14:35 +0200)]
qemu-options.hx: Improve -nodefaults description

This patch improves the description of -nodefaults QEMU command line
option by adding more information what is being disabled using this
command.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-options.hx: Improve -{read|write}config options description
Michal Novotny [Mon, 16 Jul 2012 12:28:32 +0000 (14:28 +0200)]
qemu-options.hx: Improve -{read|write}config options description

This is the patch to improve description for -{read|write}config
functions.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconstify value pointer for qdev_prop_set_string
Christian Borntraeger [Tue, 17 Jul 2012 13:26:17 +0000 (15:26 +0200)]
constify value pointer for qdev_prop_set_string

qdev_prop_set_string uses object_property_set_str, which takes
a const char * for the value. Lets propagate the constness
into qdev_prop_set_string.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agodoc: Fix indefinite article an -> a before nouns that begin with 'h'
Stefan Weil [Mon, 16 Jul 2012 21:37:07 +0000 (23:37 +0200)]
doc: Fix indefinite article an -> a before nouns that begin with 'h'

Although the rule also allows 'an' for historical reasons,
'a' is more common because 'h' is pronounced.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agofdc-test: Clean up a bit
Kevin Wolf [Mon, 16 Jul 2012 14:06:56 +0000 (16:06 +0200)]
fdc-test: Clean up a bit

Readability of the test code has suffered as the test case evolved. This
should improve it a bit again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: introduce test_relative_seek
Pavel Hrdina [Mon, 16 Jul 2012 13:48:27 +0000 (15:48 +0200)]
fdc-test: introduce test_relative_seek

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix relative seek
Pavel Hrdina [Mon, 16 Jul 2012 13:48:26 +0000 (15:48 +0200)]
fdc: fix relative seek

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: Valgrind support
Kevin Wolf [Thu, 28 Jun 2012 14:55:54 +0000 (16:55 +0200)]
qemu-iotests: Valgrind support

check -valgrind wraps all qemu-io calls with valgrind. This makes it a
bit easier to debug problems that occur somewhere deep in a test case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agocoroutine-ucontext: Help valgrind understand coroutines
Kevin Wolf [Fri, 29 Jun 2012 11:40:27 +0000 (13:40 +0200)]
coroutine-ucontext: Help valgrind understand coroutines

valgrind tends to get confused and report false positives when you
switch stacks and don't tell it about it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-io: Fix memory leaks
Kevin Wolf [Mon, 2 Jul 2012 13:13:53 +0000 (15:13 +0200)]
qemu-io: Fix memory leaks

Almost all callers of create_iovec() forgot to destroy the qiov when the
request has completed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agohw/block-common: Factor out fall back to legacy -drive cyls=...
Markus Armbruster [Wed, 11 Jul 2012 13:08:39 +0000 (15:08 +0200)]
hw/block-common: Factor out fall back to legacy -drive cyls=...

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblockdev: Don't limit DriveInfo serial to 20 characters
Markus Armbruster [Wed, 11 Jul 2012 13:08:38 +0000 (15:08 +0200)]
blockdev: Don't limit DriveInfo serial to 20 characters

All current users (IDE, SCSI and virtio-blk) happen to share this 20
characters limit.  Still, it should be left to device models.  They
already enforce their limits.  They have to, as the DriveInfo limit
only affects legacy -drive serial=..., not the qdev properties.

usb-storage, which doesn't limit serial number length, also uses
DriveInfo for -usbdevice.  But that doesn't provide access to
DriveInfo serial.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohw/block-common: Factor out fall back to legacy -drive serial=...
Markus Armbruster [Wed, 11 Jul 2012 13:08:37 +0000 (15:08 +0200)]
hw/block-common: Factor out fall back to legacy -drive serial=...

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohw/block-common: Move BlockConf & friends from block.h
Markus Armbruster [Wed, 11 Jul 2012 13:08:36 +0000 (15:08 +0200)]
hw/block-common: Move BlockConf & friends from block.h

This stuff doesn't belong to block layer, and was put there only
because a better home didn't exist then.  Now it does.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoRelax IDE CHS limits from 16383,16,63 to 65535,16,255
Markus Armbruster [Tue, 10 Jul 2012 09:12:55 +0000 (11:12 +0200)]
Relax IDE CHS limits from 16383,16,63 to 65535,16,255

New limits straight from ATA4 6.2 Register delivered data transfer
command sector addressing.

I figure the old sector limit 63 was blindly copied from the BIOS
int 13 limit.  Doesn't apply to the hardware.  No idea where the old
cylinder limit comes from.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblockdev: Drop redundant CHS validation for if=ide
Markus Armbruster [Tue, 10 Jul 2012 09:12:54 +0000 (11:12 +0200)]
blockdev: Drop redundant CHS validation for if=ide

Leave it to ide_init_drive().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Compute BIOS CHS translation in one place
Markus Armbruster [Tue, 10 Jul 2012 09:12:53 +0000 (11:12 +0200)]
hd-geometry: Compute BIOS CHS translation in one place

Currently, it is split between hd_geometry_guess() and
pc_cmos_init_late().  Confusing.  info qtree shows the result of the
former.  Also confusing.

Fold the part done in pc_cmos_init_late() into hd_geometry_guess().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqtest: Test we don't put hard disk info into CMOS for a CD-ROM
Markus Armbruster [Tue, 10 Jul 2012 09:12:52 +0000 (11:12 +0200)]
qtest: Test we don't put hard disk info into CMOS for a CD-ROM

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide pc: Put hard disk info into CMOS only for hard disks
Markus Armbruster [Tue, 10 Jul 2012 09:12:51 +0000 (11:12 +0200)]
ide pc: Put hard disk info into CMOS only for hard disks

In particular, don't set disk type and geometry when a CD-ROM on bus
ide.0 has media during CMOS initialization.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Geometry and translation hints are now useless, purge them
Markus Armbruster [Tue, 10 Jul 2012 09:12:50 +0000 (11:12 +0200)]
block: Geometry and translation hints are now useless, purge them

There are two producers of these hints: drive_init() on behalf of
-drive, and hd_geometry_guess().

The only consumer of the hint is hd_geometry_guess().

The callers of hd_geometry_guess() call it only when drive_init()
didn't set the hints.  Therefore, drive_init()'s hints are never used.

Thus, hd_geometry_guess() only ever sees hints it produced itself in a
prior call.  Only the first call computes something, subsequent calls
just repeat the first call's results.  However, hd_geometry_guess() is
never called more than once: the device models don't, and the block
device is destroyed on unplug.  Thus, dropping the repeat feature
doesn't break anything now.

If a block device wasn't destroyed on unplug and could be reused with
a new device, then repeating old results would be wrong.  Thus,
dropping the repeat feature prevents future breakage.

This renders the hints unused.  Purge them from the block layer.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqtest: Cover qdev property for BIOS CHS translation
Markus Armbruster [Tue, 10 Jul 2012 09:12:49 +0000 (11:12 +0200)]
qtest: Cover qdev property for BIOS CHS translation

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: qdev property for BIOS CHS translation
Markus Armbruster [Tue, 10 Jul 2012 09:12:48 +0000 (11:12 +0200)]
ide: qdev property for BIOS CHS translation

This isn't quite orthodox.  CHS translation is firmware configuration,
communicated via the RTC's CMOS RAM, not a property of the disk.  But
it's best to treat it just like geometry anyway.

Maintain backward compatibility exactly like for geometry: fall back
to DriveInfo's translation, set with -drive trans=...

Bonus: info qtree now shows the translation.  Except when it shows
"auto": that's resolved by pc_cmos_init_late().  To be addressed
shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqdev: New property type chs-translation
Markus Armbruster [Tue, 10 Jul 2012 09:12:47 +0000 (11:12 +0200)]
qdev: New property type chs-translation

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqdev: Collect private helpers in one place
Markus Armbruster [Tue, 10 Jul 2012 09:12:46 +0000 (11:12 +0200)]
qdev: Collect private helpers in one place

Just code motion, with one long line wrapped to keep checkpatch.pl
happy.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqtest: Cover qdev properties for disk geometry
Markus Armbruster [Tue, 10 Jul 2012 09:12:45 +0000 (11:12 +0200)]
qtest: Cover qdev properties for disk geometry

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: qdev properties for disk geometry
Markus Armbruster [Tue, 10 Jul 2012 09:12:44 +0000 (11:12 +0200)]
ide: qdev properties for disk geometry

Geometry needs to be qdev properties, because it belongs to the
disk's guest part.

Maintain backward compatibility exactly like for serial: fall back to
DriveInfo's geometry, set with -drive cyls=...

Do this only for ide-hd.  ide-drive is legacy.  ide-cd doesn't have a
geometry.

Bonus: info qtree now shows the geometry.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovirtio-blk: qdev properties for disk geometry
Markus Armbruster [Tue, 10 Jul 2012 09:12:43 +0000 (11:12 +0200)]
virtio-blk: qdev properties for disk geometry

Geometry needs to be qdev properties, because it belongs to the
disk's guest part.

Maintain backward compatibility exactly like for serial: fall back to
DriveInfo's geometry, set with -drive cyls=...

Bonus: info qtree now shows the geometry.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-hd: qdev properties for disk geometry
Markus Armbruster [Tue, 10 Jul 2012 09:12:42 +0000 (11:12 +0200)]
scsi-hd: qdev properties for disk geometry

Geometry needs to be qdev properties, because it belongs to the
disk's guest part.

Maintain backward compatibility exactly like for serial: fall back to
DriveInfo's geometry, set with -drive cyls=...

Do this only for scsi-hd.  scsi-disk is legacy.  scsi-cd doesn't have
a geometry.  scsi-block should get geometry from the host disk.

Bonus: info qtree now shows the geometry.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Switch to uint32_t to match BlockConf
Markus Armbruster [Tue, 10 Jul 2012 09:12:41 +0000 (11:12 +0200)]
hd-geometry: Switch to uint32_t to match BlockConf

Best to use the same type, to avoid unwanted truncation or sign
extension.

BlockConf can't use plain int for cyls, heads and secs, because
integer properties require an exact width.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqdev: Introduce block geometry properties
Markus Armbruster [Tue, 10 Jul 2012 09:12:40 +0000 (11:12 +0200)]
qdev: Introduce block geometry properties

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblockdev: Save geometry in DriveInfo
Markus Armbruster [Tue, 10 Jul 2012 09:12:39 +0000 (11:12 +0200)]
blockdev: Save geometry in DriveInfo

In preparation of purging it from the block layer, which will happen
later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide pc: Cut out the block layer geometry middleman
Markus Armbruster [Tue, 10 Jul 2012 09:12:38 +0000 (11:12 +0200)]
ide pc: Cut out the block layer geometry middleman

PC BIOS setup needs IDE geometry information.  Get it directly from
the device model rather than through the block layer.  In preparation
of purging geometry from the block layer, which will happen later in
this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Cut out block layer translation middleman
Markus Armbruster [Tue, 10 Jul 2012 09:12:37 +0000 (11:12 +0200)]
hd-geometry: Cut out block layer translation middleman

hd_geometry_guess() picks geometry and translation.  Callers can get
the geometry directly, via parameters, but for translation they need
to go through the block layer.

Add a parameter for translation, so it can optionally be gotten just
like geometry.  In preparation of purging translation from the block
layer, which will happen later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Clean up confusing use of prior translation hint
Markus Armbruster [Tue, 10 Jul 2012 09:12:36 +0000 (11:12 +0200)]
hd-geometry: Clean up confusing use of prior translation hint

When hd_geometry_guess() picks a geometry, it also picks the
appropriate translation, but only when the prior translation hint is
BIOS_ATA_TRANSLATION_AUTO.  Looks wrong, because such a prior
translation would be passed to the BIOS whether it's suitable for the
geometry or not.

Fortunately, that can't happen.  There are just two ways for the
translation hint to get set to something other than
BIOS_ATA_TRANSLATION_AUTO: drive_init() on behalf of -drive trans=...,
and hd_geometry_guess().  Both set it only when they also set a valid
geometry hint, i.e. one with a non-zero number of cylinders.

Since hd_geometry_guess() returns right away when it finds a valid
geometry hint, translation can only be BIOS_ATA_TRANSLATION_AUTO in
the remainder of the function.

Assert this, and simplify accordingly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Clean up gratuitous goto in hd_geometry_guess()
Markus Armbruster [Tue, 10 Jul 2012 09:12:35 +0000 (11:12 +0200)]
hd-geometry: Clean up gratuitous goto in hd_geometry_guess()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Factor out guess_chs_for_size()
Markus Armbruster [Tue, 10 Jul 2012 09:12:34 +0000 (11:12 +0200)]
hd-geometry: Factor out guess_chs_for_size()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Unnest conditional in hd_geometry_guess()
Markus Armbruster [Tue, 10 Jul 2012 09:12:33 +0000 (11:12 +0200)]
hd-geometry: Unnest conditional in hd_geometry_guess()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Add tracepoints
Markus Armbruster [Tue, 10 Jul 2012 09:12:32 +0000 (11:12 +0200)]
hd-geometry: Add tracepoints

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agohd-geometry: Move disk geometry guessing back from block.c
Markus Armbruster [Tue, 10 Jul 2012 09:12:31 +0000 (11:12 +0200)]
hd-geometry: Move disk geometry guessing back from block.c

Commit f3d54fc4 factored it out of hw/ide.c for reuse.  Sensible,
except it was put into block.c.  Device-specific functionality should
be kept in device code, not the block layer.  Move it to
hw/hd-geometry.c, and make stylistic changes required to keep
checkpatch.pl happy.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqtest: Add hard disk geometry test
Markus Armbruster [Tue, 10 Jul 2012 09:12:30 +0000 (11:12 +0200)]
qtest: Add hard disk geometry test

So far covers only IDE and tests only CMOS contents.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: Do not clobber the user's geometry
Markus Armbruster [Tue, 10 Jul 2012 09:12:29 +0000 (11:12 +0200)]
vvfat: Do not clobber the user's geometry

vvfat creates a virtual VFAT filesystem with a certain logical
geometry that depends on its options.  It sets the "geometry hint" to
this geometry.  It is the only block driver to do this.

The geometry hint is about about *physical* geometry, and used only by
certain hard disk device models.

vvfat's hint is normally invisible for device models, because
bdrv_open() puts a raw format on top of vvfat's fat protocol.  That
raw format is where drive_init() puts the user's geometry (if any),
and where the device model gets it from.

Nobody complained, because the default physical geometry is the same
as vvfat's logical geometry:

    opts        LCHS        def. PCHS
                1024,16,63  same
    :32:        1024,16,63  same
    :16:        1024,16,63  same
    :12:          64,16,63  same

Except when you specify :floppy:

    opts        LCHS        def. PCHS
       :floppy:   80, 2,36  5,16,63
    :32:floppy:   80, 2,36  5,16,63
    :16:floppy:   80, 2,36  5,16,63
    :12:floppy:   80, 2,18  2,16,63

Silly thing to do for use with a hard disk.

However, the "raw" format can be suppressed by adding an
redundant-looking "format=vvfat" to "file=fat:FOO".  Then, vvfat's
hint clobbers the user's geometry, i.e. -drive options cyls, heads,
secs get silently ignored.  Don't do that.

No change without format=vvfat.  With it, the user's hard disk
geometry (-drive options cyls, heads, secs) is now obeyed, and the
default hard disk geometry with :floppy: now matches the one without
format=vvfat.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovvfat: Fix partition table
Markus Armbruster [Tue, 10 Jul 2012 09:12:28 +0000 (11:12 +0200)]
vvfat: Fix partition table

Unless parameter ":floppy:" is given, vvfat creates a virtual image
with DOS MBR defining a single partition which holds the FAT file
system.  The size of the virtual image depends on the width of the
FAT: 32 MiB (CHS 64, 16, 63) for 12 bit FAT, 504 MiB (CHS 1024, 16,
63) for 16 and 32 bit FAT, leaving (64*16-1)*63 = 64449 and
(1024*16-1)*64 = 1032129 sectors for the partition.

However, it screws up the end of the partition in the MBR:

    FAT width param.  start CHS  end CHS     start LBA  size
        :32:          0,1,1      1023,14,63       63    1032065
        :16:          0,1,1      1023,14,55       63    1032057
        :12:          0,1,1        63,14,55       63      64377

The actual FAT file system nevertheless assumes the partition has
1032129 or 64449 sectors.  Oops.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: Move floppy geometry guessing back from block.c
Markus Armbruster [Tue, 10 Jul 2012 09:12:27 +0000 (11:12 +0200)]
fdc: Move floppy geometry guessing back from block.c

Commit 5bbdbb46 moved it to block.c because "other geometry guessing
functions already reside in block.c".  Device-specific functionality
should be kept in device code, not the block layer.  Move it back.

Disk geometry guessing is still in block.c.  To be moved out in a
later patch series.

Bonus: the floppy type used in pc_cmos_init() now obviously matches
the one in the FDrive.  Before, we relied on
bdrv_get_floppy_geometry_hint() picking the same type both in
fd_revalidate() and in pc_cmos_init().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: do not blindly memset all read buffers
Christoph Hellwig [Tue, 10 Jul 2012 14:12:27 +0000 (16:12 +0200)]
sheepdog: do not blindly memset all read buffers

Only buffers that map to unallocated blocks need to be zeroed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: always use coroutine-based network functions
MORITA Kazutaka [Wed, 4 Jul 2012 16:41:06 +0000 (01:41 +0900)]
sheepdog: always use coroutine-based network functions

This reduces some code duplication.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoaudio: Unbreak capturing in mixemu case
malc [Mon, 16 Jul 2012 14:08:36 +0000 (18:08 +0400)]
audio: Unbreak capturing in mixemu case

Signed-off-by: malc <av1474@comtv.ru>
12 years agoqemu-log: fix x86 and user logging
Blue Swirl [Sat, 7 Jul 2012 14:40:18 +0000 (14:40 +0000)]
qemu-log: fix x86 and user logging

5726c27fa913296aafab9f50b912cea5b3709271 broke
x86 specific options and user emulation specific stdio buffering.

Always enable all log items. They may not be useful for non-x86 targets,
but there's no harm either.

Fix user emulation buffering by passing around a flag.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'trivial-patches' of git://github.com/stefanha/qemu
Blue Swirl [Sat, 14 Jul 2012 10:58:22 +0000 (10:58 +0000)]
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu

* 'trivial-patches' of git://github.com/stefanha/qemu:
  make: Remove 'build-all' rule
  qemu-keymaps: Finnish keyboard mapping broken
  vnc: add a more descriptive error message
  bitops: Fix documentation
  megasas: mark mfi_frame_desc as 'static'

12 years agovga: Implement blinking of text cursor
Jan Kiszka [Wed, 4 Jul 2012 17:49:54 +0000 (19:49 +0200)]
vga: Implement blinking of text cursor

Let the text cursor blink at 1.875 Hz, the original VGA cursor
frequency. No timer is used, instead we rely on the fact that the
display is updated periodically.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconsole: Implementing blinking of cursor
Jan Kiszka [Tue, 10 Jul 2012 20:00:55 +0000 (22:00 +0200)]
console: Implementing blinking of cursor

Let the text console cursor blink at 2 HZ.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: add -Werror to QEMU_CFLAGS early
Alexander Graf [Mon, 9 Jul 2012 12:38:08 +0000 (14:38 +0200)]
configure: add -Werror to QEMU_CFLAGS early

We want all configure tests pass with -Werror if it is enabled. So we
need to update QEMU_CFLAGS early on to make sure we also pass it in to
all the compile test jobs.

This fixes a warning-became-error bug in nss for me with the default
configuration:

In file included from /usr/include/nss3/pkcs11t.h:1780,
                 from /usr/include/nss3/keythi.h:41,
                 from /usr/include/nss3/keyt.h:41,
                 from /usr/include/nss3/pk11pub.h:43,
                 from libcacard/vcard_emul_nss.c:21:
/usr/include/nss3/pkcs11n.h:365:26: error: "__GNUC_MINOR" is not defined

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomonitor: Use TARGET_PRI*PHYS to avoid TARGET_PHYS_ADDR_BITS ifdef
Peter Maydell [Mon, 25 Jun 2012 15:52:24 +0000 (16:52 +0100)]
monitor: Use TARGET_PRI*PHYS to avoid TARGET_PHYS_ADDR_BITS ifdef

Now we have TARGET_PRI*PHYS for printing target_phys_addr_t values,
we can use them in monitor.c rather than having duplicate code
in two arms of a TARGET_PHYS_ADDR_BITS ifdef.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/sh_serial: Use TARGET_PRIxPHYS rather than %x for physaddr
Peter Maydell [Mon, 25 Jun 2012 15:52:23 +0000 (16:52 +0100)]
hw/sh_serial: Use TARGET_PRIxPHYS rather than %x for physaddr

Switch a format string from %x to TARGET_PRIxPHYS so that it will
continue to work even if target_phys_addr_t is changed
to 64 bits in the future.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/omap.h: Use TARGET_PRIxPHYS to define OMAP_FMT_plx
Peter Maydell [Mon, 25 Jun 2012 15:52:22 +0000 (16:52 +0100)]
hw/omap.h: Use TARGET_PRIxPHYS to define OMAP_FMT_plx

Use the new TARGET_PRIxPHYS macro to avoid the need to define an
OMAP_FMT_plx macro whose expansion depends directly on
TARGET_PHYS_ADDR_BITS.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotargphys.h: Define TARGET_PRI*PHYS format specifier macros
Peter Maydell [Mon, 25 Jun 2012 15:52:21 +0000 (16:52 +0100)]
targphys.h: Define TARGET_PRI*PHYS format specifier macros

Define a set of TARGET_PRI*PHYS format specifier macros for working
with target_phys_addr_t types. These follow the standard pattern
for such macros, and are more flexible than TARGET_FMT_plx, which
does not allow specification of field widths.

Suggested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agodisas: Fix printing of addresses in disassembly
Peter Maydell [Mon, 25 Jun 2012 04:55:55 +0000 (04:55 +0000)]
disas: Fix printing of addresses in disassembly

In our disassembly code, the bfd_vma type is always 64 bits,
even if the target's virtual address width is only 32 bits. This
means that when we print out addresses we need to truncate them
to 32 bits, to avoid odd output which has incorrectly sign-extended
a value to 64 bits, for instance this ARM example:
    0x80479a60:  e59f4088     ldr  r4, [pc, #136]  ; 0xffffffff80479a4f

(It would also be possible to truncate before passing the address
to info->print_address_func(), but truncating in the final print
function is the same approach that binutils takes to this problem.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: add AMD PCscsi emulation (PCI SCSI adapter)
Hervé Poussineau [Mon, 9 Jul 2012 10:02:31 +0000 (12:02 +0200)]
esp: add AMD PCscsi emulation (PCI SCSI adapter)

The PCI version is supported in lots of Operating Systems,
and has been successfully tested on:
- MS DOS 6.22 (using DC390 driver)
- MS Windows 3.11 (using DC390 driver)
- MS Windows 98 SE (using default driver)
- MS Windows NT 3.1 (using DC390 driver)
- MS Windows NT 4.0 (using default driver)

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agopci: add some stubs
Hervé Poussineau [Mon, 9 Jul 2012 10:02:30 +0000 (12:02 +0200)]
pci: add some stubs

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: use trace framework instead of stderr output
Hervé Poussineau [Mon, 9 Jul 2012 10:02:29 +0000 (12:02 +0200)]
esp: use trace framework instead of stderr output

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: split esp code into generic chip emulation and sysbus layer
Hervé Poussineau [Mon, 9 Jul 2012 10:02:28 +0000 (12:02 +0200)]
esp: split esp code into generic chip emulation and sysbus layer

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: use hba_private field instead of a complex cast
Hervé Poussineau [Mon, 9 Jul 2012 10:02:27 +0000 (12:02 +0200)]
esp: use hba_private field instead of a complex cast

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: support future change of chip_id
Hervé Poussineau [Mon, 9 Jul 2012 10:02:26 +0000 (12:02 +0200)]
esp: support future change of chip_id

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: implement Reset ATN command
Hervé Poussineau [Mon, 9 Jul 2012 10:02:25 +0000 (12:02 +0200)]
esp: implement Reset ATN command

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: implement Disable selection command
Hervé Poussineau [Mon, 9 Jul 2012 10:02:24 +0000 (12:02 +0200)]
esp: implement Disable selection command

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: delay Transfer Information command if dma is not enabled
Hervé Poussineau [Mon, 9 Jul 2012 10:02:23 +0000 (12:02 +0200)]
esp: delay Transfer Information command if dma is not enabled

The same mechanism is already in place for some select commands.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: execute select commands immediately when it is a non-dma command
Hervé Poussineau [Mon, 9 Jul 2012 10:02:22 +0000 (12:02 +0200)]
esp: execute select commands immediately when it is a non-dma command

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sat, 14 Jul 2012 10:07:37 +0000 (10:07 +0000)]
Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf

* 's390-for-upstream' of git://repo.or.cz/qemu/agraf:
  s390: autodetect map private

12 years agoMerge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 14 Jul 2012 10:07:34 +0000 (10:07 +0000)]
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Add support for long format translation table walks
  target-arm: Implement TTBCR changes for LPAE
  target-arm: Implement long-descriptor PAR format
  target-arm: Use target_phys_addr_t in get_phys_addr()
  target-arm: Add 64 bit PAR, TTBR0, TTBR1 for LPAE
  target-arm: Add 64 bit variants of DBGDRAR and DBGDSAR for LPAE
  target-arm: Add AMAIR0, AMAIR1 LPAE cp15 registers
  target-arm: Extend feature flags to 64 bits
  target-arm: Implement privileged-execute-never (PXN)
  ARM: Make target_phys_addr_t 64 bits and physaddrs 40 bits
  hw/imx_avic.c: Avoid format error when target_phys_addr_t is 64 bits
  target-arm: Fix TCG temp handling in 64 bit cp writes
  target-arm: Fix some copy-and-paste errors in cp register names
  target-arm: Fix typo that meant TTBR1 accesses went to TTBR0
  target-arm: Fix CP15 based WFI

12 years agoqapi: Convert getfd and closefd
Corey Bryant [Fri, 22 Jun 2012 18:36:09 +0000 (14:36 -0400)]
qapi: Convert getfd and closefd

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: input_type_enum(): fix error message
Luiz Capitulino [Fri, 29 Jun 2012 17:25:01 +0000 (14:25 -0300)]
qapi: input_type_enum(): fix error message

The enum string is pointed to by 'enum_str' not 'name'. This bug
causes the error message to be:

{ "error": { "class": "InvalidParameter",
             "desc": "Invalid parameter 'null'",
             "data": { "name": "null" } } }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
12 years agoqmp: dump-guest-memory: improve schema doc
Luiz Capitulino [Thu, 28 Jun 2012 14:59:15 +0000 (11:59 -0300)]
qmp: dump-guest-memory: improve schema doc

Clarify a few points and makes it looks more like the other commands'
documentation.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agomake: Remove 'build-all' rule
Stefan Weil [Mon, 9 Jul 2012 18:36:36 +0000 (20:36 +0200)]
make: Remove 'build-all' rule

It is not needed, because the 'all' rule does the same.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-keymaps: Finnish keyboard mapping broken
Michael Tokarev [Thu, 12 Jul 2012 11:59:12 +0000 (12:59 +0100)]
qemu-keymaps: Finnish keyboard mapping broken

As mentioned in http://bugs.debian.org/660154 , finnish keyboard mapping
is kind of broken.  Fix it as Timo Sirainen suggests in #660154.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agovnc: add a more descriptive error message
Amos Kong [Sat, 30 Jun 2012 02:02:20 +0000 (10:02 +0800)]
vnc: add a more descriptive error message

Currently qemu outputs some low-level error in qemu-sockets.c
when failed to start vnc server.
eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'

Some libvirt users could not know what's happened with this
unclear error message. This patch added a more descriptive
error message.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agobitops: Fix documentation
Stefan Weil [Sun, 8 Jul 2012 20:31:21 +0000 (22:31 +0200)]
bitops: Fix documentation

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agomegasas: mark mfi_frame_desc as 'static'
Hannes Reinecke [Wed, 4 Jul 2012 10:02:07 +0000 (12:02 +0200)]
megasas: mark mfi_frame_desc as 'static'

Suggested by blue swirl. Patch is on top of Paolo's
scsi-next tree.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoAdd vgabios build rules to roms/Makefile
Gerd Hoffmann [Thu, 9 Feb 2012 09:40:31 +0000 (10:40 +0100)]
Add vgabios build rules to roms/Makefile

This patch adds some glue to roms/Makefile to build vgabios binaries for
qemu.  It covers both the lgpl'ed vgabios implementation used by qemu
traditionally and the new seabios implementation.

The purpose of this patch is to (a) document the vgabios build process
and (b) simplify seavgabios testing for those who want to play with it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: improve expire time calculation
Gerd Hoffmann [Wed, 11 Jul 2012 09:23:17 +0000 (11:23 +0200)]
ehci: improve expire time calculation

Move down the expire time calculation down in the frame timer, to the
point where the timer is actually reloaded.  This way we'll notice any
async_stepdown changes (especially resetting to 0 due to usb activity).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: implement Interrupt Threshold Control support
Gerd Hoffmann [Wed, 11 Jul 2012 09:06:05 +0000 (11:06 +0200)]
ehci: implement Interrupt Threshold Control support

Also reorganize and comment the irq functions while being at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: raise irq in the frame timer
Gerd Hoffmann [Tue, 10 Jul 2012 16:00:50 +0000 (18:00 +0200)]
ehci: raise irq in the frame timer

With the async schedule being kicked from other places than the frame
timer (commit 0f588df8b3688b00e77aabaa32e26ece5f19bd39) it may happen
that we call ehci_commit_interrupt() more than once per frame.

Move the call from the async schedule handler to the frame timer to
restore old irq behavior, which is more correct.  Fixes regressions
with some linux kernel versions.

TODO: implement full Interrupt Threshold Control support.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agouhci: initialize expire_time when loading v1 vmstate
Gerd Hoffmann [Tue, 10 Jul 2012 10:51:07 +0000 (12:51 +0200)]
uhci: initialize expire_time when loading v1 vmstate

$subject says all: when loading old (v1) vmstate which doesn't contain
expire_time initialize it with a reasonable default (current time).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: add usb attached scsi emulation
Gerd Hoffmann [Fri, 8 Jun 2012 14:03:37 +0000 (16:03 +0200)]
usb: add usb attached scsi emulation

$subject says all.  First cut.

It's a pure UAS (usb attached scsi) emulation, without BOT (bulk-only
transport) compatibility.  If your guest can't handle it use usb-storage
instead.

The emulation works like any other scsi hba emulation (eps, lsi, virtio,
megasas, ...).  It provides just the HBA where you can attach scsi
devices as you like using '-device'.  A single scsi target with up to
256 luns is supported.

For now only usb 2.0 transport is supported.  This will change in the
future though as I plan to use this as playground when codeing up &
testing usb 3.0 transport and streams support in the qemu usb core and
the xhci emulation.

No migration support yet.  I'm planning to add usb 3.0 support first as
this probably requires saving additional state.

Special thanks go to Paolo for bringing the qemu scsi emulation into
shape, so this can be added nicely without having to touch a single line
of scsi code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agovirtio: move common irqfd handling out of virtio-pci
Paolo Bonzini [Thu, 5 Jul 2012 15:16:30 +0000 (17:16 +0200)]
virtio: move common irqfd handling out of virtio-pci

All transports can use the same event handler for the irqfd, though the
exact mechanics of the assignment will be specific.  Note that there
are three states: handled by the kernel, handled in userspace, disabled.

This also lets virtio use event_notifier_set_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agovirtio: move common ioeventfd handling out of virtio-pci
Paolo Bonzini [Thu, 5 Jul 2012 15:16:29 +0000 (17:16 +0200)]
virtio: move common ioeventfd handling out of virtio-pci

All transports can use the same event handler for the ioeventfd, though
the exact setup (address/memory region) will be specific.

This lets virtio use event_notifier_set_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoevent_notifier: add event_notifier_set_handler
Paolo Bonzini [Thu, 5 Jul 2012 15:16:28 +0000 (17:16 +0200)]
event_notifier: add event_notifier_set_handler

Win32 event notifiers are not file descriptors, so they will not be able
to use qemu_set_fd_handler.  But even if for now we only have a POSIX
version of EventNotifier, we can add a specific function that wraps
the call.

The wrapper passes the EventNotifier as the opaque value so that it will
be used with container_of.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: pass EventNotifier, not eventfd
Paolo Bonzini [Thu, 5 Jul 2012 15:16:27 +0000 (17:16 +0200)]
memory: pass EventNotifier, not eventfd

Under Win32, EventNotifiers will not have event_notifier_get_fd, so we
cannot call it in common code such as hw/virtio-pci.c.  Pass a pointer to
the notifier, and only retrieve the file descriptor in kvm-specific code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoivshmem: wrap ivshmem_del_eventfd loops with transaction
Paolo Bonzini [Thu, 5 Jul 2012 15:16:26 +0000 (17:16 +0200)]
ivshmem: wrap ivshmem_del_eventfd loops with transaction

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoivshmem: use EventNotifier and memory API
Paolo Bonzini [Thu, 5 Jul 2012 15:16:25 +0000 (17:16 +0200)]
ivshmem: use EventNotifier and memory API

All of ivshmem's usage of eventfd now has a corresponding API in
EventNotifier.  Simplify the code by using it, and also use the
memory API consistently to set up and tear down the ioeventfds.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>