]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agousb-uhci: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:58 +0000 (17:06 +1100)]
usb-uhci: Use PCI DMA stub functions

This updates the usb-uhci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-ehci: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:57 +0000 (17:06 +1100)]
usb-ehci: Use PCI DMA stub functions

This updates the usb-ehci device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoPCI IDE: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:56 +0000 (17:06 +1100)]
PCI IDE: Use PCI DMA stub functions

This updates the PCI IDE device emulation to use the explicit PCI DMA
wrapper to initialize its scatter/gathjer structure.  This means this
driver should not need further changes when the sglist interface is
extended to support IOMMUs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agointel-hda: Use PCI DMA stub functions
David Gibson [Mon, 31 Oct 2011 06:06:55 +0000 (17:06 +1100)]
intel-hda: Use PCI DMA stub functions

This updates the intel-hda device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopcnet-pci: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:54 +0000 (17:06 +1100)]
pcnet-pci: Use PCI DMA stub functions

This updates the pcnet-pci device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agolsi53c895a: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:53 +0000 (17:06 +1100)]
lsi53c895a: Use PCI DMA stub functions

This updates the lsi53c895a device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoe1000: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:52 +0000 (17:06 +1100)]
e1000: Use PCI DMA stub functions

This updates the e1000 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoes1370: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:51 +0000 (17:06 +1100)]
es1370: Use PCI DMA stub functions

This updates the es1370 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoac97: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:50 +0000 (17:06 +1100)]
ac97: Use PCI DMA stub functions

This updates the ac97 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoeepro100: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:49 +0000 (17:06 +1100)]
eepro100: Use PCI DMA stub functions

This updates the eepro100 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agortl8139: Use PCI DMA stub functions
Eduard - Gabriel Munteanu [Mon, 31 Oct 2011 06:06:48 +0000 (17:06 +1100)]
rtl8139: Use PCI DMA stub functions

This updates the rtl8139 device emulation to use the explicit PCI DMA
functions, instead of directly calling physical memory access functions.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd stub functions for PCI device models to do PCI DMA
David Gibson [Mon, 31 Oct 2011 06:06:47 +0000 (17:06 +1100)]
Add stub functions for PCI device models to do PCI DMA

This patch adds functions to pci.[ch] to perform PCI DMA operations.
At present, these are just stubs which perform directly cpu physical
memory accesses.  Stubs are included which are analogous to
cpu_physical_memory_{read,write}(), the stX_phys() and ldX_phys()
functions and cpu_physical_memory_{map,unmap}().

In addition, a wrapper around qemu_sglist_init() is provided, which
also takes a PCIDevice *.  It's assumed that _init() is the only
sglist function which will need wrapping, the idea being that once we
have IOMMU support whatever IOMMU context handle the wrapper derives
from the PCI device will be stored within the sglist structure for
later use.

Using these stubs, however, distinguishes PCI device DMA transactions from
other accesses to physical memory, which will allow PCI IOMMU support to
be added in one place, rather than updating every PCI driver at that time.

That is, it allows us to update individual PCI drivers to support an IOMMU
without having yet determined the details of how the IOMMU emulation will
operate.  This will let us remove the most bitrot-sensitive part of an
IOMMU patch in advance.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoUse dma_addr_t type for scatter/gather code
David Gibson [Mon, 31 Oct 2011 06:06:46 +0000 (17:06 +1100)]
Use dma_addr_t type for scatter/gather code

This patch uses the newly created dma_addr_t type throughout the
scatter/gather handling code in dma-helpers.c whenever we need to
represent a dma bus address.  This makes a better distinction as to
what is a bus address and what is a cpu physical address.  Since we
don't support IOMMUs yet, they can't be very different for now, but
that will change in future, and this preliminary helps clarify what's
going on.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoDefine DMA address and direction types
David Gibson [Mon, 31 Oct 2011 06:06:45 +0000 (17:06 +1100)]
Define DMA address and direction types

As a preliminary to adding more extensive DMA and IOMMU infrastructure
support into qemu, this patch defines a dma_addr_t for storing DMA bus
addresses and a DMADirection enum which describes whether a DMA is
from an external device to main memory or from main memory to an
external device.

For now dma_addr_t is just defined to be target_phys_addr_t, but in
future, we can change this to support machines where we have bus
addresses which don't necessarily have the same format as CPU physical
addresses.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agops2: migrate ledstate
Christophe Fergeau [Mon, 17 Oct 2011 11:37:34 +0000 (13:37 +0200)]
ps2: migrate ledstate

Make the ps2 device track its ledstate so that we can migrate it.
Otherwise it gets lost across migration, and spice-server gets
confused about the actual keyboard state and sends bogus
caps/scroll/num key events. This fixes RH bug #729294

We only need to migrate the state when it is different of the default
one (0).

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoui/vnc: Fix use of free() instead of g_free()
Stefan Weil [Fri, 7 Oct 2011 19:15:20 +0000 (21:15 +0200)]
ui/vnc: Fix use of free() instead of g_free()

Please note that mechlist still uses malloc / strdup / free.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agocheckpatch: remove rule on non-indented labels
Paolo Bonzini [Fri, 7 Oct 2011 13:59:01 +0000 (15:59 +0200)]
checkpatch: remove rule on non-indented labels

