Commit graph

6272 commits

Author SHA1 Message Date
Benoît Canet 61074e46de integratorcp: convert icp pic to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Benoît Canet 71d9bc50ce integratorcp: convert core to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Jan Kiszka 4d5bf5f651 ioapic: Convert to memory API
This maintains the old imprecise access size handling.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Jan Kiszka 1a440963b9 ioapic: Reject non-dword accesses to IOWIN register
Aligns the model with the spec.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Avi Kivity cfee758cc7 sbi: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Avi Kivity dc6c1b3732 fdc: convert to memory API
FIXME: instance ID for migration

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:56 +02:00
Avi Kivity 7f8293bf63 pl190: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity ca45842ab6 pl181: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 1a6b31cec7 pl110: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 63b02e041b pl080: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 3cf89f8a27 pl061: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity b8f7a73878 pl050: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 9edbe481bf pl031: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 02a59c37b4 pl022: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity 4848475794 pl011: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:55 +02:00
Avi Kivity e71ceafc7d zaurus: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity 63858cd992 parallel: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity c601785091 jazz_led: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity 0af58e58a1 shix: convert to memory API
RAM wasn't actually allocated, only used, so fix that as well.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity 333b13fc3c virtex_ml507: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity e6d17b056d vexpress: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity 62ceeb2c22 versatilepb: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Avi Kivity 04d6668997 tosa: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-11-24 18:31:54 +02:00
Gerd Hoffmann 335b8d2068 usb-ehci: add register names
The mmio register name list only had the names for four port status
registers.  We emulate a EHCI adapter with six ports though, the last
two ones are listed as "unknown" in traces.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23 16:24:06 +01:00
Gerd Hoffmann aac882e7ce usb-ehci: codestyle fixups
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23 16:24:05 +01:00
Gerd Hoffmann 20d183b6f0 usb-hub: implement reset
based on a patch from hkran@linux.vnet.ibm.com

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23 16:24:05 +01:00
Julian Pidancet 4abf12f4ea rtl8139: Fix invalid IO access alignment
This patch makes iPXE work with the rtl8139 emulation. The rtl8139
driver in iPXE issues a 16bit access on the ChipCmd register
(offset 0x37) to check the status of the rx buffer. The offset of the
ioport access was getting fixed up to 0x36 in qemu, causing the value
read in iPXE to be invalid.

This fixes an issue with iPXE reporting timeouts during TFTP transfers.

Reposting this here because it is trivial enough and the original post
on qemu-devel didn't attract much attention.

Also, the inw() which was causing the issue has been replaced with an
inb() in upstream iPXE:
https://git.ipxe.org/ipxe.git/commit/91dd64ad25baa27954a7518e73df4fca8a2d0c93

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-23 10:36:59 +00:00
Gerd Hoffmann be35cbbc88 usb-hub: wakeup on detach too.
When detaching devices from the usb hub we must wakeup too,
otherwise the host misses the detach event.

Commit 4a33a9ea06 does the
same for device attach.

Found by hkran@linux.vnet.ibm.com

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22 14:12:36 +01:00
Gerd Hoffmann f462141f18 usb: fix usb_qdev_init error handling.
qdev doesn't call the ->exit callback on ->init failures, so we have to
take care ourself that we cleanup property on errors.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22 14:12:32 +01:00
Gerd Hoffmann 2af2a1b8d0 usb: make usb_create_simple catch and pass up errors.
Use qdev_init() instead of qdev_init_nofail(), usb device initialization
can fail, most common case being port and device speed mismatch.  Handle
failures correctly and pass up NULL pointers then.

Also fixup usb_create_simple() callers (only one was buggy) to properly
check for NULL pointers before referncing the usb_create_simple() return
value.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22 13:38:12 +01:00
Paolo Bonzini 28b77657cf scsi-generic: add as boot device
There is no reason why a scsi-generic device cannot boot if it has
the right type, and indeed it provides already a bootindex property.
So register those devices too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22 10:33:30 +01:00
Paolo Bonzini 795928f61d scsi: fix fw path
The pre-1.0 firmware path for SCSI devices already included the LUN
using the suffix argument to add_boot_device_path.  Avoid that it is
included twice, and convert the colons to commas for consistency with
other kinds of devices

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22 10:33:30 +01:00
Paolo Bonzini ce4e7e4661 usb-msd: do not register twice in the boot order
USB mass storage devices are registered twice in the boot order.
To avoid having to keep the two paths in sync, pass the bootindex
property down to the scsi-disk device and let it register itself.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22 10:33:30 +01:00
Paolo Bonzini 3a395142ba virtio-blk: fix cross-endian config space
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22 10:33:30 +01:00
Hongyong Zang ff51a738cf ivshmem: fix PCI BAR2 registration during initialization
Ivshmem cannot work, and the command lspci cannot show ivshmem BAR2 in the guest.
As for pci_register_bar(), parameter MemoryRegion should be s->bar instead of s->ivshmem.

Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 15:05:59 -06:00
Michael S. Tsirkin ae392c416c msix: avoid mask updates if mask is unchanged
Check pending bit only if vector mask status changed.
This is not really important for qemu.git but helps
fix a bug in qemu-kvm.git.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 15:05:59 -06:00
Michael S. Tsirkin 9a93b61730 msix: Prevent bogus mask updates on MMIO accesses
>From: Jan Kiszka <jan.kiszka@siemens.com>

Only accesses to the MSI-X table must trigger a call to
msix_handle_mask_update, otherwise the vector
value might be out of range.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 15:05:59 -06:00
Michael S. Tsirkin 50322249fd msix: track function masked in pci device state
Only go over the table when function is masked.
This is not really important for qemu.git but helps
fix a bug in qemu-kvm.git.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 15:05:59 -06:00
Paolo Bonzini 930b588395 9p: pass dotl flags to the unlinkat method
AT_REMOVEDIR is not defined on all systems.  Pass the raw flags from the
9p protocol, which are always there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 14:58:49 -06:00
Paolo Bonzini f565403949 9p: allow compiling the dummy virtio-9p-handle.c code on Linux
Avoid a conflict on the definition of struct file_handle by
using a replacement name.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 14:58:48 -06:00
Anthony Liguori 38e0735eb7 ivshmem: use migration blockers to prevent live migration in peer mode (v2)
Now when you try to migrate with ivshmem, you get a proper QMP error:

(qemu) migrate tcp:localhost:1025
Migration is disabled when using feature 'peer mode' in device 'ivshmem'
(qemu)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21 14:58:35 -06:00
Anthony Liguori a3baf1be67 Merge remote-tracking branch 'kraxel/usb.31' into staging 2011-11-21 14:44:04 -06:00
Anthony Liguori 1571b6cba2 Merge remote-tracking branch 'origin/master' into staging 2011-11-21 14:36:55 -06:00
Gerd Hoffmann b246721614 ehci: add assert
Coverity thinks q could be NULL there and warns.
I believe it can't be NULL there.
Add assert to prove it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21 15:32:42 +01:00
Gerd Hoffmann 5931065907 usb-storage: don't try to send the status early.
Until recently all scsi commands sent to scsi-disk did either transfer
data or finished instantly.  The correct implementation of
SYNCRONIZE_CACHE changed the picture though, and usb-storage needs
a fix to handle that case correctly.
2011-11-21 15:32:42 +01:00
Gerd Hoffmann 414c460431 usb-storage: drop result from device state.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21 14:08:07 +01:00
Gerd Hoffmann 7b863f41de usb-storage: drop tag from device state.
scsi keeps track of the tag in SCSIRequest,
no need to store a separate copy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21 14:08:01 +01:00
Gerd Hoffmann 92a114f6f8 usb-storage: fill status in complete callback.
Put status word into device state, fill it in command_complete, have
usb_msd_send_status just send it out.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21 14:08:01 +01:00
Gerd Hoffmann e04da7c3d1 usb-storage: move status debug message to usb_msd_send_status.
usb_msd_send_status can be called from different code paths, move the
debug message into the function to make sure it is printed
unconditionally.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21 14:07:56 +01:00
Markus Armbruster 725e14e91f loader: Fix read_targphys() to behave when read() fails
Happily passes (size_t)-1 to rom_add_blob_fixed(), which promptly dies
attempting to malloc that much.  Spotted by Coverity.

Bonus fix for ROMs larger than INT_MAX bytes: return ssize_t instead
of int.  Bug can't bite, because the only user load_aout() limits ROM
size to an int value.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-11-19 11:23:42 +00:00
Blue Swirl 25cc4a768d Merge branch 's390-1.0' of git://repo.or.cz/qemu/agraf
* 's390-1.0' of git://repo.or.cz/qemu/agraf:
  s390x: initialize virtio dev region
  tcg: Use TCGReg for standard tcg-target entry points.
  tcg: Standardize on TCGReg as the enum for hard registers
  s390x: Add shutdown for TCG s390-virtio machine
  s390: Fix cpu shutdown for KVM
  s390: fix short kernel command lines
  s390: fix reset hypercall to reset the status
  s390x: implement SIGP restart and shutdown
  s390x: implement rrbe instruction properly
  s390x: update R and C bits in storage key
  s390x: make ipte 31-bit aware
  s390x: add ldeb instruction
