sdk/emulator/qemu.git
15 years agoS/390 CPU fake emulation
Alexander Graf [Sat, 5 Dec 2009 11:44:21 +0000 (12:44 +0100)]
S/390 CPU fake emulation

Because Qemu currently requires a TCG target to exist and there are quite some
useful helpers here to lay the groundwork for out KVM target, let's create a
stub TCG emulation target for S390X CPUs.

This is required to make tcg happy. The emulation target itself won't work
though.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoSparc64: handle MMU global bit and nucleus context
Blue Swirl [Sat, 5 Dec 2009 11:14:55 +0000 (11:14 +0000)]
Sparc64: handle MMU global bit and nucleus context

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agomonitor: fix use of plain integer as NULL pointer, spotted by Sparse
Blue Swirl [Fri, 4 Dec 2009 20:52:02 +0000 (20:52 +0000)]
monitor: fix use of plain integer as NULL pointer, spotted by Sparse

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoAdd "static" to please Sparse
Blue Swirl [Fri, 4 Dec 2009 20:44:44 +0000 (20:44 +0000)]
Add "static" to please Sparse

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoscsi: fix incorrect ?: use
Blue Swirl [Fri, 4 Dec 2009 18:08:59 +0000 (18:08 +0000)]
scsi: fix incorrect ?: use

Fixes OpenBSD build.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agomonitor: use qemu_gettimeofday(), not gettimeofday()
Blue Swirl [Fri, 4 Dec 2009 18:06:39 +0000 (18:06 +0000)]
monitor: use qemu_gettimeofday(), not gettimeofday()

Fix mingw32 build.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agowin32: fix variable use before initialization
Blue Swirl [Fri, 4 Dec 2009 18:06:20 +0000 (18:06 +0000)]
win32: fix variable use before initialization

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agomonitor: rename EVENT_* to QEVENT_* to avoid conflict on mingw32
Blue Swirl [Fri, 4 Dec 2009 18:05:45 +0000 (18:05 +0000)]
monitor: rename EVENT_* to QEVENT_* to avoid conflict on mingw32

Partially fixes mingw32 build.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc64: fix compilation with DEBUG_MMU
Blue Swirl [Fri, 4 Dec 2009 16:16:33 +0000 (16:16 +0000)]
Sparc64: fix compilation with DEBUG_MMU

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoide: implement stub for audio control/volume read
Thadeu Lima de Souza Cascardo [Mon, 30 Nov 2009 19:37:03 +0000 (17:37 -0200)]
ide: implement stub for audio control/volume read

This implements the audio control or volume read support as needed by
some systems. A Conectiva Parolin system required this to detect an IDE
device as CD-ROM, through the CDVOLREAD ioctl.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: Use some already defined page macros instead of constants
Thadeu Lima de Souza Cascardo [Mon, 30 Nov 2009 19:36:54 +0000 (17:36 -0200)]
ide: Use some already defined page macros instead of constants

Some PAGE constants were used instead of the macros we already have
defined in internal.h.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: Improve debug messages
Stefan Weil [Fri, 27 Nov 2009 11:06:02 +0000 (12:06 +0100)]
eepro100: Improve debug messages

* buf was too small for longer register names.
* Use consistent upper case for nouns in register names.
* Use better name for array with e100 register names.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove rule for config-devices.h
Stefan Weil [Wed, 25 Nov 2009 20:59:38 +0000 (21:59 +0100)]
Remove rule for config-devices.h

Since commit a992fe3d0fc185112677286f7a02204d8245b61e
config-devices.h is no longer used.

So there is no need to keep the dependency rules
any longer.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: Allocate a larger buffer for regname()
David Benjamin [Thu, 26 Nov 2009 02:20:10 +0000 (21:20 -0500)]
eepro100: Allocate a larger buffer for regname()

This should avoid truncating the register name when debugging.

Signed-off-by: David Benjamin <davidben@mit.edu>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomultiboot: Use signed type for negative error numbers
Kevin Wolf [Wed, 18 Nov 2009 11:15:21 +0000 (12:15 +0100)]
multiboot: Use signed type for negative error numbers