There are 508 non-indented (non-default) labels, and 511 that are
indented.  So the rule is debatable at least.  Actually, in the
common case of labels at the outermost scope, there is really just
one place where to put the label, so the rule is just wrong IMHO.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosavevm: qemu_fille_buffer() used to return one error for reads of size 0.
Juan Quintela [Tue, 25 Oct 2011 17:18:58 +0000 (19:18 +0200)]
savevm: qemu_fille_buffer() used to return one error for reads of size 0.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agokvm_init didn't set return value after create vm failed
Xu He Jie [Thu, 27 Oct 2011 02:15:13 +0000 (10:15 +0800)]
kvm_init didn't set return value after create vm failed

And kvm_ioctl(s, KVM_CREATE_VM, 0)'s return value can be < -1,
so change the check of vmfd at label 'err'.

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agospapr: fix build
Anthony Liguori [Tue, 1 Nov 2011 21:49:17 +0000 (16:49 -0500)]
spapr: fix build

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "PPC: Fail configure when libfdt is not available"
Blue Swirl [Tue, 1 Nov 2011 20:59:32 +0000 (20:59 +0000)]
Revert "PPC: Fail configure when libfdt is not available"

This reverts commit f90a9d02401eeeec18a122b61ccccb91244f321c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'ppc-next' of git://repo.or.cz/qemu/agraf
Blue Swirl [Tue, 1 Nov 2011 20:57:01 +0000 (20:57 +0000)]
Merge branch 'ppc-next' of git://repo.or.cz/qemu/agraf

* 'ppc-next' of git://repo.or.cz/qemu/agraf: (24 commits)
  pseries: Add partial support for PCI
  ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate
  pseries: Allow writes to KVM accelerated TCE table
  KVM: PPC: Override host vmx/vsx/dfp only when information known
  ppc: Fix up usermode only builds
  pseries: Correct vmx/dfp handling in both KVM and TCG cases
  PPC: Fail configure when libfdt is not available
  ppc: Avoid decrementer related kvm exits
  PPC: Disable non-440 CPUs for ppcemb target
  PPC: Bump qemu-system-ppc to 64-bit physical address space
  pseries: Under kvm use guest cpu = host cpu by default
  ppc: Add cpu defs for POWER7 revisions 2.1 and 2.3
  ppc: First cut implementation of -cpu host
  ppc: Remove broken partial PVR matching
  pseries: Update SLOF firmware image
  pseries: Add device tree properties for VMX/VSX and DFP under kvm
  ppc: Generalize the kvmppc_get_clockfreq() function
  Set an invalid-bits mask for each SPE instructions
  pseries: Update SLOF firmware image
  pseries: Use Book3S-HV TCE acceleration capabilities
  ...

12 years agoMerge remote-tracking branch 'kraxel/usb.29' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:09:31 +0000 (13:09 -0500)]
Merge remote-tracking branch 'kraxel/usb.29' into staging

12 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:08:33 +0000 (13:08 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

12 years agoMerge remote-tracking branch 'spice/spice.v46' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:06:46 +0000 (13:06 -0500)]
Merge remote-tracking branch 'spice/spice.v46' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 1 Nov 2011 18:06:17 +0000 (13:06 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoopencores_eth: fix RX path: FCS, padding and TL
Max Filippov [Thu, 27 Oct 2011 22:10:27 +0000 (02:10 +0400)]
opencores_eth: fix RX path: FCS, padding and TL

OpenCores 10/100 Mbps Ethernet MAC specification doesn't clearly state
whether FCS is counted in the RX frame length or not. Looks like it is.
Append zero FCS to the received frames.

Get rid of big static buffer for RX frame padding, optimize it for the
most common MINFL value range.

Set RXD_TL for the long frames only when HUGEN bit is set.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: flush migration data to disk.
Gerd Hoffmann [Thu, 27 Oct 2011 07:12:04 +0000 (09:12 +0200)]
migration: flush migration data to disk.

This patch increases robustness when migrating to a file with
two little changes:

 (1) Before closing the migration file handle checks if it happens to be
     a regular file and if so it issues a fsync.  This way the data is
     flushed to disk before qemu sends the migration completed event.
 (2) It adds error checking.  In case either fsync or close syscall
     fails pass up the error (and fail migration).

[ v2: return -errno instead of -1 ]

Cc: Juan Quintela <quintela@redhat.com>
Cc: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd test-coroutine to checks
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:19 +0000 (17:42 +0200)]
add test-coroutine to checks

There is a "test-coroutine" which isn't in the list.
Add it so "make check" runs it too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoadd "make check" target
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:18 +0000 (17:42 +0200)]
add "make check" target

Add some Makefile glue so we have a simple "make check"
to run the unit tests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomove checks to separate variable
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:17 +0000 (17:42 +0200)]
move checks to separate variable

Create a new CHECKS variable.  Put the checks there instead
of adding them to the TOOLS variable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoProbe for libcheck by default.
Gerd Hoffmann [Thu, 1 Sep 2011 15:42:16 +0000 (17:42 +0200)]
Probe for libcheck by default.

Probe for libcheck and build checks (if found) by default.
Can be explicitly disabled using --disable-check-utests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoia64-dis.c: Undefine ABS to avoid clash with glib
Peter Maydell [Sat, 29 Oct 2011 11:58:26 +0000 (12:58 +0100)]
ia64-dis.c: Undefine ABS to avoid clash with glib

Undefine ABS to avoid a clash with the macro that glib.h
helpfully defines for us (and a resulting build failure
on ia64 hosts).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix segfault on migration completion
Luiz Capitulino [Fri, 28 Oct 2011 16:59:52 +0000 (14:59 -0200)]
Fix segfault on migration completion

A simple migration reproduces it:

1. Start the source VM with:

   # qemu [...] -S

