aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-07-26scsi-disk: parse MODE SELECT commands and parametersPaolo Bonzini3-11/+169
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-26scsi-disk: fix changeable values for MODE_PAGE_R_W_ERRORPaolo Bonzini1-0/+3
The changeable values were not all-zeros for this mode page, fix it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26scsi-disk: adjust offsets in MODE SENSE by 2Paolo Bonzini1-66/+74
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-26scsi-disk: support emulated TO_DEV requestsPaolo Bonzini1-8/+28
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-26scsi-disk: separate read_data/write_data implementation for emulate_reqopsPaolo Bonzini1-11/+25
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-26scsi-disk: split scsi-disk reqopsPaolo Bonzini1-68/+123
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-26scsi-disk: move all non-DMA commands to scsi_disk_emulate_commandPaolo Bonzini1-86/+66
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-26scsi-disk: make discard asynchronousPaolo Bonzini1-12/+10
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-26scsi-disk: let the user customize vendor and product nameDmitry Fleytman1-10/+21
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-26cutils: add strpadcpy()Dmitry Fleytman2-0/+8
Signed-off-by: Yan Vugenfirer <yan@ravellosystems.com> Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-26scsi-block: remove properties that are not relevant for passthroughPaolo Bonzini1-1/+1
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-26lsi: avoid redundant tests of s->current != NULLPaolo Bonzini1-2/+3
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-26lsi: introduce lsi_request_freePaolo Bonzini1-15/+16
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-26lsi: use qdev_reset_allPaolo Bonzini1-12/+3
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-26megasas: fix misuse of scsi_req_abortPaolo Bonzini1-1/+1
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-26megasas: Replace trace_megasas_dcmd_dump_frame()Hannes Reinecke2-30/+11
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-23Merge remote-tracking branch 'stefanha/net' into stagingAnthony Liguori60-771/+1352
* 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-23Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori9-85/+83
* 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-23Merge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into stagingAnthony Liguori11-16/+456
* pmaydell/arm-devs.for-upstream: exynos4210: add Exynos4210 i2c implementation hw/exynos4210_rtc.c: remove unnecessary code hw/exynos4210_rtc.c: Fix calculating for value of year hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard hw/arm_boot.c: Support DTBs which use 64 bit addresses device_tree: Add support for reading device tree properties hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct hw/arm_boot.c: Make ram_size a uint64_t hw/pl011.c: Avoid crash on read when no chr backend present
2012-07-23Merge remote-tracking branch 'stefanha/tracing' into stagingAnthony Liguori6-196/+340
* stefanha/tracing: Update simpletrace.py for new log format Simpletrace v2: Support multiple arguments, strings. monitor: remove unused do_info_trace trace: added ability to comment out events in the list
2012-07-23remove unused QemuOpts parameter from net init functionsLaszlo Ersek12-38/+32
v1->v2: - unchanged v2->v3: - keep "qemu-option.h" included in "net/slirp.h" Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_bridge() to NetClientOptionsLaszlo Ersek1-11/+12
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_tap() to NetClientOptionsLaszlo Ersek8-70/+71
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_vde() to NetClientOptionsLaszlo Ersek1-10/+7
v1->v2: - NetdevVdeOptions::port and ::mode are of type uint16. Remove superfluous range checks. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_socket() to NetClientOptionsLaszlo Ersek1-76/+43
I "reverse engineered" the following permissions between the -socket sub-options: fd listen connect mcast udp | localaddr fd x . . . . | . listen . x . . . | . connect . . x . . | . mcast . . . x . | x udp . . . . x | x -------------------------------------------+ localaddr . . . x x x I transformed the code accordingly. The real fix would be to embed "fd", "listen", "connect", "mcast" and "udp" in a separate union. However OptsVisitor's enum parser only supports the type=XXX QemuOpt instance as union discriminator. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_slirp() to NetClientOptionsLaszlo Ersek1-68/+25
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_dump() to NetClientOptionsLaszlo Ersek1-4/+17
v1->v2: - NetdevDumpOptions::len is of type 'size', whose C type was changed to uint64_t. Adapt the printf() format specifier macro. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_init_nic() to NetClientOptionsLaszlo Ersek1-17/+22
v1->v2: - NetLegacyNicOptions::vectors is of type uint32 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23convert net_client_init() to OptsVisitorLaszlo Ersek12-346/+127
The net_client_init() prototype is kept intact. Based on "is_netdev", the QemuOpts-rooted QemuOpt-list is parsed as a Netdev or a NetLegacy. The original meat of net_client_init() is moved to and simplified in net_client_init1(): Fields not common between -net and -netdev are clearly separated. Getting the name for the init functions is cleaner: Netdev::id is mandatory, and all init functions handle a NULL NetLegacy::name. NetLegacy::vlan explicitly depends on -net (see below). Verifying the "type=" option for -netdev can be turned into a switch. Format validation with qemu_opts_validate() can be removed because the visitor covers it. Relatedly, the "net_client_types" array is reduced to an array of init functions that can be directly indexed by opts->kind. (Help text is available in the schema JSON.) The outermost negation in the condition around qemu_find_vlan() was flattened, because it expresses the dependent code's requirements more clearly. VLAN lookup is avoided if there's no init function to pass the VLAN to. Whenever the value of type=... is needed, we substitute NetClientOptionsKind_lookup[kind]. The individual init functions are not converted yet, thus the original QemuOpts instance is passed transparently. v1->v2: - NetLegacy::name is optional. Tracked it through all init functions: they all handle a NULL name. Updated commit message accordingly. v2->v3: - NetLegacy::id is allowed and takes precedence over NetLegacy::name. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23hw, net: "net_client_type" -> "NetClientOptionsKind" (qapi-generated)Laszlo Ersek34-83/+71
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-23qapi schema: add Netdev typesLaszlo Ersek1-0/+278
NetdevTapOptions::sndbuf and NetdevDumpOptions::len use the new "size" type. v1->v2: - NetLegacy::name is optional - NetLegacyNicOptions::vectors is of type uint32 - NetdevVdeOptions::port and ::mode are of type uint16 - NetLegacy::vlan has type int32 v2->v3: - NetLegacy::id is allowed and takes precedence over NetLegacy::name - replace "@traits" with "@opts" in NetLegacy & Netdev descriptions Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi schema: remove trailing whitespaceLaszlo Ersek1-5/+5
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi: introduce OptsVisitorLaszlo Ersek3-1/+459
This visitor supports parsing -option [type=]discriminator[,optarg1=val1][,optarg2=val2][,...] style QemuOpts objects into "native" C structures. After defining the type tree in the qapi schema (see below), a root type traversal with this visitor linked to the underlying QemuOpts object will build the "native" C representation of the option. The type tree in the schema, corresponding to an option with a discriminator, must have the following structure: struct scalar member for non-discriminated optarg 1 [*] list for repeating non-discriminated optarg 2 [*] wrapper struct single scalar member union struct for discriminator case 1 scalar member for optarg 3 [*] list for repeating optarg 4 [*] wrapper struct single scalar member scalar member for optarg 5 [*] struct for discriminator case 2 ... The "type" optarg name is fixed for the discriminator role. Its schema representation is "union of structures", and each discriminator value must correspond to a member name in the union. If the option takes no "type" descriminator, then the type subtree rooted at the union must be absent from the schema (including the union itself). Optarg values can be of scalar types str / bool / integers / size. Members marked with [*] may be defined as optional in the schema, describing an optional optarg. Repeating an optarg is supported; its schema representation must be "list of structure with single mandatory scalar member". If an optarg is not described as repeating in the schema (ie. it is defined as a scalar field instead of a list), its last occurrence will take effect. Ordering between differently named optargs is not preserved. A mandatory list (or an optional one which is reported to be available), corresponding to a repeating optarg, has at least one element after successful parsing. v1->v2: - Update opts_type_size() prototype to uint64_t. - Add opts_type_uint64() for options needing the full uint64_t range. (Internals could be extracted to "cutils.c".) - Allow negative values in opts_type_int(). - Rebase to nested Makefiles. v2->v3: - Factor opts_visitor_insert() out of opts_start_struct() and call it separately for opts_root->id if there's any. - Don't require non-negative values in opts_type_int()'s error message. - g_malloc0() may return NULL for zero-sized requests. Support empty structures by requesting 1 byte for them instead. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23expose QemuOpt and QemuOpts struct definitions to interested partiesLaszlo Ersek2-23/+54
The only clients should be the existent "qemu-option.c", and the upcoming "qapi/opts-visitor.c". Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi: introduce "size" typeLaszlo Ersek3-0/+12
v1->v2: - fall back to uint64 rather than int Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi: generate C types for fixed-width integersLaszlo Ersek1-0/+4
(Long line folded using parens: <http://www.python.org/dev/peps/pep-0008/#maximum-line-length>.) Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi: add test case for deallocating traversal of incomplete structureLaszlo Ersek1-0/+42
v3: - new patch Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23qapi: fix error propagationPaolo Bonzini6-70/+121
Don't overwrite / leak previously set errors. Make traversal cope with missing mandatory sub-structs. Don't try to end a container that could not be started. v1->v2: - unchanged v2->v3: - instead of examining, assert that we never overwrite errors with error_set() - allow visitors to set a NULL struct pointer successfully, so traversal of incomplete objects can continue - check for a NULL "obj" before accessing "(*obj)->has_XXX" (this is not a typo, "obj != NULL" implies "*obj != NULL" here) - fix start_struct / end_struct balance for unions as well Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-23MAINTAINERS: Replace net maintainer Mark McLoughlin with Stefan HajnocziStefan Hajnoczi1-1/+2
The net subsystem has lacked an active maintainer since 2009. I have built and tested a net-next tree to get the ball rolling again. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21Fix some more Qemus in documentation and help textStefan Weil2-3/+3
Hopefully they will be eliminated one day. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21qdev: Fix Open Firmware commentStefan Weil1-6/+5
Commit 0d936928ef87ca1bb7b41b5b89c400c699a7691c 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-21cpus.c: Make all_cpu_threads_idle() staticPeter Maydell2-27/+26
Commit 946fb27c1 moved all the uses of all_cpu_threads_idle() into cpus.c. This means we can mark the function 'static' (again), if we shuffle it a bit earlier in the source file. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21Use macro QEMU_PACKED for new packed structuresStefan Weil2-47/+47
Since commit 541dc0d47f10973c241e9955afc2aefc96adec51, 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-21Recognize PCID featureMao, Junjie1-1/+1
This patch makes Qemu recognize the PCID feature specified from configuration or command line options. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-07-21powerpc pci: fixed packing of ranges[]Alexey Kardashevskiy1-1/+1
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-20exynos4210: add Exynos4210 i2c implementationMitsyanko Igor4-1/+365
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-20hw/exynos4210_rtc.c: remove unnecessary codeOleg Ogurtsov1-4/+1
Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20hw/exynos4210_rtc.c: Fix calculating for value of yearOleg Ogurtsov1-1/+1
Signed-off-by: Oleg Ogurtsov <o.ogurtsov@samsung.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-07-20hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboardPeter Maydell1-3/+10
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-20hw/arm_boot.c: Support DTBs which use 64 bit addressesPeter Maydell1-3/+32
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>