2011-11-19 11:17:58 +00:00
Blue Swirl 05a86f23e5 Merge branch 'ppc-1.0' of git://repo.or.cz/qemu/agraf
* 'ppc-1.0' of git://repo.or.cz/qemu/agraf:
  pseries: Fix qdev.id handling in the VIO bus code
  pseries: Allow kernel's early debug output to work
  pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS
  pseries: Check we have a chardev in spapr_vty_init()
  pseries: Fix buggy spapr_vio_find_by_reg()
  pseries: Correct RAM size check for SLOF
  PPC: Fix for the gdb single step problem on an rfi instruction
  tcg-ppc64: Fix compile errors for userspace only builds with gcc 4.6
  pseries: Fix initialization of sPAPREnvironment structure
2011-11-19 11:17:11 +00:00
Anthony Liguori 54dcd0b37e Merge remote-tracking branch 'kwolf/block-stable' into staging 2011-11-18 13:30:08 -06:00
Michael Ellerman 1e34d859d0 pseries: Fix qdev.id handling in the VIO bus code
When the user creates a device on the command line with -device, they
can specify the id, using id=foo. Currently the VIO bus code overwrites
this id with it's own value. We should only set qdev.id if it is not
already set by the user.

The device tree code uses qdev.id for the device tree node name, however
we can't rely on the user specifiying the id using proper device tree
syntax, ie. device@reg. So separate the device tree node name from the
qdev.id, but use the same syntax, so they will match by default.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:26:30 +01:00
David Gibson 3feef8ad17 pseries: Allow kernel's early debug output to work
The PAPR specification defines a virtual TTY/console interface for guest
OSes to use via the H_PUT_TERM_CHAR and H_GET_TERM_CHAR hypercalls.  There
can be multiple virtual ttys, so these take a "termno" parameter.  This
encodes which vty to use as the 'reg' property on the device tree node
associated with that vty.

However, with the early debug options enabled, the Linux kernel will
attempt debugging output through the vty very early, before it has read
the device tree.  In this case it always uses a termno of 0.  This works
on the existing PowerVM hypervisor, so we assume there must be a hack /
feature in there which interprets termno==0 to mean the default primary
console.

To help with debugging kernels, including existing distribution kernels,
this patch implements a similar feature / hack in qemu.  If termno==0
is supplied to H_{GET,PUT}_TERM_CHAR, they use the first available vty
device instead.