In mb_mod_length a return value is stored that is negative in error case. With
an unsigned type the check goes wrong.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoposix-aio-compat: Fix error check
Kevin Wolf [Wed, 18 Nov 2009 11:15:10 +0000 (12:15 +0100)]
posix-aio-compat: Fix error check

Checking for nbytes < 0 is pointless as long as it's a size_t. If we want to
use negative numbers for error codes, we should use signed types.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-img: Fix memory leak
Kevin Wolf [Wed, 18 Nov 2009 09:48:01 +0000 (10:48 +0100)]
qemu-img: Fix memory leak

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix compile error when LSI_DEBUG is defined
Ryan Harper [Fri, 20 Nov 2009 19:55:12 +0000 (13:55 -0600)]
Fix compile error when LSI_DEBUG is defined

This patch fixes the follow error when LSI_DEBUG is set.

  CC    libhw64/lsi53c895a.o
cc1: warnings being treated as errors
qemu/hw/lsi53c895a.c: In function 'lsi_io_mapfunc':
qemu/hw/lsi53c895a.c:1932: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t'
qemu/hw/lsi53c895a.c: In function 'lsi_ram_mapfunc':
/qemu/hw/lsi53c895a.c:1947: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t'
qemu/hw/lsi53c895a.c: In function 'lsi_mmio_mapfunc':
qemu/hw/lsi53c895a.c:1957: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t'
make[1]: *** [lsi53c895a.o] Error 1
make: *** [subdir-libhw64] Error 2

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix build for mingw32 on windows ($$ expansion)
Stefan Weil [Thu, 19 Nov 2009 19:19:56 +0000 (20:19 +0100)]
Fix build for mingw32 on windows ($$ expansion)

Make using mingw32 on windows fails when running grep "=y$$".
The command is expanded to grep "=y$ and the missing "
results in an error.

I don't expect a file config-devices.mak with =y somewhere in
the middle of a line (they are always at the end of the line),
so simplifying the regular expression to =y seems to be permitted.

This avoids problems with wrong expansion.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix build for mingw32 on windows ($@ in macro)
Stefan Weil [Thu, 19 Nov 2009 19:07:52 +0000 (20:07 +0100)]
Fix build for mingw32 on windows ($@ in macro)

Make using mingw32 on windows does not preserve $@ in macros
when they are modified using this pattern:
target: macro += something

This behaviour results in an error when QEMU_CFLAGS containing
"-MMD -MP -MT $@" is modified for compilation of source files
which use SDL: $@ will expand to nothing, -MT no longer has
the correct argument (it will take the next one from the command
line) and the build will fail or run with a wrong command line.

The problem is fixed by using a new macro QEMU_DGFLAGS
which is not modified by a target rule.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoe1000: Fix warning from code review
Stefan Weil [Thu, 19 Nov 2009 18:44:55 +0000 (19:44 +0100)]
e1000: Fix warning from code review

A code review run by Steve Grubb complained about code in e1000.c:

In hw/e1000.c at line 89, vlan is declared to be 4 bytes.
At line 382 is an attempt to do a memmove over it with a size of 12.

This was fixed by splitting the memmove in two calls and
adding a comment to the declaration of vlan and data.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomultiboot: Fix module loading and setting of mmap.
Adam Lackorzynski [Mon, 30 Nov 2009 22:25:44 +0000 (23:25 +0100)]
multiboot: Fix module loading and setting of mmap.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake -kernel for linux work with bochsbios
Alexander Graf [Tue, 17 Nov 2009 16:49:16 +0000 (17:49 +0100)]
Make -kernel for linux work with bochsbios

While trying to run -kernel with -bios pc-bios/pcbios.bin, I realized
that I was actually writing data to %es, but only set up %ds to a 32-bit
segment we want to write to.

So at the end of the day the data hasn't actually been copied. Oops.

So here's a fix to set ES instead of DS, which makes -kernel work with
BOCHS bios again (and actually makes the code do the correct thing)!

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix recently introduced bugs in -usbdevice host
Markus Armbruster [Fri, 27 Nov 2009 12:05:53 +0000 (13:05 +0100)]
Fix recently introduced bugs in -usbdevice host

Commit 26a9e82a has the following flaws:

