sdk/emulator/qemu.git
10 years agoAdapt Makefiles to the new LTTng ust interface
Mohamad Gebai [Thu, 30 Jan 2014 03:47:56 +0000 (22:47 -0500)]
Adapt Makefiles to the new LTTng ust interface

Add generation of new files for LTTng ust.

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoModified the tracetool framework for LTTng 2.x
Mohamad Gebai [Thu, 30 Jan 2014 03:47:55 +0000 (22:47 -0500)]
Modified the tracetool framework for LTTng 2.x

* A new format is required to generate definitions for ust tracepoints.
  Files ust_events_h.py and ust_events_c.py define common macros, while
  new function ust_events_h in events.py does the actual definition of
  each tracepoint.
* ust.py generates the new interface for calling userspace tracepoints
  with LTTng 2.x, replacing trace_name(args) to tracepoint(name, args).
* As explained in ust_events_c.py, -Wredundant-decls gives a warning
  when compiling with gcc 4.7 or older. This is specific to lttng-ust so
  for now use a pragma clause to avoid getting a warning.

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Reviewed-by: Alex Bennée <alex@bennee.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoFix configure script for LTTng 2.x
Mohamad Gebai [Thu, 30 Jan 2014 03:47:54 +0000 (22:47 -0500)]
Fix configure script for LTTng 2.x

Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoFix QEMU build on OpenBSD on x86 archs
Brad [Wed, 11 Dec 2013 00:49:08 +0000 (19:49 -0500)]
Fix QEMU build on OpenBSD on x86 archs

This resolves the build issue with building the ROMs on OpenBSD on x86 archs.
As of OpenBSD 5.3 the compiler builds PIE binaries by default and thus the
whole OS/packages and so forth. The ROMs need to have PIE disabled.
Check in configure whether the compiler supports the flags for disabling
PIE, and if it does then use them for building the ROMs. This fixes the
following buildbot failure:

>From the OpenBSD buildbots..
  Building optionrom/multiboot.img
ld: multiboot.o: relocation R_X86_64_16 can not be used when making a shared object; recompile with -fPIC

Signed-off by: Brad Smith <brad@comstyle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agolibvixl: fix 64bit constants usage
Michael Tokarev [Sat, 15 Feb 2014 20:26:25 +0000 (20:26 +0000)]
libvixl: fix 64bit constants usage

Since commit 999b53ec8794f203964db3ecf939a3da5c4bc843:
 Author: Claudio Fontana <claudio.fontana@linaro.org>
 Date:   Wed Feb 5 17:27:28 2014 +0000

    disas: Implement disassembly output for A64

    Use libvixl to implement disassembly output in debug
    logs for A64, for use with both AArch64 hosts and targets.

disas/libvixl/ contains functions which uses 64bit constants
without using appropriate suffixes, which fails on 32bits.

