]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
10 years agoexec: memory radix tree page level compression
Michael S. Tsirkin [Mon, 11 Nov 2013 15:52:07 +0000 (17:52 +0200)]
exec: memory radix tree page level compression

At the moment, memory radix tree is already variable width, but it can
only skip the low bits of address.

This is efficient if we have huge memory regions but inefficient if we
are only using a tiny portion of the address space.

After we have built up the map, detect
configurations where a single L2 entry is valid.

We then speed up the lookup by skipping one or more levels.
In case any levels were skipped, we might end up in a valid section
instead of erroring out. We handle this by checking that
the address is in range of the resulting section.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoexec: pass hw address to phys_page_find
Michael S. Tsirkin [Wed, 13 Nov 2013 18:08:19 +0000 (20:08 +0200)]
exec: pass hw address to phys_page_find

callers always shift by target page bits so let's just do this
internally.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoexec: extend skip field to 6 bit, page entry to 32 bit
Michael S. Tsirkin [Mon, 11 Nov 2013 12:51:56 +0000 (14:51 +0200)]
exec: extend skip field to 6 bit, page entry to 32 bit

Extend skip to 6 bit. As page entry doesn't fit in 16 bit
any longer anyway, extend it to 32 bit.
This doubles node map memory requirements, but follow-up
patches will save this memory.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoexec: replace leaf with skip
Michael S. Tsirkin [Mon, 11 Nov 2013 12:42:43 +0000 (14:42 +0200)]
exec: replace leaf with skip

In preparation for dynamic radix tree depth support, rename is_leaf
field to skip, telling us how many bits to skip to next level.
Set to 0 for leaf.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agosplit definitions for exec.c and translate-all.c radix trees
Paolo Bonzini [Thu, 7 Nov 2013 16:14:36 +0000 (17:14 +0100)]
split definitions for exec.c and translate-all.c radix trees

The exec.c and translate-all.c radix trees are quite different, and
the exec.c one in particular is not limited to the CPU---it can be
used also by devices that do DMA, and in that case the address space
is not limited to TARGET_PHYS_ADDR_SPACE_BITS bits.

We want to make exec.c's radix trees 64-bit wide.  As a first step,
stop sharing the constants between exec.c and translate-all.c.
exec.c gets P_L2_* constants, translate-all.c gets V_L2_*, for
consistency with the existing V_L1_* symbols.  Though actually
in the softmmu case translate-all.c is also indexed by physical
addresses...

This patch has no semantic change.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agospapr_pci: s/INT64_MAX/UINT64_MAX/
Michael S. Tsirkin [Wed, 6 Nov 2013 18:25:21 +0000 (20:25 +0200)]
spapr_pci: s/INT64_MAX/UINT64_MAX/

It doesn't make sense for a region to be INT64_MAX in size:
memory core uses UINT64_MAX as a special value meaning
"all 64 bit" this is what was meant here.

While this should never affect the spapr system which at the moment always
has < 63 bit size, this makes us hit all kind of corner case bugs with
sub-pages, so users are probably better off if we just use UINT64_MAX
instead.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agopc: s/INT64_MAX/UINT64_MAX/
Paolo Bonzini [Wed, 6 Nov 2013 18:18:08 +0000 (20:18 +0200)]
pc: s/INT64_MAX/UINT64_MAX/

It doesn't make sense for a region to be INT64_MAX in size:
memory core uses UINT64_MAX as a special value meaning
"all 64 bit" this is what was meant here.

While this should never affect the PC system which at the moment always
has < 63 bit size, this makes us hit all kind of corner case bugs with
sub-pages, so users are probably better off if we just use UINT64_MAX
instead.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopci: fix address space size for bridge
Michael S. Tsirkin [Wed, 6 Nov 2013 18:23:26 +0000 (20:23 +0200)]
pci: fix address space size for bridge

Address space size for bridge should be full 64 bit,
so we should use UINT64_MAX not INT64_MAX as it's size.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMAINTAINERS: update X86 machine entry
Michael S. Tsirkin [Wed, 6 Nov 2013 15:16:42 +0000 (17:16 +0200)]
MAINTAINERS: update X86 machine entry

Add a bunch of files missing, and add self as maintainer.  Since I'm
hacking on these anyway, it will be helpful if people Cc me on patches.
Anthony gets to review everything anyway ...

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi-test: basic acpi unit-test
Michael S. Tsirkin [Thu, 17 Oct 2013 21:52:18 +0000 (00:52 +0300)]
acpi-test: basic acpi unit-test

We run bios, and boot a minimal boot sector that immediately halts.
Then poke at memory to find ACPI tables.

This only checks that RSDP is there.
More will be added later.

Cc: Andreas Färber <afaerber@suse.de>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqtest: split configuration of qtest accelerator and chardev
Paolo Bonzini [Fri, 18 Oct 2013 11:51:11 +0000 (13:51 +0200)]
qtest: split configuration of qtest accelerator and chardev

qtest uses the icount infrastructure to implement a test-driven vm_clock.  This
however is not necessary when using -qtest as a "probe" together with a normal
TCG-, KVM- or Xen-based virtual machine.  Hence, split out the call to
configure_icount into a new function that is called only for "-machine
accel=qtest"; and disable those commands when running with an accelerator
other than qtest.

This also fixes an assertion failure with "qemu-system-x86_64 -machine
accel=qtest" but no -qtest option.  This is a valid case, albeit somewhat
weird; nothing will happen in the VM but you'll still be able to
interact with the monitor or the GUI.

Now that qtest_init is not limited to an int(void) function, change
global variables that are not used outside qtest_init to arguments.

And finally, cleanup useless parts of include/sysemu/qtest.h.  The file
is not used at all for user-only emulation, and qtest is not available
on Win32 due to its usage of sigwait.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: map PCI address space as catchall region for not mapped addresses
Michael S. Tsirkin [Tue, 29 Oct 2013 12:57:34 +0000 (13:57 +0100)]
pc: map PCI address space as catchall region for not mapped addresses

With a help of negative memory region priority PCI address space
is mapped underneath RAM regions effectively catching every access
to addresses not mapped by any other region.
It simplifies PCI address space mapping into system address space.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
10 years agohw: Pass QEMUMachine to its init() method
Markus Armbruster [Wed, 30 Oct 2013 12:56:39 +0000 (13:56 +0100)]
hw: Pass QEMUMachine to its init() method

Put it in QEMUMachineInitArgs, so I don't have to touch every board.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agotarget-mips: Use macro ARRAY_SIZE where possible
Stefan Weil [Sat, 7 Dec 2013 13:48:07 +0000 (14:48 +0100)]
target-mips: Use macro ARRAY_SIZE where possible