* It enabled DEBUG.

* It referenced two properties by the wrong name in
  usb_host_device_open(), which crashes with "qdev_prop_set: property
  "USB Host Device.bus" not found".

* It broke "-usbdevice host:auto:..." by calling parse_filter()
  incorrectly.

* It broke parsing of "-usbdevice host:BUS.ADDR" and "-usbdevice
  host:VID:PRID" with a trivial pasto.

* It broke wildcards in "-usbdevice host:auto:...".  Before, the four
  filter components were stored as int, and the wildcard was encoded
  as -1.  The faulty commit changed storage to uint32_t, and the
  wildcard encoding to 0.  But it failed to update parse_filter()
  accordingly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix description of size parameter in qemu-img's help text
Pierre Riteau [Fri, 27 Nov 2009 13:14:56 +0000 (14:14 +0100)]
Fix description of size parameter in qemu-img's help text

Valid description taken from qemu-img.texi, although it would be better
to have this information recorded in only one place.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSuppress optionrom build on Solaris x86
Andreas Faerber [Fri, 27 Nov 2009 21:18:52 +0000 (22:18 +0100)]
Suppress optionrom build on Solaris x86

To avoid the build failing with:

gcc -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-
builtin -I/export/home/andreas/QEMU/qemu   -Wall -Wstrict-prototypes -
Werror -fomit-frame-pointer -fno-builtin -I/export/home/andreas/QEMU/
qemu   -c -o multiboot.o multiboot.S
/var/tmp//ccd3aWyk.s: Assembler messages:
/var/tmp//ccd3aWyk.s:15: Error: value of 512 too large for field of 1
bytes at 0000000000000002
gmake[1]: *** [multiboot.o] Error 1

disable recursion into pc-bios/optionrom, as done for Darwin already.

Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename DriveInfo.onerror to on_write_error
Kevin Wolf [Fri, 27 Nov 2009 12:25:36 +0000 (13:25 +0100)]
Rename DriveInfo.onerror to on_write_error

Either rename variables and functions to refer to write errors (which is what
they actually do) or introduce a parameter to distinguish reads and writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSCSI: Fix Standard INQUIRY data
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
SCSI: Fix Standard INQUIRY data

Vendor identification, product identification and product revision level
should be padded with spaces without a terminating NULL character, see
SCSI-2 standard, 8.2.5.1 Standard INQUIRY data.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: x86: Add support for VCPU event states
Jan Kiszka [Tue, 24 Nov 2009 23:33:03 +0000 (00:33 +0100)]
kvm: x86: Add support for VCPU event states

This patch extends the qemu-kvm state sync logic with support for
KVM_GET/SET_VCPU_EVENTS, giving access to yet missing exception,
interrupt and NMI states.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: x86: Fix merge artifact of f8d926e9 about mp_state
Jan Kiszka [Tue, 24 Nov 2009 23:31:03 +0000 (00:31 +0100)]
kvm: x86: Fix merge artifact of f8d926e9 about mp_state

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotarge-ppc: Sync CPU state for KVM
Alexander Graf [Wed, 2 Dec 2009 22:20:29 +0000 (23:20 +0100)]
targe-ppc: Sync CPU state for KVM

Some recent change made PPC guests always start at address 0x0 because env
isn't synced to kvm_state on first bootup.

I'm not sure if this is the correct bugfix, but at least it makes PPC boot
again with KVM enabled.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-ppc: Get MMU state on register sync
Alexander Graf [Wed, 2 Dec 2009 22:19:47 +0000 (23:19 +0100)]
target-ppc: Get MMU state on register sync

While x86 only needs to sync cr0-4 to know all about its MMU state and enable
qemu to resolve virtual to physical addresses, we need to sync all of the
segment registers on PPC to know which mapping we're in.

So let's grab the segment register contents to be able to use the "x" monitor
command and also enable the gdbstub to resolve virtual addresses.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoqemu: cleanup unused macros in cirrus
Michael S. Tsirkin [Mon, 30 Nov 2009 19:02:32 +0000 (21:02 +0200)]
qemu: cleanup unused macros in cirrus