2. Start the destination VM with:

   # qemu <source VM cmd-line> -incoming tcp:0:4444

3. In the source VM:

   (qemu) migrate -d tcp:0:4444

4. The source VM will segfault as soon as migration completes (might not
   happen in the first try)

What is happening here is that qemu_file_put_notify() can end up closing
's->file' (in which case it's also set to NULL). The call stack is rather
complex, but Eduardo helped tracking it to:

select loop -> migrate_fd_put_notify() -> qemu_file_put_notify() ->
buffered_put_buffer() -> migrate_fd_put_ready() ->
migrate_fd_completed() -> migrate_fd_cleanup().

To be honest, it's not completely clear to me in which cases 's->file'
is not closed (on error maybe)? But I doubt this fix will make anything
worse.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd qapi related generated files to .gitignore
David Gibson [Fri, 28 Oct 2011 04:26:18 +0000 (15:26 +1100)]
Add qapi related generated files to .gitignore

.gitignore already lists the qapi-generated subdirectory which includes a
number of files generated during build.  However, there are some additional
files generated by the qapi build which go in the top level directory.

This patch adds them to .gitignore, removing the irritating noise from
diffs and the like.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-barrier: Fix build failure on PowerPC Mac OS X
Eric Sunshine [Tue, 1 Nov 2011 09:39:49 +0000 (05:39 -0400)]
qemu-barrier: Fix build failure on PowerPC Mac OS X

qemu-barrier.h tests if macro __powerpc__ is defined, however, the
preprocessor on PowerPC Mac OS X defines only __POWERPC__, not
__powerpc__.  Resolve by testing instead for qemu-provided _ARCH_PPC.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agofw_cfg: Use g_file_get_contents instead of multiple fread() calls
Pavel Borzenkov [Mon, 24 Oct 2011 11:31:30 +0000 (07:31 -0400)]
fw_cfg: Use g_file_get_contents instead of multiple fread() calls

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoSimplify cpu_exec_all to tcg_exec_all
Jan Kiszka [Mon, 26 Sep 2011 07:40:39 +0000 (09:40 +0200)]
Simplify cpu_exec_all to tcg_exec_all

After the removal of the non-threaded mode cpu_exec_all is now only used
by TCG. Refactor it accordingly, also dropping its unused return value.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMake cpu_single_env thread-local
Paolo Bonzini [Fri, 28 Oct 2011 09:52:42 +0000 (10:52 +0100)]
Make cpu_single_env thread-local

Make cpu_single_env thread-local. This fixes a regression
in handling of multi-threaded programs in linux-user mode
(bug 823902).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Peter Maydell: rename tls_cpu_single_env to cpu_single_env]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agodarwin-user/main.c: Drop unused cpu_single_env definition
Paolo Bonzini [Fri, 28 Oct 2011 09:52:41 +0000 (10:52 +0100)]
darwin-user/main.c: Drop unused cpu_single_env definition

Drop the cpu_single_env definition as it is unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-tls.h: Add abstraction layer for TLS variables
Peter Maydell [Fri, 28 Oct 2011 09:52:40 +0000 (10:52 +0100)]
qemu-tls.h: Add abstraction layer for TLS variables

Add an abstraction layer for defining and using thread-local
variables. For the moment this is implemented only for Linux,
which means they can only be used in restricted circumstances.
The abstraction layer allows us to add POSIX and Win32 support
later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoError check find_ram_offset
Alex Williamson [Mon, 31 Oct 2011 14:54:09 +0000 (08:54 -0600)]
Error check find_ram_offset

Spotted via code review, we initialize offset to 0 to avoid a
compiler warning, but in the unlikely case that offset is
never set to something else, we should abort instead of return
a value that will almost certainly cause problems.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-host: fix host close
Gerd Hoffmann [Fri, 28 Oct 2011 14:13:50 +0000 (16:13 +0200)]
usb-host: fix host close

The whole usb_host_close() function is skipped in case the device is not
in attached state.  This is wrong though, only then usb_device_detach()
must be skipped, all other cleanup (especially device reset and closing
the file handle) still needs to be done.  There are code paths where
usb_host_close() is called with the device in detached state already.

This fixes usb-host devices not being released and returned to the host
after removing them with device_del.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: change VID/PID for usb-hub and usb-msd to prevent conflict
Roy Tam [Thu, 15 Sep 2011 03:25:47 +0000 (11:25 +0800)]
usb: change VID/PID for usb-hub and usb-msd to prevent conflict

Some USB drivers, for example USBASPI.SYS, will skip different type of
device which has same VID/PID. The following patch helps preventing
usb-msd being skipped by the driver.

Signed-off-by: Roy Tam <roytam@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoSupport running QEMU on Valgrind
Stefan Weil [Mon, 31 Oct 2011 20:29:46 +0000 (21:29 +0100)]
Support running QEMU on Valgrind

Valgrind is a tool which can automatically detect many kinds of bugs.

Running QEMU on Valgrind with x86_64 hosts was not possible because
Valgrind aborts when memalign is called with an alignment larger than
1 MiB. QEMU normally uses 2 MiB on Linux x86_64.

Now the alignment is reduced to the page size when QEMU is running on
Valgrind.

v2:
Instead of using the macro RUNNING_ON_VALGRIND from valgrind.h,
the patch now uses a hack from libvirt which tests for the pre-loaded
vgpreload_*.so shared libraries. This avoids the need for valgrind.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMAINTAINERS: Add PReP maintainer
Andreas Färber [Mon, 31 Oct 2011 23:03:07 +0000 (00:03 +0100)]
MAINTAINERS: Add PReP maintainer