We need to be careful in the case that the user has manually created
an spapr-vty at address 0. So first we search for the specified reg and
only if that doesn't match do we fall back.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:22:46 +01:00
Michael Ellerman 5afdec404e pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS
In commit b4a7852735 ("Place pseries vty
devices at addresses more similar to existing machines"), we changed the
default reg for the vty to 0x30000000, however we didn't update the default
value for a user specified vty device. Fix that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:22:46 +01:00
Michael Ellerman 57285302af pseries: Check we have a chardev in spapr_vty_init()
If qemu is run like:

 qemu-system-ppc64 -nodefaults -device spapr-vty

We end up in spapr_vty_init() with dev->chardev == NULL. Currently
that leads to a segfault because we unconditionally call
qemu_chr_add_handlers().

Although we could make that call conditional, I think a spapr-vty
without a chardev is basically useless so fail the init. This is
similar to what the serial code does for example.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:22:46 +01:00
David Gibson 5435352ce6 pseries: Fix buggy spapr_vio_find_by_reg()
The spapr_vio_find_by_reg() function in hw/spapr_vio.c is supposed to find
the device structure for a PAPR virtual IO device with the given reg value,
and return NULL if none exists.

It does the first ok, but if no device with that reg exists, it just
returns the last device traversed in the list.  This patch fixes it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:22:45 +01:00
David Gibson 92c93a816a pseries: Correct RAM size check for SLOF
The SLOF firmware used on the pseries machine needs a reasonable amount of
(guest) RAM in order to run, so we have a check in the machine init
function to check that this is available.  However, SLOF runs in real mode
(MMU off) which means it can only actually access the RMA (Real Mode Area),
not all of RAM.  In many cases the RMA is the same as all RAM, but when
running with Book3S HV KVM on PowerPC 970, the RMA must be especially
allocated to be (host) physically contiguous.  In this case, the RMA size
is determined by what the host admin allocated at boot time, and will
usually be less than the whole guest RAM size.

This patch corrects the test to see if SLOF has enough memory for this
case.

In addition, more recent versions of SLOF that were committed earlier don't
need quite as much memory as earlier versions.  Therefore, this patch also
reduces the amount of RAM we require to run SLOF.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18 14:22:45 +01:00
Paolo Bonzini 33ebad1263 scsi-block: always use SG_IO for MMC devices
CD burning messes up the state of the host page cache and host block
device.  Just pass all operations down to the device, even though that
might have slightly worse performance.  Everything else just is not
reliable in combination with burning.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 14:14:32 +01:00
Paolo Bonzini f3b338ef4a scsi: pass down REQUEST SENSE to the device when there is no stored sense
This will let scsi-block/scsi-generic report progress on long
operations.

Reported-by: Thomas Schmitt <scdbackup@gmxbackup.net>
Tested-by: Thomas Schmitt <scdbackup@gmxbackup.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 14:12:15 +01:00
Paolo Bonzini 0fd76ff40b scsi: remove block descriptors from CDs
Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Tested-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 14:09:05 +01:00
Paolo Bonzini 06b863577e scsi: fix parsing of allocation length field
- several MMC commands were parsed wrong by QEMU because their allocation
length/parameter list length is placed in a non-standard position in
the CDB (i.e. it is different from most commands with the same value in
bits 5-7).

- SEND VOLUME TAG length was multiplied by 40 which is not in SMC.  The
parameter list length is between 32 and 40 bytes.  Same for MEDIUM SCAN
(spec found at http://ldkelley.com/SCSI2/SCSI2-16.html but not in any of
the PDFs I have here).

- READ_POSITION (SSC) conflicts with PRE_FETCH (SBC).  READ_POSITION's
transfer length is not hardcoded to 20 in SSC; for PRE_FETCH cmd->xfer
should be 0.  Both fixed.

- FORMAT MEDIUM (the SSC name for FORMAT UNIT) was missing.  The FORMAT
UNIT command is still somewhat broken for block devices because its
parameter list length is not in the CDB.  However it works for CD/DVD
drives, which mandate the length of the payload.

- fixed wrong sign-extensions for 32-bit fields (for the LBA field,
this affects disks >1 TB).

- several other SBC or SSC commands were missing or parsed wrong.

- some commands were not in the list of "write" commands.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Tested-by: Thomas Schmitt <scdbackup@gmx.net> (MMC bits only)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 14:04:01 +01:00
Paolo Bonzini 00a01ad47a scsi: update list of commands
Add more commands and their names, and remove SEEK(6) which is obsolete.
Instead, use SET_CAPACITY which is still in SSC.

Tested-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 13:57:16 +01:00
Paolo Bonzini 2c20ae11ad atapi: kill MODE SENSE(6), fix MODE SENSE(10)
Mode page 2A of emulated ATAPI DVD-ROM should have page length 0x14
like SCSI CD-ROM, rather than 0x12.

Mode page length is off by 8, as it should contain the length of the
payload after the first two bytes.

MODE SENSE(6) should be thrown out of ATAPI DVD-ROM emulation.  It is
not specified in the ATAPI list of MMC-2, and MMC-5 prescribes to use
MODE SENSE(10).  Anyway, its implementation is wrong.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 13:54:32 +01:00
Paolo Bonzini 245d004947 scsi-disk: guess geometry
Old operating systems rely on correct geometry to convert from CHS
addresses to LBA.  Providing correct data is necessary for them to boot.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 13:37:52 +01:00
Paolo Bonzini 7082826eb4 scsi: fix fw path
The pre-1.0 firmware path for SCSI devices already included the LUN
using the suffix argument to add_boot_device_path.  I missed that when
making channel and LUN customizable.  Avoid that it is included twice, and
convert the colons to commas for consistency with other kinds of devices

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18 13:35:20 +01:00
Stefan Weil b5e4946f96 Fix spelling in documentation and comments (similiar -> similar)
This bug was detected by codespell.
In mips_mipssim.c a grammatical error was fixed, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-17 12:57:36 +00:00
Alon Levy 3827cdb1c3 pc_piix: set qxl revision to 2 for pc-0.14
The default is still 3, and I didn't change older machine types.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-14 11:26:32 -06:00
Peter Maydell e1556ad5b8 hw/omap_gpio: Fix infinite recursion when doing 8/16 bit reads
Fix a long-standing bug which meant that any attempt to do an
8 or 16 bit read from the OMAP GPIO module would cause qemu to
crash due to an infinite recursion.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-14 11:26:32 -06:00
Andrzej Zaborowski 371572dff4 Revert bugfix e7852674d5 until tested or until after the release.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 18:17:59 +01:00
Alexander Graf 326384d5b6 s390x: initialize virtio dev region
When running the s390x virtio machine we can potentially use uninitialized
memory for the virtio device backing ram. That can lead to weird breakge.

So let's better initialize it to 0 properly.

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - use target_phys_addr_t
2011-11-14 17:47:27 +01:00
Christian Borntraeger 854e42f3e8 s390: Fix cpu shutdown for KVM
On s390 a shutdown is the state of all CPUs being either stopped
or disabled (for interrupts) waiting. We have to track the overall
number of running CPUs to call the shutdown sequence accordingly.
This patch implements the counting and shutdown handling for the
kvm path in qemu.
Lets also wrap changes to env->halted and env->exception_index.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-14 17:47:26 +01:00
Christian Borntraeger 13449a6e0e s390: fix short kernel command lines
The default kernel command line for s390 is
"root=/dev/ram0 ro"

When overriding this line, we have to ensure to also copy the \0 to
avoid false lines, for example, -append "root=/dev/vda" will result in
"root=/dev/vda0 ro" with the current code.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-14 17:47:26 +01:00
Christian Borntraeger e9d86b760c s390: fix reset hypercall to reset the status
This patch fixes the reset hypercall which is supposed to also
reset the device status in device memory.
This fixes the following bug:

[root@localhost driver]# echo virtio0 > unbind
[   35.056966] ------------[ cut here ]------------
[   35.057054] kernel BUG at drivers/virtio/virtio.c:157!
[   35.057113] illegal operation: 0001 [#1] SMP
[   35.057181] Modules linked in:
[   35.057243] CPU: 0 Not tainted 3.0.0-rc1-00180-g0792644-dirty #51
[   35.057323] Process bash (pid: 497, task: 000000003e58c538, ksp: 000000003ef43978)
[   35.057409] Krnl PSW : 0704100180000000 00000000003d46f8 (virtio_check_driver_offered_feature+0x0/0x38)
[   35.057528]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
[   35.057616] Krnl GPRS: 0000000000000000 0000000040000000 0000000000000007 0000000000000000
[   35.057716]            00000000003b3be4 0000000000000001 000000003ef4d380 000000003f1cff00
[   35.057805]            000000003ef43f18 00000000005ca620 0000000000000008 0000000000838e88
[   35.057919]            000000000083c860 000000003f7c2e00 00000000003d46b0 000000003ef43d10
[   35.058027] Krnl Code: 00000000003d46e8: f0b00004ebcf	srp	4(12,%r0),3023(%r14),0
[   35.058115]            00000000003d46ee: f0a0000407f4	srp	4(11,%r0),2036,0
[   35.058207]            00000000003d46f4: a7f40001		brc	15,3d46f6
[   35.058295]           >00000000003d46f8: e31020900004	lg	%r1,144(%r2)
[   35.058383]            00000000003d46fe: bf2f1080		icm	%r2,15,128(%r1)
[   35.058470]            00000000003d4702: a784000d		brc	8,3d471c
[   35.058557]            00000000003d4706: e32010780004	lg	%r2,120(%r1)
[   35.058645]            00000000003d470c: 59302000		c	%r3,0(%r2)
[   35.058748] Call Trace:
[   35.058777] ([<00000000003d469e>] virtio_dev_remove+0x36/0x90)
[   35.058852]  [<00000000003f3a40>] __device_release_driver+0x7c/0xec
[   35.058936]  [<00000000003f3ae8>] device_release_driver+0x38/0x48
[   35.059023]  [<00000000003f2a98>] driver_unbind+0xa4/0xc4
[   35.059111]  [<00000000002acb70>] sysfs_write_file+0xe8/0x19c
[   35.059226]  [<000000000022e7a4>] vfs_write+0xb0/0x18c
[   35.059317]  [<000000000022eb18>] SyS_write+0x58/0xb4
[   35.059398]  [<000000000057e674>] sysc_noemu+0x16/0x1c
[   35.059475]  [<000003fffd44b6c0>] 0x3fffd44b6c0
[   35.059531] Last Breaking-Event-Address:
[   35.059576]  [<00000000003d46f4>] virtio_dev_remove+0x8c/0x90
[   35.059646]
[   35.059661] ---[ end trace 9b1959188f21ee11 ]---

Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-14 17:47:26 +01:00
Juha Riihimäki a3efecb847 hw/onenand: reject read-only drives
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 03:22:30 +01:00
Juha Riihimäki 3fc3abf7ec hw/nand: reject read-only drives
also gracefully fail on nand_device_init() for unsupported block
size instead of aborting.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 03:19:18 +01:00
Jean-Christophe DUBOIS b2887c43ee hw/arm_sysctl: Fix RESETCTL for realview-pb-a8 and -pbx-a9
Depending on the considered baseboard the bit used to
reset the platform is different.

Here is the list of considered Realview/Versatile platforms:

Realview/Versatile AB for ARM926EJ-S: BOARD_ID = 0x100 = BOARD_ID_PB9
http://infocenter.arm.com/help/topic/com.arm.doc.dui0225d/CACCIFGI.html

RealView Emulation Baseboard: BOARD_ID = 0x140 = BOARD_ID_EB
No reset register

RealView PB for Cortex-A8: BOARD_ID = 0x178 = BOARD_ID_PBA8
http://infocenter.arm.com/help/topic/com.arm.doc.dui0417d/BBACIGAD.html

RealView PB for Cortex-A9: BOARD_ID = 0x182 = BOARD_ID_PBX
http://infocenter.arm.com/help/topic/com.arm.doc.dui0440b/CACCHBFB.html

Motherboard Express =C2=B5ATX: BOARD_ID = 0x190 = BOARD_ID_VEXPRESS
No reset register

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 03:09:20 +01:00
Peter Maydell 7c64d297f9 hw/pxa2xx.c: Fix handling of RW bits in PMCR
Fix an error in commit afd4a6522 which meant that writing a zero
to the RW bits in the PMCR wouldn't actually clear them. (Error
spotted by Andrzej Zaborowski.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 02:26:20 +01:00
Peter Maydell e7852674d5 hw/usb-net.c: Fix precedence bug when checking rndis_state
"!X == 2" is always false (spotted by Coverity), so the checks
for whether rndis is in the correct state would never fire.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-11-14 02:19:24 +01:00
Anthony Liguori 74d33d5ce4 Merge remote-tracking branch 'kwolf/block-stable' into staging 2011-11-11 17:26:37 -06:00
Peter Maydell ee71c98434 hw/arm_timer.c: Fix bounds check for Integrator timer accesses
There are only three counter/timers on the integrator board:
correct the bounds check to avoid an array overrun. (Spotted
by Coverity, see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11 12:49:53 -06:00
Peter Maydell afd4a65225 hw/pxa2xx.c: Fix handling of R/WC bits in PMCR
Fix a bug in handling the write-one-to-clear bits in the PMCR
which meant that we would always clear the bit even if the
value written was a zero. Spotted by Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11 12:49:53 -06:00
Peter Maydell b78c2b3aad hw/pl061: Remove pointless comparison of array to null
Remove a pointless comparison of an array to null. (There is
no need to check whether s->out[i] is non-null as qemu_set_irq
will do that for us.) Spotted by Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11 12:49:53 -06:00
Peter Maydell 35914dc724 hw/tc58128.c: Remove unnecessary check for g_malloc failure
Remove a check for g_malloc failing: this never happens.
Also use g_malloc rather than g_malloc0 as we immediately
memset the entire region and so zero-initialising it is pointless.
Spotted by Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11 12:49:53 -06:00
Peter Maydell 096685fc2a hw/omap_intc.c: Avoid crash on access to nonexistent banked registers
Avoid a crash due to null pointer dereference if a guest attempts
to access banked registers for a nonexistent bank. Spotted by
Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-11 12:49:52 -06:00
David Gibson d43b45e220 pseries: Fix initialization of sPAPREnvironment structure
Since we added PCI support to the pseries machine, we include a qlist of
PCI host bridges in the sPAPREnvironment structure.  However this list
was never properly initialized it.  Somehow we got away with this until
some other recent change broke it, and we now segfault immediately on
startup.

This patch adds the required QLIST_INIT(), and while we're at it makes sure
we initialize the rest of the sPAPREnvironment structure to 0, to avoid
future nasty surprises.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-11 17:33:58 +01:00
Peter Maydell 980bda8ba2 hw/pc.c: Fix use-while-uninitialized of fd_type[]
Fix a use-while-uninitialized of the fd_type[] array (introduced
in commit 34d4260e1, noticed by Coverity). This is more theoretical
than practical, since it's quite hard to get here with floppy==NULL
(the qdev_try_create() of the isa-fdc device has to fail).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-11 14:02:59 +01:00
Paolo Bonzini 4480de19d9 scsi-disk: implement eject requests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-11 14:02:57 +01:00
Paolo Bonzini 2df0a3a308 atapi: implement eject requests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-11 14:02:57 +01:00
Peter Maydell 0e3b800e71 hw/lan9118.c: Add missing 'break' to fix buffer overrun
Add a missing 'break' statement to fix a buffer overrun when
executing the EEPROM write-all command. Spotted by Coverity
(see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-10 12:29:50 +00:00
Markus Armbruster 542379f426 qdev: Fix crash on -device '?=x'
Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-10 12:29:50 +00:00
Max Filippov 4f61927a41 hpet: fix infinite loop in qemu_run_timers with -icount enabled
hpet_timer timer callback rearms itself based on difference between
current HPET tick counter and comparator value. Difference calculated by
the hpet_calculate_diff function is limited to non-negative values.

cur_tick is calculated via hpet_get_ticks that uses qemu_get_clock_ns(vm_clock).

With -icount enabled vm_clock doesn't advance during qemu_run_timers
loop thus once difference is zero, qemu_run_timers loops forever
handling hpet_timer.

Limit hpet_calculate_diff results to positive only values to avoid that
infinite loop.

This fixes the following qemu-system-x86_64 hang when it reaches
timer_irq_works() in the linux bootup:

[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 1000.054 MHz processor.
[    0.000031] Calibrating delay loop (skipped), value calculated using timer frequency.. 2000.10 BogoMIPS (lpj=10000540)
[    0.000404] pid_max: default: 32768 minimum: 301
[    0.001138] Mount-cache hash table entries: 256
[    0.003883] Initializing cgroup subsys ns
[    0.004035] Initializing cgroup subsys cpuacct
[    0.004280] Initializing cgroup subsys freezer
[    0.004790] Performance Events: AMD PMU driver.
[    0.004985] ... version:                0
[    0.005134] ... bit width:              48
[    0.005285] ... generic registers:      4
[    0.005437] ... value mask:             0000ffffffffffff
[    0.005625] ... max period:             00007fffffffffff
[    0.005807] ... fixed-purpose events:   0
[    0.005957] ... event mask:             000000000000000f
[    0.006275] SMP alternatives: switching to UP code

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09 12:06:20 -06:00
Peter Maydell c0465d1a1d hw/omap_gpmc.c: Add missing 'break's to fix 8 bit NAND writes
Add missing 'break' statements which would have meant that writing
to an 8 bit NAND device was broken. Spotted by Coverity (see bug
887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09 12:06:20 -06:00
Peter Maydell 95117be5a3 hw/omap_dss.c: Fix !-vs-~ bug in handling DISPC_CONTROL
Fix a bug revealed by a coverity scan (see bug 887883) which meant
that we would never print the warning about unpredictable behaviour
if a nonexistent overlay is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09 12:06:20 -06:00
Avi Kivity 4f26f2b6f2 configure: fix detection for xattr.h on modern distributions
Modern distributions place xattr.h in /usr/include/sys, and fold
libattr.so into libc.  They also don't have an ENOATTR.

Make configure detect this, and add a qemu-xattr.h file that
directs the #include to the right place.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09 12:06:20 -06:00
Edgar E. Iglesias 9770b91252 virtex: Remove memset of clk_setup
clk_setup is now a function. Fixes a segfault.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-11-08 20:53:49 +01:00
Gerd Hoffmann f67ab77a43 qxl: fix vga port initialization.
Commit 0a039dc700 broke vga modes for
qxl-vga by loosing vga_ioport_read windup.  qxl needs to hook into
vga port writes only and used to realize that by letting vga_init() do
the work for both reads and writes, then overwrite the write function.
That little detail was missed while doing the conversion ...

This patch fixes it.  It also switch qxl vga ioport registration to
portio lists while being at it.

Cc: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-07 10:57:37 -06:00
Gerd Hoffmann 25a21c94c0 ac97: don't override the pci subsystem id
This patch removes the code lines which set the subsystem id for the
emulated ac97 card to 8086:0000.  Due to the device id being zero the
subsystem id isn't vaild anyway.  With the patch applied the sound card
gets the default qemu subsystem id (1af4:1100) instead.

[ v2: old & broken id is maintained for -M pc-$oldqemuversion ]

Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-07 10:57:37 -06:00
Gerd Hoffmann 19857e625a pc: add 1.0 machine type
This patch adds a pc-1.0 machine type.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-07 10:57:36 -06:00
Paolo Bonzini 6023d83248 disable automatic loading of sgabios when -nographic
sgabios hasn't gotten a lot of coverage since it was not shipped.  For 1.0,
let's disable the automatic loading of the option ROM in -nographic
mode.  We can put it back for 1.1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-07 10:57:36 -06:00
Anthony Liguori 2963e65a4e Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-11-07 10:57:27 -06:00
Anthony Liguori ca062aaed0 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-11-07 10:56:38 -06:00
Anthony PERARD e7b48c97fe xen-platform: Fix IO port read/write functions
Somehow, the read/write functions handle an offset that does not exist anymore.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-07 08:07:48 +00:00
Rabin Vincent 41bf234d8e arm_gic: handle banked enable bits for per-cpu interrupts
The first enable set/clear register (which controls the PPIs and SGIs)
is supposed to be banked for each processor.  Currently it is just
handled globally and this prevents recent SMP Linux kernels from
booting, because CPU0 stops receiving localtimer interrupts when CPU1
disables them locally.

To fix this, allow the enable bits to be enabled per-cpu.  For SPIs,
always enable/disable ALL_CPU_MASK.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-11-06 16:01:08 +00:00
Kevin Wolf acae6f1c4c dma: Avoid reentrancy in DMA transfer handlers
With the conversion of the block layer to coroutines, bdrv_read/write
have changed to run a nested event loop that calls qemu_bh_poll.
Consequently a scheduled BH can be called while a DMA transfer handler
runs and this means that DMA_run becomes reentrant.

Devices haven't been designed to cope with that, so instead of running a
nested transfer handler just wait for the next invocation of the BH from the
main loop.

This fixes some problems with the floppy device.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-04 14:23:58 +01:00
Blue Swirl 932eacc158 Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  xtensa_lx60: fix build date code and change memory region names
  xtensa_lx60: pass kernel arguments from -append
  xtensa_lx60: add FLASH support
  target-xtensa: raise an exception for invalid and reserved opcodes
  target-xtensa: handle cache options in the overlay tool
  target-xtensa: mask out undefined bits of WINDOWSTART SR
2011-11-02 20:52:23 +00:00
Anthony Liguori 42dfb09510 Merge remote-tracking branch 'aneesh/for-upstream-8' into staging 2011-11-02 12:30:00 -05:00
Bharata B Rao f2209eb854 Fix X86 CPU topology in KVM mode
apic id returned to guest kernel in ebx for cpuid(function=1) depends on
CPUX86State->cpuid_apic_id which gets populated after the cpuid information
is cached in the host kernel. This results in broken CPU topology in guest.

Fix this by setting cpuid_apic_id before cpuid information is passed to
the host kernel. This is done by moving the setting of cpuid_apic_id
to cpu_x86_init() where it will work for both KVM as well as TCG modes.

Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Bharata B Rao <bharata.rao@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-02 07:55:05 -05:00
Gerd Hoffmann 18ebcc86f2 intel-hda: fix stream search
commit ba43d28916 introduces a bug:
The stream-not-found case doesn't error out any more, instead the
code silently uses the first stream.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-02 07:51:58 -05:00
Paolo Bonzini 5bb2392776 virtio-blk: pass full status to the guest
When SCSI passthrough is being used by the guest with virtio-blk, the
guest is not able to detect disk failures.  This is because the status
field is expected by the guest driver to include also the msg_status,
host_status and driver_status fields, but the device is only passing
down the SCSI status.

The patch fixes this, and also makes sure that the guest always sees a
CHECK_CONDITION status when there is valid sense data.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-02 07:51:58 -05:00
Stefan Hajnoczi 779b5b04fd hw/9pfs: use g_vasprintf() instead of rolling our own
Markus Armbruster <armbru@redhat.com> sent fixes for va_list vararg
issues in v9fs_string_alloc_printf().  It turns out the function
duplicates g_vasprintf() and can therefore be eliminated entirely.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-11-02 12:57:15 +05:30
Max Filippov 556ba66845 xtensa_lx60: fix build date code and change memory region names
Fix date code to uses MMDDYYYY notation.
Change memory region names to reflect specification that defines them.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2011-11-02 05:05:52 +04:00
Max Filippov 292627bb5e xtensa_lx60: pass kernel arguments from -append
Create boot parameters in the end of SRAM region, insert kernel
arguments specified in -append there.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2011-11-02 05:05:52 +04:00
Max Filippov 82b25dc8b0 xtensa_lx60: add FLASH support
LX60 carry 4 Mbyte FLASH and 128 Kbyte SRAM, LX200 carry 16 Mbyte FLASH
and 32 Mbyte SRAM. Either of these memories may be mapped to the system
ROM region.

Select boot from FLASH if -kernel option is not specified, otherwise
boot from SRAM.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2011-11-02 05:05:52 +04:00
Anthony Liguori b0eb8449f2 Revert "virtio: Add PCI memory BAR in addition to PIO BAR"
This reverts commit 46d95bfec7.
2011-11-01 19:32:21 -05:00
Jan Kiszka e1c2008af6 pcnet: Add link state support
Update lnkst on link state changes so that guests can obtain this
information via reading back the LED output pin. Works for Linux but
not for guests that depend on the missing PHY.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:09 -05:00
Jan Kiszka 7ba7974197 pcnet-pci: Fix PIO word access to PROM
Implement the various IO access widths according to the spec. This
specifically unbreaks word and dword access to the PROM area that is
mapped into IO space. It also drops redundant upper limit checks and
spurious "return void".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:09 -05:00
Jan Kiszka 488a1a5dfe pcnet: Move BCR defines to header
This moves BCR defines to the common header and immediately makes use of
them to add BCR_APROMWE, replacing the open-coded write check in
pcnet_aprom_writeb.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:09 -05:00
Avi Kivity 2284451019 event_notifier: move to top-level directory
Has no business in hw/.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:08 -05:00
David Gibson 46d95bfec7 virtio: Add PCI memory BAR in addition to PIO BAR
Currently, virtio devices are usually presented to the guest as an
emulated PCI device, virtio_pci.  Although the actual IO operations
are done through system memory, the configuration of the virtio device
is done through the one PCI IO space BAR that virtio_pci presents.

But PCI IO space (aka PIO) is deprecated for modern PCI devices, and
on some systems with many PCI domains accessing PIO space can be
problematic.  For example on the existing PowerVM implementation of
the PAPR spec, PCI PIO access is not supported at all.  We're hoping
that our KVM implementation will support PCI PIO (once we support PCI
at all), but it will probably have some irritating limitations.

This patch, therefore, extends the virtio_pci device to have a PCI
memory space (MMIO) BAR as well as the IO BAR.  The MMIO BAR contains
exactly the same registers, in exactly the same layout as the existing
PIO BAR.

Because the PIO BAR is still present, existing guest drivers should
still work fine.  With this change in place, future guest drivers can
check for an MMIO BAR and use that if present (falling back to PIO
when possible to support older qemu versions).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:08 -05:00
David Gibson fff23ee9a5 usb-uhci: Use PCI DMA stub functions
This updates the usb-uhci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:08 -05:00
David Gibson 68d553587c usb-ehci: Use PCI DMA stub functions
This updates the usb-ehci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:08 -05:00
David Gibson 552908fef5 PCI IDE: Use PCI DMA stub functions
This updates the PCI IDE device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
David Gibson fa0ce55c71 intel-hda: Use PCI DMA stub functions
This updates the intel-hda device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 14fecf26d0 pcnet-pci: Use PCI DMA stub functions
This updates the pcnet-pci device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 9ba4524cda lsi53c895a: Use PCI DMA stub functions
This updates the lsi53c895a device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 62ecbd353d e1000: Use PCI DMA stub functions
This updates the e1000 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 3204db98de es1370: Use PCI DMA stub functions
This updates the es1370 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 93f43c4888 ac97: Use PCI DMA stub functions
This updates the ac97 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:07 -05:00
Eduard - Gabriel Munteanu 16ef60c9a8 eepro100: Use PCI DMA stub functions
This updates the eepro100 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:06 -05:00
Eduard - Gabriel Munteanu 3ada003aee rtl8139: Use PCI DMA stub functions
This updates the rtl8139 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:06 -05:00
David Gibson ec17457588 Add stub functions for PCI device models to do PCI DMA
This patch adds functions to pci.[ch] to perform PCI DMA operations.
At present, these are just stubs which perform directly cpu physical
memory accesses.  Stubs are included which are analogous to
cpu_physical_memory_{read,write}(), the stX_phys() and ldX_phys()
functions and cpu_physical_memory_{map,unmap}().

In addition, a wrapper around qemu_sglist_init() is provided, which
also takes a PCIDevice *.  It's assumed that _init() is the only
sglist function which will need wrapping, the idea being that once we
have IOMMU support whatever IOMMU context handle the wrapper derives
from the PCI device will be stored within the sglist structure for
later use.

Using these stubs, however, distinguishes PCI device DMA transactions from
other accesses to physical memory, which will allow PCI IOMMU support to
be added in one place, rather than updating every PCI driver at that time.

That is, it allows us to update individual PCI drivers to support an IOMMU
without having yet determined the details of how the IOMMU emulation will
operate.  This will let us remove the most bitrot-sensitive part of an
IOMMU patch in advance.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:06 -05:00
Christophe Fergeau 7f540ab524 ps2: migrate ledstate
Make the ps2 device track its ledstate so that we can migrate it.
Otherwise it gets lost across migration, and spice-server gets
confused about the actual keyboard state and sends bogus
caps/scroll/num key events. This fixes RH bug #729294

We only need to migrate the state when it is different of the default
one (0).

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:05 -05:00
Anthony Liguori 3a26360d1d spapr: fix build
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 16:52:05 -05:00
Blue Swirl e927dab1fd Merge branch 'ppc-next' of git://repo.or.cz/qemu/agraf
* 'ppc-next' of git://repo.or.cz/qemu/agraf: (24 commits)
  pseries: Add partial support for PCI
  ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate
  pseries: Allow writes to KVM accelerated TCE table
  KVM: PPC: Override host vmx/vsx/dfp only when information known
  ppc: Fix up usermode only builds
  pseries: Correct vmx/dfp handling in both KVM and TCG cases
  PPC: Fail configure when libfdt is not available
  ppc: Avoid decrementer related kvm exits
  PPC: Disable non-440 CPUs for ppcemb target
  PPC: Bump qemu-system-ppc to 64-bit physical address space
  pseries: Under kvm use guest cpu = host cpu by default
  ppc: Add cpu defs for POWER7 revisions 2.1 and 2.3
  ppc: First cut implementation of -cpu host
  ppc: Remove broken partial PVR matching
  pseries: Update SLOF firmware image
  pseries: Add device tree properties for VMX/VSX and DFP under kvm
  ppc: Generalize the kvmppc_get_clockfreq() function
  Set an invalid-bits mask for each SPE instructions
  pseries: Update SLOF firmware image
  pseries: Use Book3S-HV TCE acceleration capabilities
  ...
2011-11-01 20:57:01 +00:00
Anthony Liguori 2ff6458116 Merge remote-tracking branch 'kraxel/usb.29' into staging 2011-11-01 13:09:31 -05:00
Anthony Liguori 110fc0864d Merge remote-tracking branch 'spice/spice.v46' into staging 2011-11-01 13:06:46 -05:00
Anthony Liguori 5962353006 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-11-01 13:06:17 -05:00
Max Filippov 90ea59fe7d opencores_eth: fix RX path: FCS, padding and TL
OpenCores 10/100 Mbps Ethernet MAC specification doesn't clearly state
whether FCS is counted in the RX frame length or not. Looks like it is.
Append zero FCS to the received frames.

Get rid of big static buffer for RX frame padding, optimize it for the
most common MINFL value range.

Set RXD_TL for the long frames only when HUGEN bit is set.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 11:50:21 -05:00
Pavel Borzenkov 9477c87ed9 fw_cfg: Use g_file_get_contents instead of multiple fread() calls
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-01 11:50:11 -05:00
Roy Tam db80358a20 usb: change VID/PID for usb-hub and usb-msd to prevent conflict
Some USB drivers, for example USBASPI.SYS, will skip different type of
device which has same VID/PID. The following patch helps preventing
usb-msd being skipped by the driver.

Signed-off-by: Roy Tam <roytam@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-01 16:38:27 +01:00
Gerd Hoffmann 4a33a9ea06 usb-hub: wakeup on attach
When attaching a new device we must send a wakeup request to the root
hub, otherwise the guest will not notice the new device in case the
usb hub is suspended.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-01 13:40:33 +01:00
Alon Levy 54825d2e39 qxl: create slots on post_load in vga state
RHBZ 740547

If we migrate when the device is in vga state the guest
still believes the slots are created, and will cause operations
that reference the slots, causing a "panic: virtual address out of range"
on the first of them. Easy to see by migrating in vga mode with
a driver loaded, for instance windows cmd window in full screen mode,
and then exiting vga mode back to native mode will cause said panic.

Fixed by doing the slot recreation in post_load for vga mode as well.
Note that compat does not require any changes because it creates it's
only slot by a side effect of QXL_IO_SET_MODE.

Signed-off-by: Alon Levy <alevy@redhat.com>
2011-11-01 13:24:55 +01:00
Gerd Hoffmann a053f1b1fb qxl: make sure we continue to run with a shared buffer
The qxl renderer works only with a shared displaysurface.  So better
make sure we actually have one and restore it when needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-01 12:11:53 +01:00
Gerd Hoffmann 0e2487bd6f qxl: stride fixup
spice uses negative stride value to signal the bitmap is upside down.
The qxl renderer (used for scl, vnc and screenshots) wants a positive
value because it is easier to work with.  The positive value is then
stored in the very same variable, which has the drawback that the
upside-down test works only once.  Fix by using two variables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-01 12:11:53 +01:00
Markus Armbruster d0bc5bc3aa sysbus: Supply missing va_end()
C99 7.15.1: Each invocation of the va_start and va_copy macros shall
be matched by a corresponding invocation of the va_end macro in the
same function.

Spotted by Coverity.  Harmless on the (common) systems where va_end()
does nothing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-01 06:23:48 +00:00
Anthony Liguori 8494a397b6 Merge remote-tracking branch 'kwolf/for-anthony' into staging
Conflicts:
	block/vmdk.c
2011-10-31 11:09:00 -05:00
Anthony Liguori d439b79d73 Merge remote-tracking branch 'aneesh/for-upstream-7' into staging 2011-10-31 11:06:02 -05:00
Anthony Liguori 96b3d73f5a Merge remote-tracking branch 'qmp/queue/qmp' into staging
Conflicts:
	ui/spice-core.c
2011-10-31 11:02:29 -05:00
Anthony Liguori 3a069ff11b Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-10-31 10:23:15 -05:00
Anthony Liguori eca968d0d4 Merge remote-tracking branch 'spice/spice.v45' into staging 2011-10-31 10:12:14 -05:00
Harsh Prateek Bora 2583e44367 hw/9pfs: Replace rwlocks with RCU variants of interfaces.
Use QLIST_INSERT_HEAD_RCU and rcu_read_lock/unlock instead of rwlocks.
Use v9fs_synth_mutex as a write-only mutex to handle concurrent writers.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:18 +05:30
Aneesh Kumar K.V 9db221ae73 hw/9pfs: Add synthetic file system support using 9p
This patch create a synthetic file system with mount tag
v_synth when -virtfs_synth command line option is specified
in qemu. The synthetic file system can be mounted in guest
using 9p using the below command line

mount -t 9p -oversion=9p2000.L,trans=virtio v_synth  <mountpint>

Synthetic file system enabled different qemu subsystem to register
callbacks for read and write events from guest. The subsystem
can create directories and files in the synthetic file system as show
in ex below

    qemu_v9fs_synth_mkdir(NULL, 0777, "test2", &node);
    qemu_v9fs_synth_add_file(node, 0777, "testfile",
                             my_test_read, NULL, NULL);

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:18 +05:30
Aneesh Kumar K.V cc720ddb54 hw/9pfs: Abstract open state of fid to V9fsFidOpenState
To implement synthetic file system in Qemu we may not really
require file descriptor and Dir *. Make generic code use
V9fsFidOpenState instead.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:17 +05:30
M. Mohan Kumar 2c74c2cb4b hw/9pfs: Read-only support for 9p export
A new fsdev parameter "readonly" is introduced to control accessing 9p export.
"readonly" can be used to specify the access type. By default "rw" access
is given to 9p export.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:17 +05:30
Aneesh Kumar K.V 17b1971f63 hw/9pfs: Fix error handling in local_mknod
Update local_chown to remove unnecessary if loop

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:15 +05:30
Peter Maydell 03a0e9444c hw/vexpress.c, hw/realview.c: Add PL041 to VExpress, Realview boards
Instantiate the PL041 audio on the Versatile Express and
Realview board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-10-31 05:40:29 +01:00
Mathieu Sonet d028d02d0c Add AACI audio playback support to the ARM Versatile/PB platform
This driver emulates the ARM AACI interface (PL041) connected to a LM4549 codec.
It enables audio playback for the Versatile/PB platform.

Limitations:
- Supports only a playback on one channel (Versatile/Vexpress)
- Supports only one TX FIFO in compact-mode or non-compact mode.
- Supports playback of 12, 16, 18 and 20 bits samples.
- Record is not supported.
- The PL041 is hardwired to a LM4549 codec.

Versatile/PB test build:
linux-2.6.38.5
buildroot-2010.11
alsa-lib-1.0.22
alsa-utils-1.0.22
mpg123-0.66

Qemu host: Ubuntu 10.04 in Vmware/OS X

Playback tested successfully with speaker-test/aplay/mpg123.

Signed-off-by: Mathieu Sonet <contact@elasticsheep.com>
[Peter Maydell: fixed typo in code clearing SL1RXBUSY/SL2RXBUSY
 bits, as spotted by Andrzej Zaborowski]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-10-31 05:40:22 +01:00
David Gibson 3384f95c59 pseries: Add partial support for PCI
This patch adds a PCI bus to the pseries machine.  This instantiates
the qemu generic PCI bus code, advertises a PCI host bridge in the
guest's device tree and implements the RTAS methods specified by PAPR
to access PCI config space.  It also sets up the memory regions we
need to provide windows into the PCI memory and IO space, and
advertises those to the guest.

However, because qemu can't yet emulate an IOMMU, which is mandatory on
pseries, PCI devices which use DMA (i.e. most of them) will not work with
this code alone.  Still, this is enough to support the virtio_pci device
(which probably _should_ use emulated PCI DMA, but is specced to use
direct hypervisor access to guest physical memory instead).

[agraf] remove typedef which could cause compile errors

Signed-off-by: Alexey Kardashevskiy <aik@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-31 04:53:01 +01:00
David Gibson a7342588c0 pseries: Correct vmx/dfp handling in both KVM and TCG cases
Currently, when KVM is enabled, the pseries machine checks if the host
CPU supports VMX, VSX and/or DFP instructions and advertises
accordingly in the guest device tree.  It does this regardless of what
CPU is selected on the command line.  On the other hand, when in TCG
mode, it never advertises any of these facilities, even basic VMX
(Altivec) which is supported in TCG.

Now that we have a -cpu host option for ppc, it is fairly
straightforward to fix both problems.  This patch changes the -cpu
host code to override the basic cpu spec derived from the PVR with
information queried from the host avout VMX, VSX and DFP capability.
The pseries code then uses the instruction availability advertised in
the cpu state to set the guest device tree correctly for both the KVM
and TCG cases.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 20:03:26 +01:00
David Gibson 55f7d4b09e ppc: Avoid decrementer related kvm exits
In __cpu_ppc_store_decr(), we set up a regular timer used to trigger
decrementer interrupts.  This is necessary to implement the decrementer
properly under TCG, but is unnecessary under KVM (true for both Book3S-PR
and Book3S-HV KVM variants), because the kernel handles generating and
delivering decrementer exceptions.

Under kvm, in fact, the timer causes expensive and unnecessary exits from
kvm to qemu.  This patch, therefore, disables setting the timer when kvm
is in use.

Signed-off-by: Anton Blanchard <anton@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 20:03:26 +01:00
David Gibson 6b7a2cf6d9 pseries: Under kvm use guest cpu = host cpu by default
Now that we've implemented -cpu host for ppc, this patch updates the
pseries machine to use the host cpu as the guest cpu by default when
running under KVM.  This is important because under KVM Book3S-HV the guest
cpu _cannot_ be of a different type to the host cpu (at the moment
KVM Book3S-HV will silently virtualize the host cpu instead of whatever was
requested, but in future it is likely to simply refuse to run the VM if
a cpu model other than the host's is requested).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:54 +01:00
David Gibson 6659394fa1 pseries: Add device tree properties for VMX/VSX and DFP under kvm
Sufficiently recent PAPR specifications define properties "ibm,vmx"
and "ibm,dfp" on the CPU node which advertise whether the VMX vector
extensions (or the later VSX version) and/or the Decimal Floating
Point operations from IBM's recent POWER CPUs are available.

Currently we do not put these in the guest device tree and the guest
kernel will consequently assume they are not available.  This is good,
because they are not supported under TCG.  VMX is similar enough to
Altivec that it might be trivial to support, but VSX and DFP would
both require significant work to support in TCG.

However, when running under kvm on a host which supports these
instructions, there's no reason not to let the guest use them.  This
patch, therefore, checks for the relevant support on the host CPU
and, if present, advertises them to the guest as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:53 +01:00
David Gibson 0f5cb2989f pseries: Use Book3S-HV TCE acceleration capabilities
The pseries machine of qemu implements the TCE mechanism used as a
virtual IOMMU for the PAPR defined virtual IO devices.  Because the
PAPR spec only defines a small DMA address space, the guest VIO
drivers need to update TCE mappings very frequently - the virtual
network device is particularly bad.  This means many slow exits to
qemu to emulate the H_PUT_TCE hypercall.

Sufficiently recent kernels allow this to be mitigated by implementing
H_PUT_TCE in the host kernel.  To make use of this, however, qemu
needs to initialize the necessary TCE tables, and map them into itself
so that the VIO device implementations can retrieve the mappings when
they access guest memory (which is treated as a virtual DMA
operation).

This patch adds the necessary calls to use the KVM TCE acceleration.
If the kernel does not support acceleration, or there is some other
error creating the accelerated TCE table, then it will still fall back
to full userspace TCE implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:53 +01:00
David Gibson 354ac20a36 pseries: Allow KVM Book3S-HV on PPC970 CPUS
At present, using the hypervisor aware Book3S-HV KVM will only work
with qemu on POWER7 CPUs.  PPC970 CPUs also have hypervisor
capability, but they lack the VRMA feature which makes assigning guest
memory easier.

In order to allow KVM Book3S-HV on PPC970, we need to specially
allocate the first chunk of guest memory (the "Real Mode Area" or
RMA), so that it is physically contiguous.

Sufficiently recent host kernels allow such contiguous RMAs to be
allocated, with a kvm capability advertising whether the feature is
available and/or necessary on this hardware.  This patch enables qemu
to use this support, thus allowing kvm acceleration of pseries qemu
machines on PPC970 hardware.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>

---

agraf: fix to use memory api
2011-10-30 17:11:53 +01:00
David Gibson e97c363638 pseries: Support SMT systems for KVM Book3S-HV
Alex Graf has already made qemu support KVM for the pseries machine
when using the Book3S-PR KVM variant (which runs the guest in
usermode, emulating supervisor operations).  This code allows gets us
very close to also working with KVM Book3S-HV (using the hypervisor
capabilities of recent POWER CPUs).

This patch moves us another step towards Book3S-HV support by
correctly handling SMT (multithreaded) POWER CPUs.  There are two
parts to this:

 * Querying KVM to check SMT capability, and if present, adjusting the
   cpu numbers that qemu assigns to cause KVM to assign guest threads
   to cores in the right way (this isn't automatic, because the POWER
   HV support has a limitation that different threads on a single core
   cannot be in different guests at the same time).

 * Correctly informing the guest OS of the SMT thread to core mappings
   via the device tree.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:53 +01:00
Liu Yu-B13201 eeae2e7b52 ppc/e500_pci: Fix an array overflow issue
When access PPCE500_PCI_IW1 the previous index get overflow.
The patch fix the issue and update all to keep consistent style.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:53 +01:00
Liu Yu-B13201 6875dc8ea4 ppc/e500_pci: Fix code style
Put trailing statements on next line.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-30 17:11:53 +01:00
Aneesh Kumar K.V 7999f7e127 hw/9pfs: Make VirtFS tracing work correctly
this patch fix multiple issues with VirtFS tracing.
a) Add tracepoint to the correct code path. We handle error in complete_pdu
b) Fix indentation in python script
c) Fix variable naming issue in python script

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-30 09:05:28 +00:00
Paolo Bonzini 336a6915bc scsi-disk: add scsi-block for device passthrough
scsi-block is a new device that supports device passthrough of Linux
block devices (i.e. /dev/sda, not /dev/sg0).  It uses SG_IO for commands
other than I/O commands, and regular AIO read/writes for I/O commands.
Besides being simpler to configure (no mapping required to scsi-generic
device names), this removes the need for a large bounce buffer and,
in the future, will get scatter/gather support for free from scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 71544d30a6 scsi: push request restart to SCSIDevice
The request restart mechanism is generic and could be reused for
scsi-generic.  In the meanwhile, pushing it to SCSIDevice avoids
that scsi_dma_restart_bh looks at SCSIGenericReqs when working on
a scsi-block device.

The code is the same that is already in hw/scsi-disk.c, with
the type flags replaced by req->cmd.mode and a more generic way to
requeue SCSI_XFER_NONE commands.

I also added a missing call to qemu_del_vm_change_state_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini c9501c951c scsi-generic: bump SCSIRequest reference count until aio completion runs
Same as before, but for scsi-generic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini c7bae6a75b scsi-disk: bump SCSIRequest reference count until aio completion runs
In some cases a request may be canceled before the completion callback
runs.  Keep a reference to the request between starting an AIO operation
and the corresponding scsi_req_cancel or scsi_*_complete.

When a request has to be retried, the request can be dropped because
scsi_dma_restart_bh only looks at requests that are enqueued.  As such,
they always have at least a reference.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini e88c591d63 scsi: do not call transfer_data after canceling a request
Otherwise, if cancellation is "faked" by the AIO layer and goes
through qemu_aio_flush, the whole request is completed synchronously
during scsi_req_cancel.

Using the enqueued flag would work here, but not in the next patches,
so I'm introducing a new io_canceled flag.  That's because scsi_req_data
is a synchronous callback and the enqueued flag might be reset by the
time it returns.  scsi-disk cannot unref the request until after calling
scsi_req_data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 63db0f0eee scsi: pass cdb to alloc_req
This will let scsi-block choose between passthrough and emulation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 765d1525a6 scsi: export scsi_generic_reqops
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini adcf2754b9 scsi: make reqops const
Also delete a stale occurrence of SCSIReqOps inside SCSIDeviceInfo.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 7877903aa0 scsi: move max_lba to SCSIDevice
The field is only in scsi-disk for now.  Moving it up to SCSIDevice makes
it easier to reuse the scsi-generic reqops elsewhere.

At the same time, make scsi-generic get max_lba from snooped READ CAPACITY
commands as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini e39be48232 scsi-disk: small clean up to INQUIRY
Set s->removable, s->qdev.blocksize and s->qdev.type in the callers
of scsi_initfn.

With this in place, s->qdev.type is allowed, and we can just reuse it
as the first byte in VPD data (just like we do in standard INQUIRY data).
Also set s->removable is set consistently and we can use it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 69377307b2 scsi-disk: remove cluster_size
This field is redundant, and having it makes it more complicated
to share reqops between the upcoming scsi-block and scsi-generic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 44740c3816 scsi-disk: do not duplicate BlockDriverState member
Same as for scsi-generic, avoid duplication even if it causes longer
lines.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:52 +02:00
Paolo Bonzini 9b6eef8a31 scsi-generic: snoop READ CAPACITY commands to get block size
Instead of "guessing" the block size when there is no medium in the
drive, wait for the guest to send a READ CAPACITY command and snoop
it from there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini a3b16e71ab scsi-generic: look at host status
Pass down the host status so that failing transport can be detected
by the guest.  Similar treatment of host status could be done in
virtio-blk, too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini fe0ed71279 scsi-generic: check ioctl statuses when SG_IO succeeds
A succeeding ioctl does not imply that the SCSI command succeeded.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 6a58a3a6eb scsi-generic: remove scsi_req_fixup
This is not needed anymore, since asynchronous ioctls were introduced
by commit 221f715 (new scsi-generic abstraction, use SG_IO, 2009-03-28).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 8869e10397 scsi-generic: drop SCSIGenericState
It is not needed, because s->bs is already stored in SCSIDevice, and
can be reached from the conf.bs member.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 628e95b616 scsi-disk: fix retrying a flush
Flush does not go anymore through scsi_disk_emulate_command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 7cec78b6f0 scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0
Tested by the Windows Logo Kit SCSI Compliance test. From SBC-3, paragraph
5.25: "The LOGICAL BLOCK ADDRESS field shall be set to zero if the PMI
bit is set to zero. If the PMI bit is set to zero and the LOGICAL BLOCK
ADDRESS field is not set to zero, then the device server shall terminate
the command with CHECK CONDITION status with the sense key set to ILLEGAL
REQUEST and the additional sense code set to INVALID FIELD IN CDB".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 0d3545e76c scsi: add channel to addressing
This also requires little more than adding the new argument to
scsi_device_find, and the qdev property.  All devices by default
end up on channel 0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 7e0380b9bb scsi: allow arbitrary LUNs
This only requires changes in two places: in SCSIBus, we need to look
for a free LUN if somebody creates a device with a pre-existing scsi-id
but the default LUN (-1, meaning "search for a free spot"); in vSCSI,
we need to actually parse the LUN according to the SCSI spec.

For vSCSI, max_target/max_lun are set according to the logical unit
addressing format in SAM.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini ba74307c5a scsi: implement REPORT LUNS for arbitrary LUNs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini f48a7a6e35 scsi: remove devs array from SCSIBus
Change the devs array into a linked list, and add a scsi_device_find
function to navigate the children list instead.  This lets the SCSI
bus use more complex addressing, and HBAs can talk to the correct device
when there are multiple LUNs per target.

scsi_device_find may return another LUN on the same target if none is
found that matches exactly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini d8bb00d6d7 qdev: switch children device list to QTAILQ
SCSI buses will need to read the children list first-to-last.  This
requires using a QTAILQ, because hell breaks loose if you just try
inserting at the tail (thus reversing the order of all existing
visits from last-to-first to first-to-tail).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini afd4030c16 scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini 3c2f7c12c2 scsi-disk: report media changed via GET EVENT STATUS NOTIFICATION
This adds support for media change notification via the GET EVENT STATUS
NOTIFICATION command, used by Linux versions 2.6.38 and newer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:51 +02:00
Paolo Bonzini ceb792ef29 scsi-disk: support READ DVD STRUCTURE
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini 430ee2f26f scsi-disk: support DVD profile in GET CONFIGURATION
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini a07c7dcd6f atapi/scsi-disk: make mode page values coherent between the two
This patch adds to scsi-disk the missing mode page 0x01 for both disk
and CD-ROM drives, and mode page 0x0e for CD drives only.

A few offsets were wrong in atapi.c.  Also change the 2Ah mode page to
expose DVD media read capabilities in the IDE cdrom.  This lets you run
dvd+rw-mediainfo on the virtual DVD drives.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini a8f4bbe290 scsi-disk: store valid mode pages in a table
A small refactoring of the MODE SENSE implementation in scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini b6c251ab17 scsi-disk: add stubs for more MMC commands
This patch adds a few stub implementations for MMC commands to
scsi-disk, to be filled in later in the series.  It also adds to
scsi-defs.h constants for commands implemented by ide/atapi.c,
when missing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini f01b59319c scsi-disk: fix coding style issues (braces)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini 8a9c16f69e scsi-disk: report media changed via unit attention sense codes
Building on the previous patch, this one adds a media change callback
to scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini 3653d8c40e scsi: notify the device when unit attention is reported
Reporting media change events via unit attention sense codes requires
a small state machine: first report "NO MEDIUM", then report "MEDIUM MAY
HAVE CHANGED".  Unfortunately there is no good hooking point for the
device to notice that its pending unit attention condition has been
reported.  This patch reworks the generic machinery to add one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini af0e1ea2d3 atapi: cleanup/fix mode sense results
The first two bytes (after the 8-byte ATAPI header) are the mode page
number and the number of bytes after the length field itself.  Make
this clear in the code.

The AUDIO_CTL page was filled with wrong values.  It is not anymore in
MMC, but at least keep the values sane.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini f0f992e650 atapi: move GESN definitions to scsi-defs.h
As a complement to the previous patch, move definitions for GET EVENT
STATUS NOTIFICATION from the two functions to scsi-defs.h.

The NCR_* constants are just bit values corresponding to the ENC_*
values, with no offsets even, so keep just one copy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini 67cc61e430 atapi/scsi: unify definitions for MMC
The definitions in ide/internal.h are duplicates, since ATAPI commands
actually come from SCSI.  Use the ones in scsi-defs.h and move the
missing ones there.  Two exceptions:

- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"
page in scsi-disk.c.  It is unused, so pick the latter.

- GPCMD_* is left in ide/internal.h, at least for now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Paolo Bonzini 7e218df518 scsi: pass correct sense code for ENOMEDIUM
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28 19:25:50 +02:00
Kevin Wolf fb60105d49 ide: Fix off-by-one error in array index check
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-28 19:25:49 +02:00
Luiz Capitulino 79627472db qapi: Convert query-pci
This also fixes a bug with the old version: QMP would invert device id
and vendor id. This would look ok on HMP because it was printing
"device:vendor" instead of "vendor:device".

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-27 11:48:47 -02:00
Luiz Capitulino 96637bcdf9 qapi: Convert query-balloon
Please, note that some of the code supporting memory statistics is
still around (eg. virtio_balloon_receive_stats() and reset_stats()).

Also, the qmp_query_balloon() function is synchronous and thus doesn't
make any use of the (not fully working) monitor's asynchronous command
support (the old non-qapi implementation did).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-27 11:48:47 -02:00
Anthony Liguori e86d9b12b5 Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-10-26 10:29:24 -05:00
Max Filippov 3899edf7e4 ahci: fix DPRINTF format strings
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-26 14:22:40 +01:00
Hervé Poussineau 1ce9c19210 Fix typo: buf -> bus
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-26 14:14:19 +01:00
Marc-André Lureau ba43d28916 hda: do not mix output and input stream states, RHBZ #740493
Windows 7 may use the same stream number for input and output.
Current code will confuse streams.

Changes since v1:
- keep running_compat[] for migration version 1
- add running_real[] for migration version 2

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2011-10-25 19:15:20 +04:00
Marc-André Lureau 36ac4ad3d0 hda: do not mix output and input streams, RHBZ #740493
Windows 7 may use the same stream number for input and output.
That will result in lot of garbage on playback.

The hardcoded value of 4 needs to be in sync with GCAP streams
description and IN/OUT registers.

Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2011-10-25 19:15:07 +04:00
Alon Levy 9f0f352d85 qxl: reset update_surface
update init_qxl_ram to reset update_surface to 0. This fixes one case
of breakage when installing an old driver in a vm that had a new driver
installed. The newer driver would know about surface creation and would
change update_surface to !=0, then a reset would happen, all surfaces
are destroyed, then the old driver is initialized and issues an
UPDATE_AREA, and spice server aborts on invalid surface.

RHBZ: 690427

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-25 14:00:54 +02:00
Yonit Halperin 30f6da6656 qxl: fix guest cursor tracking
(1) If the guest cursor command is empty, don't reload it after migration.
(2) Cleaning the guest cursor when it is released by
    the spice server. In addition, explicitly reset the
    cursor in spice upon destroying the primary surface
    (was done by spice-server implicitly). This will prevent
    access to pci memory that was released.

RHBZ: 744518

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-25 14:00:54 +02:00
Gerd Hoffmann 78e60ba53d qxl: factor out properties
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-25 14:00:54 +02:00
Jan Kiszka 4ec8d3077b qxl: Drop phread_yield on OOM
This was only a best-effort attempt, by far not guaranteed to have an
effect. Drop it so that also no direct pthread usage remain in the
device model.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-25 14:00:53 +02:00
Jan Kiszka 691f5c7bde qxl: Convert to QEMU thread API
Use QEMU thread API instead of pthread directly. We still need to get
rid of pthread_yield, though, to drop pthread.h inclusion.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-10-25 14:00:53 +02:00
Anthony Liguori 952e849c15 Merge remote-tracking branch 'bonzini/split-main-loop-for-anthony' into staging 2011-10-24 10:51:12 -05:00
Blue Swirl b1f88301b5 m48t59: fix write access
Fix incorrect order of arguments, letting writes to NVRAM succeed.

It looks like guests never write to the device, only read from it, since the bug
originates back to 819385c58b.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-23 14:08:30 +00:00
Blue Swirl 0fb56ffc5e m48t59: drop obsolete address base arithmetic
Remove now incorrect address base arithmetic, missed by
9936d6e423. Fixes Sparc64 boot.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-23 14:07:38 +00:00
Blue Swirl 52ce6f05c1 pci_bridge: fix typo
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-23 14:05:46 +00:00
Paolo Bonzini 0abc2712b8 remove unused function
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:29 +02:00
Kevin Wolf 34d4260e18 pc: Fix floppy drives with if=none
Commit 63ffb564 broke floppy devices specified on the command line like
-drive file=...,if=none,id=floppy -global isa-fdc.driveA=floppy because it
relies on drive_get() which works only with -fda/-drive if=floppy.

This patch resembles what we're already doing for IDE, i.e. remember the floppy
device that was created and use that to extract the BlockDriverStates where
needed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2011-10-21 17:34:13 +02:00
Kevin Wolf a18e67f5f9 fdc: Fix floppy port I/O
The floppy device was broken by commit 212ec7ba (fdc: Convert to
isa_register_portio_list). While the old interface provided the port number
relative to the floppy drive's io_base, the new one provides the real port
number, so we need to apply a bitmask now to get the register number.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-21 17:34:13 +02:00
Kevin Wolf 5cce43bb28 xen_disk: Always set feature-barrier = 1
The synchronous .bdrv_flush callback doesn't exist any more and a device really
shouldn't poke into the block layer internals anyway. All drivers are supposed
to have a correctly working bdrv_flush, so let's just hard-code this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-21 17:34:12 +02:00
Dmitry Koshelev c2e2343e1f hw/arm_gic.c: Fix save/load of irq_target array
irq_target array saving/loading is in the wrong loop.
Version bump.

Signed-off-by: Dmitry Koshelev <karaghiozis@gmail.com>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-10-21 17:19:56 +02:00
Peter Maydell f45b885ffc hw/omap2: Wire up the IRQ for the 2430's fifth GPIO module
The OMAP2430 version of the omap-gpio device has five GPIO modules,
not four like the other OMAP2 versions; wire up the fifth module's
IRQ line correctly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-10-21 17:19:53 +02:00
Anthony Liguori a6e43daa73 Merge remote-tracking branch 'quintela/migration-pull' into staging 2011-10-20 08:46:55 -05:00
Anthony Liguori 46cd37e771 Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-10-20 08:43:00 -05:00
Anthony Liguori 1f99b94932 Merge remote-tracking branch 'aneesh/for-upstream-6' into staging
Conflicts:
	trace-events
2011-10-20 08:42:08 -05:00
Juan Quintela 624b9cc209 migration: rename qemu_file_has_error to qemu_file_get_error
Now the function returned errno, so it is better the new name.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20 13:23:52 +02:00
Juan Quintela dcd1d224df migration: change has_error to contain errno values
We normally already have an errno value.  When not, abuse EIO.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-10-20 13:23:52 +02:00
Juan Quintela 3a230256e8 ds1225y: Use stdio instead of QEMUFile
QEMUFile * is only intended for migration nowadays.  Using it for
anything else just adds pain and a layer of buffers for no good
reason.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-20 13:23:51 +02:00
Avi Kivity d08151bf7c tcx: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity fe06bd93e3 tc63963xb: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity 9f7adc31ad syborg: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity d4edce380c sun4u: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity 3150fa5010 sun4m: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity eb2fefbc44 strongarm: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity 7cc09e6c4b spitz: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity 890c2b772d spapr: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity 25793bfafa sm501: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:18 +02:00
Avi Kivity ca3dbc2757 s390-virtio: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:17 +02:00
Avi Kivity 35e87820d7 realview: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:17 +02:00
Avi Kivity 5dea2efb3b r2d: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:17 +02:00
Avi Kivity 2646c133b5 ppcr500_mpc8544ds: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-17 15:59:17 +02:00