Cirrus vga has a copy of many PCI macros,
and it doesn't even use them. Clean up.
We also don't need to override header type
as it is NORMAL by default.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu: make cirrus init value pci spec compliant
Michael S. Tsirkin [Mon, 30 Nov 2009 19:02:26 +0000 (21:02 +0200)]
qemu: make cirrus init value pci spec compliant

PCI memory should be disabled at reset, otherwise
we might claim transactions at address 0.
I/O should also be disabled, although for cirrus
it is harmless to enable it as we do not
have I/O bar.

Note: bios fix needed for this patch to work
was already applied:
previously bios incorrently assumed that it does not
need to enable i/o unless device has i/o bar.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoDon't leak file descriptors
Kevin Wolf [Wed, 2 Dec 2009 11:24:42 +0000 (12:24 +0100)]
Don't leak file descriptors

We're leaking file descriptors to child processes. Set FD_CLOEXEC on file
descriptors that don't need to be passed to children to stop this misbehaviour.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-img: There is more than one host device driver
Kevin Wolf [Mon, 30 Nov 2009 15:54:15 +0000 (16:54 +0100)]
qemu-img: There is more than one host device driver

I haven't heard yet of anyone using qemu-img to copy an image to a real floppy,
but it's a valid use case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Fix some more qemu_malloc fallout
Kevin Wolf [Fri, 27 Nov 2009 16:35:55 +0000 (17:35 +0100)]
qcow2: Fix some more qemu_malloc fallout

Oh joy...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Store exact backing format length
Kevin Wolf [Thu, 26 Nov 2009 13:03:42 +0000 (14:03 +0100)]
qcow2: Store exact backing format length

Currently qcow2 unnecessarily rounds up the length of the backing format string
to the next multiple of 8. At the same time, the array in BlockDriverState can
only hold 15 characters, so in effect backing formats with 9 characters or more
don't work (e.g. host_device).

Save the real string length and things start to work for all valid image format
names.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-blk: Implement rerror option
Kevin Wolf [Fri, 27 Nov 2009 12:25:39 +0000 (13:25 +0100)]
virtio-blk: Implement rerror option

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: Implement rerror option
Kevin Wolf [Fri, 27 Nov 2009 12:25:38 +0000 (13:25 +0100)]
ide: Implement rerror option

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoIntroduce rerror option for drives
Kevin Wolf [Fri, 27 Nov 2009 12:25:37 +0000 (13:25 +0100)]
Introduce rerror option for drives

rerror controls the action to be taken when an error occurs while accessing the
guest image file. It corresponds to werror which already controls the action
take for write errors.

This purely introduces parsing rerror command line option into the right
structures, real support for it in the device emulation is added in the
following patches.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename DriveInfo.onerror to on_write_error
Kevin Wolf [Fri, 27 Nov 2009 12:25:36 +0000 (13:25 +0100)]
Rename DriveInfo.onerror to on_write_error

Either rename variables and functions to refer to write errors (which is what
they actually do) or introduce a parameter to distinguish reads and writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoram migration: Properly reset statistics
Jan Kiszka [Wed, 2 Dec 2009 10:29:38 +0000 (11:29 +0100)]
ram migration: Properly reset statistics

As we may do more than one migration (cancellation, live backup), reset
bytes_transferred on stage 1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-opts: Release id on deletion
Jan Kiszka [Tue, 1 Dec 2009 14:24:18 +0000 (15:24 +0100)]
qemu-opts: Release id on deletion

The opts id is always allocated via qemu_strdup, so it need not be
const, but it has to be released on opts deletion.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolive migration: Serialize vmstate saving in stage 2
Jan Kiszka [Tue, 1 Dec 2009 14:19:55 +0000 (15:19 +0100)]
live migration: Serialize vmstate saving in stage 2

The effect of this patch with current block migration is that its stage
2, ie. the first full walk-through of the block devices will be
performed completely before RAM migration starts. This ensures that
continuously changing RAM pages are not re-synchronized all the time
while block migration is not completed.

Future versions of block migration which will respect the specified
downtime will generate a different pattern: After RAM migration has
started as well, block migration may also continue to inject dirty
blocks into the RAM stream once it detects that the number of pending
blocks would extend the downtime unacceptably.