Officially take on maintainership for PReP and upgrade to Odd Fixes.

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotrace: Add wildcard trace event support
Mark Wu [Mon, 31 Oct 2011 03:29:04 +0000 (11:29 +0800)]
trace: Add wildcard trace event support

A basic wildcard matching is supported in both the monitor command
"trace-event" and the events list file. That means you can enable/disable
the events having a common prefix in a batch. For example, virtio-blk trace
events could be enabled using:
    trace-event virtio_blk_* on

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agousb-hub: wakeup on attach
Gerd Hoffmann [Fri, 14 Oct 2011 09:36:43 +0000 (11:36 +0200)]
usb-hub: wakeup on attach

When attaching a new device we must send a wakeup request to the root
hub, otherwise the guest will not notice the new device in case the
usb hub is suspended.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: create slots on post_load in vga state
Alon Levy [Tue, 25 Oct 2011 13:39:50 +0000 (15:39 +0200)]
qxl: create slots on post_load in vga state

RHBZ 740547

If we migrate when the device is in vga state the guest
still believes the slots are created, and will cause operations
that reference the slots, causing a "panic: virtual address out of range"
on the first of them. Easy to see by migrating in vga mode with
a driver loaded, for instance windows cmd window in full screen mode,
and then exiting vga mode back to native mode will cause said panic.

Fixed by doing the slot recreation in post_load for vga mode as well.
Note that compat does not require any changes because it creates it's
only slot by a side effect of QXL_IO_SET_MODE.

Signed-off-by: Alon Levy <alevy@redhat.com>
12 years agoqxl: make sure we continue to run with a shared buffer
Gerd Hoffmann [Fri, 21 Oct 2011 19:53:54 +0000 (21:53 +0200)]
qxl: make sure we continue to run with a shared buffer

The qxl renderer works only with a shared displaysurface.  So better
make sure we actually have one and restore it when needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: stride fixup
Gerd Hoffmann [Fri, 21 Oct 2011 13:59:07 +0000 (15:59 +0200)]
qxl: stride fixup

spice uses negative stride value to signal the bitmap is upside down.
The qxl renderer (used for scl, vnc and screenshots) wants a positive
value because it is easier to work with.  The positive value is then
stored in the very same variable, which has the drawback that the
upside-down test works only once.  Fix by using two variables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoacl: Fix use after free in qemu_acl_reset()
Markus Armbruster [Fri, 28 Oct 2011 15:07:02 +0000 (17:07 +0200)]
acl: Fix use after free in qemu_acl_reset()

Reproducer:

    $ MALLOC_PERTURB_=234 qemu-system-x86_64 -vnc :0,acl,sasl [...]
    QEMU 0.15.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username fred allow
    acl: added rule at position 1
    (qemu) acl_reset vnc.username
    Segmentation fault (core dumped)

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqapi: fix typos in documentation JSON examples
Stefan Hajnoczi [Fri, 28 Oct 2011 14:58:26 +0000 (15:58 +0100)]
qapi: fix typos in documentation JSON examples

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agosysbus: Supply missing va_end()
Markus Armbruster [Fri, 28 Oct 2011 08:52:25 +0000 (10:52 +0200)]
sysbus: Supply missing va_end()

C99 7.15.1: Each invocation of the va_start and va_copy macros shall
be matched by a corresponding invocation of the va_end macro in the
same function.

Spotted by Coverity.  Harmless on the (common) systems where va_end()
does nothing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agonet: tap-linux: Fix unhelpful error message
Luiz Capitulino [Fri, 14 Oct 2011 18:05:10 +0000 (15:05 -0300)]
net: tap-linux: Fix unhelpful error message

I'm getting:

    could not configure /dev/net/tun (tap%d): Operation not permitted