Fix this by using ULL suffix.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-02-15' into staging
Peter Maydell [Sat, 15 Feb 2014 16:36:40 +0000 (16:36 +0000)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-02-15' into staging

trivial patches for 2014-02-15

# gpg: Signature made Sat 15 Feb 2014 12:10:46 GMT using RSA key ID 74F0C838
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: E190 8639 3B10 B51B AC2C  8B73 5253 C5AD 74F0 C838

* remotes/mjt/tags/trivial-patches-2014-02-15:
  char/serial: Fix emptyness check
  gitignore: anchor all ignored names
  vl: trim includes
  vl: remove old, long-unused defines
  net: declare struct iovec in checksum.h to fix compiler warning
  linux-user: refactor do_socketcall()
  configure: add hints to a remedy for feature_not_found errors
  configure: add hint of libfdt to DTC dependency not found message
  sparc/leon3: Initialize stack pointer
  misc: Fix case Qemu -> QEMU

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Sat, 15 Feb 2014 16:15:52 +0000 (16:15 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Fri 14 Feb 2014 17:26:30 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  block: Open by reference will try device then node_name.
  block: Relax bdrv_lookup_bs constraints.
  blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.
  block: mirror - use local_err to avoid NULL errp
  qemu-iotests: Don't run 005 on vmdk split formats
  block: qemu-iotests - add vhdx log replay tests for qemu-img
  block: qemu-iotests - fix test 070 (vhdx)
  block: Don't throw away errno via error_setg
  block: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare
  blockdev: Remove 'type' parameter from blockdev_init()
  sdhci: Drop unnecessary #include

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/jliu/or32-ld-st' into staging
Peter Maydell [Sat, 15 Feb 2014 15:20:08 +0000 (15:20 +0000)]
Merge remote-tracking branch 'remotes/jliu/or32-ld-st' into staging

* remotes/jliu/or32-ld-st:
  target-openrisc: Use new qemu_ld/st opcodes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/jovanovic/mips-ufrp' into staging
Peter Maydell [Sat, 15 Feb 2014 15:07:00 +0000 (15:07 +0000)]
Merge remote-tracking branch 'remotes/jovanovic/mips-ufrp' into staging

* remotes/jovanovic/mips-ufrp:
  target-mips: add user-mode FR switch support for MIPS32r5
  target-mips: add support for CP0_Config5
  target-mips: add support for CP0_Config4
  target-mips: add CPU definition for MIPS32R5

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agochar/serial: Fix emptyness check
Peter Crosthwaite [Tue, 11 Feb 2014 06:49:35 +0000 (22:49 -0800)]
char/serial: Fix emptyness check

This was guarding against a full fifo rather than an empty fifo when
popping. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agogitignore: anchor all ignored names
Michael Tokarev [Tue, 11 Feb 2014 10:22:32 +0000 (14:22 +0400)]
gitignore: anchor all ignored names

by default, patterns/names in .gitignore are applied
recursively to all subdirectories.  So any name mentioned
in .gitignore is ignored in all subdirectores.  This is good
for, say. object files (*.o), but not good for particular
names which should be ignored only in one directory.  For
example, qemu-img.1 file is generated in the top directory,
and it should be ignored only there, not in some subdir.

At first, this might not matter much, but we have lots of
examples already where it actually does not help at all.
For example, top-level .gitignore ignores a file/dir named
"patches" (which is very questionable by itself), but it
is applied recursively, so git also ignores, for example,
debian/patches/ which should not be ignored.

So anchor all the names where appropriate.  .gitignore
should be cleaned up further, which will be addressed in
a subsequent patch.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: trim includes
Michael Tokarev [Fri, 7 Feb 2014 08:26:14 +0000 (12:26 +0400)]
vl: trim includes

Over time, lots of stuff moved from vl.c into separate
files.  But include statements has never been cleaned,
and they continue to carry lots of anymore-unused stuff.

Remove includes which are not relevant for vl.c anymore.
Apparently there are more includes like this, because
many are included from qemu-common.h and the like, or,
for example, I don't see were we use win32-specific
stuff in vl.c (so that maybe #include <windows.h> might
be removed too).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: remove old, long-unused defines
Michael Tokarev [Fri, 7 Feb 2014 08:23:05 +0000 (12:23 +0400)]
vl: remove old, long-unused defines

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agonet: declare struct iovec in checksum.h to fix compiler warning
Michael Tokarev [Fri, 7 Feb 2014 08:22:18 +0000 (12:22 +0400)]
net: declare struct iovec in checksum.h to fix compiler warning

The checksum calculation header exports a function that refers to
struct iov defined in iov.h.  Without including the former, build
fails like this:

  In file included from hw/net/fsl_etsec/rings.c:24:0:
  include/net/checksum.h:51:31: error: ‘struct iovec’ declared inside parameter list [-Werror]
  include/net/checksum.h:51:31: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]

Mention struct iovec there.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolinux-user: refactor do_socketcall()
Michael Tokarev [Fri, 17 Jan 2014 10:23:51 +0000 (14:23 +0400)]
linux-user: refactor do_socketcall()

Refactor do_socketcall() to do argument conversion/checking first,
according to a lookup table (which call has how many args) and
by calling the right function second with ready-to-go arguments.

This ensures that all arguments are handled as abi_long, according
to socketcall prototype, and simplifies argument handling alot too.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoconfigure: add hints to a remedy for feature_not_found errors
Stewart Smith [Fri, 24 Jan 2014 01:39:10 +0000 (12:39 +1100)]
configure: add hints to a remedy for feature_not_found errors

Modify feature_not_found to accept an optional second parameter to be
printed after the generic feature not found error.

Modify most calls to feature_not_found to provide hints as to the
packages that may be missing. The few calls remaining without a remedy
are ones I couldn't work out how to remedy myself.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: add hint of libfdt to DTC dependency not found message
Stewart Smith [Fri, 24 Jan 2014 01:39:06 +0000 (12:39 +1100)]
configure: add hint of libfdt to DTC dependency not found message

Most distros package it as libfdt, and mentioning libfdt here makes it
much easier to find the package you're missing.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agosparc/leon3: Initialize stack pointer
Sebastian Huber [Mon, 3 Feb 2014 09:18:11 +0000 (10:18 +0100)]
sparc/leon3: Initialize stack pointer

A lot of real world LEON3 systems are shipped with the GRMON boot
loader.  This boot loader initializes the stack pointer with the end of
RAM address.  The application can use this to detect the RAM size of a
particular board variant.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Fix case Qemu -> QEMU
Stefan Weil [Tue, 4 Feb 2014 05:43:09 +0000 (06:43 +0100)]
misc: Fix case Qemu -> QEMU

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoblock: Open by reference will try device then node_name.
Benoît Canet [Wed, 12 Feb 2014 16:15:07 +0000 (17:15 +0100)]
block: Open by reference will try device then node_name.

Since we introduced node_name for named bs of the graph modify the opening by
reference to use it as a fallback.

This patch also enforce the separation of the device id and graph node
namespaces.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Relax bdrv_lookup_bs constraints.
Benoît Canet [Wed, 12 Feb 2014 16:15:06 +0000 (17:15 +0100)]
block: Relax bdrv_lookup_bs constraints.

The following patch will reuse bdrv_lookup_bs in order to open images by
references so the rules of usage of bdrv_lookup_bs must be relaxed a bit.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.
Benoît Canet [Thu, 13 Feb 2014 16:22:33 +0000 (17:22 +0100)]
blockdev: Fix wrong usage of QDECREF causing snapshoted quorum to crash on close.

As bdrv_open() documentation states:
"The reference to the QDict belongs to the block layer
 * after the call (even on failure), so if the caller intends to reuse the
 * dictionary, it needs to use QINCREF() before calling bdrv_open."

the optional options dict will not be reused after bdrv_open() and should
belong to the block layer so remove the extra QDECREF(options).

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: mirror - use local_err to avoid NULL errp
Jeff Cody [Thu, 13 Feb 2014 14:23:38 +0000 (09:23 -0500)]
block: mirror - use local_err to avoid NULL errp

When starting a block job, commit_active_start() relies on whether *errp
is set by mirror_start_job.  This allows it to determine if the mirror
job start failed, so that it can clean up any changes to open flags from
the bdrv_reopen().  If errp is NULL, then it will not be able to
determine if mirror_start_job failed or not.

To avoid this, use a local Error variable, and then propagate the error
(if any) to errp.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: Don't run 005 on vmdk split formats
Fam Zheng [Thu, 13 Feb 2014 02:05:31 +0000 (10:05 +0800)]
qemu-iotests: Don't run 005 on vmdk split formats

There would be too many extents that VMDK driver can't open all of them:

    005 0s ... - output mismatch (see 005.out.bad)
    --- 005.out     2013-12-24 09:27:27.608181030 +0800
    +++ 005.out.bad 2014-02-13 10:00:15.282184557 +0800
    @@ -4,10 +4,10 @@
     Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5368709120000

     small read
    -read 4096/4096 bytes at offset 1024
    -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files
    +no file open, try 'help open'

     small write
    -wrote 4096/4096 bytes at offset 8192
    -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files
    +no file open, try 'help open'
     *** done

So disable the two subformats.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: qemu-iotests - add vhdx log replay tests for qemu-img
Jeff Cody [Wed, 12 Feb 2014 21:30:53 +0000 (16:30 -0500)]
block: qemu-iotests - add vhdx log replay tests for qemu-img

VHDX logs can now be replayed via 'qemu-img check -r all'.  Add
tests to verify that the log replay is successful when using qemu-img.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: qemu-iotests - fix test 070 (vhdx)
Jeff Cody [Wed, 12 Feb 2014 21:30:52 +0000 (16:30 -0500)]
block: qemu-iotests - fix test 070 (vhdx)

VHDX test 070 failed, due to different output from qemu-io / qemu
when opening an image read-only that contains a log file.  Filter
the output, and update the expected results to match the correct
output.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Don't throw away errno via error_setg
Jeff Cody [Wed, 12 Feb 2014 19:46:24 +0000 (14:46 -0500)]
block: Don't throw away errno via error_setg

There are a handful of places in the block layer where a failure path
has a valid -errno value, yet error_setg() is used.  Those instances
should instead use error_setg_errno(), to preserve as much error
information as possible.

This patch replaces those instances with error_setg_errno(), so that
errno is passed up the stack in the error message.

Reported-By: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare
Jeff Cody [Tue, 4 Feb 2014 19:12:44 +0000 (14:12 -0500)]
block: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare

iSCSI currently does not need to do any actions to support the
current usage of bdrv_reopen().  However, it is important to note
a couple of things: 1.) A connection will not be re-established to
an iSCSI target, and 2.) If iscsi_open() is changed to parse 'flags',
then iscsi_reopen_prepare() may need to be more than a stub.

