Commit graph

7620 commits

Author SHA1 Message Date
Anthony Liguori d4a06f466a Merge remote-tracking branch 'bonzini/scsi-next' into staging
* bonzini/scsi-next: (32 commits)
  virtio-scsi: enable MSI-X support
  virtio-scsi: add ioeventfd support
  virtio-scsi: report parameter change events
  virtio-scsi: do not report dropped events after reset
  virtio-scsi: Report missed events
  virtio-scsi: Implement hotplug support for virtio-scsi
  scsi: report parameter changes to HBA drivers
  scsi-disk: report resized disk via sense codes
  scsi: establish precedence levels for unit attention
  scsi: introduce hotplug() and hot_unplug() interfaces for SCSI bus
  scsi: add tracepoint for scsi_req_cancel
  scsi-disk: removable hard disks support load/eject
  scsi-disk: Fail medium writes with proper sense for readonly LUNs
  scsi-disk: improve the lba-out-of-range tests for read/write/verify
  scsi-disk: rd/wr/vr-protect !=0 is an error
  scsi-disk: support toggling the write cache
  scsi-disk: parse MODE SELECT commands and parameters
  scsi-disk: fix changeable values for MODE_PAGE_R_W_ERROR
  scsi-disk: adjust offsets in MODE SENSE by 2
  scsi-disk: support emulated TO_DEV requests
  ...