When the ioctl() fails, ifr.ifr_name will most likely not be overwritten.
So we better only use it when ifname contains a string.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Mon, 31 Oct 2011 20:05:40 +0000 (15:05 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:09:00 +0000 (11:09 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

Conflicts:
block/vmdk.c

12 years agoMerge remote-tracking branch 'aneesh/for-upstream-7' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:06:02 +0000 (11:06 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-7' into staging

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:02:29 +0000 (11:02 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

Conflicts:
ui/spice-core.c

12 years agoMerge remote-tracking branch 'qemu-kvm-tmp/uq/master' into staging
Anthony Liguori [Mon, 31 Oct 2011 16:00:27 +0000 (11:00 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/uq/master' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:23:15 +0000 (10:23 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoMerge remote-tracking branch 'alon/pull-libcacard-assert' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:14:06 +0000 (10:14 -0500)]
Merge remote-tracking branch 'alon/pull-libcacard-assert' into staging

12 years agoMerge remote-tracking branch 'spice/spice.v45' into staging
Anthony Liguori [Mon, 31 Oct 2011 15:12:14 +0000 (10:12 -0500)]
Merge remote-tracking branch 'spice/spice.v45' into staging

12 years agohw/9pfs: Replace rwlocks with RCU variants of interfaces.
Harsh Prateek Bora [Thu, 13 Oct 2011 20:35:02 +0000 (02:05 +0530)]
hw/9pfs: Replace rwlocks with RCU variants of interfaces.

Use QLIST_INSERT_HEAD_RCU and rcu_read_lock/unlock instead of rwlocks.
Use v9fs_synth_mutex as a write-only mutex to handle concurrent writers.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoqemu-queue: Introduce QLIST_INSERT_HEAD_RCU and dummy RCU wrappers.
Harsh Prateek Bora [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
qemu-queue: Introduce QLIST_INSERT_HEAD_RCU and dummy RCU wrappers.

SynthFS needs a QLIST_INSERT_HEAD_RCU to make sure list instructions are not
re-ordered and therefore avoiding a crash. There may be parallel readers which
should be allowed for lock-free access and this variant allows us to get rid
of rwlocks used by readers.

SynthFS is a special case where we dont really need full RCU capabilities as
it doesnt allow list entry deletion but concurrent readers/writers and
instruction re-ordering should not result in a crash.

Also, once the real rcu is available, dummy rcu macro definitions will go away
and the code will still work as expected.

This patchwork is based on inputs from Paolo Bonzini.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Add synthetic file system support using 9p
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
hw/9pfs: Add synthetic file system support using 9p

This patch create a synthetic file system with mount tag
v_synth when -virtfs_synth command line option is specified
in qemu. The synthetic file system can be mounted in guest
using 9p using the below command line

mount -t 9p -oversion=9p2000.L,trans=virtio v_synth  <mountpint>

Synthetic file system enabled different qemu subsystem to register
callbacks for read and write events from guest. The subsystem
can create directories and files in the synthetic file system as show
in ex below

    qemu_v9fs_synth_mkdir(NULL, 0777, "test2", &node);
    qemu_v9fs_synth_add_file(node, 0777, "testfile",
                             my_test_read, NULL, NULL);

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Abstract open state of fid to V9fsFidOpenState
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:40 +0000 (12:10 +0530)]
hw/9pfs: Abstract open state of fid to V9fsFidOpenState

To implement synthetic file system in Qemu we may not really
require file descriptor and Dir *. Make generic code use
V9fsFidOpenState instead.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Read-only support for 9p export
M. Mohan Kumar [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
hw/9pfs: Read-only support for 9p export

A new fsdev parameter "readonly" is introduced to control accessing 9p export.
"readonly" can be used to specify the access type. By default "rw" access
is given to 9p export.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoqemu: Add opt_set_bool functionality
M. Mohan Kumar [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
qemu: Add opt_set_bool functionality

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agoconfigure: Update configure so that open_by_handle_at check returns correct value
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
configure: Update configure so that open_by_handle_at check returns correct value

According to David Gibson for some compiler/libc combinations, open_by_handle_at
test in configure isn't quite right: because the file_handle pointer is never
dereferenced, gcc doesn't complain even if it is undefined. Change the test
as suggested by him.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/9pfs: Fix error handling in local_mknod
Aneesh Kumar K.V [Tue, 25 Oct 2011 06:40:39 +0000 (12:10 +0530)]
hw/9pfs: Fix error handling in local_mknod

Update local_chown to remove unnecessary if loop

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
12 years agohw/vexpress.c, hw/realview.c: Add PL041 to VExpress, Realview boards
Peter Maydell [Fri, 28 Oct 2011 09:55:38 +0000 (10:55 +0100)]
hw/vexpress.c, hw/realview.c: Add PL041 to VExpress, Realview boards

Instantiate the PL041 audio on the Versatile Express and
Realview board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoAdd AACI audio playback support to the ARM Versatile/PB platform
Mathieu Sonet [Fri, 28 Oct 2011 09:55:37 +0000 (10:55 +0100)]
Add AACI audio playback support to the ARM Versatile/PB platform

This driver emulates the ARM AACI interface (PL041) connected to a LM4549 codec.
It enables audio playback for the Versatile/PB platform.

Limitations:
- Supports only a playback on one channel (Versatile/Vexpress)
- Supports only one TX FIFO in compact-mode or non-compact mode.
- Supports playback of 12, 16, 18 and 20 bits samples.
- Record is not supported.
- The PL041 is hardwired to a LM4549 codec.

Versatile/PB test build:
linux-2.6.38.5
buildroot-2010.11
alsa-lib-1.0.22
alsa-utils-1.0.22
mpg123-0.66

Qemu host: Ubuntu 10.04 in Vmware/OS X

Playback tested successfully with speaker-test/aplay/mpg123.

Signed-off-by: Mathieu Sonet <contact@elasticsheep.com>
[Peter Maydell: fixed typo in code clearing SL1RXBUSY/SL2RXBUSY
 bits, as spotted by Andrzej Zaborowski]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agopseries: Add partial support for PCI
David Gibson [Sun, 30 Oct 2011 17:16:46 +0000 (17:16 +0000)]
pseries: Add partial support for PCI

This patch adds a PCI bus to the pseries machine.  This instantiates
the qemu generic PCI bus code, advertises a PCI host bridge in the
guest's device tree and implements the RTAS methods specified by PAPR
to access PCI config space.  It also sets up the memory regions we
need to provide windows into the PCI memory and IO space, and
advertises those to the guest.

However, because qemu can't yet emulate an IOMMU, which is mandatory on
pseries, PCI devices which use DMA (i.e. most of them) will not work with
this code alone.  Still, this is enough to support the virtio_pci device
(which probably _should_ use emulated PCI DMA, but is specced to use
direct hypervisor access to guest physical memory instead).

[agraf] remove typedef which could cause compile errors

Signed-off-by: Alexey Kardashevskiy <aik@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate
David Gibson [Sun, 30 Oct 2011 15:51:24 +0000 (15:51 +0000)]
ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate

The CPU state contains two bitmaps, initialized from the CPU spec
which describes which instructions are implemented on the CPU.  A
couple of bits are defined which cover instructions (VSX and DFP)
which are not currently implemented in TCG.  So far, these are only
used to handle the case of -cpu host because a KVM guest can use
the instructions when the host CPU supports them.

However, it's a mild layering violation to simply not include those
bits in the CPU descriptions for those CPUs that do support them,
just because we can't handle them in TCG.  This patch corrects the
situation, so that the instruction bits _are_ shown correctly in the
cpu spec table, but are masked out from the cpu state in the non-KVM
case.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Allow writes to KVM accelerated TCE table
David Gibson [Thu, 27 Oct 2011 15:56:31 +0000 (15:56 +0000)]
pseries: Allow writes to KVM accelerated TCE table

Sufficiently recent kernels include a KVM call to accelerate use of
PAPR TCE tables (IOMMU), which are used by PAPR virtual IO devices.
This involves qemu mapping the TCE table in from a kernel obtained fd,
which currently we do with PROT_READ only.  This is a hangover from
early (never released) versions of this kernel interface which only
permitted read-only mappings and required us to destroy and recreate
the table when we needed to clear it from qemu.

Now, the kernel permits read-write mappings, and we rely on this to
clear the table in spapr_vio_quiesce_one().  However, due to
insufficient testing, I forgot to update the actual mapping of the
table in kvmppc_create_spapr_tce() to add PROT_WRITE to the mmap().

This patch corrects the oversight.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoKVM: PPC: Override host vmx/vsx/dfp only when information known
Alexander Graf [Mon, 24 Oct 2011 18:43:22 +0000 (20:43 +0200)]
KVM: PPC: Override host vmx/vsx/dfp only when information known

The -cpu host feature tries to find out the host capabilities based
on device tree information. However, we don't always have that available
because it's an optional property in dt.

So instead of force unsetting values depending on an unreliable source
of information, let's just try to be clever about it and not override
capabilities when we don't know the device tree pieces.

This fixes altivec with -cpu host on YDL PowerStations.

Reported-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Fix up usermode only builds
David Gibson [Sun, 23 Oct 2011 17:25:04 +0000 (17:25 +0000)]
ppc: Fix up usermode only builds

The recent usage of MemoryRegion in kvm_ppc.h breaks builds with
CONFIG_USER_ONLY=y.  This patch fixes it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Correct vmx/dfp handling in both KVM and TCG cases
David Gibson [Mon, 17 Oct 2011 18:15:41 +0000 (18:15 +0000)]
pseries: Correct vmx/dfp handling in both KVM and TCG cases

Currently, when KVM is enabled, the pseries machine checks if the host
CPU supports VMX, VSX and/or DFP instructions and advertises
accordingly in the guest device tree.  It does this regardless of what
CPU is selected on the command line.  On the other hand, when in TCG
mode, it never advertises any of these facilities, even basic VMX
(Altivec) which is supported in TCG.

Now that we have a -cpu host option for ppc, it is fairly
straightforward to fix both problems.  This patch changes the -cpu
host code to override the basic cpu spec derived from the PVR with
information queried from the host avout VMX, VSX and DFP capability.
The pseries code then uses the instruction availability advertised in
the cpu state to set the guest device tree correctly for both the KVM
and TCG cases.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Fail configure when libfdt is not available
Alexander Graf [Tue, 18 Oct 2011 00:10:36 +0000 (02:10 +0200)]
PPC: Fail configure when libfdt is not available

We have several targets in the PPC tree now that basically require libfdt
to function properly, namely the pseries and the e500 targets. This dependency
will rather increase than decrease in the future, so I want to make sure
that people building shiny new 1.0 actually have libfdt installed to get
rid of a few ifdefs in the code.

Warning: This patch will likely make configure fail for people who don't
select their own --target-list, but don't have libfdt development packages
installed. However, we really need this new dependency to move on.

Signed-off-by: Alexander Graf <agraf@suse.de>
---

v1 -> v2:

  - no paranthesis
  - no fdt check for config_pseries
  - add . in error message

12 years agoppc: Avoid decrementer related kvm exits
David Gibson [Sun, 16 Oct 2011 19:26:17 +0000 (19:26 +0000)]
ppc: Avoid decrementer related kvm exits

In __cpu_ppc_store_decr(), we set up a regular timer used to trigger
decrementer interrupts.  This is necessary to implement the decrementer
properly under TCG, but is unnecessary under KVM (true for both Book3S-PR
and Book3S-HV KVM variants), because the kernel handles generating and
delivering decrementer exceptions.

Under kvm, in fact, the timer causes expensive and unnecessary exits from
kvm to qemu.  This patch, therefore, disables setting the timer when kvm
is in use.

Signed-off-by: Anton Blanchard <anton@au1.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Disable non-440 CPUs for ppcemb target
Alexander Graf [Tue, 18 Oct 2011 00:00:51 +0000 (02:00 +0200)]
PPC: Disable non-440 CPUs for ppcemb target

The sole reason we have the ppcemb target is to support MMUs that have
less than the usual 4k possible page size. There are very few of these
chips and I don't want to add additional QA and testing burden to everyone
to ensure that code still works when TARGET_PAGE_SIZE is not 4k.

So this patch disables all CPUs except for MMU_BOOKE capable ones from
the ppcemb target.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: Bump qemu-system-ppc to 64-bit physical address space
Alexander Graf [Mon, 17 Oct 2011 23:46:08 +0000 (01:46 +0200)]
PPC: Bump qemu-system-ppc to 64-bit physical address space

Some 32-bit PPC CPUs can use up to 36 bit of physical address space.
Treat them accordingly in the qemu-system-ppc binary type.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Under kvm use guest cpu = host cpu by default
David Gibson [Wed, 12 Oct 2011 22:40:34 +0000 (22:40 +0000)]
pseries: Under kvm use guest cpu = host cpu by default

Now that we've implemented -cpu host for ppc, this patch updates the
pseries machine to use the host cpu as the guest cpu by default when
running under KVM.  This is important because under KVM Book3S-HV the guest
cpu _cannot_ be of a different type to the host cpu (at the moment
KVM Book3S-HV will silently virtualize the host cpu instead of whatever was
requested, but in future it is likely to simply refuse to run the VM if
a cpu model other than the host's is requested).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Add cpu defs for POWER7 revisions 2.1 and 2.3
David Gibson [Wed, 12 Oct 2011 22:40:33 +0000 (22:40 +0000)]
ppc: Add cpu defs for POWER7 revisions 2.1 and 2.3

This patch adds cpu specs to the table for POWER7 revisions 2.1 and 2.3.
This allows -cpu host to be used on these host cpus.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: First cut implementation of -cpu host
David Gibson [Wed, 12 Oct 2011 22:40:32 +0000 (22:40 +0000)]
ppc: First cut implementation of -cpu host

For convenience with kvm, x86 allows the user to specify -cpu host on the
qemu command line, which means make the guest cpu the same as the host
cpu.  This patch implements the same option for ppc targets.

For now, this just read the host PVR (Processor Version Register) and
selects one of our existing CPU specs based on it.  This means that the
option will not work if the host cpu is not supported by TCG, even if that
wouldn't matter for use under kvm.

In future, we can extend this in future to override parts of the cpu spec
based on information obtained from the host (via /proc/cpuinfo, the host
device tree, or explicit KVM calls).  That will let us handle cases where
the real kvm-virtualized CPU doesn't behave exactly like the TCG-emulated
CPU.  With appropriate annotation of the CPU specs we'll also then be able
to use host cpus under kvm even when there isn't a matching full TCG model.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Remove broken partial PVR matching
David Gibson [Wed, 12 Oct 2011 22:40:31 +0000 (22:40 +0000)]
ppc: Remove broken partial PVR matching

The ppc target contains a ppc_find_by_pvr() function, which looks up a
CPU spec based on a PVR (that is, based on the value in the target cpu's
Processor Version Register).  PVR values contain information on both the
cpu model (upper 16 bits, usually) and on the precise revision (low 16
bits, usually).

ppc_find_by_pvr, as well as making exact PVR matches, attempts to find
"close" PVR matches, when we don't have a CPU spec for the exact revision
specified.  This sounds like a good idea, execpt that the current logic
is completely nonsensical.

It seems to assume CPU families are subdivided bit by bit in the PVR in a
way they just aren't.  Specifically, it requires a match on all bits of the
specified pvr up to the last non-zero bit.  This has the bizarre effect
that when the low bits are simply a sequential revision number (a common
though not universal pattern), then odd specified revisions must be matched
exactly, whereas even specified revisions will also match the next odd
revision, likewise for powers of 4, 8 and so forth.

To correctly do inexact matching we'd need to re-organize the table of CPU
specs to include a mask showing what PVR range the spec is compatible with
(similar to the cputable code in the Linux kernel).

For now, just remove the bogosity by only permitting exact PVR matches.
That at least makes the matching simple and consistent.  If we need inexact
matching we can add the necessary per-subfamily masks later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Update SLOF firmware image
David Gibson [Wed, 12 Oct 2011 19:10:30 +0000 (19:10 +0000)]
pseries: Update SLOF firmware image

This patch is a general update to the SLOF firmware image used on the
pseries machine.  This doesn't contain updates for specific features but
contains a number of bugfixes and enhancements in the main SLOF tree from
Thomas Huth.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Add device tree properties for VMX/VSX and DFP under kvm
David Gibson [Mon, 10 Oct 2011 18:31:01 +0000 (18:31 +0000)]
pseries: Add device tree properties for VMX/VSX and DFP under kvm

Sufficiently recent PAPR specifications define properties "ibm,vmx"
and "ibm,dfp" on the CPU node which advertise whether the VMX vector
extensions (or the later VSX version) and/or the Decimal Floating
Point operations from IBM's recent POWER CPUs are available.

Currently we do not put these in the guest device tree and the guest
kernel will consequently assume they are not available.  This is good,
because they are not supported under TCG.  VMX is similar enough to
Altivec that it might be trivial to support, but VSX and DFP would
both require significant work to support in TCG.

However, when running under kvm on a host which supports these
instructions, there's no reason not to let the guest use them.  This
patch, therefore, checks for the relevant support on the host CPU
and, if present, advertises them to the guest as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc: Generalize the kvmppc_get_clockfreq() function
David Gibson [Mon, 10 Oct 2011 18:31:00 +0000 (18:31 +0000)]
ppc: Generalize the kvmppc_get_clockfreq() function

Currently the kvmppc_get_clockfreq() function reads the host's clock
frequency from /proc/device-tree, which is useful to past to the guest
in KVM setups.  However, there are some other host properties
advertised in the device tree which can also be relevant to the
guests.

This patch, therefore, replaces kvmppc_get_clockfreq() which can
retrieve any named, single integer property from the host device
tree's CPU node.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoSet an invalid-bits mask for each SPE instructions
Fabien Chouteau [Wed, 28 Sep 2011 05:54:05 +0000 (05:54 +0000)]
Set an invalid-bits mask for each SPE instructions

SPE instructions are defined by pairs. Currently, the invalid-bits mask is set
for the first instruction, but the second one can have a different mask.

example:
GEN_SPE(efdcmpeq,    efdcfs,      0x17, 0x0B, 0x00600000, 0x00180000, PPC_SPE_DOUBLE),

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Update SLOF firmware image
David Gibson [Thu, 29 Sep 2011 21:39:13 +0000 (21:39 +0000)]
pseries: Update SLOF firmware image

This patch updates the SLOF submodule and precompiled image.  The new
SLOF versions contains two changes of note:

 * The previous SLOF has a bug in SCSI condition handling that was
   exposed by recent updates to qemu's SCSI emulation.  This update
   fixes the bug.

 * The previous SLOF has a bug in its addressing of SCSI devices,
   which can be exposed under certain conditions.  The new SLOF also
   fixes this.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Use Book3S-HV TCE acceleration capabilities
David Gibson [Thu, 29 Sep 2011 21:39:12 +0000 (21:39 +0000)]
pseries: Use Book3S-HV TCE acceleration capabilities

The pseries machine of qemu implements the TCE mechanism used as a
virtual IOMMU for the PAPR defined virtual IO devices.  Because the
PAPR spec only defines a small DMA address space, the guest VIO
drivers need to update TCE mappings very frequently - the virtual
network device is particularly bad.  This means many slow exits to
qemu to emulate the H_PUT_TCE hypercall.

Sufficiently recent kernels allow this to be mitigated by implementing
H_PUT_TCE in the host kernel.  To make use of this, however, qemu
needs to initialize the necessary TCE tables, and map them into itself
so that the VIO device implementations can retrieve the mappings when
they access guest memory (which is treated as a virtual DMA
operation).

This patch adds the necessary calls to use the KVM TCE acceleration.
If the kernel does not support acceleration, or there is some other
error creating the accelerated TCE table, then it will still fall back
to full userspace TCE implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Allow KVM Book3S-HV on PPC970 CPUS
David Gibson [Thu, 29 Sep 2011 21:39:11 +0000 (21:39 +0000)]
pseries: Allow KVM Book3S-HV on PPC970 CPUS

At present, using the hypervisor aware Book3S-HV KVM will only work
with qemu on POWER7 CPUs.  PPC970 CPUs also have hypervisor
capability, but they lack the VRMA feature which makes assigning guest
memory easier.

In order to allow KVM Book3S-HV on PPC970, we need to specially
allocate the first chunk of guest memory (the "Real Mode Area" or
RMA), so that it is physically contiguous.

Sufficiently recent host kernels allow such contiguous RMAs to be
allocated, with a kvm capability advertising whether the feature is
available and/or necessary on this hardware.  This patch enables qemu
to use this support, thus allowing kvm acceleration of pseries qemu
machines on PPC970 hardware.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
---

agraf: fix to use memory api

12 years agopseries: Support SMT systems for KVM Book3S-HV
David Gibson [Thu, 29 Sep 2011 21:39:10 +0000 (21:39 +0000)]
pseries: Support SMT systems for KVM Book3S-HV

Alex Graf has already made qemu support KVM for the pseries machine
when using the Book3S-PR KVM variant (which runs the guest in
usermode, emulating supervisor operations).  This code allows gets us
very close to also working with KVM Book3S-HV (using the hypervisor
capabilities of recent POWER CPUs).

This patch moves us another step towards Book3S-HV support by
correctly handling SMT (multithreaded) POWER CPUs.  There are two
parts to this:

 * Querying KVM to check SMT capability, and if present, adjusting the
   cpu numbers that qemu assigns to cause KVM to assign guest threads
   to cores in the right way (this isn't automatic, because the POWER
   HV support has a limitation that different threads on a single core
   cannot be in different guests at the same time).

 * Correctly informing the guest OS of the SMT thread to core mappings
   via the device tree.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc/e500_pci: Fix an array overflow issue
Liu Yu-B13201 [Thu, 29 Sep 2011 17:52:50 +0000 (17:52 +0000)]
ppc/e500_pci: Fix an array overflow issue

When access PPCE500_PCI_IW1 the previous index get overflow.
The patch fix the issue and update all to keep consistent style.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoppc/e500_pci: Fix code style
Liu Yu-B13201 [Thu, 29 Sep 2011 17:52:49 +0000 (17:52 +0000)]
ppc/e500_pci: Fix code style

Put trailing statements on next line.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoMAINTAINERS: update wiki URL and machine names for target-xtensa
Max Filippov [Thu, 27 Oct 2011 22:11:05 +0000 (02:11 +0400)]
MAINTAINERS: update wiki URL and machine names for target-xtensa

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg: Optimize some forms of deposit.
Richard Henderson [Thu, 27 Oct 2011 21:15:00 +0000 (14:15 -0700)]
tcg: Optimize some forms of deposit.

If the deposit replaces the entire word, optimize to a move.

If we're inserting to the top of the word, avoid the mask of arg2
as we'll be shifting out all of the garbage and shifting in zeros.

If the host is 32-bit, reduce a 64-bit deposit to a 32-bit deposit
when possible.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohw/9pfs: Make VirtFS tracing work correctly
Aneesh Kumar K.V [Mon, 24 Oct 2011 09:39:49 +0000 (15:09 +0530)]
hw/9pfs: Make VirtFS tracing work correctly

this patch fix multiple issues with VirtFS tracing.
a) Add tracepoint to the correct code path. We handle error in complete_pdu
b) Fix indentation in python script
c) Fix variable naming issue in python script

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>