Note that all this relies on the current registration order: block
before RAM migration.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Skip zero-sized disks
Jan Kiszka [Mon, 30 Nov 2009 19:34:55 +0000 (20:34 +0100)]
block migration: Skip zero-sized disks

No need to migrate emptiness (risking divide by zero later on).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Increase dirty chunk size to 1M
Jan Kiszka [Mon, 30 Nov 2009 17:21:22 +0000 (18:21 +0100)]
block migration: Increase dirty chunk size to 1M

4K is too small for efficiently saving and restoring multi-GB block
devices.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Add support for restore progress reporting
Jan Kiszka [Tue, 1 Dec 2009 14:20:17 +0000 (15:20 +0100)]
block migration: Add support for restore progress reporting

Inject progress report in percentage into the block live stream. This
can be read out and displayed easily on restore.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Report progress also via info migration
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
block migration: Report progress also via info migration

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Fix outgoing progress output
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
block migration: Fix outgoing progress output

Report progress of an outgoing live migration to the monitor instead of
stdout.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolive migration: Propagate output monitor to callback handler
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
live migration: Propagate output monitor to callback handler

In order to allow proper progress reporting to the monitor that
initiated the migration, forward the monitor reference through the
migration layer down to SaveLiveStateHandler.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Report overall migration progress
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
block migration: Report overall migration progress

So far progress reporting only works for the first block device. Fix
this by keeping an overall sum of sectors to be migratated, calculating
the sum of all processed sectors, and finally basing the progress
display on those values.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolive migration: Allow cleanup after cancellation or error
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
live migration: Allow cleanup after cancellation or error

Introduce qemu_savevm_state_cancel and inject a stage -1 to cancel a
live migration. This gives the involved subsystems a chance to clean up
dynamically allocated resources. Namely, the block migration layer can
now free its device descriptors and pending blocks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoram migration: Stop loading on error
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
ram migration: Stop loading on error

Besides catching real errors, this also allows to interrrupt the qemu
process during restore.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Add error handling/propagation
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
block migration: Add error handling/propagation

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Consolidate block transmission
Jan Kiszka [Mon, 30 Nov 2009 17:21:21 +0000 (18:21 +0100)]
block migration: Consolidate block transmission

Based on the original patch by Pierre Riteau: Use a common blk_send
function to transmit a block.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Consolidate mig_read_device_bulk into mig_save_device_bulk
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Consolidate mig_read_device_bulk into mig_save_device_bulk

Both functions share a lot of code, so make them one.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Clean up use of total_sectors
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Clean up use of total_sectors

We already save total_sectors in BlkMigDevState, let's use this value
during the migration and avoid to recalculate it needlessly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Initialize remaining BlkMigState fields
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Initialize remaining BlkMigState fields

In case we restart a migration, submitted, read_done, transferred, and
print_completion need to be reinitialized to 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Switch device and block lists to QSIMPLEQ
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Switch device and block lists to QSIMPLEQ