In light of the above, this commit adds comments above both of the
functions to bring attention to these facts.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblockdev: Remove 'type' parameter from blockdev_init()
Kevin Wolf [Sun, 9 Feb 2014 08:52:32 +0000 (09:52 +0100)]
blockdev: Remove 'type' parameter from blockdev_init()

blockdev-add doesn't know about the device that the backend will be
attached to, this is a legacy -drive concept. Move the remaining checks
that use it to drive_init().

[Fam Zheng <famz@redhat.com> suggested line-wrapping to 80 chars as
required by the coding standard.  I have fixed this.
--Stefan]

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agosdhci: Drop unnecessary #include
Kevin Wolf [Sun, 9 Feb 2014 09:02:27 +0000 (10:02 +0100)]
sdhci: Drop unnecessary #include

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoPPC: KVM: Add missing address space to ldl_phys helper
Alexander Graf [Fri, 14 Feb 2014 08:15:21 +0000 (09:15 +0100)]
PPC: KVM: Add missing address space to ldl_phys helper

We now have to pass an address space to our _phys helpers. During the
transition apparently the EPR exit path missed out, so let's put it there.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Thu, 13 Feb 2014 15:02:03 +0000 (15:02 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi,pc,pci fixes and enhancements

Most changes here are hotplug related:

This merges hotplug infrastructure changes by Igor,
some acpi related fixes, and PC fixes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 10 Feb 2014 09:13:26 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  ACPI: Remove commented-out code from HPET._CRS
  hw/pci: switch to a generic hotplug handling for PCIDevice
  pci/pcie: convert PCIE hotplug to use hotplug-handler API
  pci/shpc: convert SHPC hotplug to use hotplug-handler API
  acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-handler API
  qdev:pci: refactor PCIDevice to use generic "hotpluggable" property
  hw/acpi: move typeinfo to the file end
  qdev: add "hotpluggable" property to Device
  qdev: add to BusState "hotplug-handler" link
  define hotplug interface
  loader: document that errno is set
  pc.c: better error message on initrd sizing failure
  pc_piix: enable legacy hotplug for Xen
  qtest: don't report signals if qtest driver enabled
  hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug
  pcihp: remove unused AcpiPciHpPciStatus.device_present field
  pcihp: make pci_read() mmio calback compatible with legacy ACPI hotplug
  pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR
  pcihp: replace enable|disable_device() with oneliners
  pcihp: reduce number of device check events

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging
Peter Maydell [Thu, 13 Feb 2014 14:52:06 +0000 (14:52 +0000)]
Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging

PReP machine and devices

* Cleanups for Raven PCI host bridge
* Removal of PReP machine and devices from qemu-system-ppcemb

# gpg: Signature made Mon 10 Feb 2014 16:19:03 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/prep-for-upstream:
  prep: Drop from ppcemb-softmmu
  raven: Use constant PCI_NUM_PINS instead of 4
  prep: Kill get_system_io() usage

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/alon/pull-libcacard.glusterfs' into staging
Peter Maydell [Wed, 12 Feb 2014 17:53:31 +0000 (17:53 +0000)]
Merge remote-tracking branch 'remotes/alon/pull-libcacard.glusterfs' into staging