2012-07-30 09:59:23 -05:00
Blue Swirl 0ed8b6f67f Avoid returning void
It's silly and non-conforming to standards to return void,
don't do it.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:23:11 +00:00
Peter Maydell 16fd921bd3 hw/escc: Drop duplicate definition of 'disabled' property
Drop a duplicate definition of the 'disabled' property from
the escc qdev property list: this redefinition is currently
effectively ignored but will become an error. (The duplication
was inadvertently introduced in 2009 in commit ec02f7dec2.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:18:25 +00:00
Jia Liu ce6e1e9ec9 target-or32: Add a IIS dummy board
Add a IIS dummy board.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:02 +00:00
Jia Liu 99f575edcc target-or32: Add timer support
Add OpenRISC timer support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:02 +00:00
Jia Liu dd29c7fb01 target-or32: Add PIC support
Add OpenRISC Programmable Interrupt Controller support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:01 +00:00
Jia Liu e67db06e9f target-or32: Add target stubs and QOM cpu
Add OpenRISC target stubs, QOM cpu and basic machine.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:55 +00:00
Paolo Bonzini 4c205d0cb1 virtio-scsi: enable MSI-X support
While virtio-scsi does support multiqueue, the default number of
interrupt vectors is not enough to actually enable usage of
multiple queues in the driver; this is because with only 2
vectors the driver will not be able to use a separate
interrupt for each request queue.  Derive the desired number
of vectors from the number of request queues.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 15:47:30 +02:00
Paolo Bonzini 3f910904ec virtio-scsi: add ioeventfd support
Probably due to bad merge months ago, virtio-scsi-pci did not have
ioeventfd support.  Fix this and enable it by default, as is the
case for other virtio-pci devices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 14:36:07 +02:00
Paolo Bonzini feda01e40f virtio-scsi: report parameter change events
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:27 +02:00
Paolo Bonzini 2baa1beb1e virtio-scsi: do not report dropped events after reset
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:27 +02:00
Paolo Bonzini 64f64855d0 virtio-scsi: Report missed events
When an event is reported but no buffers are present in the event vq,
we can set a flag and report a dummy event as soon as one is added.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:27 +02:00
Cong Meng b6866fee58 virtio-scsi: Implement hotplug support for virtio-scsi
Implement the hotplug() and hot_unplug() interfaces in virtio-scsi, by signal
the virtio_scsi.ko in guest kernel via event virtual queue.

The counterpart patch of virtio_scsi.ko will be sent soon in another thread.

Signed-off-by: Sen Wang <senwang@linux.vnet.ibm.com>
Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
[ Add memset, fix LUN field, placate checkpatch - Paolo ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:26 +02:00
Paolo Bonzini 53200fad0e scsi: report parameter changes to HBA drivers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:26 +02:00
Paolo Bonzini aaebacef0a scsi-disk: report resized disk via sense codes
Linux will not use these, but a very similar mechanism will be used to
report the condition via virtio-scsi events.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:26 +02:00
Paolo Bonzini e48e84ea80 scsi: establish precedence levels for unit attention
When a device is resized, we will report a unit attention condition
for CAPACITY DATA HAS CHANGED.  However, we should ensure that this
condition does not override a more important unit attention condition.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:25 +02:00
Cong Meng 350e6e4199 scsi: introduce hotplug() and hot_unplug() interfaces for SCSI bus
Add two interfaces hotplug() and hot_unplug() to scsi bus info.
The scsi bus can implement these two interfaces to signal the HBA driver
of guest kernel to add/remove the scsi device in question.

Signed-off-by: Sen Wang <senwang@linux.vnet.ibm.com>
Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
[ Fixed braces and indentation - Paolo ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:25 +02:00
Paolo Bonzini 814589c450 scsi: add tracepoint for scsi_req_cancel
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:24 +02:00
Paolo Bonzini b456a71c4a scsi-disk: removable hard disks support load/eject
Support for the LOEJ bit of the START/STOP UNIT command right now is
limited to CD-ROMs.  This is wrong, since removable hard disks (in the
real world: SD card readers) also support it in pretty much the same way.

Without the LOEJ bit, START/STOP UNIT does nothing for all devices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-27 08:25:21 +02:00
Ronnie Sahlberg 6a8a685c4d scsi-disk: Fail medium writes with proper sense for readonly LUNs
Add sense code for DATA_PROTECT/WRITE_PROTECTED and return this error
for any WRITE*/WRITE_VERIFY* calls if the device is readonly=on,
i.e. write-protected

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:11 +02:00
Ronnie Sahlberg ba6095cd6b scsi-disk: improve the lba-out-of-range tests for read/write/verify
Improve the tests for the LBA to cover more cases.

For the 16 byte opcodes, the lba is a uint64, so we need to check is to
make sure that we do not wrap.  For example if an opcode would specify
the LBA:0xffffffffffffffff and LEN:2 then lba+len would wrap to 1.

Also verify that ALL requested blocks are available, not just the first one.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:10 +02:00
Ronnie Sahlberg 96bdbbab55 scsi-disk: rd/wr/vr-protect !=0 is an error
The QEMU SCSI emulation does not support protection information,
so any READ/WRITE/VERIFY commands that has the protect bits set to
non-zero should fail with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB

From SCSI SBC :
If the logical unit does not support protection information,
then the device server should 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: Ronnie Sahlberg <ronniesahlberg@gmail.com>
[ Rebase after scsi_dma_reqops introduction - Paolo ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:10 +02:00
Paolo Bonzini 96c91bbf60 scsi-disk: support toggling the write cache
Finally, this uses the "plumbing" in the previous patch to
add support for toggling the WCE bit of the caching mode page.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:10 +02:00
Paolo Bonzini 380feaffb0 scsi-disk: parse MODE SELECT commands and parameters
This adds the bulk of the parsing code for MODE SELECT, including
breaking out changes to different mode pages, and checking that only
changeable values are modified.

In order to report errors correctly two passes are made through the
parameters; the first only looks for errors, the second actually
applies the changes to the mode page.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:10 +02:00
Paolo Bonzini 4f588b1511 scsi-disk: fix changeable values for MODE_PAGE_R_W_ERROR
The changeable values were not all-zeros for this mode page, fix it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:10 +02:00
Paolo Bonzini ef40561116 scsi-disk: adjust offsets in MODE SENSE by 2
This will make offsets the same when implementing MODE SELECT.  This is
because MODE SELECT has to deal with both 2-byte and 4-byte headers.
Unfortunately, this means that the offsets are now off by two compared
to the descriptions in the SCSI specs, which include the header.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini af6d510ddb scsi-disk: support emulated TO_DEV requests
This adds the implementation of write_data for the emulated
command case.  The first time through it asks for more data,
the second time it finishes the processing of the command.

MODE SELECT and MODE SELECT(10) can now be re-enabled, but they
will not do much.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini 314a329906 scsi-disk: separate read_data/write_data implementation for emulate_reqops
The previous patch only separated the send_command callback.
Use different implementations also for read_data and write_data.
The latter is still unreachable, so it aborts for now.

read_data passes the data buffer that was prepared and completes
the command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini b08d0ea044 scsi-disk: split scsi-disk reqops
Only checks for present medium were still done in scsi_send_command
for emulated commands.  So move those to scsi_disk_emulate_command
and return different SCSIReqOps depending on the kind of command.

Checks for present medium can be done unconditionally for the
scsi_disk_dma_reqops case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini 101aa85f98 scsi-disk: move all non-DMA commands to scsi_disk_emulate_command
We want to use separate SCSIReqOps for emulated commands needing an
allocated buffer vs. those that are zerocopy when the HBA supports
S/G lists.  Ensure that all of the former are in scsi_disk_emulate_command.

Commands that do not have any parameters are more similar to emulated
commands, so also move them, even if they do I/O.

Finally, MODE SELECT and MODE SELECT(10) are broken because we do not
yet support passing parameter data _to_ emulated commands, so disable
them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini c1b3524788 scsi-disk: make discard asynchronous
By making discard asynchronous, we can reuse all the error handling
code that is used for other commands.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Dmitry Fleytman 353815aa6d scsi-disk: let the user customize vendor and product name
This patch adds two new properties vendor and product to SCSI disks.
These options let the user customize the inquiry data returned by the
disk.

Signed-off-by: Yan Vugenfirer <yan@ravellosystems.com>
Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
[ Use vendor and product property names, avoid "if" statements. - PB ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:09 +02:00
Paolo Bonzini 038478370d scsi-block: remove properties that are not relevant for passthrough
scsi-block is a passthrough device and does not allow customization
of vendor, product, removable, DPOFUA, block size or any other piece of
information.  Thus, drop DEFINE_SCSI_DISK_PROPERTIES() from the
list of qdev properties.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:08 +02:00
Paolo Bonzini 8f6e699ddb lsi: avoid redundant tests of s->current != NULL
Simplify the code by checking against req->hba_private directly,
and asserting that it is non-NULL before a command is completed
or canceled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:08 +02:00
Paolo Bonzini d2a9998f88 lsi: introduce lsi_request_free
Split the common bits of lsi_request_cancelled and lsi_command_complete
out to a new function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:08 +02:00
Paolo Bonzini 2f0772c5b4 lsi: use qdev_reset_all
By first resetting the devices, lsi_soft_reset will find the queue
already cleared so there is no need to do that forcibly (which may also
leak SCSIRequests, and/or worse due to dangling references to the
lsi_request in the hba_private field).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:08 +02:00
Paolo Bonzini e2b06058f7 megasas: fix misuse of scsi_req_abort
scsi_req_abort is for terminating a command with a non-zero status.
The ABORT task management function is invoked by scsi_req_cancel.
In fact, ABORTED_COMMAND is a sense key, not a SAM status code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:07 +02:00
Hannes Reinecke 10d6530c64 megasas: Replace trace_megasas_dcmd_dump_frame()
trace_megasas_dcmd_dump_frame() takes 9 arguments, which is
rather much. Plus the trace infrastructure doesn't support
it.  As we can get the information via other means it's pointless
to have it in the driver, so rather use some proper trace
point here and remove the old one.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26 17:44:07 +02:00
Anthony Liguori a21143486b Merge remote-tracking branch 'stefanha/net' into staging
* stefanha/net:
  remove unused QemuOpts parameter from net init functions
  convert net_init_bridge() to NetClientOptions
  convert net_init_tap() to NetClientOptions
  convert net_init_vde() to NetClientOptions
  convert net_init_socket() to NetClientOptions
  convert net_init_slirp() to NetClientOptions
  convert net_init_dump() to NetClientOptions
  convert net_init_nic() to NetClientOptions
  convert net_client_init() to OptsVisitor
  hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)
  qapi schema: add Netdev types
  qapi schema: remove trailing whitespace
  qapi: introduce OptsVisitor
  expose QemuOpt and QemuOpts struct definitions to interested parties
  qapi: introduce "size" type
  qapi: generate C types for fixed-width integers
  qapi: add test case for deallocating traversal of incomplete structure
  qapi: fix error propagation
  MAINTAINERS: Replace net maintainer Mark McLoughlin with Stefan Hajnoczi
2012-07-23 13:15:34 -05:00
Anthony Liguori ef6bbdf9e5 Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches:
  Fix some more Qemus in documentation and help text
  qdev: Fix Open Firmware comment
  cpus.c: Make all_cpu_threads_idle() static
  Use macro QEMU_PACKED for new packed structures
  Recognize PCID feature
  powerpc pci: fixed packing of ranges[]
2012-07-23 13:15:34 -05:00
Laszlo Ersek 2be64a68ed hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)
NET_CLIENT_TYPE_ -> NET_CLIENT_OPTIONS_KIND_

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23 11:55:18 +01:00
Stefan Weil c578861451 qdev: Fix Open Firmware comment
Commit 0d936928ef removed code,
but left the related comment at a location where it no longer
belongs to.

The patch moves the comment to the correct callback and improves the text.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21 10:54:40 +01:00
Stefan Weil 7c7bb0223e Use macro QEMU_PACKED for new packed structures
Since commit 541dc0d47f,
some new packed structures were added without using QEMU_PACKED.

QEMU_PACKED is needed for compilations with MinGW.
For other platforms nothing changes.

The code was fixed using this command:

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

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21 10:54:40 +01:00
Alexey Kardashevskiy c4889f5423 powerpc pci: fixed packing of ranges[]
By default mingw-gcc is trying to pack structures the way to
preserve binary compatibility with MS Visual C what leads to
incorrect and unexpected padding in the PCI bus ranges property of
the sPAPR PHB.

The patch replaces __attribute__((packed)) with more strict QEMU_PACKED
which actually is __attribute__((gcc_struct, packed)) on Windows.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21 10:54:40 +01:00
Mitsyanko Igor ffbbe7d02f exynos4210: add Exynos4210 i2c implementation
Create 9 exynos4210 i2c interfaces.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20 14:30:09 +01:00
Oleg Ogurtsov 4688870d87 hw/exynos4210_rtc.c: remove unnecessary code
Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20 14:18:24 +01:00
Oleg Ogurtsov 64de1ecfe7 hw/exynos4210_rtc.c: Fix calculating for value of year
Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20 14:16:14 +01:00
Peter Maydell 25d7169982 hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard
Now that we have LPAE support and can handle passing 64 bit
RAM sizes to Linux via the device tree, we can lift the
restriction in the Versatile Express A15 daughterboard model
on not having more than 2GB of RAM. Allow up to 30GB, which
is the maximum that can fit in the address map before running
into the (unmodelled) aliases of the first 2GB.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20 13:34:50 +01:00
Peter Maydell 9bfa659e6b hw/arm_boot.c: Support DTBs which use 64 bit addresses
Support the case where the device tree blob specifies that
#address-cells and #size-cells are greater than 1. (This
is needed for device trees which can handle 64 bit physical
addresses and thus total RAM sizes over 4GB.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
2012-07-20 13:34:50 +01:00
Peter Maydell 3871481c0a hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
The legacy ATAGS format for passing information to the kernel only
allows RAM sizes which fit in 32 bits; enforce this restriction
rather than silently doing something weird.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
2012-07-20 13:34:50 +01:00