This rearranges code in preparation for interrupt state
implementation.
Changes:
- split up bus walk away from interrupt handling
into a subroutine
- change irq_state from an array to bitmask
- verify that irq_state values are 0 or 1 on load
Andre Przywara [Mon, 7 Dec 2009 10:58:02 +0000 (11:58 +0100)]
cpuid: Fix multicore setup on Intel
The multicore CPUID code detects whether the guest is an Intel or an
AMD CPU, because the Linux kernel is picky about the CmpLegacy bit.
KVM by default passes through the host's vendor, which was not
catched by the code. So fork out the vendor determining bits into a
separate function to be used from both places and always get the real
vendor.
This fixes KVM's multicore setup on Intel CPUs.
Jan Kiszka [Sun, 6 Dec 2009 14:51:24 +0000 (15:51 +0100)]
kvm: x86: Fix initial kvm_has_msr_star
KVM_GET_MSR_INDEX_LIST returns -E2BIG when the provided space is too
small for all MSRs. But this is precisely the error we trigger with the
initial request in order to obtain that size. Do not fail in that case.
This caused a subtle corruption of the guest state as MSR_STAR was not
properly saved/restored. The corruption became visible with latest kvm
optimizing the MSR updates.
Alexander Graf [Sat, 5 Dec 2009 11:44:31 +0000 (12:44 +0100)]
Add S390 maintainer information
This patch adds information about who handles what when it comes to S390.
I'll gladly support anything that's related to the device emulation model and
S390 KVM parts.
Since this patchset doesn't implement S390 CPU emulation, I left that part
with a question mark. As soon as Uli's patchset gets committed I'd recommend
setting him there.
Alexander Graf [Sat, 5 Dec 2009 11:44:30 +0000 (12:44 +0100)]
Set default console to virtio on S390x
All "normal" system emulation targets in qemu I'm aware of display output
on either VGA or serial output.
Our S390x virtio machine doesn't have such kind of legacy hardware. So
instead we need to default to a virtio console.
I'm not particularly proud of this patch. It would be a lot better to
have something in the machine description that tells us about the default
terminal.
Alexander Graf [Sat, 5 Dec 2009 11:44:28 +0000 (12:44 +0100)]
Add S390x virtio machine description
In order to use the new S390x virtio bus we just introduced, we also
need a machine description that sets up the machine according to our
PV specification.
Alexander Graf [Sat, 5 Dec 2009 11:44:24 +0000 (12:44 +0100)]
Add KVM support for S390x
S390x was one of the first platforms that received support for KVM back in the
day. Unfortunately until now there hasn't been a qemu implementation that would
enable users to actually run guests.
Alexander Graf [Sat, 5 Dec 2009 11:44:23 +0000 (12:44 +0100)]
S/390 fake TCG implementation
Qemu won't let us run a KVM target without having host TCG support. Well, for
now we don't have any so let's implement a fake target that only stubs out
everything.
I tried to keep the patch as close to Uli's source as possible, so whenever
he feels like it he can easily diff his version against this one.
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.
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.
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.
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
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.
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.
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)!
* 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.