Commit graph

21098 commits

Author SHA1 Message Date
Anthony Liguori 4dd533aa03 Merge remote-tracking branch 'bonzini/nbd-next' into staging
* bonzini/nbd-next:
  qemu-nbd: add --cache and --aio options
  qemu-nbd: reorganize help message
2012-07-30 09:59:38 -05:00
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
Anthony Liguori e6a7671998 Merge commit 'quintela/migration-next-v5' into staging
* commit '6c779f22a93cc6e4565b940ef616e3efc5b50ba5':
  Change ram_save_block to return -1 if there are no more changes
  ram: save_live_setup() we don't need to synchronize the dirty bitmap.
  ram: iterate phase
  ram: save_live_complete() only do one loop
  ram: save_live_setup() don't need to sent pages
  savevm: split save_live into stage2 and stage3
  savevm: split save_live_setup from save_live_state
  savevm: introduce is_active method
  savevm: Refactor cancel operation in its own operation
  savevm: remove SaveLiveStateHandler
  savevm: remove SaveSetParamsHandler
  savevm: Live migration handlers register the struct directly
  savevm: Use a struct to pass all handlers
2012-07-30 09:58:48 -05:00
Vitaly Chipounov 7162ab21fe x86: Fixed incorrect segment base address addition in 64-bits mode
According to the Intel manual
"Intel® 64 and IA-32 Architectures Software Developer’s Manual
Volume 3", "3.4.4 Segment Loading Instructions in IA-32e Mode":

"When in compatibility mode, FS and GS overrides operate as defined by
32-bit mode behavior regardless of the value loaded into the upper 32
linear-address bits of the hidden descriptor register base field.
Compatibility mode ignores the upper 32 bits when calculating an effective address."

However, the code misses the 64-bit mode case, where an instruction with
address and segment size override would be translated incorrectly. For example,
inc dword ptr gs:260h[ebx*4] gets incorrectly translated to:

(uint32_t)(gs.base + ebx * 4 + 0x260)
instead of
gs.base + (uint32_t)(ebx * 4 + 0x260)

Signed-off-by: Vitaly Chipounov <vitaly.chipounov@epfl.ch>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-29 08:45:57 +00:00
Paolo Bonzini e6d91ab66b place qemu-sockets.c contributions since 2012-01-13 under GPLv2+
Past contributions since 2012-01-13 were only made by Red Hat people,
so they are already available under GPLv2+.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-29 08:44:00 +00:00
Dunrong Huang 54c2e50205 build: Fix linking failure for qemu-ga
This patch will fix the following linking failed:

  LINK  qemu-ga
gcc: error: qga/../qapi-generated/qga-qapi-types.o: No such file or directory
gcc: error: qga/../qapi-generated/qga-qapi-visit.o: No such file or directory
gcc: error: qga/../qapi-generated/qga-qmp-marshal.o: No such file or directory
make: *** [qemu-ga] Error 1

Commit cdc976b040 changes the
dependencies of qemu-ga to depend "../qapi-generated/qga-qapi-types.o",
which will be expanded to "qga/../qapi-generated/qga-qapi-types.o" when
building qemu-ga.

In top-level Makefile, we defined a target "qapi-generated/qga-qapi-types.o"
which was not equal to "qga/../qapi-generated/qga-qapi-types" in the
Makefile world. So "No such file" error happened when qemu-ga was linking.

The easy approach to fix is to change the target name to
"qga/../qapi-generated/qga-qapi-types.o", but it is weird.

So, in order to solve it more graciously, I move those temporary
files(qga-qapi-*.{c,h}) qemu-ga depends on to qemu-ga/qapi-generated,
this makes dependencies more clearer.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-29 08:41:53 +00:00
Blue Swirl b595c14a7b Avoid redefining inline
System headers (e.g. gutils.h) may define 'inline', #undefine it
before #defining.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:23:20 +00: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 Frber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:18:25 +00:00
Paolo Bonzini 1435ddb89c build: get dependency file directories from object file names
After commit dcff25f2cd, Dependency file
are taken from the directories that have a Makefile.objs file.  This is
not enough, since files can be included from other directories.
So, pick them from directories that have an object file in them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:16:09 +00:00
Paolo Bonzini cdc976b040 build: include qapi-generated/ files in qga/Makefile.objs
No reason to leave them out, and it will ensure that the dependencies
are picked up.  Later we can perhaps move the files to another
directory to avoid ../ usage.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:15:29 +00:00
Eduardo Habkost 14117c7ba1 tests: Makefile: include dependency files
Otherwise 'make check' won't recompile files that need to be recompiled
because of header changes.

To reproduce the bug, run:

 $ make check  # succeeds
 $ echo B0RKED > hw/mc146818rtc_regs.h
 $ make check  # is supposed to try to rebuild tests/rtc-test.o and fail

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:13:49 +00:00
Peter Maydell 52d06136bd vl.c: Don't print errno after failed qemu_chr_new()
The qemu_chr_new() function doesn't set errno on failure, so
don't print strerror(errno) on the error handling path when
dealing with the -serial, -parallel and -virtioconsole arguments.
This avoids nonsensical error messages like:
  $ ./arm-softmmu/qemu-system-arm -serial wombat
  qemu: could not open serial device 'wombat': Success

We also rephrase the message slightly to make it a little clearer
that we're expecting the name of a QEMU chr backend rather than
a host or guest serial/parallel/etc device.

Reported-by: Christian Müller <christian.mueller@heig-vd.ch>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:08:12 +00:00
Max Filippov 7ff7563fc1 target-xtensa: fix big-endian BBS/BBC implementation
Quote from ISA, 2.1:

For most Xtensa instructions, bit numbering is irrelevant; only the BBC
and BBS instructions assign bit numbers to values on which the processor
operates. The BBC/BBS instructions use big-endian bit ordering (0 is the
most-significant bit) on a big-endian processor configuration.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:06:40 +00:00
Jia Liu d901eff3e6 target-or32: Add testcases
Add testcases for OpenRISC.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:06 +00:00
Jia Liu d962783e98 target-or32: Add linux user support
Add QEMU OpenRISC linux user support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:05 +00:00
Jia Liu a8720299f1 target-or32: Add linux syscall, signal and termbits
Add OpenRISC linux syscall, signal and termbits.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:05 +00:00
Jia Liu fc04355bb8 target-or32: Add gdb stub support
Add OpenRISC gdb stub support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:04 +00:00
Jia Liu 4dd044c6ba target-or32: Add system instructions
Add OpenRISC system instructions.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:03 +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 bbe418f25d target-or32: Add instruction translation
Add OpenRISC instruction tanslation routines.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:00 +00:00
Jia Liu 5b5695073b target-or32: Add float instruction helpers
Add OpenRISC float instruction helpers.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:13:00 +00:00
Jia Liu e54a5aff13 target-or32: Add int instruction helpers
Add OpenRISC int instruction helpers.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:59 +00:00
Jia Liu 1d7d403469 target-or32: Add exception support
Add OpenRISC exception support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:58 +00:00
Jia Liu b6a71ef7e0 target-or32: Add interrupt support
Add OpenRISC interrupt support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:57 +00:00
Jia Liu 726fe04572 target-or32: Add MMU support
Add OpenRISC MMU support.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:56 +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