This improves readability and simplifies the code.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotarget-mips: fix 64-bit FPU config for user-mode emulation
Petar Jovanovic [Fri, 29 Nov 2013 16:27:42 +0000 (17:27 +0100)]
target-mips: fix 64-bit FPU config for user-mode emulation

FR bit should be initialized to 1 for MIPS64, under condition that this
bit is writable and that CPU has an FPU unit. It should be initialized to
zero for MIPS32.
This fixes different MIPS32 issues with FPU instructions whose behaviour
defaulted to 64-bit FPU mode.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotarget-sh4: move features flag after CPU_COMMON
Bobby Bingham [Sun, 24 Nov 2013 20:03:05 +0000 (14:03 -0600)]
target-sh4: move features flag after CPU_COMMON

Everything before CPU_COMMON in the structure is cleared as part of a
CPU reset. This included the features flag, which indicates whether SH4A
instructions are supported or not. As a result, a CPU reset downgraded
the CPU from an SH4A to an SH4.

Signed-off-by: Bobby Bingham <koorogi@koorogi.info>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotarget-cris: Use new qemu_ld/st opcodes
Richard Henderson [Sat, 7 Dec 2013 01:52:34 +0000 (14:52 +1300)]
target-cris: Use new qemu_ld/st opcodes

Using the new opcodes we can reduce if/else trees to
a single statement.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agoMerge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20131206.0' into staging
Anthony Liguori [Sat, 7 Dec 2013 15:47:24 +0000 (07:47 -0800)]
Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20131206.0' into staging

vfio-pci updates include:
 - Update linux-headers to include KVM-VFIO device support
 - Enable QEMU support for KVM-VFIO device
 - Additional Nvidia x-vga quirk to ACK MSI interrupts
 - Debug options to disable MSI/X KVM acceleration
 - Fix to cleanup MSI-X vectors on shutdown and avoid IRQ route leaks

The KVM-VFIO device support enables KVM to manage how it handles
coherency instructions in the presence of non-coherent I/O.  Dave
Airlie had noted that the Nvidia MSI ACK support here may just be
scratching the surface, but it's better than what we have now and
it's only enabled via the x-vga option, so I'm willing to add since
it does enable some users.

# gpg: Signature made Fri 06 Dec 2013 12:28:19 PM PST using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

# By Alex Williamson
# Via Alex Williamson
* awilliam/tags/vfio-pci-for-qemu-20131206.0:
  vfio-pci: Release all MSI-X vectors when disabled
  vfio-pci: Add debug config options to disable MSI/X KVM support
  vfio-pci: Fix Nvidia MSI ACK through 0x88000 quirk
  vfio-pci: Make use of new KVM-VFIO device
  linux-headers: Update from v3.13-rc3

Message-id: 20131206204715.16731.12627.stgit@bling.home
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Sat, 7 Dec 2013 15:35:31 +0000 (07:35 -0800)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Paolo Bonzini (17) and others
# Via Stefan Hajnoczi
* stefanha/block: (48 commits)
  qemu-iotests: filter QEMU monitor \r\n
  aio: make aio_poll(ctx, true) block with no fds
  block: clean up bdrv_drain_all() throttling comments
  qcow2: use start_of_cluster() and offset_into_cluster() everywhere
  qemu-img: decrease progress update interval on convert
  qemu-img: round down request length to an aligned sector
  qemu-img: dynamically adjust iobuffer size during convert
  block/iscsi: set bs->bl.opt_transfer_length
  block: add opt_transfer_length to BlockLimits
  block/iscsi: set bdi->cluster_size
  qemu-img: fix usage instruction for qemu-img convert
  qemu-img: add support for skipping zeroes in input during convert
  qemu-nbd: add doc for option -f
  qemu-iotests: add test for snapshot in qemu-img convert
  qemu-img: add -l for snapshot in convert
  qemu-iotests: add 058 internal snapshot export with qemu-nbd case
  qemu-nbd: support internal snapshot export
  snapshot: distinguish id and name in load_tmp
  qemu-iotests: Split qcow2 only cases in 048
  qemu-iotests: Clean up spaces in usage output
  ...

Message-id: 1386347807-27359-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Sat, 7 Dec 2013 15:35:25 +0000 (07:35 -0800)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

# By Alex Williamson (1) and others
# Via Paolo Bonzini
* qemu-kvm/uq/master:
  target-i386: fix cpuid leaf 0x0d
  qemu: mempath: prefault pages manually (v4)
  kvm: Query KVM for available memory slots

Message-id: 1386345276-9803-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kraxel/tags/pull-seabios-31b8b4e-1' into staging
Anthony Liguori [Sat, 7 Dec 2013 15:35:16 +0000 (07:35 -0800)]
Merge remote-tracking branch 'kraxel/tags/pull-seabios-31b8b4e-1' into staging

Update seabios to master snapshot (pre-1.7.4).
Update vgabios, switch from lgplvgabios to seavgabios.
Update build process to build both 128k and 256k bios versions.
Use 256k bios for pc-*-2.0+ machine types.

# gpg: Signature made Fri 06 Dec 2013 12:01:24 AM PST using RSA key ID D3E87138
# gpg: Can't check signature: public key not found

# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/tags/pull-seabios-31b8b4e-1:
  pc: switch 2.0 machine types to large seabios binary
  roms: update vgabios binaries
  roms: update seabios binaries
  roms: enable seabios cross builds
  roms: build two seabios binaries
  roms: update seabios submodule to 31b8b4eea9d9ad58a73b22a6060d3ac1c419c26d
  add firmware to machine options
  add pc-{i440fx,q35}-2.0 machine types

Message-id: 1386322527-23148-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'otubo/seccomp' into staging
Anthony Liguori [Sat, 7 Dec 2013 15:35:01 +0000 (07:35 -0800)]
Merge remote-tracking branch 'otubo/seccomp' into staging

# By Paul Moore
# Via Eduardo Otubo
* otubo/seccomp:
  seccomp: add kill() to the syscall whitelist

Message-id: 1386075077-3240-1-git-send-email-otubo@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kwolf/tags/for-anthony' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:59:58 +0000 (12:59 -0800)]
Merge remote-tracking branch 'kwolf/tags/for-anthony' into staging

Block patches for 2.0 (flushing block-next)

# gpg: Signature made Fri 29 Nov 2013 08:43:18 AM PST using RSA key ID C88F2FD6
# gpg: Can't check signature: public key not found