* remotes/alon/pull-libcacard.glusterfs:
  libcacard: Don't link with all libraries QEMU links to

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-anthony' into staging
Peter Maydell [Wed, 12 Feb 2014 16:42:50 +0000 (16:42 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-anthony' into staging

Block patches

# gpg: Signature made Sun 09 Feb 2014 08:12:51 GMT using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-anthony:
  block: Fix 32 bit truncation in mark_request_serialising()
  blkdebug: Don't leak bs->file on failure
  block: Don't call ROUND_UP with negative values
  block: bdrv_aligned_pwritev: Assert overlap range
  block: Fix memory leaks in bdrv_co_do_pwritev()
  raw: Fix BlockLimits passthrough
  qemu-iotests: add test for qcow2 preallocation with different cluster sizes
  qcow2: check for NULL l2meta
  qcow2: fix offset overflow in qcow2_alloc_clusters_at()
  qcow2: remove n_start and n_end of qcow2_alloc_cluster_offset()
  block/iscsi: always fill bs->bl.opt_transfer_length
  block: Fail gracefully with missing filename
  qemu-iotests: enable support for NFS protocol
  qemu-iotests: enable test 016 and 025 to work with NFS protocol
  qemu-iotests: blacklist test 020 for NFS protocol
  qemu-iotests: change _supported_proto to file for various tests
  block: add native support for NFS
  qemu-iotest: Make 077 raw-only

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-openrisc: Use new qemu_ld/st opcodes
Richard Henderson [Wed, 11 Dec 2013 16:42:08 +0000 (08:42 -0800)]
target-openrisc: Use new qemu_ld/st opcodes

Signed-off-by: Richard Henderson <rth@twiddle.net>
Acked-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Jia Liu <proljc@gmail.com>
10 years agopetalogix-ml605: Create the CPU with object_new()
Edgar E. Iglesias [Mon, 16 Dec 2013 02:44:20 +0000 (12:44 +1000)]
petalogix-ml605: Create the CPU with object_new()

This is to allow future patches to set properties before cpu::realize().

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make cpu_memory_rw_debug use the CPUs AS
Edgar E. Iglesias [Fri, 13 Dec 2013 06:31:02 +0000 (16:31 +1000)]
exec: Make cpu_memory_rw_debug use the CPUs AS

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make cpu_physical_memory_write_rom input an AS
Edgar E. Iglesias [Fri, 13 Dec 2013 06:28:52 +0000 (16:28 +1000)]
exec: Make cpu_physical_memory_write_rom input an AS

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make stb_phys input an AddressSpace
Edgar E. Iglesias [Tue, 17 Dec 2013 05:29:06 +0000 (15:29 +1000)]
exec: Make stb_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make stw_*_phys input an AddressSpace
Edgar E. Iglesias [Tue, 17 Dec 2013 05:22:06 +0000 (15:22 +1000)]
exec: Make stw_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make stl_phys_notdirty input an AddressSpace
Edgar E. Iglesias [Thu, 28 Nov 2013 09:13:41 +0000 (10:13 +0100)]
exec: Make stl_phys_notdirty input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make stl_*_phys input an AddressSpace
Edgar E. Iglesias [Tue, 17 Dec 2013 05:07:29 +0000 (15:07 +1000)]
exec: Make stl_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make stq_*_phys input an AddressSpace
Edgar E. Iglesias [Wed, 27 Nov 2013 23:11:44 +0000 (00:11 +0100)]
exec: Make stq_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make lduw_*_phys input an AddressSpace
Edgar E. Iglesias [Tue, 17 Dec 2013 04:33:56 +0000 (14:33 +1000)]
exec: Make lduw_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make ldq/ldub_*_phys input an AddressSpace
Edgar E. Iglesias [Tue, 17 Dec 2013 04:05:40 +0000 (14:05 +1000)]
exec: Make ldq/ldub_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make ldl_*_phys input an AddressSpace
Edgar E. Iglesias [Fri, 15 Nov 2013 13:46:38 +0000 (14:46 +0100)]
exec: Make ldl_*_phys input an AddressSpace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: On AS changes, only flush affected CPU TLBs
Edgar E. Iglesias [Thu, 21 Nov 2013 18:06:30 +0000 (19:06 +0100)]
exec: On AS changes, only flush affected CPU TLBs

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agocpu: Add per-cpu address space
Edgar E. Iglesias [Tue, 17 Dec 2013 03:06:51 +0000 (13:06 +1000)]
cpu: Add per-cpu address space

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agomemory: Add MemoryListener to typedefs.h
Edgar E. Iglesias [Thu, 21 Nov 2013 17:36:42 +0000 (18:36 +0100)]
memory: Add MemoryListener to typedefs.h

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make memory_region_section_get_iotlb use section AS
Edgar E. Iglesias [Thu, 7 Nov 2013 17:43:28 +0000 (18:43 +0100)]
exec: Make memory_region_section_get_iotlb use section AS

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Always initialize MemorySection address spaces
Edgar E. Iglesias [Thu, 7 Nov 2013 17:42:51 +0000 (18:42 +0100)]
exec: Always initialize MemorySection address spaces

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make iotlb_to_region input an AS
Edgar E. Iglesias [Thu, 7 Nov 2013 18:55:56 +0000 (19:55 +0100)]
exec: Make iotlb_to_region input an AS

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoexec: Make tb_invalidate_phys_addr input an AS
Edgar E. Iglesias [Thu, 7 Nov 2013 18:43:10 +0000 (19:43 +0100)]
exec: Make tb_invalidate_phys_addr input an AS

No functional change.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140208' into...
Peter Maydell [Tue, 11 Feb 2014 11:26:36 +0000 (11:26 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140208' into staging

target-arm queue:
 * more A64 Neon instructions
 * AArch32 VCVTB and VCVTT ARMv8 instructions
 * fixes to inaccuracies in GIC emulation
 * libvixl disassembler for A64
 * Allwinner SoC ethernet controller
 * zynq software system reset support

# gpg: Signature made Sat 08 Feb 2014 15:53:05 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20140208: (29 commits)
  arm/zynq: Add software system reset via SCLR
  hw/arm/allwinner-a10: initialize EMAC
  hw/net: add support for Allwinner EMAC Fast Ethernet controller
  util/fifo8: clear fifo head upon reset
  util/fifo8: implement push/pop of multiple bytes
  disas: Implement disassembly output for A64
  disas/libvixl: Fix upstream libvixl compilation issues
  disas: Add subset of libvixl sources for A64 disassembler
  rules.mak: Link with C++ if we have a C++ compiler
  rules.mak: Support .cc as a C++ source file suffix
  arm_gic: Add GICC_APRn state to the GICState
  vmstate: Add uint32 2D-array support
  arm_gic: Support setting/getting binary point reg
  arm_gic: Keep track of SGI sources
  arm_gic: Fix GIC pending behavior
  target-arm: Add support for AArch32 64bit VCVTB and VCVTT
  target-arm: A64: Add FNEG and FABS to the SIMD 2-reg-misc group
  target-arm: A64: Add 2-reg-misc REV* instructions
  target-arm: A64: Add narrowing 2-reg-misc instructions
  target-arm: A64: Implement 2-reg-misc CNT, NOT and RBIT
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kvaneesh/for-upstream' into staging
Peter Maydell [Mon, 10 Feb 2014 18:31:06 +0000 (18:31 +0000)]
Merge remote-tracking branch 'remotes/kvaneesh/for-upstream' into staging

* remotes/kvaneesh/for-upstream:
  hw/9pfs: fix P9_STATS_GEN handling
  hw/9pfs: make get_st_gen() return ENOTTY error on special files
  hw/9pfs: handle undefined FS_IOC_GETVERSION case in handle_ioc_getversion()
  hw/9pfs: fix error handing in local_ioc_getversion()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agomemory: fix limiting of translation at a page boundary
Paolo Bonzini [Fri, 7 Feb 2014 14:47:46 +0000 (15:47 +0100)]
memory: fix limiting of translation at a page boundary

Commit 360e607 (address_space_translate: do not cross page boundaries,
2014-01-30) broke MMIO accesses in cases where the section is shorter
than the full register width.  This can happen for example with the
Bochs DISPI registers, which are 16 bits wide but have only a 1-byte
long MemoryRegion (if you write to the "second byte" of the register
your access is discarded; it doesn't write only to half of the register).

Restrict the action of commit 360e607 to direct RAM accesses.  This
is enough for Xen, since MMIO will not go through the mapcache.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoprep: Drop from ppcemb-softmmu
Andreas Färber [Thu, 23 Jan 2014 10:22:16 +0000 (11:22 +0100)]
prep: Drop from ppcemb-softmmu

ppcemb covers only embedded processors, which does not include PReP.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
10 years agotarget-mips: add user-mode FR switch support for MIPS32r5
Petar Jovanovic [Wed, 22 Jan 2014 17:35:32 +0000 (18:35 +0100)]
target-mips: add user-mode FR switch support for MIPS32r5

Description of UFR feature:

Required in MIPS32r5 if floating point is implemented and user-mode FR
switching is supported. The UFR register allows user-mode to clear StatusFR
by executing a CTC1 to UFR with GPR[0] as input, and read StatusFR by
executing a CFC1 to UFR.

helper_ctc1 has been extended with an additional parameter rt to check
requirements for UFR feature.
Definition of mips32r5-generic has been modified to include support for UFR.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Eric Johnson <eric.johnson@imgtec.com>
10 years agotarget-mips: add support for CP0_Config5
Petar Jovanovic [Fri, 17 Jan 2014 18:25:57 +0000 (19:25 +0100)]
target-mips: add support for CP0_Config5

Add CP0_Config5, define rw_bitmask and enable modifications.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Eric Johnson <eric.johnson@imgtec.com>
10 years agotarget-mips: add support for CP0_Config4
Petar Jovanovic [Fri, 24 Jan 2014 12:45:05 +0000 (13:45 +0100)]
target-mips: add support for CP0_Config4

Add CP0_Config4, define rw_bitmask.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Eric Johnson <eric.johnson@imgtec.com>
10 years agotarget-mips: add CPU definition for MIPS32R5
Petar Jovanovic [Wed, 15 Jan 2014 16:01:46 +0000 (17:01 +0100)]
target-mips: add CPU definition for MIPS32R5

Add mips32r5-generic among CPU definitions for MIPS.
Define ISA_MIPS32R3 and ISA_MIPS32R5.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Eric Johnson <eric.johnson@imgtec.com>
10 years agoACPI: Remove commented-out code from HPET._CRS
Gabriel L. Somlo [Fri, 7 Feb 2014 15:30:40 +0000 (10:30 -0500)]
ACPI: Remove commented-out code from HPET._CRS

IRQNoFlags on HPET._CRS crashes WinXP because it causes the HPET
to conflict with the system timer and/or the RTC. It only occurs
on Apple hardware, and even there it is exposed fully only when
OS X is detected (via _OSI). Recent OS X versions work on QEMU
without this statement, so at this time there is no need to find
a better way to conditionally include the statement. This patch
removes the commented out (and wrong, should have been {0, 8})
statement from HPET._CRS.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
10 years agohw/pci: switch to a generic hotplug handling for PCIDevice
Igor Mammedov [Wed, 5 Feb 2014 15:36:52 +0000 (16:36 +0100)]
hw/pci: switch to a generic hotplug handling for PCIDevice

make qdev_unplug()/device_set_realized() to call hotplug handler's
plug/unplug methods if available and remove not needed anymore
hot(un)plug handling from PCIDevice.

In case if hotplug handler is not available, revert to the legacy
hotplug method for compatibility with not yet converted buses.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopci/pcie: convert PCIE hotplug to use hotplug-handler API
Igor Mammedov [Wed, 5 Feb 2014 15:36:51 +0000 (16:36 +0100)]
pci/pcie: convert PCIE hotplug to use hotplug-handler API

Split pcie_cap_slot_hotplug() into hotplug/unplug callbacks
and register them as "hotplug-handler" interface implementation of
PCIE_SLOT device.

Replace pci_bus_hotplug() wiring with setting link on PCI BUS
"hotplug-handler" property to PCI_BRIDGE_DEV device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopci/shpc: convert SHPC hotplug to use hotplug-handler API
Igor Mammedov [Wed, 5 Feb 2014 15:36:50 +0000 (16:36 +0100)]
pci/shpc: convert SHPC hotplug to use hotplug-handler API

Split shpc_device_hotplug() into hotplug/unplug callbacks
and register them as "hotplug-handler" interface implementation of
PCI_BRIDGE_DEV device.

Replace pci_bus_hotplug() wiring with setting link on PCI BUS
"hotplug-handler" property to PCI_BRIDGE_DEV device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi/piix4pm: convert ACPI PCI hotplug to use hotplug-handler API
Igor Mammedov [Wed, 5 Feb 2014 15:36:49 +0000 (16:36 +0100)]
acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-handler API

Split piix4_device_hotplug() into hotplug/unplug callbacks
and register them as "hotplug-handler" interface implementation of
PIIX4_PM device.

Replace pci_bus_hotplug() wiring with setting link on
PCI BUS "hotplug-handler" property to PIIX4_PM device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqdev:pci: refactor PCIDevice to use generic "hotpluggable" property
Igor Mammedov [Wed, 5 Feb 2014 15:36:48 +0000 (16:36 +0100)]
qdev:pci: refactor PCIDevice to use generic "hotpluggable" property

Get rid of PCIDevice specific PCIDeviceClass.no_hotplug and use
generic DeviceClass.hotpluggable field instead.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohw/acpi: move typeinfo to the file end
Igor Mammedov [Wed, 5 Feb 2014 15:36:47 +0000 (16:36 +0100)]
hw/acpi: move typeinfo to the file end

do so to avoid not necessary forward declarations and
place typeinfo registration at the file end where it's
usually expected.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqdev: add "hotpluggable" property to Device
Igor Mammedov [Wed, 5 Feb 2014 15:36:46 +0000 (16:36 +0100)]
qdev: add "hotpluggable" property to Device

Currently it's possible to make PCIDevice not hotpluggable
by using no_hotplug field of PCIDeviceClass. However it
limits this only to PCI devices and prevents from
generalizing hotplug code.

So add similar field to DeviceClass so it could be reused
with other Devices and would allow to replace PCI specific
hotplug callbacks with generic implementation. Following
patches will replace PCIDeviceClass.no_hotplug with this
new property.

In addition expose field as "hotpluggable" readonly property,
to make it possible to read its value via QOM interface.

Make DeviceClass hotpluggable by default as it was assumed
before.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqdev: add to BusState "hotplug-handler" link
Igor Mammedov [Wed, 5 Feb 2014 15:36:45 +0000 (16:36 +0100)]
qdev: add to BusState "hotplug-handler" link

It will allow to reuse field with different BUSes,
reducing code duplication. Field is intended for
replacing 'hotplug_qdev' field in PCIBus and also
will allow to avoid adding equivalent field to
DimmBus with possiblitity to refactor other BUSes
to use it instead of custom field.
In addition once all users of allow_hotplug field
are converted to new API, link could replace
allow_hotplug field in qdev hotplug code.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agodefine hotplug interface
Igor Mammedov [Wed, 5 Feb 2014 15:36:44 +0000 (16:36 +0100)]
define hotplug interface

Provide a generic hotplug interface for hotplug handlers.
Intended for replacing hotplug mechanism used by
PCI/PCIE/SHPC code and will be used for memory hotplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoloader: document that errno is set
Michael S. Tsirkin [Wed, 5 Feb 2014 19:57:55 +0000 (21:57 +0200)]
loader: document that errno is set

Document that get_image_size sets errno
on failure.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoraven: Use constant PCI_NUM_PINS instead of 4
Hervé Poussineau [Mon, 4 Nov 2013 23:09:44 +0000 (00:09 +0100)]
raven: Use constant PCI_NUM_PINS instead of 4

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
10 years agoprep: Kill get_system_io() usage
Hervé Poussineau [Mon, 4 Nov 2013 23:09:43 +0000 (00:09 +0100)]
prep: Kill get_system_io() usage

While ISA address space in prep machine is currently the one returned
by get_system_io(), this depends of the implementation of i82378/raven
devices, and this may not be the case forever.

Use the right ISA address space when adding some more ports to it.
We can use whatever ISA device on the right ISA bus, as all ISA devices
on the same ISA bus share the same ISA address space.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
10 years agolibcacard: Don't link with all libraries QEMU links to
Christophe Fergeau [Thu, 30 Jan 2014 13:56:49 +0000 (14:56 +0100)]
libcacard: Don't link with all libraries QEMU links to

As described in https://bugzilla.redhat.com/show_bug.cgi?id=987441 ,
libcacard currently links to all the libraries QEMU is linking to,
including glusterfs libraries, libiscsi, ... libcacard does not need all of
these. This patch ensures it's only linked with the libraries it needs.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
10 years agoblock: Fix 32 bit truncation in mark_request_serialising()
Kevin Wolf [Sat, 8 Feb 2014 09:42:18 +0000 (10:42 +0100)]
block: Fix 32 bit truncation in mark_request_serialising()

On 32 bit hosts, size_t is too small for align as the bitmask
~(align - 1) will zero out the higher 32 bits of the offset.

While at it, change the local overlap_bytes variable to unsigned to
match the field in BdrvTrackedRequest.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoblkdebug: Don't leak bs->file on failure
Kevin Wolf [Sat, 8 Feb 2014 08:53:22 +0000 (09:53 +0100)]
blkdebug: Don't leak bs->file on failure

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoblock: Don't call ROUND_UP with negative values
Kevin Wolf [Fri, 7 Feb 2014 15:00:09 +0000 (16:00 +0100)]
block: Don't call ROUND_UP with negative values

The behaviour of the ROUND_UP macro with negative numbers isn't obvious.
It happens to do the right thing in this please, but better avoid it.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoblock: bdrv_aligned_pwritev: Assert overlap range
Kevin Wolf [Fri, 7 Feb 2014 14:35:56 +0000 (15:35 +0100)]
block: bdrv_aligned_pwritev: Assert overlap range

This adds assertions that the request that we actually end up passing to
the block driver (which includes RMW data and has therefore potentially
been rounded to alignment boundaries) is fully covered by the
overlap_{offset,size} fields of the associated BdrvTrackedRequest.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoblock: Fix memory leaks in bdrv_co_do_pwritev()
Kevin Wolf [Fri, 7 Feb 2014 14:29:00 +0000 (15:29 +0100)]
block: Fix memory leaks in bdrv_co_do_pwritev()

The error path for a failure in one of the two bdrv_aligned_preadv()
calls leaked head_buf or tail_buf, respectively. This fixes the memory
leak.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoraw: Fix BlockLimits passthrough
Kevin Wolf [Tue, 4 Feb 2014 10:54:13 +0000 (11:54 +0100)]
raw: Fix BlockLimits passthrough

raw copies over the BlockLimits of bs->file during bdrv_open().
However, since commit d34682cd it is immediately overwritten during
bdrv_refresh_limits(). This caused all fields except for
opt_transfer_length and opt_mem_alignment (which happen to be correctly
inherited in generic code) to be zeroed.

Move the BlockLimit assignment to a .bdrv_refresh_limits() callback to
make it work again for all fields.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years agoqemu-iotests: add test for qcow2 preallocation with different cluster sizes
Hu Tao [Sun, 26 Jan 2014 03:12:40 +0000 (11:12 +0800)]
qemu-iotests: add test for qcow2 preallocation with different cluster sizes

Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: check for NULL l2meta
Hu Tao [Sun, 26 Jan 2014 03:12:39 +0000 (11:12 +0800)]
qcow2: check for NULL l2meta

In the case of a metadata preallocation with a large cluster size,
qcow2_alloc_cluster_offset() can allocate nothing and returns a
NULL l2meta. This patch checks for it and link2 l2 with only valid
l2meta.

Replace 9 and 512 with BDRV_SECTOR_BITS, BDRV_SECTOR_SIZE
respectively while at the function.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: fix offset overflow in qcow2_alloc_clusters_at()
Hu Tao [Sun, 26 Jan 2014 03:12:38 +0000 (11:12 +0800)]
qcow2: fix offset overflow in qcow2_alloc_clusters_at()

When cluster size is big enough it can lead to an offset overflow
in qcow2_alloc_clusters_at(). This patch fixes it.

The allocation is stopped each time at L2 table boundary
(see handle_alloc()), so the possible maximum bytes could be

  2^(cluster_bits - 3 + cluster_bits)

cluster_bits - 3 is used to compute the number of entry by L2
and the additional cluster_bits is to take into account each
clusters referenced by the L2 entries.

so int is safe for cluster_bits<=17, unsafe otherwise.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: remove n_start and n_end of qcow2_alloc_cluster_offset()
Hu Tao [Sun, 26 Jan 2014 03:12:37 +0000 (11:12 +0800)]
qcow2: remove n_start and n_end of qcow2_alloc_cluster_offset()

n_start can be actually calculated from offset. The number of
sectors to be allocated(n_end - n_start) can be passed in in
num. By removing n_start and n_end, we can save two parameters.

The side effect is there is a bug in qcow2.c:preallocate() that
passes incorrect n_start to qcow2_alloc_cluster_offset() is
fixed. The bug can be triggerred by a larger cluster size than
the default value(65536), for example:

./qemu-img create -f qcow2 \
  -o 'cluster_size=131072,preallocation=metadata' file.img 4G

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/iscsi: always fill bs->bl.opt_transfer_length
Peter Lieven [Wed, 29 Jan 2014 12:03:35 +0000 (13:03 +0100)]
block/iscsi: always fill bs->bl.opt_transfer_length

the opt_transfer_length has nothing to do with logical
block provisioning stuff so always copy it from
the block limits VPD page.

Reported-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Fail gracefully with missing filename
Kevin Wolf [Mon, 3 Feb 2014 13:49:42 +0000 (14:49 +0100)]
block: Fail gracefully with missing filename

This fixes a regression introduced in commit 2a05cbe42 ('block: Allow
block devices without files'):

$ qemu-system-x86_64 -drive driver=file
qemu-system-x86_64: block.c:892: bdrv_open_common: Assertion
`!drv->bdrv_needs_filename || filename != ((void *)0)' failed.

Now the respective check must be performed not only in bdrv_file_open(),
but also in bdrv_open().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqemu-iotests: enable support for NFS protocol
Peter Lieven [Mon, 3 Feb 2014 09:26:17 +0000 (10:26 +0100)]
qemu-iotests: enable support for NFS protocol

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: enable test 016 and 025 to work with NFS protocol
Peter Lieven [Mon, 3 Feb 2014 09:26:16 +0000 (10:26 +0100)]
qemu-iotests: enable test 016 and 025 to work with NFS protocol

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: blacklist test 020 for NFS protocol
Peter Lieven [Mon, 3 Feb 2014 09:26:15 +0000 (10:26 +0100)]
qemu-iotests: blacklist test 020 for NFS protocol

reopening is currently not supported.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: change _supported_proto to file for various tests
Peter Lieven [Mon, 3 Feb 2014 09:26:14 +0000 (10:26 +0100)]
qemu-iotests: change _supported_proto to file for various tests

all these tests do anything of the following and thus fail with any
protocol other than file:
 - the tests use rm, cp or mv shell commands which only work on file
 - the tests use qcow2.py
 - the images construct new filenames (e.g. backing file names) and
   the logic is broken for anything else than file

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: add native support for NFS
Peter Lieven [Mon, 3 Feb 2014 09:26:13 +0000 (10:26 +0100)]
block: add native support for NFS

This patch adds native support for accessing images on NFS
shares without the requirement to actually mount the entire
NFS share on the host.

NFS Images can simply be specified by an url of the form:
nfs://<host>/<export>/<filename>[?param=value[&param2=value2[&...]]]

For example:
qemu-img create -f qcow2 nfs://10.0.0.1/qemu-images/test.qcow2

You need LibNFS from Ronnie Sahlberg available at:
   git://github.com/sahlberg/libnfs.git
for this to work.

During configure it is automatically probed for libnfs and support
is enabled on-the-fly. You can forbid or enforce libnfs support
with --disable-libnfs or --enable-libnfs respectively.

Due to NFS restrictions you might need to execute your binaries
as root, allow them to open priviledged ports (<1024) or specify
insecure option on the NFS server.

For additional information on ROOT vs. non-ROOT operation and URL
format + parameters see:
   https://raw.github.com/sahlberg/libnfs/master/README

Supported by qemu are the uid, gid and tcp-syncnt URL parameters.

LibNFS currently support NFS version 3 only.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotest: Make 077 raw-only
Kevin Wolf [Thu, 30 Jan 2014 11:52:47 +0000 (12:52 +0100)]
qemu-iotest: Make 077 raw-only

The qemu-io command sequences make the assumption that an unaligned
request on the format layer will be unaligned on the blkdebug layer as
well. This doesn't necessarily hold true for drivers other than raw.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Benoît Canet <benoit@irqsave.net>
10 years agoMerge remote-tracking branch 'remotes/mwalle/tags/lm32-fixes/20140204' into staging
Peter Maydell [Sat, 8 Feb 2014 15:57:51 +0000 (15:57 +0000)]
Merge remote-tracking branch 'remotes/mwalle/tags/lm32-fixes/20140204' into staging

target-lm32: fixes

# gpg: Signature made Tue 04 Feb 2014 18:47:56 GMT using DSA key ID 3F98A378
# gpg: Can't check signature: public key not found

* remotes/mwalle/tags/lm32-fixes/20140204:
  hw/lm32: print error if cpu model is not found
  target-lm32: stop VM on illegal or unknown instruction
  lm32_sys: dump cpu state if test case fails
  lm32_sys: print test result on stderr
  target-lm32: add breakpoint/watchpoint support
  target-lm32: move model features to LM32CPU
  target-lm32: kill cpu_abort() calls
  milkymist-vgafb: swap pixel data in source buffer
  lm32_uart/lm32_juart: use qemu_chr_fe_write_all()
  milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write()
  tests: lm32: new rule for single test cases
  lm32_sys: increase test case name length limit

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoarm/zynq: Add software system reset via SCLR
Sebastian Huber [Wed, 5 Feb 2014 07:31:55 +0000 (08:31 +0100)]
arm/zynq: Add software system reset via SCLR

Support software-driven system reset via the register in the SCLR.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/arm/allwinner-a10: initialize EMAC
Beniamino Galvani [Thu, 30 Jan 2014 22:02:07 +0000 (23:02 +0100)]
hw/arm/allwinner-a10: initialize EMAC

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/net: add support for Allwinner EMAC Fast Ethernet controller
Beniamino Galvani [Thu, 30 Jan 2014 22:02:06 +0000 (23:02 +0100)]
hw/net: add support for Allwinner EMAC Fast Ethernet controller

This patch adds support for the Fast Ethernet MAC found on Allwinner
SoCs, together with a basic emulation of Realtek RTL8201CP PHY.

Since there is no public documentation of the Allwinner controller, the
implementation is based on Linux kernel driver.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoutil/fifo8: clear fifo head upon reset
Beniamino Galvani [Thu, 30 Jan 2014 22:02:05 +0000 (23:02 +0100)]
util/fifo8: clear fifo head upon reset

To improve the predictability of fifo8_pop_buf(), the fifo head is set
to the start of data buffer upon a reset so that the first call to the
function will be able to retrieve all data in the fifo.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoutil/fifo8: implement push/pop of multiple bytes
Beniamino Galvani [Thu, 30 Jan 2014 22:02:04 +0000 (23:02 +0100)]
util/fifo8: implement push/pop of multiple bytes

The patch adds functions fifo8_push_all() and fifo8_pop_buf() which
can be used respectively to push the content of a memory buffer to the
fifo and to pop multiple bytes obtaining a pointer to the fifo backing
buffer.

In addition, it implements fifo8_num_free() and fifo8_num_used() which
allow to check if a multi-byte operation can be performed.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>