Based on the original patch by Pierre Riteau.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoImport a simple queue implementation from NetBSD
Pierre Riteau [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
Import a simple queue implementation from NetBSD

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Drop dead code
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Drop dead code

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Avoid indirection of block_mig_state
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Avoid indirection of block_mig_state

No need to push block_mig_state to the heap and, thus, establish an
indirection.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Avoid large stack buffer
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Avoid large stack buffer

Move a potentially large buffer from stack to heap.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Cleanup dirty tracking code
Jan Kiszka [Mon, 30 Nov 2009 17:21:20 +0000 (18:21 +0100)]
block migration: Cleanup dirty tracking code

This switches the dirty bitmap to a true bitmap, reducing its footprint
(specifically in caches). It moreover fixes off-by-one bugs in
set_dirty_bitmap (nb_sectors+1 were marked) and bdrv_get_dirty (limit
check allowed one sector behind end of drive). And is drops redundant
dirty_tracking field from BlockDriverState.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Rework constants API
Jan Kiszka [Mon, 30 Nov 2009 17:21:19 +0000 (18:21 +0100)]
block migration: Rework constants API

Instead of duplicating the definition of constants or introducing
trivial retrieval functions move the SECTOR constants into the public
block API. This also obsoletes sector_per_block in BlkMigState.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock migration: Fix coding style and whitespaces
Jan Kiszka [Mon, 30 Nov 2009 17:21:19 +0000 (18:21 +0100)]
block migration: Fix coding style and whitespaces

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomigration: Catch multiple start commands
Jan Kiszka [Mon, 30 Nov 2009 17:21:19 +0000 (18:21 +0100)]
migration: Catch multiple start commands

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomigration: Fix use of file after release
Jan Kiszka [Mon, 30 Nov 2009 17:21:19 +0000 (18:21 +0100)]
migration: Fix use of file after release

qemu_fclose frees the passed file structure, but do_migrate_set_speed
may access it later on. Fix it by setting file NULL in
migrate_fd_cleanup and checking for this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosavevm: Port to qdev.vmsd all devices that have qdev
Juan Quintela [Wed, 2 Dec 2009 11:36:46 +0000 (12:36 +0100)]
savevm: Port to qdev.vmsd all devices that have qdev

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: enable vmstate_unregister() support
Juan Quintela [Wed, 2 Dec 2009 11:36:45 +0000 (12:36 +0100)]
qdev: enable vmstate_unregister() support

Now vmstate_unregister have the right type

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopci: vmstate_register() already assign consecutive numbers starting at 0
Juan Quintela [Wed, 2 Dec 2009 11:36:44 +0000 (12:36 +0100)]
pci: vmstate_register() already assign consecutive numbers starting at 0

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Add support for multiplying size for a constant
Juan Quintela [Wed, 2 Dec 2009 11:36:43 +0000 (12:36 +0100)]
vmstate: Add support for multiplying size for a constant

When the size that we want to transmit is in another field, but in an
unit different that bytes

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: remove usused VMSTATE_STRUCT_ARRAY_SIZE_UINT8
Juan Quintela [Wed, 2 Dec 2009 11:36:42 +0000 (12:36 +0100)]
vmstate: remove usused VMSTATE_STRUCT_ARRAY_SIZE_UINT8

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Introduce UINT16_TEST support
Juan Quintela [Wed, 2 Dec 2009 11:36:41 +0000 (12:36 +0100)]
vmstate: Introduce UINT16_TEST support

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Introduce VMSTATE_STRUCT_POINTER_TEST
Juan Quintela [Wed, 2 Dec 2009 11:36:40 +0000 (12:36 +0100)]
vmstate: Introduce VMSTATE_STRUCT_POINTER_TEST

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Introduce VMSTATE_STRUCT_TEST
Juan Quintela [Wed, 2 Dec 2009 11:36:39 +0000 (12:36 +0100)]
vmstate: Introduce VMSTATE_STRUCT_TEST

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Add support for VBUFFERS
Juan Quintela [Wed, 2 Dec 2009 11:36:38 +0000 (12:36 +0100)]
vmstate: Add support for VBUFFERS

Support for buffer that are pointed by a pointer (i.e. not embedded)
where the size that we want to use is a field in the state.
We also need a new place to store where to start in the middle of the
buffer, as now it is a pointer, not the offset of the 1st field.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: fix missing ARRAY_OF_POINTERS support on save state
Juan Quintela [Wed, 2 Dec 2009 11:36:37 +0000 (12:36 +0100)]
vmstate: fix missing ARRAY_OF_POINTERS support on save state

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Fix info field of VMSTATE_MACADDR
Jan Kiszka [Wed, 2 Dec 2009 11:36:36 +0000 (12:36 +0100)]
vmstate: Fix info field of VMSTATE_MACADDR

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Avoid seeking
Jan Kiszka [Wed, 2 Dec 2009 11:36:35 +0000 (12:36 +0100)]
vmstate: Avoid seeking

Seeking on vmstate save/load does not work if the underlying file is a
stream. We could try to make all QEMUFile* forward-seek-aware, but first
attempts in this direction indicated that it's saner to convert the few
qemu_fseek-on-vmstates users to plain reads/writes.

This fixes various subtle vmstate corruptions where unused fields were
involved.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Implement IRQ on reselection
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Implement IRQ on reselection

The critical part of this change is how to deal with simultaneaous
generation of interrupts. The only (normal) case when this happens in
the emulation is near simultaneous reselection + selection. If selection
comes first, there is no problem, since the target attempting
reselection loses the arbitration (in the emulation it only means that
the reselect function will not be started). In the worst case the host
adapter is reselected, but the device driver already started a
selection, so we jump to the alternative address to handle the
situation.

The SCRIPTS code can trigger another interrupt to notify the driver that
the new task has to be postponed. I suppose that on real hardware there
is enough time after the reselection interrupt to set the SIP bit before
the next interrupt comes, so it would result in 2 stacked interrupts (a
SCSI and a DMA one). However, in the emulation there is no interrupt
stacking, so there is a good chance that the 2 interrupts will get to
the interrupt handler at the same time.

Nevertheless, it should not make a big difference in interrupt handling,
since in both cases both interrupts have to be fetched first, and after
that the new task (that failed during the selection phase) has to be
prepared/reset for a later restart, and the reconnected device has to be
serviced.

The changes do not modify the host adapter's behavior if this interrupt
is not enabled.

See also LSI53C895A technical manual, SCID and SIEN0.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Use alternative address when already reselected
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Use alternative address when already reselected

See SCRIPTS, 3.2.17 SELECT.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Fix SDID in SELECT ID command
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Fix SDID in SELECT ID command

See SCRIPTS Programming Guide, 3.2.17 SELECT.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Fix message code of DISCONNECT
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Fix message code of DISCONNECT

See SCSI-2, 6.5 Message system description/message codes.

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Add support for LSI53C700 Family Compatibility bit
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Add support for LSI53C700 Family Compatibility bit

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: Whitespace and typo fixes
Laszlo Ast [Thu, 19 Nov 2009 10:07:12 +0000 (11:07 +0100)]
lsi53c895a: Whitespace and typo fixes

Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi: add read/write 16 commands.
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:16 +0000 (15:34 +0100)]
scsi: add read/write 16 commands.