# By Peter Lieven (17) and others
# Via Kevin Wolf
* kwolf/tags/for-anthony: (41 commits)
  qemu-iotests: Add sample image and test for VMDK version 3
  vmdk: Allow read only open of VMDK version 3
  qemu-iotests: Filter out 'qemu-io> ' prompt
  qemu-iotests: Filter qemu-io output in 025
  block: Use BDRV_O_NO_BACKING where appropriate
  qemu-iotests: Test snapshot mode
  block: Enable BDRV_O_SNAPSHOT with driver-specific options
  qemu-iotests: Make test case 030, 040 and 055 deterministic
  qemu-iotest: Add pause_drive and resume_drive methods
  blkdebug: add "remove_break" command
  qemu-iotests: Drop local version of cancel_and_wait from 040
  sheepdog: support user-defined redundancy option
  sheepdog: refactor do_sd_create()
  qdict: Optimise qdict_do_flatten()
  qdict: Fix memory leak in qdict_do_flatten()
  MAINTAINERS: add sheepdog development mailing list
  COW: Extend checking allocated bits to beyond one sector
  COW: Speed up writes
  qapi: Change BlockDirtyInfo to list
  block: per caller dirty bitmap
  ...

Message-id: 1385743555-27888-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'sstabellini/xen-2013-12-01' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:58:28 +0000 (12:58 -0800)]
Merge remote-tracking branch 'sstabellini/xen-2013-12-01' into staging

# By Paul Durrant (1) and Wei Liu (1)
# Via Stefano Stabellini
* sstabellini/xen-2013-12-01:
  xen-pvdevice: make device-id property compulsory
  xen: fix two errors when debug is enabled

Message-id: alpine.DEB.2.02.1312011829000.3198@kaball.uk.xensource.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'rth/auxv-2' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:57:21 +0000 (12:57 -0800)]
Merge remote-tracking branch 'rth/auxv-2' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/auxv-2:
  linux-user: Use qemu_getauxval for AT_EXECFD
  util: Use qemu_getauxval in linux qemu_cache_utils_init
  tcg-s390: Use qemu_getauxval in query_facilities
  tcg-arm: Use qemu_getauxval
  tcg-ppc64: Use qemu_getauxval
  osdep: Create qemu_getauxval and qemu_init_auxval

Message-id: 1385757754-10702-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:56:51 +0000 (12:56 -0800)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

# By Erik de Castro Lopo (2) and others
# Via Riku Voipio
* riku/linux-user-for-upstream:
  linux-user: pass correct parameter to do_shmctl()
  linux-user: create target_structs header to place ipc_perm and shmid_ds
  flatload: fix non-GOT relocations
  linux-user: Implement handling of 5 POSIX timer syscalls.
  linux-user: Add target struct defs needed for POSIX timer syscalls.

Message-id: cover.1385732338.git.riku.voipio@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:54:35 +0000 (12:54 -0800)]
Merge remote-tracking branch 'kraxel/tags/pull-usb-1' into staging

Improvements for usb3 bulk stream (usb core, xhci).
Bugfixes for uas emulation.
Add remote wakeup support for ehci.
Add suspend support for xhci.
Misc minor tweaks and fixes.

# gpg: Signature made Thu 28 Nov 2013 11:44:49 PM PST using RSA key ID D3E87138
# gpg: Can't check signature: public key not found

# By Hans de Goede (11) and others
# Via Gerd Hoffmann
* kraxel/tags/pull-usb-1:
  usb: move usb_{hi,lo} helpers to header file.
  usb: add vendor request defines
  trace-events: Clean up after removal of old usb-host code
  Revert "usb-tablet: Don't claim wakeup capability for USB-2 version"
  ehci: implement port wakeup
  xhci: Call usb_device_alloc/free_streams
  usb: Add usb_device_alloc/free_streams
  usb: Add max_streams attribute to endpoint info
  uas: s/ui/iu/
  uas: Fix response iu struct definition
  uas: Bounds check tags when using streams
  uas: Streams are numbered 1-y, rather then 0-x
  uas: Fix / cleanup usb_uas_task error handling
  uas: Only use report iu-s for task_mgmt status reporting
  scsi: Add 2 new sense codes needed by uas
  xhci: add support for suspend/resume
  xhci: Add a few missing checks for disconnected devices

Message-id: 1385712381-30918-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Fri, 6 Dec 2013 20:52:50 +0000 (12:52 -0800)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (9) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  eeprom93xx: fix coding style
  hw/ppc/mac.h: remove unused BIOS_FILENAME definition
  Don't crash on keyboard input with no handler
  libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
  libcacard/cac: Remove unused statement (value stored is never read)
  virtio-net: fix the indent
  misc: Replace 'struct QEMUTimer' by 'QEMUTimer'
  qobject: Fix compiler warning (missing gnu_printf format attribute)
  acpi-build: Fix compiler warning (missing gnu_printf format attribute)
  .gitignore: Ignore config.status
  gtk: Replace conditional debug messages by trace methods
  console: Replace conditional debug messages by trace methods
  trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
  trace: Remove trace.h from console.h (less dependencies)

Message-id: 1385408466-13183-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoeeprom93xx: fix coding style
Antony Pavlov [Wed, 4 Dec 2013 06:27:29 +0000 (10:27 +0400)]
eeprom93xx: fix coding style

scripts/checkpatch.pl reports about some style problems,
this commit fixes some of them:

