]> Git Repo - qemu.git/log
qemu.git
7 years agoqemu.py: use os.path.null instead of /dev/null
Amador Pahim [Fri, 1 Sep 2017 11:28:19 +0000 (13:28 +0200)]
qemu.py: use os.path.null instead of /dev/null

For increased portability, let's use os.path.devnull.

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20170901112829[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: avoid writing to stdout/stderr
Amador Pahim [Fri, 1 Sep 2017 11:28:18 +0000 (13:28 +0200)]
qemu.py: avoid writing to stdout/stderr

This module should not write directly to stdout/stderr. Instead, it
should either raise exceptions or just log the messages and let the
callers handle them and decide what to do. For example, scripts could
choose to send the log messages stderr or/and write them to a file if
verbose or debugging mode is enabled.

This patch replaces the writes to stderr by an exception in the
send_fd_scm() when _socket_scm_helper is not set or not present. In the
same method, the subprocess Popen will now redirect the stdout/stderr to
logging.debug instead of writing to system stderr. As consequence, since
the Popen.communicate() is now used (in order to get the stdout), the
further call to wait() became redundant and was replaced by
Popen.returncode.

The shutdown() message on negative exit code will now be logged
to logging.warn instead of written to system stderr.

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20170901112829[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: fix is_running() return before first launch()
Amador Pahim [Fri, 1 Sep 2017 11:28:17 +0000 (13:28 +0200)]
qemu.py: fix is_running() return before first launch()

is_running() returns None when called before the first time we
call launch():

    >>> import qemu
    >>> vm = qemu.QEMUMachine('qemu-system-x86_64')
    >>> vm.is_running()
    >>>

It should return False instead. This patch fixes that.

For consistence, this patch removes the parenthesis from the
second clause as it's not really needed.

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20170901112829[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqtest.py: Few pylint/style fixes
Lukáš Doktor [Fri, 18 Aug 2017 14:26:13 +0000 (16:26 +0200)]
qtest.py: Few pylint/style fixes

No actual code changes, just few pylint/style fixes.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqmp.py: Avoid overriding a builtin object
Lukáš Doktor [Fri, 18 Aug 2017 14:26:12 +0000 (16:26 +0200)]
qmp.py: Avoid overriding a builtin object

The "id" is a builtin method to get object's identity and should not be
overridden. This might bring some issues in case someone was directly
calling "cmd(..., id=id)" but I haven't found such usage on brief search
for "cmd\(.*id=".

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqmp.py: Avoid "has_key" usage
Lukáš Doktor [Fri, 18 Aug 2017 14:26:11 +0000 (16:26 +0200)]
qmp.py: Avoid "has_key" usage

The "has_key" is deprecated in favor of "__in__" operator.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqmp.py: Use object-based class for QEMUMonitorProtocol
Lukáš Doktor [Fri, 18 Aug 2017 14:26:10 +0000 (16:26 +0200)]
qmp.py: Use object-based class for QEMUMonitorProtocol

There is no need to define QEMUMonitorProtocol as old-style class.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqmp.py: Couple of pylint/style fixes
Lukáš Doktor [Fri, 18 Aug 2017 14:26:09 +0000 (16:26 +0200)]
qmp.py: Couple of pylint/style fixes

No actual code changes, just initializing attributes earlier to avoid
AttributeError on early introspection, a few pylint/style fixes and
docstring clarifications.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: Use custom exceptions rather than Exception
Lukáš Doktor [Fri, 18 Aug 2017 14:26:08 +0000 (16:26 +0200)]
qemu.py: Use custom exceptions rather than Exception

The naked Exception should not be widely used. It makes sense to be a
bit more specific and use better-suited custom exceptions. As a benefit
we can store the full reply in the exception in case someone needs it
when catching the exception.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20170818142613[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: Simplify QMP key-conversion
Lukáš Doktor [Fri, 18 Aug 2017 14:26:07 +0000 (16:26 +0200)]
qemu.py: Simplify QMP key-conversion

The QMP key conversion consist of '_'s to be replaced with '-'s, which
can easily be done by a single `str.replace` method which is faster and
does not require `string` module import.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20170818142613[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: Use iteritems rather than keys()
Lukáš Doktor [Fri, 18 Aug 2017 14:26:06 +0000 (16:26 +0200)]
qemu.py: Use iteritems rather than keys()

Let's avoid creating an in-memory list of keys and query for each value
and use `iteritems` which is an iterator of key-value pairs.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170818142613[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu|qtest: Avoid dangerous arguments
Lukáš Doktor [Fri, 18 Aug 2017 14:26:05 +0000 (16:26 +0200)]
qemu|qtest: Avoid dangerous arguments

The list object is mutable in python and potentially might modify other
object's arguments when used as default argument. Reproducer:

    >>> vm1 = QEMUMachine("qemu")
    >>> vm2 = QEMUMachine("qemu")
    >>> vm1._wrapper.append("foo")
    >>> print vm2._wrapper
    ['foo']

In this case the `args` is actually copied so it would be safe to keep
it, but it's not a good practice to keep it. The same issue applies in
inherited qtest module.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-Id: <20170818142613[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqemu.py: Pylint/style fixes
Lukáš Doktor [Fri, 18 Aug 2017 14:26:04 +0000 (16:26 +0200)]
qemu.py: Pylint/style fixes

No actual code changes, just several pylint/style fixes and docstring
clarifications.

Signed-off-by: Lukáš Doktor <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-Id: <20170818142613[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/huth/tags/check-20170915' into staging
Peter Maydell [Fri, 15 Sep 2017 19:29:44 +0000 (20:29 +0100)]
Merge remote-tracking branch 'remotes/huth/tags/check-20170915' into staging

Some fixes and improvements for various qtests by Eric and me.

# gpg: Signature made Fri 15 Sep 2017 08:37:21 BST
# gpg:                using RSA key 0x2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth/tags/check-20170915:
  qtest: Avoid passing raw strings through hmp()
  libqtest: Remove dead qtest_instances variable
  numa-test: Use hmp()
  qtest: Don't perform side effects inside assertion
  test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code
  tests: Fix broken ivshmem-server-msi/-irq tests
  tests/libqtest: Use a proper error message if QTEST_QEMU_BINARY is missing
  tests/test-hmp: Remove puv3 and tricore_testboard from the blacklist
  tests: Introduce generic device hot-plug/hot-unplug functions

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20170915' into staging
Peter Maydell [Fri, 15 Sep 2017 18:00:16 +0000 (19:00 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20170915' into staging

ppc patch queue 2017-09-15

Here's the current batch of accumulated ppc patches.  These are all
pretty simple bugfixes or cleanups, no big new features here.

# gpg: Signature made Fri 15 Sep 2017 04:50:00 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <[email protected]>"
# gpg:                 aka "David Gibson (Red Hat) <[email protected]>"
# gpg:                 aka "David Gibson (ozlabs.org) <[email protected]>"
# gpg:                 aka "David Gibson (kernel.org) <[email protected]>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.11-20170915:
  ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()
  spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()
  spapr_cpu_core: cleaning up qdev_get_machine() calls
  spapr_pci: don't create 64-bit MMIO window if we don't need to
  spapr_pci: convert sprintf() to g_strdup_printf()
  spapr_cpu_core: fail gracefully with non-pseries machine types
  xics: fix several error leaks
  vfio, spapr: Fix levels calculation
  spapr_pci: handle FDT creation errors with _FDT()
  spapr_pci: use the common _FDT() helper
  spapr: fix CAS-generated reset
  ppc/xive: fix OV5_XIVE_EXPLOIT bits
  spapr: only update SDR1 once per-cpu during CAS
  spapr_pci: use g_strdup_printf()
  spapr_pci: drop useless check in spapr_populate_pci_child_dt()
  spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()
  hw/ppc/spapr.c: cleaning up qdev_get_machine() calls
  net: Add SunGEM device emulation as found on Apple UniNorth

Signed-off-by: Peter Maydell <[email protected]>
7 years agoqtest: Avoid passing raw strings through hmp()
Eric Blake [Mon, 11 Sep 2017 17:20:14 +0000 (12:20 -0500)]
qtest: Avoid passing raw strings through hmp()

hmp() passes its string argument through the sprintf() family;
with a proper attribute, gcc -Wformat warns us when we do something
dangerous like passing a non-constant format string.  Fortunately,
all our strings were safe, but checking whether the string can
contain an unintended % is easy to avoid and therefore worth doing.

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agolibqtest: Remove dead qtest_instances variable
Eric Blake [Mon, 11 Sep 2017 17:19:49 +0000 (12:19 -0500)]
libqtest: Remove dead qtest_instances variable

Prior to commit 063c23d9, we were tracking a list of parallel
qtest objects, in order to safely clean up a SIGABRT handler
only after the last connection quits.  But when we switched to
more of glib's infrastructure, the list became dead code that
is never assigned to.

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agonuma-test: Use hmp()
Eric Blake [Mon, 11 Sep 2017 17:19:47 +0000 (12:19 -0500)]
numa-test: Use hmp()

Don't open-code something that has a convenient helper available.

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agoqtest: Don't perform side effects inside assertion
Eric Blake [Mon, 11 Sep 2017 17:19:46 +0000 (12:19 -0500)]
qtest: Don't perform side effects inside assertion

Assertions should be separate from the side effects, since in
theory, g_assert() can be disabled (in practice, we can't really
ever do that).

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agotest-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code
Eric Blake [Mon, 11 Sep 2017 17:19:45 +0000 (12:19 -0500)]
test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code

Back when the test was introduced, in commit 62c39b307, the
test was set up to run qemu-ga directly on the host performing
the test, and defaults to limiting itself to safe commands.  At
the time, it was envisioned that setting QGA_TEST_SIDE_EFFECTING
in the environment could cover a few more commands, while noting
the potential danger of those side effects running in the host.

But this has NEVER been tested: if you enable the environment
variable, the test WILL fail.  One obvious reason: if you are not
running as root, you'll probably get a permission failure when
trying to freeze the file systems, or when changing system time.
Less obvious: if you run the test as root (wow, you're brave), you
could end up hanging if the test tries to log things to a
temporarily frozen filesystem.  But the cutest reason of all: if
you get past the above hurdles, the test uses invalid JSON in
test_qga_fstrim() (missing '' around the dictionary key 'minimum'),
and will thus fail an assertion in qmp_fd().

Rather than leave this untested time-bomb in place, rip it out.
Hopefully, as originally envisioned, we can find an opportunity
to test an actual sandboxed guest where the guest-agent has
full permissions and will not unduly affect the host running
the test - if so, 'git revert' can be used if desired, for
salvaging any useful parts of this attempt.

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agotests: Fix broken ivshmem-server-msi/-irq tests
Thomas Huth [Tue, 29 Aug 2017 17:03:51 +0000 (19:03 +0200)]
tests: Fix broken ivshmem-server-msi/-irq tests

Broken with commit b4ba67d9a7025 ("libqos: Change PCI accessors to take
opaque BAR handle") a while ago, but nobody noticed since the tests are
not run by default: The msix_pba_bar is not correctly initialized
anymore if bir_pba has the same value as bir_table. With this fix,
"make check SPEED=slow" should work fine again.

Fixes: b4ba67d9a702507793c2724e56f98e9b0f7be02b
Tested-by: Cornelia Huck <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agotests/libqtest: Use a proper error message if QTEST_QEMU_BINARY is missing
Thomas Huth [Mon, 28 Aug 2017 10:25:45 +0000 (12:25 +0200)]
tests/libqtest: Use a proper error message if QTEST_QEMU_BINARY is missing

The user can currently still cause an abort() if running certain tests
(like the prom-env-test) without setting the QTEST_QEMU_BINARY first.
A similar problem has been fixed with commit 7c933ad61b8f3f51337
already, but forgot to also take care of the qtest_get_arch() function,
so let's introduce a proper wrapper around getenv("QTEST_QEMU_BINARY")
that can be used in both locations now.

Buglink: https://bugs.launchpad.net/qemu/+bug/1713434
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: John Snow <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agotests/test-hmp: Remove puv3 and tricore_testboard from the blacklist
Thomas Huth [Thu, 24 Aug 2017 05:00:11 +0000 (07:00 +0200)]
tests/test-hmp: Remove puv3 and tricore_testboard from the blacklist

The problem with puv3 has been fixed with 0ac241bcf9f9d99a252a352a162f
('unicore32: abort when entering "x 0" on the monitor') and the problem
with tricore_testboard has been fixed with b190f477e29c7cd03a8fee49c96d
('qemu-system-tricore: segfault when entering "x 0" on the monitor').

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agotests: Introduce generic device hot-plug/hot-unplug functions
Thomas Huth [Tue, 15 Aug 2017 06:58:54 +0000 (08:58 +0200)]
tests: Introduce generic device hot-plug/hot-unplug functions

A lot of tests provide code for adding and removing a device via the
device_add and device_del QMP commands. Maintaining this code in so many
places is cumbersome and error-prone (some of the code parts check the
responses for device deletion in an incorrect way, for example, we've got
to deal with both, error code and DEVICE_DEL event here). So let's provide
some proper generic functions for adding and removing a device instead.

The code for correctly unplugging a device has been taken from a patch
from Peter Xu.

Reviewed-by: Peter Xu <[email protected]>
Tested-by: Peter Xu <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
7 years agoppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()
Greg Kurz [Thu, 14 Sep 2017 10:48:04 +0000 (12:48 +0200)]
ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()

If the host has both KVM PR and KVM HV loaded and we pass:

-machine pseries,accel=kvm,kvm-type=PR

the kvmppc_is_pr() returns false instead of true. Since the helper
is mostly used as fallback, it doesn't have any real impact with
recent kernels. A notable exception is the workaround to allow
migration between compatible hosts with different PVRs (eg, POWER8
and POWER8E), since KVM still doesn't provide a way to check if a
specific PVR is supported (see commit c363a37a450f for details).

According to the official KVM API documentation [1], KVM_PPC_GET_PVINFO
is "vm ioctl", but we check it as a global ioctl. The following function
in KVM is hence called with kvm == NULL and considers we're in HV mode.

int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
{
int r;
/* Assume we're using HV mode when the HV module is loaded */
int hv_enabled = kvmppc_hv_ops ? 1 : 0;

if (kvm) {
/*
 * Hooray - we know which VM type we're running on. Depend on
 * that rather than the guess above.
 */
hv_enabled = is_kvmppc_hv_enabled(kvm);
}

Let's use kvm_vm_check_extension() to fix the issue.

[1] https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()
Greg Kurz [Tue, 12 Sep 2017 18:48:05 +0000 (20:48 +0200)]
spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()

QTAILQ_FOREACH_SAFE() must be used when removing the current element
inside the loop block.

This fixes a user-after-free error introduced by commit 56258174238eb
and reported by Coverity (CID 1381017).

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_cpu_core: cleaning up qdev_get_machine() calls
Greg Kurz [Tue, 12 Sep 2017 06:51:21 +0000 (08:51 +0200)]
spapr_cpu_core: cleaning up qdev_get_machine() calls

This patch removes the qdev_get_machine() calls that are made
in spapr_cpu_core.c in situations where we can get an existing
pointer for the MachineState by either passing it as an argument
to the function or by using other already available pointers.

Credits to Daniel Henrique Barboza for the idea and the changelog
text.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: don't create 64-bit MMIO window if we don't need to
Greg Kurz [Mon, 11 Sep 2017 10:14:19 +0000 (12:14 +0200)]
spapr_pci: don't create 64-bit MMIO window if we don't need to

When running a pseries-2.2 or older machine type, we get the following
lines in info mtree:

address-space: memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
 pci@800000020000000.mmio64-alias @pci@800000020000000.mmio
  ffffffffffffffff-ffffffffffffffff

address-space: cpu-memory
...
ffffffffffffffff-ffffffffffffffff (prio 0, i/o): alias
 pci@800000020000000.mmio64-alias @pci@800000020000000.mmio
  ffffffffffffffff-ffffffffffffffff

The same thing occurs when running a pseries-2.7 with

    -global spapr-pci-host-bridge.mem_win_size=2147483648

This happens because we always create a 64-bit MMIO window, even if
we didn't explicitely requested it (ie, mem64_win_size == 0) and the
32-bit window is below 2GiB. It doesn't seem to have an impact on the
guest though because spapr_populate_pci_dt() doesn't advertise the
bogus windows when mem64_win_size == 0.

Since these memory regions don't induce any state, we can safely
choose to not create them when their address is equal to -1,
without breaking migration from existing setups.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: convert sprintf() to g_strdup_printf()
Greg Kurz [Mon, 11 Sep 2017 10:14:12 +0000 (12:14 +0200)]
spapr_pci: convert sprintf() to g_strdup_printf()

In order to follow a QEMU common practice.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_cpu_core: fail gracefully with non-pseries machine types
Greg Kurz [Mon, 11 Sep 2017 20:52:06 +0000 (22:52 +0200)]
spapr_cpu_core: fail gracefully with non-pseries machine types

Since commit 7cca3e466eb0 ("ppc: spapr: Move VCPU ID calculation into
sPAPR"), QEMU aborts when started with a *-spapr-cpu-core device and
a non-pseries machine.

Let's rely on the already existing call to object_dynamic_cast() instead
of using the SPAPR_MACHINE() macro.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoxics: fix several error leaks
Greg Kurz [Mon, 11 Sep 2017 22:04:40 +0000 (00:04 +0200)]
xics: fix several error leaks

If object_property_get_link() fails then it allocates an error, which
must be freed before returning. The error_get_pretty() function is
merely an accessor to the error message and doesn't free anything.

The error.h header indicates how to do it right:

 * Pass an existing error to the caller with the message modified:
 *     error_propagate(errp, err);
 *     error_prepend(errp, "Could not frobnicate '%s': ", name);

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agovfio, spapr: Fix levels calculation
Alexey Kardashevskiy [Tue, 12 Sep 2017 02:53:07 +0000 (12:53 +1000)]
vfio, spapr: Fix levels calculation

The existing tries to round up the number of pages but @pages is always
calculated as the rounded up value minus one  which makes ctz64() always
return 0 and have create.levels always set 1.

This removes wrong "-1" and allows having more than 1 levels. This becomes
handy for >128GB guests with standard 64K pages as this requires blocks
with zone order 9 and the popular limit of CONFIG_FORCE_MAX_ZONEORDER=9
means that only blocks up to order 8 are allowed.

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: handle FDT creation errors with _FDT()
Greg Kurz [Sat, 9 Sep 2017 15:06:33 +0000 (17:06 +0200)]
spapr_pci: handle FDT creation errors with _FDT()

libfdt failures when creating the FDT should cause QEMU to terminate.

Let's use the _FDT() macro which does just that instead of propagating
the error to the caller. spapr_populate_pci_child_dt() no longer needs
to return a value in this case.

Note that, on the way, this get rids of the following nonsensical lines:

    g_assert(!ret);
    if (ret) {

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: use the common _FDT() helper
Greg Kurz [Sat, 9 Sep 2017 15:06:25 +0000 (17:06 +0200)]
spapr_pci: use the common _FDT() helper

All other users in hw/ppc already consider an error when building
the FDT to be fatal, even on hotplug paths. There's no valid reason
for spapr_pci to behave differently. So let's used the common _FDT()
helper which terminates QEMU when libfdt fails.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: fix CAS-generated reset
Cédric Le Goater [Fri, 8 Sep 2017 14:33:43 +0000 (16:33 +0200)]
spapr: fix CAS-generated reset

The OV5_MMU_RADIX_300 requires special handling in the CAS negotiation
process. It is cleared from the option vector of the guest before
evaluating the changes and re-added later. But, when testing for a
possible CAS reset :

    spapr->cas_reboot = spapr_ovec_diff(ov5_updates,
                                        ov5_cas_old, spapr->ov5_cas);

the bit OV5_MMU_RADIX_300 will each time be seen as removed from the
previous OV5 set, hence generating a reset loop.

Fix this problem by also clearing the same bit in the ov5_cas_old set.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc/xive: fix OV5_XIVE_EXPLOIT bits
Cédric Le Goater [Fri, 8 Sep 2017 14:33:42 +0000 (16:33 +0200)]
ppc/xive: fix OV5_XIVE_EXPLOIT bits

On POWER9, the Client Architecture Support (CAS) negotiation process
determines whether the guest operates in XIVE Legacy compatibility or
in XIVE exploitation mode. Now that we have initial guest support for
the XIVE interrupt controller, let's fix the bits definition which have
evolved in the latest specs.

The platform advertises the XIVE Exploitation Mode support using the
property "ibm,arch-vec-5-platform-support-vec-5", byte 23 bits 0-1 :

 - 0b00 XIVE legacy mode Only
 - 0b01 XIVE exploitation mode Only
 - 0b10 XIVE legacy or exploitation mode

The OS asks for XIVE Exploitation Mode support using the property
"ibm,architecture-vec-5", byte 23 bits 0-1:

 - 0b00 XIVE legacy mode Only
 - 0b01 XIVE exploitation mode Only

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: only update SDR1 once per-cpu during CAS
Greg Kurz [Mon, 4 Sep 2017 21:46:55 +0000 (23:46 +0200)]
spapr: only update SDR1 once per-cpu during CAS

Commit b55d295e3ec9 added the possibility to support HPT resizing with KVM.
In the case of PR, we need to pass the userspace address of the HPT to KVM
using the SDR1 slot.
This is handled by kvmppc_update_sdr1() which uses CPU_FOREACH() to update
all CPUs. It is hence not needed to call kvmppc_update_sdr1() for each CPU.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: use g_strdup_printf()
Greg Kurz [Sat, 9 Sep 2017 15:06:18 +0000 (17:06 +0200)]
spapr_pci: use g_strdup_printf()

Building strings with g_strdup_printf() instead of snprintf() is
a QEMU common practice.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: drop useless check in spapr_populate_pci_child_dt()
Greg Kurz [Sat, 9 Sep 2017 15:06:10 +0000 (17:06 +0200)]
spapr_pci: drop useless check in spapr_populate_pci_child_dt()

spapr_phb_get_loc_code() either returns a non-null pointer, or aborts
if g_strdup_printf() failed to allocate memory.

Signed-off-by: Greg Kurz <[email protected]>
[dwg: Grammatical fix to commit message]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()
Greg Kurz [Sat, 9 Sep 2017 15:06:02 +0000 (17:06 +0200)]
spapr_pci: drop useless check in spapr_phb_vfio_get_loc_code()

g_strdup_printf() either returns a non-null pointer, or aborts if it
failed to allocate memory.

Signed-off-by: Greg Kurz <[email protected]>
[dwg: Grammatical fix to commit message]
Acked-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/ppc/spapr.c: cleaning up qdev_get_machine() calls
Daniel Henrique Barboza [Wed, 6 Sep 2017 18:43:05 +0000 (15:43 -0300)]
hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

This patch removes the qdev_get_machine() calls that are made in
spapr.c in situations where we can get an existing pointer for
the MachineState by either passing it as an argument to the function
or by using other already available pointers.

The following changes were made:

- spapr_node0_size: static function that is called two times:
at spapr_setup_hpt_and_vrma and ppc_spapr_init. In both cases we can
pass an existing MachineState pointer to it.

- spapr_build_fdt: MachineState pointer can be retrieved from
the existing sPAPRMachineState pointer.

- spapr_boot_set: the opaque in the first arg is a sPAPRMachineState
pointer as we can see inside ppc_spapr_init:

    qemu_register_boot_set(spapr_boot_set, spapr);

We can get a MachineState pointer from it.

- spapr_machine_device_plug and spapr_machine_device_unplug_request: the
MachineState, sPAPRMachineState, MachineClass and sPAPRMachineClass pointers
can all be retrieved from the HotplugHandler pointer.

Signed-off-by: Daniel Henrique Barboza <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agonet: Add SunGEM device emulation as found on Apple UniNorth
Benjamin Herrenschmidt [Wed, 6 Sep 2017 18:19:55 +0000 (19:19 +0100)]
net: Add SunGEM device emulation as found on Apple UniNorth

This adds a simplistic emulation of the Sun GEM ethernet controller
found in Apple ASICs.

Currently we only support the Apple UniNorth 1.x variant, but the
other Apple or Sun variants should mostly be a matter of adding
PCI IDs options.

We have a very primitive emulation of a single Broadcom 5201 PHY
which is supported by the MacOS driver.

This model brings out-of-the-box networking to MacOS 9, and all
versions of OS X I tried with the mac99 platform.

Further improvements from Mark:
- Remove sungem.h file, moving constants into sungem.c as required
- Switch to using tracepoints for debugging
- Split register blocks into separate memory regions
- Use arrays in SunGEMState to hold register values
- Add state-saving support

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Mark Cave-Ayland <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170914' into...
Peter Maydell [Thu, 14 Sep 2017 17:54:09 +0000 (18:54 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170914' into staging

target-arm queue:
 * v7M: various code cleanups
 * v7M: set correct BFSR bits on bus fault
 * v7M: clear exclusive monitor on reset and exception entry/exit
 * v7M: don't apply priority mask to negative priorities
 * zcu102: support 'secure' and 'virtualization' machine properties
 * aarch64: fix ERET single stepping
 * gpex: implement PCI INTx routing
 * mps2-an511: fix UART overflow interrupt line wiring

# gpg: Signature made Thu 14 Sep 2017 18:50:48 BST
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20170914:
  mps2-an511: Fix wiring of UART overflow interrupt lines
  hw/pci-host/gpex: Implement PCI INTx routing
  hw/arm/virt: Set INTx/gsi mapping
  hw/pci-host/gpex: Set INTx index/gsi mapping
  target/arm: Avoid an extra temporary for store_exclusive
  AArch64: Fix single stepping of ERET instruction
  xlnx-zcu102: Mark the EP108 machine as deprecated
  xlnx-zcu102: Add a machine level virtualization property
  xlnx-zcu102: Add a machine level secure property
  xlnx-zcu102: Manually create the machines
  xlnx-ep108: Rename to ZCU102
  target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit()
  target/arm: Add and use defines for EXCRET constants
  target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit()
  nvic: Don't apply group priority mask to negative priorities
  target/arm: Get PRECISERR and IBUSERR the right way round
  target/arm: Clear exclusive monitor on v7M reset, exception entry/exit
  target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2

Signed-off-by: Peter Maydell <[email protected]>
7 years agomps2-an511: Fix wiring of UART overflow interrupt lines
Peter Maydell [Thu, 14 Sep 2017 17:43:19 +0000 (18:43 +0100)]
mps2-an511: Fix wiring of UART overflow interrupt lines

Fix an error that meant we were wiring every UART's overflow
interrupts into the same inputs 0 and 1 of the OR gate,
rather than giving each its own input.

Cc: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-id: 1505232834[email protected]

7 years agohw/pci-host/gpex: Implement PCI INTx routing
Pranavkumar Sawargaonkar [Thu, 14 Sep 2017 17:43:19 +0000 (18:43 +0100)]
hw/pci-host/gpex: Implement PCI INTx routing

Now we are able to retrieve the gsi from the INTx pin, let's
enable intx_to_irq routing. From that point on, irqfd becomes
usable along with INTx when assigning a PCIe device.

Signed-off-by: Pranavkumar Sawargaonkar <[email protected]>
Signed-off-by: Tushar Jagad <[email protected]>
Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Tested-by: Feng Kan <[email protected]>
Message-id: 1505296004[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agohw/arm/virt: Set INTx/gsi mapping
Pranavkumar Sawargaonkar [Thu, 14 Sep 2017 17:43:19 +0000 (18:43 +0100)]
hw/arm/virt: Set INTx/gsi mapping

Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
needed for INTx/gsi routing.

Signed-off-by: Pranavkumar Sawargaonkar <[email protected]>
Signed-off-by: Tushar Jagad <[email protected]>
Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Tested-by: Feng Kan <[email protected]>
Message-id: 1505296004[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agohw/pci-host/gpex: Set INTx index/gsi mapping
Pranavkumar Sawargaonkar [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
hw/pci-host/gpex: Set INTx index/gsi mapping

To implement INTx to gsi routing we need to pass the gpex host
bridge the gsi associated to each INTx index. Let's introduce
irq_num array and gpex_set_irq_num setter function.

Signed-off-by: Pranavkumar Sawargaonkar <[email protected]>
Signed-off-by: Tushar Jagad <[email protected]>
Signed-off-by: Eric Auger <[email protected]>
Tested-by: Feng Kan <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1505296004[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Avoid an extra temporary for store_exclusive
Richard Henderson [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
target/arm: Avoid an extra temporary for store_exclusive

Instead of copying addr to a local temp, reuse the value (which we
have just compared as equal) already saved in cpu_exclusive_addr.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-id: 20170908163859[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoAArch64: Fix single stepping of ERET instruction
Jaroslaw Pelczar [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
AArch64: Fix single stepping of ERET instruction

Previously when single stepping through ERET instruction via GDB
would result in debugger entering the "next" PC after ERET instruction.
When debugging in kernel mode, this will also cause unintended behavior,
because debugger will try to access memory from EL0 point of view.

Signed-off-by: Jaroslaw Pelczar <[email protected]>
Message-id: 001c01d32895$483027f0$d89077d0[email protected]
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxlnx-zcu102: Mark the EP108 machine as deprecated
Alistair Francis [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
xlnx-zcu102: Mark the EP108 machine as deprecated

The EP108 is the same as the ZCU102, mark it as deprecated as we don't
need two machines.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxlnx-zcu102: Add a machine level virtualization property
Alistair Francis [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
xlnx-zcu102: Add a machine level virtualization property

Add a machine level virtualization property. This defaults to false and can be
set to true using this machine command line argument:
    -machine xlnx-zcu102,virtualization=on

This follows what the ARM virt machine does.

This property only applies to the ZCU102 machine. The EP108 machine does
not have this property.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxlnx-zcu102: Add a machine level secure property
Alistair Francis [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
xlnx-zcu102: Add a machine level secure property

Add a machine level secure property. This defaults to false and can be
set to true using this machine command line argument:
    -machine xlnx-zcu102,secure=on

This follows what the ARM virt machine does.

This property only applies to the ZCU102 machine. The EP108 machine does
not have this property.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxlnx-zcu102: Manually create the machines
Alistair Francis [Thu, 14 Sep 2017 17:43:18 +0000 (18:43 +0100)]
xlnx-zcu102: Manually create the machines

In preperation for future work let's manually create the Xilnx machines.
This will allow us to set properties for the machines in the future.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxlnx-ep108: Rename to ZCU102
Alistair Francis [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
xlnx-ep108: Rename to ZCU102

The EP108 is a early access development board. Now that silicon is in
production people have access to the ZCU102. Let's rename the internal
QEMU files and variables to use the ZCU102.

There is no functional change here as the EP108 is still a valid board
option.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Rename 'type' to 'excret' in do_v7m_exception_exit()
Peter Maydell [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit()

In the v7M and v8M ARM ARM, the magic exception return values are
referred to as EXC_RETURN values, and in QEMU we use V7M_EXCRET_*
constants to define bits within them. Rename the 'type' variable
which holds the exception return value in do_v7m_exception_exit()
to excret, making it clearer that it does hold an EXC_RETURN value.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1505137930[email protected]

7 years agotarget/arm: Add and use defines for EXCRET constants
Peter Maydell [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
target/arm: Add and use defines for EXCRET constants

The exception-return magic values get some new bits in v8M, which
makes some bit definitions for them worthwhile.

We don't use the bit definitions for the switch on the low bits
which checks the return type for v7M, because this is defined
in the v7M ARM ARM as a set of valid values rather than via
per-bit checks.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-id: 1505137930[email protected]

7 years agotarget/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit()
Peter Maydell [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit()

In do_v7m_exception_exit(), there's no need to force the high 4
bits of 'type' to 1 when calling v7m_exception_taken(), because
we know that they're always 1 or we could not have got to this
"handle return to magic exception return address" code. Remove
the unnecessary ORs.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Acked-by: Alistair Francis <[email protected]>
Message-id: 1505137930[email protected]

7 years agonvic: Don't apply group priority mask to negative priorities
Peter Maydell [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
nvic: Don't apply group priority mask to negative priorities

In several places we were unconditionally applying the
nvic_gprio_mask() to a priority value. This is incorrect
if the priority is one of the fixed negative priority
values (for NMI and HardFault), so don't do it.

This bug would have caused both NMI and HardFault to be
considered as the same priority and so NMI wouldn't
correctly preempt HardFault.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1505137930[email protected]

7 years agotarget/arm: Get PRECISERR and IBUSERR the right way round
Peter Maydell [Thu, 14 Sep 2017 17:43:17 +0000 (18:43 +0100)]
target/arm: Get PRECISERR and IBUSERR the right way round

For a bus fault, the M profile BFSR bit PRECISERR means a bus
fault on a data access, and IBUSERR means a bus fault on an
instruction access. We had these the wrong way around; fix this.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1505137930[email protected]

7 years agotarget/arm: Clear exclusive monitor on v7M reset, exception entry/exit
Peter Maydell [Thu, 14 Sep 2017 17:43:16 +0000 (18:43 +0100)]
target/arm: Clear exclusive monitor on v7M reset, exception entry/exit

For M profile we must clear the exclusive monitor on reset, exception
entry and exception exit.  We weren't doing any of these things; fix
this bug.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1505137930[email protected]

7 years agotarget/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
Peter Maydell [Thu, 14 Sep 2017 17:43:16 +0000 (18:43 +0100)]
target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2

Use a symbolic constant M_REG_NUM_BANKS for the array size for
registers which are banked by M profile security state, rather
than hardcoding lots of 2s.

Suggested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Message-id: 1505137930[email protected]

7 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging
Peter Maydell [Thu, 14 Sep 2017 15:33:02 +0000 (16:33 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging

HMP pull 2017-09-14

# gpg: Signature made Thu 14 Sep 2017 15:57:30 BST
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <[email protected]>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20170914:
  hmp: introduce 'info memory_size_summary' command
  qmp: introduce query-memory-size-summary command
  hmp: extend "info numa" with hotplugged memory information
  tests/hmp: test "none" machine with memory
  dump: do not dump non-existent guest memory
  hmp: fix "dump-quest-memory" segfault (arm)
  hmp: fix "dump-quest-memory" segfault (ppc)

Signed-off-by: Peter Maydell <[email protected]>
7 years agohmp: introduce 'info memory_size_summary' command
Vadim Galitsyn [Tue, 29 Aug 2017 15:30:22 +0000 (17:30 +0200)]
hmp: introduce 'info memory_size_summary' command

Add 'info memory_size_summary' command which is a sibling
of QMP command query-memory-size-summary. It provides the
following memory information in bytes:

  * base-memory - size of "base" memory specified with command line option -m.

  * plugged-memory - amount of memory that was hot-plugged.
    If target does not have CONFIG_MEM_HOTPLUG enabled, no
    value is reported.

Signed-off-by: Vasilis Liaskovitis <[email protected]>
Signed-off-by: Mohammed Gamal <[email protected]>
Signed-off-by: Eduardo Otubo <[email protected]>
Signed-off-by: Vadim Galitsyn <[email protected]>
Reviewed-by: Eugene Crosser <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: [email protected]
Message-Id: <20170829153022[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  Fixed up comments from Igor's review

7 years agoqmp: introduce query-memory-size-summary command
Vadim Galitsyn [Tue, 29 Aug 2017 15:30:21 +0000 (17:30 +0200)]
qmp: introduce query-memory-size-summary command

Add a new query-memory-size-summary command which provides the
following memory information in bytes:

  * base-memory - size of "base" memory specified with command line option -m.

  * plugged-memory - amount of memory that was hot-plugged.
    If target does not have CONFIG_MEM_HOTPLUG enabled, no
    value is reported.

Signed-off-by: Vasilis Liaskovitis <[email protected]>
Signed-off-by: Mohammed Gamal <[email protected]>
Signed-off-by: Eduardo Otubo <[email protected]>
Signed-off-by: Vadim Galitsyn <[email protected]>
Reviewed-by: Eugene Crosser <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: [email protected]
Message-Id: <20170829153022[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  Fixup comments as per Igor's review
  Added 'of' from Vadim's reply

7 years agohmp: extend "info numa" with hotplugged memory information
Vadim Galitsyn [Tue, 29 Aug 2017 15:30:20 +0000 (17:30 +0200)]
hmp: extend "info numa" with hotplugged memory information

Report amount of hotplugged memory in addition to total
amount per NUMA node.

Signed-off-by: Vadim Galitsyn <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: [email protected]
Message-Id: <20170829153022[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agotests/hmp: test "none" machine with memory
Laurent Vivier [Wed, 13 Sep 2017 14:20:36 +0000 (16:20 +0200)]
tests/hmp: test "none" machine with memory

and add a test case of dump-guest-memory without
"[begin length]" parameters.

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-Id: <20170913142036[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agodump: do not dump non-existent guest memory
Cornelia Huck [Wed, 13 Sep 2017 14:20:35 +0000 (16:20 +0200)]
dump: do not dump non-existent guest memory

It does not really make sense to dump memory that is not there.

Moreover, that fixes a segmentation fault when calling dump-guest-memory
with no filter for a machine with no memory defined.

New behaviour is:

(qemu) dump-guest-memory /dev/null
dump: no guest memory to dump
(qemu) dump-guest-memory /dev/null 0 4096
dump: no guest memory to dump

Signed-off-by: Cornelia Huck <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Message-Id: <20170913142036[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agohmp: fix "dump-quest-memory" segfault (arm)
Laurent Vivier [Wed, 13 Sep 2017 14:20:34 +0000 (16:20 +0200)]
hmp: fix "dump-quest-memory" segfault (arm)

Running QEMU with
    qemu-system-aarch64 -M none -nographic -m 256
and executing
    dump-guest-memory /dev/null 0 8192
results in segfault

Fix by checking if we have CPU, and exit with
error if there is no CPU:

    (qemu) dump-guest-memory /dev/null
    this feature or command is not currently supported

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Message-Id: <20170913142036[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Tested-by: Eric Auger <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agohmp: fix "dump-quest-memory" segfault (ppc)
Laurent Vivier [Wed, 13 Sep 2017 14:20:33 +0000 (16:20 +0200)]
hmp: fix "dump-quest-memory" segfault (ppc)

Running QEMU with
    qemu-system-ppc64 -M none -nographic -m 256
and executing
    dump-guest-memory /dev/null 0 8192
results in segfault

Fix by checking if we have CPU, and exit with
error if there is no CPU:

    (qemu) dump-guest-memory /dev/null
    this feature or command is not currently supported

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20170913142036[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/usb-20170913-pull-request' into...
Peter Maydell [Thu, 14 Sep 2017 14:49:30 +0000 (15:49 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20170913-pull-request' into staging

usb: misc small fixes.

# gpg: Signature made Wed 13 Sep 2017 10:28:25 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20170913-pull-request:
  usb: only build usb-host with CONFIG_USB=y
  usb: drop HOST_USB
  MAINTAINERS: add missing USB entry
  xhci: Avoid DMA when ERSTBA is set to zero

Signed-off-by: Peter Maydell <[email protected]>
7 years agosparc: Fix typedef clash
Dr. David Alan Gilbert [Thu, 14 Sep 2017 12:36:09 +0000 (13:36 +0100)]
sparc: Fix typedef clash

Older compilers (rhel6) don't like redefinition of typedefs

Fixes: 12a6c15ef31c98ecefa63e91ac36955383038384
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170914123609[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20170913-pull-request' into...
Peter Maydell [Thu, 14 Sep 2017 12:44:17 +0000 (13:44 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170913-pull-request' into staging

ui: console fixes
drop pixman submodule

# gpg: Signature made Wed 13 Sep 2017 09:40:34 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20170913-pull-request:
  console: add question-mark escape operator
  console: fix dpy_gfx_replace_surface assert
  pixman: drop configure switches
  pixman: drop submodule

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/vga-20170913-pull-request' into...
Peter Maydell [Thu, 14 Sep 2017 11:58:13 +0000 (12:58 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20170913-pull-request' into staging

vga: bugfixes.
qxl: chunked cursor support.

# gpg: Signature made Wed 13 Sep 2017 08:41:08 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/vga-20170913-pull-request:
  virtio-gpu: don't clear QemuUIInfo information on reset
  vga/migration: Update memory map in post_load
  qxl: add support for chunked cursors.
  qxl: drop mono cursor support
  vga: stop passing pointers to vga_draw_line* functions
  vga: fix display update region calculation (split screen)

Signed-off-by: Peter Maydell <[email protected]>
7 years agousb: only build usb-host with CONFIG_USB=y
Gerd Hoffmann [Fri, 8 Sep 2017 11:12:17 +0000 (13:12 +0200)]
usb: only build usb-host with CONFIG_USB=y

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Tested-by: Thomas Huth <[email protected]>
Message-id: 20170908111217[email protected]

7 years agousb: drop HOST_USB
Gerd Hoffmann [Fri, 8 Sep 2017 11:12:16 +0000 (13:12 +0200)]
usb: drop HOST_USB

Nowdays we use libusb for usb-host, so we don't have different code
for linux vs. bsd any more.  So there is little reason to have the
HOST_USB variable, we can just write things directly into the Makefile
and avoid a pointless indirection.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-id: 20170908111217[email protected]

7 years agoMAINTAINERS: add missing USB entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:24 +0000 (14:36 -0300)]
MAINTAINERS: add missing USB entry

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoxhci: Avoid DMA when ERSTBA is set to zero
Alexey Kardashevskiy [Mon, 11 Sep 2017 06:56:06 +0000 (16:56 +1000)]
xhci: Avoid DMA when ERSTBA is set to zero

The existing XHCI code reads the Event Ring Segment Table Base Address
Register (ERSTBA) every time when it is changed. However zero is its
default state so one would think that zero there means it is not in use.

This adds a check for ERSTBA in addition to the existing check for
the Event Ring Segment Table Size Register (ERSTSZ).

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Message-id: 20170911065606[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoconsole: add question-mark escape operator
Alexander Graf [Tue, 29 Aug 2017 11:38:18 +0000 (13:38 +0200)]
console: add question-mark escape operator

Some termcaps (found using SLES11SP1) use [? sequences. According to man
console_codes (http://linux.die.net/man/4/console_codes) the question mark
is a nop and should simply be ignored.

This patch does exactly that, rendering screen output readable when
outputting guest serial consoles to the graphical console emulator.

Signed-off-by: Alexander Graf <[email protected]>
Message-id: 20170829113818[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoconsole: fix dpy_gfx_replace_surface assert
Gerd Hoffmann [Wed, 6 Sep 2017 14:21:09 +0000 (16:21 +0200)]
console: fix dpy_gfx_replace_surface assert

virtio-gpu can trigger the assert added by commit "6905b93447 console:
add same surface replace pre-condition" in multihead setups (where
surface can be NULL for secondary displays).  Allow surface being NULL.

Fixes: 6905b93447a42e606dfd126b90f75f4cd3c6fe94
Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-id: 20170906142109[email protected]

7 years agopixman: drop configure switches
Gerd Hoffmann [Tue, 5 Sep 2017 14:01:16 +0000 (16:01 +0200)]
pixman: drop configure switches

Remove pixman switches from configure, should not be needed any more,
configure can figure by itself whenever pixman is needed or not.

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170905140116[email protected]

7 years agopixman: drop submodule
Gerd Hoffmann [Tue, 5 Sep 2017 14:01:15 +0000 (16:01 +0200)]
pixman: drop submodule

Drop pixman submodule and support for the "internal" pixman build.
pixman should be reasonably well established meanwhile so we don't
need the fallback submodule any more.  While being at it also drop
some #ifdefs for pixman versions older than what we require in
configure anyway.

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170905140116[email protected]

7 years agovirtio-gpu: don't clear QemuUIInfo information on reset
Gerd Hoffmann [Wed, 6 Sep 2017 14:20:58 +0000 (16:20 +0200)]
virtio-gpu: don't clear QemuUIInfo information on reset

Don't reset window layout information (passed via virtio_gpu_ui_info) on
device reset, so the user interface window layout will be kept intact
over reboots.  The head size and position was commented out already, so
this patch just drops the dead code.  Additionally the enabled head mask
must be kept so multihead setups work properly too.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1460595
Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-id: 20170906142058[email protected]

7 years agotcg/tci: do not use ldst label (never implemented)
Philippe Mathieu-Daudé [Mon, 11 Sep 2017 02:28:39 +0000 (23:28 -0300)]
tcg/tci: do not use ldst label (never implemented)

changed in 659ef5cbb893, this fixes building with --enable-tcg-interpreter:

/home/travis/build/qemu/qemu/tcg/tcg.c:116:14: error: ‘tcg_out_ldst_finalize’ used but never defined [-Werror]
 static bool tcg_out_ldst_finalize(TCGContext *s);
              ^

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Stefan Weil <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20170911022839[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging
Peter Maydell [Mon, 11 Sep 2017 10:44:30 +0000 (11:44 +0100)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging

Update OpenBIOS images

# gpg: Signature made Mon 11 Sep 2017 08:08:39 BST
# gpg:                using RSA key 0x5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <[email protected]>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-openbios-signed:
  Update OpenBIOS images to 314d4f8 built from submodule.

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.11-pull-request' into...
Peter Maydell [Mon, 11 Sep 2017 09:27:07 +0000 (10:27 +0100)]
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.11-pull-request' into staging

# gpg: Signature made Sun 10 Sep 2017 17:17:28 BST
# gpg:                using RSA key 0xF30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-2.11-pull-request:
  target/m68k: Switch fpu_rom from make_floatx80() to make_floatx80_init()

Signed-off-by: Peter Maydell <[email protected]>
7 years agoUpdate OpenBIOS images to 314d4f8 built from submodule.
Mark Cave-Ayland [Mon, 11 Sep 2017 06:43:34 +0000 (07:43 +0100)]
Update OpenBIOS images to 314d4f8 built from submodule.

Signed-off-by: Mark Cave-Ayland <[email protected]>
7 years agotarget/m68k: Switch fpu_rom from make_floatx80() to make_floatx80_init()
Kamil Rytarowski [Mon, 4 Sep 2017 21:23:06 +0000 (23:23 +0200)]
target/m68k: Switch fpu_rom from make_floatx80() to make_floatx80_init()

GCC 4.7.2 on SunOS reports that the values assigned to array members are not
real constants:

target/m68k/fpu_helper.c:32:5: error: initializer element is not constant
target/m68k/fpu_helper.c:32:5: error: (near initialization for 'fpu_rom[0]')
rules.mak:66: recipe for target 'target/m68k/fpu_helper.o' failed

Convert the array to make_floatx80_init() to fix it.
Replace floatx80_pi-like constants with make_floatx80_init() as they are
defined as make_floatx80().

This fixes build on SmartOS (Joyent).

Signed-off-by: Kamil Rytarowski <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20170904212306[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Fri, 8 Sep 2017 15:04:42 +0000 (16:04 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, pci, virtio: patches queued before 2.10

A bunch of stuff that was posted before the 2.10 timeframe,
mostly fixes/cleanups.  New PCI bridges.

Signed-off-by: Michael S. Tsirkin <[email protected]>
# gpg: Signature made Fri 08 Sep 2017 14:15:34 BST
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <[email protected]>"
# gpg:                 aka "Michael S. Tsirkin <[email protected]>"
# 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:
  fw_cfg: rename read callback
  pci: add reserved slot check to do_pci_register_device()
  pci: move check for existing devfn into new pci_bus_devfn_available() helper
  vmgenid: replace x-write-pointer-available hack
  vhost-user-bridge: fix resume regression (since 2.9)
  libvhost-user: support resuming vq->last_avail_idx based on used_idx
  acpi/vmgenid: change device category to misc
  intel_iommu: fix missing BQL in pt fast path
  docs: update documentation considering PCIE-PCI bridge
  hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port
  hw/pci: introduce bridge-only vendor-specific capability to provide some hints to firmware
  hw/pci: introduce pcie-pci-bridge device
  Revert "ACPI: don't call acpi_pcihp_device_plug_cb on xen"
  hw/acpi: Move acpi_set_pci_info to pcihp
  hw/acpi: Limit hotplug to root bus on legacy mode
  pc: add 2.11 machine types
  vhost: Release memory references on cleanup

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20170908' into staging
Peter Maydell [Fri, 8 Sep 2017 13:44:44 +0000 (14:44 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20170908' into staging

ppc patch queue 2017-09-08

This is the first batch of ppc related patches for qemu-2.11, and it's
accumulated quite a few things.  Includes:

  * A cleanup to handling of ppc cpu models from Igor
  * First parts of fixes to handling of guest vs. host SMT modes from
    Sam Bobroff
  * Preliminary patches towards supporting the Sam460 board from
    Balaton Zoltan
  * Several fixes for hotplug logic
  * Assorted other fixes and cleanups

# gpg: Signature made Fri 08 Sep 2017 06:28:42 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <[email protected]>"
# gpg:                 aka "David Gibson (Red Hat) <[email protected]>"
# gpg:                 aka "David Gibson (ozlabs.org) <[email protected]>"
# gpg:                 aka "David Gibson (kernel.org) <[email protected]>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.11-20170908: (40 commits)
  ppc: spapr: Move VCPU ID calculation into sPAPR
  ppc: remove non implemented cpu models
  ppc: drop caching ObjectClass from PowerPCCPUAlias
  ppc: simplify cpu model lookup by PVR
  ppc: replace inter-function cyclic dependency/recurssion with 2 simple lookups
  ppc: make cpu alias point only to real cpu models
  ppc: make cpu_model translation to type consistent
  ppc: use macros to make cpu type name from string literal
  target/ppc: Remove old STATUS file
  PPC: KVM: Support machine option to set VSMT mode
  spapr: fallback to raw mode if best compat mode cannot be set during CAS
  hw/nvram/spapr_nvram: Device can not be created by the users
  hw/ppc/spapr_cpu_core: Add a proper check for spapr machine
  ppc4xx: Export ECB and PLB emulation
  ppc4xx_i2c: Move to hw/i2c
  ppc4xx_i2c: QOMify
  ppc4xx: Split off 4xx I2C emulation from ppc405_uc to its own file
  ppc4xx: Make MAL emulation more generic
  ppc4xx: Move MAL from ppc405_uc to ppc4xx_devs
  spapr_iommu: Realloc guest visible TCE table when hot(un)plugging vfio-pci
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agofw_cfg: rename read callback
Marc-André Lureau [Mon, 7 Aug 2017 18:16:11 +0000 (20:16 +0200)]
fw_cfg: rename read callback

The callback is called on select.

Furthermore, the next patch introduced a new callback, so rename the
function type with a generic name.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: add reserved slot check to do_pci_register_device()
Mark Cave-Ayland [Sun, 16 Jul 2017 20:27:34 +0000 (21:27 +0100)]
pci: add reserved slot check to do_pci_register_device()

Add a new slot_reserved_mask bitmask to PCIBus indicating whether or not each
PCI slot on the bus is reserved. Ensure that it is initialised to zero to
maintain the existing behaviour that all slots are available by default, and
add the additional check with appropriate error reporting to
do_pci_register_device().

Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: move check for existing devfn into new pci_bus_devfn_available() helper
Mark Cave-Ayland [Sun, 16 Jul 2017 20:27:33 +0000 (21:27 +0100)]
pci: move check for existing devfn into new pci_bus_devfn_available() helper

Also touch up the logic in do_pci_register_device() accordingly.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovmgenid: replace x-write-pointer-available hack
Marc-André Lureau [Mon, 7 Aug 2017 16:45:13 +0000 (18:45 +0200)]
vmgenid: replace x-write-pointer-available hack

This compat property sole function is to prevent the device from being
instantiated. Instead of requiring an extra compat property, check if
fw_cfg has DMA enabled.

fw_cfg is a built-in device that is initialized very early by the
machine init code.  We have at least one other device that also
assumes fw_cfg_find() can be safely used on realize: pvpanic.

This has the additional benefit of handling other cases properly, like:

  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
  [boots normally]

Suggested-by: Eduardo Habkost <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Ben Warren <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovhost-user-bridge: fix resume regression (since 2.9)
Marc-André Lureau [Tue, 29 Aug 2017 15:27:51 +0000 (17:27 +0200)]
vhost-user-bridge: fix resume regression (since 2.9)

Commit e10e798c85c2331 switched to libvhost-user which lacked support
for resuming the avail_idx based on used_idx.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1485867

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agolibvhost-user: support resuming vq->last_avail_idx based on used_idx
Marc-André Lureau [Tue, 29 Aug 2017 15:27:50 +0000 (17:27 +0200)]
libvhost-user: support resuming vq->last_avail_idx based on used_idx

This is the same workaround as commit 523b018dde3b765, which was lost
with libvhost-user transition in commit e10e798c85c2331.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoacpi/vmgenid: change device category to misc
Yoni Bettan [Tue, 5 Sep 2017 08:46:34 +0000 (11:46 +0300)]
acpi/vmgenid: change device category to misc

Moved vmgenid from uncategorized to misc category in QEMU help menu

Signed-off-by: Yoni Bettan <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agointel_iommu: fix missing BQL in pt fast path
Peter Xu [Thu, 17 Aug 2017 05:56:14 +0000 (13:56 +0800)]
intel_iommu: fix missing BQL in pt fast path

In vtd_switch_address_space() we did the memory region switch, however
it's possible that the caller of it has not taken the BQL at all. Make
sure we have it.

CC: Paolo Bonzini <[email protected]>
CC: Jason Wang <[email protected]>
CC: Michael S. Tsirkin <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agodocs: update documentation considering PCIE-PCI bridge
Aleksandr Bezzubikov [Thu, 17 Aug 2017 23:36:50 +0000 (02:36 +0300)]
docs: update documentation considering PCIE-PCI bridge

Signed-off-by: Aleksandr Bezzubikov <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Tested-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agohw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port
Aleksandr Bezzubikov [Thu, 17 Aug 2017 23:36:49 +0000 (02:36 +0300)]
hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port

To enable hotplugging of a newly created pcie-pci-bridge,
we need to tell firmware (e.g. SeaBIOS) to reserve
additional buses or IO/MEM/PREF space for pcie-root-port.
Additional bus reservation allows us to hotplug pcie-pci-bridge into this root port.
The number of buses and IO/MEM/PREF space to reserve are provided to the device via
a corresponding property, and to the firmware via new PCI capability.
The properties' default values are -1 to keep default behavior unchanged.

Signed-off-by: Aleksandr Bezzubikov <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Tested-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agohw/pci: introduce bridge-only vendor-specific capability to provide some hints to...
Aleksandr Bezzubikov [Thu, 17 Aug 2017 23:36:48 +0000 (02:36 +0300)]
hw/pci: introduce bridge-only vendor-specific capability to provide some hints to firmware

On PCI init PCI bridges may need some extra info about bus number,
IO, memory and prefetchable memory to reserve. QEMU can provide this
with a special vendor-specific PCI capability.

Signed-off-by: Aleksandr Bezzubikov <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Tested-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
This page took 0.098415 seconds and 4 git commands to generate.