Add READ_16 + friends to scsi-defs.h, scsi_command_name() and the
request parsing helper functions.

Use them in scsi-disk.c too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: VERIFY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:15 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: VERIFY

Move VERIFY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: REPORT_LUNS
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:14 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: REPORT_LUNS

Move REPORT_LUNS emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add REPORT_LUNS to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: SERVICE_ACTION_IN
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:13 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: SERVICE_ACTION_IN

Move SERVICE_ACTION_IN emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add SERVICE_ACTION_IN to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: GET_CONFIGURATION
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:12 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: GET_CONFIGURATION

Move GET_CONFIGURATION emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: READ_TOC
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:11 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: READ_TOC

Move READ_TOC emulation from scsi_send_command() to
scsi_disk_emulate_command().  Add scsi_disk_emulate_read_toc() function
which holds the longisch READ_TOC emulation code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: SYNCHRONIZE_CACHE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:10 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: SYNCHRONIZE_CACHE

Move SYNCHRONIZE_CACHE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: READ_CAPACITY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:09 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: READ_CAPACITY

Move READ_CAPACITY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:08 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL

Move ALLOW_MEDIUM_REMOVAL emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: START_STOP
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:07 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: START_STOP

Move START_STOP emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: MODE_SENSE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:06 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: MODE_SENSE

Move MODE_SENSE emulation from scsi_send_command() to
scsi_disk_emulate_command().  Create two helper functions:
mode_sense_page() which writes the actual mode pages and
scsi_disk_emulate_mode_sense() which holds the longish MODE_SENSE
emulation code, calling into mode_sense_page() as needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: RESERVE+RELEASE
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:05 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: RESERVE+RELEASE

Move RESERVE+RELEASE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoscsi-disk: restruct emulation: INQUIRY
Gerd Hoffmann [Thu, 26 Nov 2009 14:34:04 +0000 (15:34 +0100)]
scsi-disk: restruct emulation: INQUIRY

Move INQUIRY emulation from scsi_send_command() to
scsi_disk_emulate_command().  Also split the longish INQUITY emulation
code into the new scsi_disk_emulate_inquiry() function.  Serial number
handling is slightly changed, we don't copy it any more but look it up
directly in DriveInfo which we have at hand anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>