ERROR: space prohibited before open square bracket '['
+    .fields      = (VMStateField []) {

ERROR: space prohibited after that '!' (ctx:BxW)
+    if (! eeprom->eecs && eecs) {
         ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eeprom->eecs && ! eecs) {
                                ^

ERROR: space prohibited after that '!' (ctx:WxW)
+    } else if (eecs && ! eeprom->eesk && eesk) {
                        ^

ERROR: switch and case should be at the same indent
                     switch (address >> (eeprom->addrbits - 2)) {
+                        case 0:
[...]
+                        case 1:
[...]
+                        case 2:
[...]
+                        case 3:

ERROR: return is not a function, parentheses are not required
+    return (eeprom->eedo);

ERROR: switch and case should be at the same indent
     switch (nwords) {
+        case 16:
+        case 64:
[...]
+        case 128:
+        case 256:
[...]
+        default:

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovfio-pci: Release all MSI-X vectors when disabled
Alex Williamson [Fri, 6 Dec 2013 18:16:40 +0000 (11:16 -0700)]
vfio-pci: Release all MSI-X vectors when disabled

We were relying on msix_unset_vector_notifiers() to release all the
vectors when we disable MSI-X, but this only happens when MSI-X is
still enabled on the device.  Perform further cleanup by releasing
any remaining vectors listed as in-use after this call.  This caused
a leak of IRQ routes on hotplug depending on how the guest OS prepared
the device for removal.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org
10 years agovfio-pci: Add debug config options to disable MSI/X KVM support
Alex Williamson [Fri, 6 Dec 2013 18:16:29 +0000 (11:16 -0700)]
vfio-pci: Add debug config options to disable MSI/X KVM support

It's sometimes useful to be able to verify interrupts are passing
through correctly.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio-pci: Fix Nvidia MSI ACK through 0x88000 quirk
Alex Williamson [Fri, 6 Dec 2013 18:16:23 +0000 (11:16 -0700)]
vfio-pci: Fix Nvidia MSI ACK through 0x88000 quirk

When MSI is enabled on Nvidia GeForce cards the driver seems to
acknowledge the interrupt by writing a 0xff byte to the MSI capability
ID register using the PCI config space mirror at offset 0x88000 from
BAR0.  Without this, the device will only fire a single interrupt.
VFIO handles the PCI capability ID/next registers as virtual w/o write
support, so any write through config space is currently dropped.  Add
a check for this and allow the write through the BAR window.  The
registers are read-only anyway.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio-pci: Make use of new KVM-VFIO device
Alex Williamson [Fri, 6 Dec 2013 18:16:13 +0000 (11:16 -0700)]
vfio-pci: Make use of new KVM-VFIO device

Add and remove groups from the KVM virtual VFIO device as we make
use of them.  This allows KVM to optimize for performance and
correctness based on properties of the group.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agolinux-headers: Update from v3.13-rc3
Alex Williamson [Fri, 6 Dec 2013 18:16:09 +0000 (11:16 -0700)]
linux-headers: Update from v3.13-rc3

Update to tag v3.13-rc3 (374b105797c3d4f29c685f3be535c35f5689b30e)

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agoqemu-iotests: filter QEMU monitor \r\n
Stefan Hajnoczi [Thu, 14 Nov 2013 14:24:58 +0000 (15:24 +0100)]
qemu-iotests: filter QEMU monitor \r\n

SMTP does not preserve newlines.  This is normally not a problem if the
email body uses DOS or UNIX newlines consistently.  In 051.out we mix
UNIX newlines with DOS newlines (since QEMU monitor output uses \r\n).

This patch filters the QEMU monitor output so the golden master file
uses UNIX newlines exclusively.

The result is that patches touching 051.out will apply cleanly without
mangling newlines after this commit.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoaio: make aio_poll(ctx, true) block with no fds
Stefan Hajnoczi [Tue, 26 Nov 2013 15:18:01 +0000 (16:18 +0100)]
aio: make aio_poll(ctx, true) block with no fds

This patch drops a special case where aio_poll(ctx, true) returns false
instead of blocking if no file descriptors are waiting on I/O.  Now it
is possible to block in aio_poll() to wait for aio_notify().

This change eliminates busy waiting.  bdrv_drain_all() used to rely on
busy waiting to completed throttled I/O requests but this is no longer
required so we can simplify aio_poll().

Note that aio_poll() still returns false when aio_notify() was used.  In
other words, stopping a blocking aio_poll() wait is not considered
making progress.

Adjust test-aio /aio/bh/callback-delete/one which assumed aio_poll(ctx,
true) would immediately return false instead of blocking.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: clean up bdrv_drain_all() throttling comments
Stefan Hajnoczi [Tue, 26 Nov 2013 15:18:00 +0000 (16:18 +0100)]
block: clean up bdrv_drain_all() throttling comments

Since cc0681c45430a1f1a4c2d06e9499b7775afc9a18 ("block: Enable the new
throttling code in the block layer.") bdrv_drain_all() no longer spins.
The code used to look as follows:

  do {
      busy = qemu_aio_wait();

      /* FIXME: We do not have timer support here, so this is effectively
       * a busy wait.
       */
      QTAILQ_FOREACH(bs, &bdrv_states, list) {
          while (qemu_co_enter_next(&bs->throttled_reqs)) {
              busy = true;
          }
      }
  } while (busy);

Note that throttle requests are kicked but I/O throttling limits are
still in effect.  The loop spins until the vm_clock time allows the
request to make progress and complete.

The new throttling code introduced bdrv_start_throttled_reqs().  This
function not only kicks throttled requests but also temporarily disables
throttling so requests can run.

The outdated FIXME comment can be removed.  Also drop the busy = true
assignment since we overwrite it immediately afterwards.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: use start_of_cluster() and offset_into_cluster() everywhere
Hu Tao [Thu, 5 Dec 2013 06:32:34 +0000 (14:32 +0800)]
qcow2: use start_of_cluster() and offset_into_cluster() everywhere

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: decrease progress update interval on convert
Peter Lieven [Wed, 27 Nov 2013 10:07:09 +0000 (11:07 +0100)]
qemu-img: decrease progress update interval on convert

when doing very large jobs updating the progress only every 2%
is too rare.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: round down request length to an aligned sector
Peter Lieven [Wed, 27 Nov 2013 10:07:07 +0000 (11:07 +0100)]
qemu-img: round down request length to an aligned sector

this patch shortens requests to end at an aligned sector so that
the next request starts aligned.

[Squashed Peter's fix for bdrv_get_info() failure discussed on the
mailing list.
--Stefan]

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agopc: switch 2.0 machine types to large seabios binary
Gerd Hoffmann [Mon, 2 Dec 2013 11:52:04 +0000 (12:52 +0100)]
pc: switch 2.0 machine types to large seabios binary

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoroms: update vgabios binaries
Gerd Hoffmann [Mon, 2 Dec 2013 12:01:20 +0000 (13:01 +0100)]
roms: update vgabios binaries

This also switches from lgplvgabios to seavgabios.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoroms: update seabios binaries
Gerd Hoffmann [Mon, 2 Dec 2013 11:58:45 +0000 (12:58 +0100)]
roms: update seabios binaries

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoroms: enable seabios cross builds
Gerd Hoffmann [Tue, 15 Oct 2013 15:05:55 +0000 (17:05 +0200)]
roms: enable seabios cross builds

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoroms: build two seabios binaries
Gerd Hoffmann [Mon, 30 Sep 2013 09:37:12 +0000 (11:37 +0200)]
roms: build two seabios binaries

Adding xhci support to seabios made it jump over the 128k line.
Changing the bios size breaks migration, so we have to keep a
128k seabios binary for old machine types.  New machine types can
use a large 256k bios which should be big enougth for a while.

This patch updates the seabios build process to build seabios twice,
once full featured and once with xen and xhci turned off so the
resulting binary is small enougth to fit into 128k.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoroms: update seabios submodule to 31b8b4eea9d9ad58a73b22a6060d3ac1c419c26d
Gerd Hoffmann [Tue, 15 Oct 2013 15:02:19 +0000 (17:02 +0200)]
roms: update seabios submodule to 31b8b4eea9d9ad58a73b22a6060d3ac1c419c26d

Updates seabios to git master snapshot.  seabios is in freeze now,
update to final 1.7.4 will follow later this year.

Summary of major changes:

 * Support for acpi table loading from qemu.
 * Support for the xhci host adapter.
 * Support for the pvscsi HBA.
 * Various minor bug fixes.
 * Lots of cleanups.

Full shortlog since 1.7.3 (note that some of these changes have been
cherry-picked into 1.7.3-stable):

Evgeny Budilovsky (1):
      Add pvscsi boot support

Gerd Hoffmann (27):
      coreboot: add cbmem console support
      Add CONFIG_DEBUG_COREBOOT config option
      apm: fix shutdown
      ahci: add missing check for allocation failure
      bochsvga: fallback to stdvga if dispi interface isn't present
      Add generic qemu detection
      Drop coreboot qemu detection
      Add qemu detection to csm
      uas: add (temporary) superspeed stopgap
      usb: add usb_update_pipe()
      usb: add xhci support
      fix buildversion.sh
      build: simplify cross builds
      build: create output dirs in do-kconfig
      build: explicitly set ROM size
      Add qemu_cfg_e820 function.
      Add support for etc/e820 fw_cfg file
      pci: don't reorder entries when moving to 64bit list
      pci: don't map usb host adapters above 4G
      pci: align 64bit pci regions to 1G
      pci: tweak + comment minimum allocations
      pci: log pci windows
      pci: map 64-bit BARs at location provided by emulator
      ahci: zap real mode macros
      ahci: remote some parentheses
      ahci: alloc structs in high memory
      add hw/serialio.c to SRC32SEG

Jonathan A. Kollasch (1):
      vgahooks: add SM720 VGA BIOS hooks for WIN Enterprises MB-60470

Kevin O'Connor (80):
      Fix USB EHCI detection that was broken in hlist conversion of PCIDevices.
      Update README to include info on VARLOW variables.
      PIC code cleanups.
      Move internal timer code from clock.c to a new file timer.c.
      Don't pass khz to pmtimer_setup - it's always PM_TIMER_FREQUENCY.
      Add helper functions to convert timer irqs to milliseconds.
      Improve accuracy of internal timers.
      Rename cpu_khz to TimerKHz.
      Shift CPU TSC down to reduce need for 64bit variables.
      Rename check_timer() function (and similar) to irqtimer_check().
      Rename check_tsc() (and similar) to timer_check() and use u32.
      Separate out timer setup code.
      Unify pmtimer_read() and pittimer_read() code.
      Default unused UMB areas to be read-only.
      Add missing mathcp_setup() call to CSM code.
      Fix bug in CBFS file walking with compressed files.
      Support custom boot menu prompt and custom boot menu key.
      Minor cleanups to smm assembler.
      Add config option to support memory allocations in 9-segment.
      Minor - no need to declare MaxCountCPUs as VARFSEG.
      Minor - simplify rom_reserve().
      Rename tools/ directory to scripts/ directory.
      Update kconfig to latest version.
      build: Don't use vpath makefile directive.
      Move code centered around specific hardware devices to src/hw/
      Move code cenetered around firmware initialization to src/fw/
      build: Reorder makefile source list to group like files together.
      README: Update readme to note scripts/ directory rename and vgasrc/ directory.
      vgabios: Rename stdvga_bpp_factor to stdvga_vram_ratio.
      vgabios: Limit the range of the VBE number of "pages" parameter.
      readme: Minor - fix typo in readme.
      Split x86 specific functions out of util.c/h to new files x86.c/h.
      Move keyboard calling code from util.c to boot.c.
      Rename util.c to string.c and introduce string.h.
      build: Perform compile checking on vgasrc code.
      Move stacks.c definitions from util.h to new file stacks.h.
      Move romfile definitions from util.h to new file romfile.h.
      Move malloc code from pmm.c to new files malloc.c and malloc.h.
      Move function definitions for output.c from util.h to new file output.h.
      Move definition of struct segoff_s from farptr.h to types.h.
      build: Fix import of gcc dependency files.
      Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.
      Move optionroms.h to std/optionrom.h and util.h.
      Move vbe.h to std/vbe.h.
      Move fw/LegacyBios.h to std/LegacyBios.h and remove csm.h.
      Move fw/smbios.h to std/smbios.h.
      Move fw/mptable.h to std/mptable.h.
      Move fw/acpi.h to std/acpi.h.
      Move pnpbios definition to new file std/pnpbios.h.
      Move pmm definitions to new file std/pmm.h.
      Split disk.h into block.h and std/disk.h.
      Move standard bda type info from biosvar.h to std/bda.h.
      Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.
      Sort the sections of util.h.
      Move PIT setup from clock.c to hw/timer.c.
      Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.
      Move dma code to new file hw/dma.c.
      Remove ioport.h; disperse its contents to other header files.
      Minor - update file comments in src/malloc.c.
      Rename fields of 'struct chs_s' and use in floppy lba2chs().
      Rearrange stack_hop_back() call in wait_irq, check_irqs, and _farcall16.
      Minor - move call16 assembler in romlayout.S.
      Make __call16 use C calling convention and support two passed parameters.
      Update _farcall16() to pass segment of callregs explicitly.
      Support call16() calls after entering 32bit mode from call32().
      Run ahci code entirely in 32bit mode.
      Build different final files for QEMU, coreboot, and CSM.
      Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.
      megasas: Don't attempt to access 'struct pci_device' at runtime.
      Minor - eliminate the SET_GLOBAL macro.
      Move low-level hardware writing from output.c to new file hw/serialio.c.
      vgabios: Load the DAC palette in "packed" modes on Cirrus and BochsVGA.
      vgabios: Support custom fonts in vga framebuffer text writing.
      vgabios: Add bochsvga "HDTV" resolutions.
      vgabios: Avoid possible divide by zero in bochsvga_set_displaystart.
      vgabios: Work around lack of support for "calll" in x86emu emulation.
      Minor - update file comment on bootsplash.c.
      vgabios: Support allocating an extra stack for vgabios calls and default on.
      vgabios: Move initialization code to new file vgainit.c.
      floppy: Minor - add warnings if timeouts occur.

Michael S. Tsirkin (6):
      acpi: sync FADT flags from PIIX4 to Q35
      acpi_extract.py: document DEVICE directives
      biostables: support looking up RSDP
      romfile_loader: utility to patch in-memory ROM files
      acpi: load and link tables through romfile loader
      acpi: strip compiler info in built-in DSDT if any

Paul Menzel (2):
      ACPI DSDT: Make control method `IQCR` serialized
      hw/usb-xhci.c: Code refactoring to not override initializers in `speed_from_xhci[16]`

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agotarget-i386: fix cpuid leaf 0x0d
Liu Jinsong [Mon, 2 Dec 2013 20:17:50 +0000 (04:17 +0800)]
target-i386: fix cpuid leaf 0x0d

Fix cpuid leaf 0x0d which incorrectly parsed eax and ebx.

However, before this patch the CPUID worked fine -- the .offset
field contained the size _and_ was stored in the register that
is supposed to hold the size (eax), and likewise the .size field
contained the offset _and_ was stored in the register trhat is
supposed to hold the offset (ebx).

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoqemu-img: dynamically adjust iobuffer size during convert
Peter Lieven [Wed, 27 Nov 2013 10:07:06 +0000 (11:07 +0100)]
qemu-img: dynamically adjust iobuffer size during convert

since the convert process is basically a sync operation it might
be benificial in some case to change the hardcoded I/O buffer
size to a greater value.

This patch increases the I/O buffer size if the output
driver advertises an optimal transfer length or discard alignment
that is greater than the default buffer size of 2M.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: set bs->bl.opt_transfer_length
Peter Lieven [Wed, 27 Nov 2013 10:07:05 +0000 (11:07 +0100)]
block/iscsi: set bs->bl.opt_transfer_length

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add opt_transfer_length to BlockLimits
Peter Lieven [Wed, 27 Nov 2013 10:07:04 +0000 (11:07 +0100)]
block: add opt_transfer_length to BlockLimits

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: set bdi->cluster_size
Peter Lieven [Wed, 27 Nov 2013 10:07:03 +0000 (11:07 +0100)]
block/iscsi: set bdi->cluster_size

this patch aims to set bdi->cluster_size to the internal page size
of the iscsi target so that enabled callers can align requests
properly.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: fix usage instruction for qemu-img convert
Peter Lieven [Wed, 27 Nov 2013 10:07:02 +0000 (11:07 +0100)]
qemu-img: fix usage instruction for qemu-img convert

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: add support for skipping zeroes in input during convert
Peter Lieven [Wed, 27 Nov 2013 10:07:01 +0000 (11:07 +0100)]
qemu-img: add support for skipping zeroes in input during convert

we currently do not check if a sector is allocated during convert.
This means if a sector is unallocated that we allocate a bounce
buffer of zeroes, find out its zero later and do not write it
in the best case. In the worst case this can lead to reading
blocks from a raw device (like iSCSI) altough we could easily
know via get_block_status that they are zero and simply skip them.

This patch also fixes the progress output not being at 100% after
a successful conversion.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-nbd: add doc for option -f
Wenchao Xia [Wed, 4 Dec 2013 09:10:59 +0000 (17:10 +0800)]
qemu-nbd: add doc for option -f

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: add test for snapshot in qemu-img convert
Wenchao Xia [Wed, 4 Dec 2013 09:10:58 +0000 (17:10 +0800)]
qemu-iotests: add test for snapshot in qemu-img convert

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-img: add -l for snapshot in convert
Wenchao Xia [Wed, 4 Dec 2013 09:10:57 +0000 (17:10 +0800)]
qemu-img: add -l for snapshot in convert

Now qemu-img convert have similar options as qemu-nbd for internal
snapshot.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: add 058 internal snapshot export with qemu-nbd case
Wenchao Xia [Wed, 4 Dec 2013 09:10:56 +0000 (17:10 +0800)]
qemu-iotests: add 058 internal snapshot export with qemu-nbd case

This case can't run when IMGPROTO=nbd, since it needs to create some
internal snapshot which would fail for EOF write request, even when
TEST_IMG is exported with "-f raw" in common.rc, so set _supported_proto
to file.

_require_command() is changed to tip what util is missing, instead
of printing a blank.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-nbd: support internal snapshot export
Wenchao Xia [Wed, 4 Dec 2013 09:10:55 +0000 (17:10 +0800)]
qemu-nbd: support internal snapshot export

Now it is possible to directly export an internal snapshot, which
can be used to probe the snapshot's contents without qemu-img
convert.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agosnapshot: distinguish id and name in load_tmp
Wenchao Xia [Wed, 4 Dec 2013 09:10:54 +0000 (17:10 +0800)]
snapshot: distinguish id and name in load_tmp

Since later this function will be used so improve it. The only caller of it
now is qemu-img, and it is not impacted by introduce function
bdrv_snapshot_load_tmp_by_id_or_name() that call bdrv_snapshot_load_tmp()
twice to keep old search logic. bdrv_snapshot_load_tmp_by_id_or_name() return
int to let caller know the errno, and errno will be used later.
Also fix a typo in comments of bdrv_snapshot_delete().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Split qcow2 only cases in 048
Fam Zheng [Wed, 4 Dec 2013 01:07:03 +0000 (09:07 +0800)]
qemu-iotests: Split qcow2 only cases in 048

Format "raw" doesn't always work on certain file systems (e.g. tmpfs).
Use qcow2 to make the allocation status explicit and split into a new
case.

[Resolved merge conflict due to "qemu-io> " prompt filter, added 074 to
group file, and fixed up s/048/074/ copy-paste mistake.
--Stefan]

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Clean up spaces in usage output
Fam Zheng [Wed, 4 Dec 2013 01:07:02 +0000 (09:07 +0800)]
qemu-iotests: Clean up spaces in usage output

Whitespace changes to align columns.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Change default cache mode to "writeback"
Fam Zheng [Wed, 4 Dec 2013 01:07:01 +0000 (09:07 +0800)]
qemu-iotests: Change default cache mode to "writeback"

So that the tests can run faster.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Add _default_cache_mode and _supported_cache_modes
Fam Zheng [Wed, 4 Dec 2013 01:07:00 +0000 (09:07 +0800)]
qemu-iotests: Add _default_cache_mode and _supported_cache_modes

This replaces _unsupported_qemu_io_options and check for support of
current cache mode, and allow to provide a default if user didn't
specify.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Honour cache mode in iotests.py
Fam Zheng [Wed, 4 Dec 2013 01:06:59 +0000 (09:06 +0800)]
qemu-iotests: Honour cache mode in iotests.py

This will allow overriding cache mode from the "-c mode" option.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Add "-c <cache-mode>" option
Fam Zheng [Wed, 4 Dec 2013 01:06:58 +0000 (09:06 +0800)]
qemu-iotests: Add "-c <cache-mode>" option

The option sets cache mode used in the tests. "-nocache" is changed to
an alias to "-c none", and internally passes "-t none" to qemu-io.

Python scripts will make use of option this in the next commit.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Zero-initialise first cluster for new images
Kevin Wolf [Wed, 4 Dec 2013 10:06:36 +0000 (11:06 +0100)]
qcow2: Zero-initialise first cluster for new images

Strictly speaking, this is only required for has_zero_init() == false,
but it's easy enough to just do a cluster-aligned write that is padded
with zeros after the header.

This fixes that after 'qemu-img create' header extensions are attempted
to be parsed that are really just random leftover data.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Close backing file early in bdrv_img_create
Max Reitz [Tue, 3 Dec 2013 13:57:52 +0000 (14:57 +0100)]
block: Close backing file early in bdrv_img_create

Leaving the backing file open although it is not needed anymore can
cause problems if it is opened through a block driver which allows
exclusive access only and if the create function of the block driver
used for the top image (the one being created) tries to close and reopen
the image file (which will include opening the backing file a second
time).

In particular, this will happen with a backing file opened through
qemu-nbd and using qcow2 as the top image file format (which reopens the
image to flush it to disk).

In addition, the BlockDriverState in bdrv_img_create() is used for the
backing file only; it should therefore be made local to the respective
block.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoscsi-disk: correctly implement WRITE SAME
Paolo Bonzini [Fri, 22 Nov 2013 12:40:01 +0000 (13:40 +0100)]
scsi-disk: correctly implement WRITE SAME

Fetch the data to be written from the input buffer.  If it is all zeroes,
we can use the write_zeroes call (possibly with the new MAY_UNMAP flag).
Otherwise, do as many write cycles as needed, writing 512k at a time.

Strictly speaking, this is still incorrect because a zero cluster should
only be written if the MAY_UNMAP flag is set.  But this is a bug in qcow2
and the other formats, not in the SCSI code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoscsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands
Paolo Bonzini [Fri, 22 Nov 2013 12:40:00 +0000 (13:40 +0100)]
scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands

Since we report ANC_SUP==0 in VPD page B2h, we need to return
an error (ILLEGAL REQUEST/INVALID FIELD IN CDB) for all WRITE SAME
requests with ANCHOR==1.

Inspired by a similar patch to the LIO in-kernel target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoscsi-disk: catch write protection errors in UNMAP
Paolo Bonzini [Fri, 22 Nov 2013 12:39:59 +0000 (13:39 +0100)]
scsi-disk: catch write protection errors in UNMAP

This is the same that is already done for WRITE SAME.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: 033 is fast
Paolo Bonzini [Fri, 22 Nov 2013 12:39:58 +0000 (13:39 +0100)]
qemu-iotests: 033 is fast

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoraw-posix: add support for write_zeroes on XFS and block devices
Paolo Bonzini [Fri, 22 Nov 2013 12:39:57 +0000 (13:39 +0100)]
raw-posix: add support for write_zeroes on XFS and block devices

The code is similar to the implementation of discard and write_zeroes
with UNMAP.  However, failure must be propagated up to block.c.

The stale page cache problem can be reproduced as follows:

    # modprobe scsi-debug lbpws=1 lbprz=1
    # ./qemu-io /dev/sdXX
    qemu-io> write -P 0xcc 0 2M
    qemu-io> write -z 0 1M
    qemu-io> read -P 0x00 0 512
    Pattern verification failed at offset 0, 512 bytes
    qemu-io> read -v 0 512
    00000000:  cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc  ................
    ...

    # ./qemu-io --cache=none /dev/sdXX
    qemu-io> write -P 0xcc 0 2M
    qemu-io> write -z 0 1M
    qemu-io> read -P 0x00 0 512
    qemu-io> read -v 0 512
    00000000:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    ...

And similarly with discard instead of "write -z".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoraw-posix: implement write_zeroes with MAY_UNMAP for block devices
Paolo Bonzini [Fri, 22 Nov 2013 12:39:56 +0000 (13:39 +0100)]
raw-posix: implement write_zeroes with MAY_UNMAP for block devices

See the next commit for the description of the Linux kernel problem
that is worked around in raw_open_common.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoraw-posix: implement write_zeroes with MAY_UNMAP for files
Paolo Bonzini [Fri, 22 Nov 2013 12:39:55 +0000 (13:39 +0100)]
raw-posix: implement write_zeroes with MAY_UNMAP for files

Writing zeroes to a file can be done by punching a hole if
MAY_UNMAP is set.

Note that in this case ENOTSUP is not ignored, but makes
the block layer fall back to the generic implementation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: check WRITE SAME support differently depending on MAY_UNMAP
Paolo Bonzini [Fri, 22 Nov 2013 12:39:54 +0000 (13:39 +0100)]
block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP

The current check is right for MAY_UNMAP=1.  For MAY_UNMAP=0, just
try and fall back to regular writes as soon as a WRITE SAME command
fails.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: updated copyright
Peter Lieven [Fri, 22 Nov 2013 12:39:53 +0000 (13:39 +0100)]
block/iscsi: updated copyright

added myself to reflect recent work on the iscsi block driver.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/iscsi: remove .bdrv_has_zero_init
Peter Lieven [Fri, 22 Nov 2013 12:39:52 +0000 (13:39 +0100)]
block/iscsi: remove .bdrv_has_zero_init

since commit 3ac21627 the default value changed to 0.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock drivers: expose requirement for write same alignment from formats
Paolo Bonzini [Fri, 22 Nov 2013 12:39:51 +0000 (13:39 +0100)]
block drivers: expose requirement for write same alignment from formats

This will let misaligned but large requests use zero clusters.  This
is important because the cluster size is not guest visible.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock drivers: add discard/write_zeroes properties to bdrv_get_info implementation
Paolo Bonzini [Fri, 22 Nov 2013 12:39:50 +0000 (13:39 +0100)]
block drivers: add discard/write_zeroes properties to bdrv_get_info implementation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovpc, vhdx: add get_info
Paolo Bonzini [Fri, 22 Nov 2013 12:39:49 +0000 (13:39 +0100)]
vpc, vhdx: add get_info

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: make bdrv_co_do_write_zeroes stricter in producing aligned requests
Paolo Bonzini [Fri, 22 Nov 2013 12:39:48 +0000 (13:39 +0100)]
block: make bdrv_co_do_write_zeroes stricter in producing aligned requests

Right now, bdrv_co_do_write_zeroes will only try to align the
beginning of the request.  However, it is simpler for many
formats to expect the block layer to separate both the head *and*
the tail.  This makes sure that the format's bdrv_co_write_zeroes
function will be called with aligned sector_num and nb_sectors for
the bulk of the request.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: handle ENOTSUP from discard in generic code
Paolo Bonzini [Fri, 22 Nov 2013 12:39:47 +0000 (13:39 +0100)]
block: handle ENOTSUP from discard in generic code

Similar to write_zeroes, let the generic code receive a ENOTSUP for
discard operations.  Since bdrv_discard has advisory semantics,
we can just swallow the error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add bdrv_aio_write_zeroes
Paolo Bonzini [Fri, 22 Nov 2013 12:39:46 +0000 (13:39 +0100)]
block: add bdrv_aio_write_zeroes

This will be used by the SCSI layer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add flags argument to bdrv_co_write_zeroes tracepoint
Paolo Bonzini [Fri, 22 Nov 2013 12:39:45 +0000 (13:39 +0100)]
block: add flags argument to bdrv_co_write_zeroes tracepoint

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add flags to BlockRequest
Paolo Bonzini [Fri, 22 Nov 2013 12:39:44 +0000 (13:39 +0100)]
block: add flags to BlockRequest

This lets bdrv_co_do_rw receive flags, so that it can be used for
zero writes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: generalize BlockLimits handling to cover bdrv_aio_discard too
Paolo Bonzini [Fri, 22 Nov 2013 12:39:43 +0000 (13:39 +0100)]
block: generalize BlockLimits handling to cover bdrv_aio_discard too

bdrv_co_discard is only covering drivers which have a .bdrv_co_discard()
implementation, but not those with .bdrv_aio_discard(). Not very nice,
and easy to avoid.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoseccomp: add kill() to the syscall whitelist
Paul Moore [Thu, 21 Nov 2013 15:40:15 +0000 (10:40 -0500)]
seccomp: add kill() to the syscall whitelist

The kill() syscall is triggered with the following command:

 # qemu -sandbox on -monitor stdio \
        -device intel-hda -device hda-duplex -vnc :0

The resulting syslog/audit message:

 # ausearch -m SECCOMP
 ----
 time->Wed Nov 20 09:52:08 2013
 type=SECCOMP msg=audit(1384912328.482:6656): auid=0 uid=0 gid=0 ses=854
  subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12087
  comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f7a1d2abc67 code=0x0
 # scmp_sys_resolver 62
 kill

Reported-by: CongLi <coli@redhat.com>
Tested-by: CongLi <coli@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Acked-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
10 years agovmdk: Fix creating big description file
Fam Zheng [Tue, 3 Dec 2013 02:41:05 +0000 (10:41 +0800)]
vmdk: Fix creating big description file

The buffer for description file was 4096 which only covers a few
hundred of extents. This changes the buffer to dynamic allocated with
g_strdup_printf in order to support bigger cases.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agohw/ppc/mac.h: remove unused BIOS_FILENAME definition
Michael Tokarev [Mon, 2 Dec 2013 17:17:19 +0000 (21:17 +0400)]
hw/ppc/mac.h: remove unused BIOS_FILENAME definition

This definition has been moved to prep.c.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoDon't crash on keyboard input with no handler
Don Koch [Tue, 19 Nov 2013 20:01:59 +0000 (15:01 -0500)]
Don't crash on keyboard input with no handler

Prevent a call to put_kbd if null.

On shutdown of some OSes, the keyboard handler goes away before the
system is down. If a key is typed during this window, qemu crashes.

Signed-off-by: Don Koch <dkoch@verizon.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/vcard_emul_nss: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:12:18 +0000 (22:12 +0100)]
libcacard/vcard_emul_nss: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/vcard_emul_nss.c:937:9: warning:
 Value stored to 'cert_count' is never read
        cert_count = options->vreader[i].cert_count;
        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard/cac: Remove unused statement (value stored is never read)
Stefan Weil [Sun, 17 Nov 2013 21:11:23 +0000 (22:11 +0100)]
libcacard/cac: Remove unused statement (value stored is never read)

Warning from ccc-analyzer:

libcacard/cac.c:192:13: warning: Value stored to 'ret' is never read
            ret = VCARD_DONE;
            ^     ~~~~~~~~~~

Here 'ret' is assigned a value inside of a switch statement and also after
that switch statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovirtio-net: fix the indent
Zhi Yong Wu [Wed, 27 Nov 2013 07:35:26 +0000 (15:35 +0800)]
virtio-net: fix the indent

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Replace 'struct QEMUTimer' by 'QEMUTimer'
Stefan Weil [Sun, 1 Dec 2013 07:49:47 +0000 (08:49 +0100)]
misc: Replace 'struct QEMUTimer' by 'QEMUTimer'

Most code already used QEMUTimer without the redundant 'struct' keyword.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqobject: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:42 +0000 (19:00 +0100)]
qobject: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    qobject/qerror.o
qobject/qerror.c: In function ‘qerror_from_info’:
qobject/qerror.c:53:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     qerr->err_msg = g_strdup_vprintf(fmt, *va);
     ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoacpi-build: Fix compiler warning (missing gnu_printf format attribute)
Stefan Weil [Sun, 17 Nov 2013 18:00:22 +0000 (19:00 +0100)]
acpi-build: Fix compiler warning (missing gnu_printf format attribute)

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    m68k-softmmu/hw/m68k/mcf5206.o
hw/i386/acpi-build.c: In function ‘build_append_nameseg’:
hw/i386/acpi-build.c:294:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     g_string_vprintf(s, format, args);
     ^

When this warning is fixed, there is a new compiler warning:

  CC    i386-softmmu/hw/i386/acpi-build.o
hw/i386/acpi-build.c: In function ‘build_append_notify’:
hw/i386/acpi-build.c:632:5: error:
 format not a string literal and no format arguments [-Werror=format-security]
     build_append_nameseg(method, name);
     ^

This is fixed here, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years ago.gitignore: Ignore config.status
Fam Zheng [Fri, 22 Nov 2013 06:39:56 +0000 (14:39 +0800)]
.gitignore: Ignore config.status

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogtk: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:24:02 +0000 (16:24 +0100)]
gtk: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconsole: Replace conditional debug messages by trace methods
Stefan Weil [Sun, 10 Nov 2013 15:04:16 +0000 (16:04 +0100)]
console: Replace conditional debug messages by trace methods

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotrace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)
Stefan Weil [Sun, 10 Nov 2013 13:20:17 +0000 (14:20 +0100)]
trace: Remove trace.h from hw/usb/hcd-ehci.h (less dependencies)

This reduces the dependencies on trace.h.
Only one source file which needs hcd-ehci.h also needs trace.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>