Commit Graph

61 Commits

Author SHA1 Message Date
Erik Skultety
77f51ab520 qemu: caps: Format SEV platform data into qemuCaps cache
Since we're not saving the platform-specific data into a cache, we're
not going to populate the structure, which in turn will cause a crash
upon calling virNodeGetSEVInfo because of a NULL pointer dereference.
Ultimately, we should start caching this data along with host-specific
capabilities like NUMA and SELinux stuff into a separate cache, but for
the time being, this is a semi-proper fix for a potential crash.

Backtrace (requires libvirtd restart to load qemu caps from cache):
    #0 qemuGetSEVInfoToParams
    #1 qemuNodeGetSEVInfo
    #2 virNodeGetSEVInfo
    #3 remoteDispatchNodeGetSevInfo
    #4 remoteDispatchNodeGetSevInfoHelper
    #5 virNetServerProgramDispatchCall
    #6 virNetServerProgramDispatch
    #7 virNetServerProcessMsg
    #8 virNetServerHandleJob
    #9 virThreadPoolWorker
    #10 virThreadHelper

https: //bugzilla.redhat.com/show_bug.cgi?id=1612009
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
2018-08-20 07:18:21 +02:00
Erik Skultety
d48813e81a conf: Introduce new video type 'none'
Historically, we've always enabled an emulated video device every time we
see that graphics should be supported with a guest. With the appearance
of mediated devices which can support QEMU's vfio-display capability,
users might want to use such a device as the only video device.
Therefore introduce a new, effectively a 'disable', type for video
device.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-07-18 18:23:51 +02:00
Erik Skultety
d8266ebe16 qemu: Introduce a new graphics display type 'headless'
Since 2.10 QEMU supports a new display type egl-headless which uses the
drm nodes for OpenGL rendering copying back the rendered bits back to
QEMU into a dma-buf which can be accessed by standard "display" apps
like VNC or SPICE. Although this display type can be used on its own,
for any practical use case it makes sense to pair it with either VNC or
SPICE display. The clear benefit of this display is that VNC gains
OpenGL support, which it natively doesn't have, and SPICE gains remote
OpenGL support (native OpenGL support only works locally through a UNIX
socket, i.e. listen type=socket/none).

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-07-18 18:16:07 +02:00
Erik Skultety
6688393c6b conf: Fix formatting of <sev> element in domain capabilities XML
We only formatted the <sev> element when QEMU supported the feature when
in fact we should always format the element to make clear that libvirt
knows about the feature and the fact whether it is or isn't supported
depends on QEMU version, in other words if QEMU doesn't support the
feature we're going to format the following into the domain capabilities
XML:

<sev supported='no'/>

This patch also adjusts the RNG schema accordingly in order to reflect
the proposed change.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-15 10:49:13 +02:00
John Ferlan
0f358fcdca domcaps: Add 'genid' to domain capabilities
Report domaincaps <features><genid supported='yes'/> if the guest
config accepts <genid/> or <genid>$GUID</genid>.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-05-25 08:15:58 -04:00
Shalini Chellathurai Saroja
c6e605dc0e tests: Update caps for QEMU 2.12.0 on s390x
Let us update the existing xml and replies files for QEMU 2.12.0 on
s390x.

Used a z14 using a QEMU 2.12 GA build and the following sequence:

  tests/qemucapsprobe /usr/bin/qemu-system-s390x > \
         tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies

  VIR_TEST_REGENERATE_OUTPUT=1 tests/qemucapabilitiestest
  VIR_TEST_REGENERATE_OUTPUT=1 tests/domaincapstest

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-05-16 14:19:57 -04:00
Cole Robinson
5d84835e09 tests: domaincapstest: Fix after iothreads addition
Introduced in 8525b9694. Some files weren't updated. I'm just
guessing on the bhyve ones

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2018-05-03 17:34:41 -04:00
Cole Robinson
33455bc4ce domain_capabilities: Report <vmcoreinfo> support
Report <features><vmcoreinfo supported='yes'/> if the guest config
accepts <features><vmcoreinfo state='on'/>

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2018-05-03 16:37:41 -04:00
Martin Kletzander
8525b9694e qemu: Add I/O thread support info into domain capabilities
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2018-05-03 22:31:37 +02:00
Andrea Bolognani
7dd5b0c54b tests: qemucapabilities: Drop mostly duplicated data
When GIC support was introduced (QEMU 2.6 timeframe) we needed
to make sure both GICv2 hardware and GICv3 hardware were handled
correctly, and that was achieved by having separate capabilities
data for each.

Now that we have capabilities data for several QEMU versions we
can stop storing data for GICv2 and GICv3 hardware separately,
and instead have GICv2 data for QEMU <= 2.10 and GICv3 data for
QEMU >= 2.12, without losing any coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-03-23 20:27:52 +01:00
Andrea Bolognani
9be6210f9e tests: domaincaps: Add QEMU 2.12
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-03-23 20:27:51 +01:00
Shaohe Feng
e7cb9c4e23 cpu: Add support for al57 Intel features
We can start qemu with a "cpu,+la57" to set 57-bit vitrual address
space. So VM can be aware that it need to enable 5-level paging.

Corresponding QEMU commits:
        al57 6c7c3c21f95dd9af8a0691c0dd29b07247984122
2018-01-25 15:30:32 +01:00
Andrea Bolognani
61ea70341a tests: Rename ppc64le caps to ppc64
The architecture itself is called ppc64, and it can run both in big
endian and little endian mode - the latter is known as ppc64le.

From the (virtual) hardware point of view, ppc64 is a more accurate
name so it should be used here.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-11-08 10:47:38 +01:00
Jiri Denemark
78d177df67 cpu: Add clwb/pcommit CPU features
The features were added to QEMU by commit v2.4.0-1690-gf7fda28094 as
Skylake Server features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-18 15:10:46 +02:00
Cole Robinson
a2ca7ca52e conf: domain: add VIDEO_TYPE_DEFAULT
Will be needed for future patches to pull the default video type
setting out of XML parsing routines.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-09-05 10:41:32 -04:00
dann frazier
123880d333 qemu: Add AAVMF32 to the list of known UEFIs
Add a path for UEFI VMs for AArch32 VMs, based on the path Debian is using.
libvirt is the de facto canonical location for defining where distros
should place these firmware images, so let's define this path here to try
and minimize distro fragmentation.
2017-07-21 14:36:54 -04:00
Pavel Hrdina
fa60251b01 tests: domaincapstest: add test for Q35 machine type
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Pavel Hrdina
8ddd44806b qemu: report IDE bus in domain capabilities only if it's supported
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441964

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Jiri Denemark
385c1cc96c qemu: Check non-migratable host CPU features
CPU features which change their value from disabled to enabled between
two calls to query-cpu-model-expansion (the first with no extra
properties set and the second with 'migratable' property set to false)
can be marked as enabled and non-migratable in qemuMonitorCPUModelInfo.

Since the code consuming qemuMonitorCPUModelInfo currently ignores the
migratable flag, this change is effectively changing the CPU model
advertised in domain capabilities to contain all features (even those
which block migration). And this matches what we do for QEMU older than
2.9.0, when we detect all CPUID bits ourselves without asking QEMU.

As a result of this change

    <cpu mode='host-model'>
      <feature name='invtsc' policy='require'/>
    </cpu>

will work with all QEMU versions. Such CPU definition would be forbidden
with QEMU >= 2.9.0 without this patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-30 09:59:42 +02:00
Erik Skultety
ec783d7c77 conf: Introduce new hostdev device type mdev
A mediated device will be identified by a UUID (with 'model' now being
a mandatory <hostdev> attribute to represent the mediated device API) of
the user pre-created mediated device. We also need to make sure that if
user explicitly provides a guest address for a mdev device, the address
type will be matching the device API supported on that specific mediated
device and error out with an incorrect XML message.

The resulting device XML:
<devices>
  <hostdev mode='subsystem' type='mdev' model='vfio-pci'>
    <source>
      <address uuid='c2177883-f1bb-47f0-914d-32a22e3a8804'>
    </source>
  </hostdev>
</devices>

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-03-27 15:39:35 +02:00
Roman Bogorodskiy
74cfb5bb85 domaincapstest: add bhyve caps test
* Extract filling bhyve capabilities from virBhyveDomainCapsBuild()
   into a new function virBhyveDomainCapsFill() to make testing
   easier by not having to mock firmware directory listing and
   hypervisor capabilities probing
 * Also, just presence of the firmware files is not sufficient
   to enable os.loader.supported, hypervisor should support UEFI
   boot too
 * Add tests to domaincapstest for the main caps possible flows:
    - when UEFI bootrom is supported
    - when video (fbus) is supported
    - neither of above is supported
2017-03-26 18:44:46 +04:00
Fabian Freyer
04664327c6 bhyve: add video support
bhyve supports 'gop' video device that allows clients to connect
to VMs using VNC clients. This commit adds support for that to
the bhyve driver:

 - Introducr 'gop' video device type
 - Add capabilities probing for the 'fbuf' device that's
   responsible for graphics
 - Update command builder routines to let users configure
   domain's VNC via gop graphics.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2017-03-11 23:30:56 +04:00
Pavel Hrdina
2149d405a0 qemu_capabilities: report SATA bus in domain capabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 09:11:03 +01:00
Jiri Denemark
bb3363c90b qemu: Use full CPU model expansion on x86
The static CPU model expansion is designed to return only canonical
names of all CPU properties. To maintain backwards compatibility libvirt
is stuck with different spelling of some of the features, but we need to
use the full expansion to get the additional spellings. In addition to
returning all spelling variants for all properties the full expansion
will contain properties which are not guaranteed to be migration
compatible. Thus, we need to combine both expansions. First we need to
call the static expansion to limit the result to migratable properties.
Then we can use the result of the static expansion as an input to the
full expansion to get both canonical names and their aliases.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
f013828992 qemu: Get host CPU model from QEMU on x86_64
Until now host-model CPU mode tried to enable all CPU features supported
by the host CPU even if QEMU/KVM did not support them. This caused a
number of issues and made host-model quite unreliable. Asking QEMU for
the CPU it can provide and the current host makes host-model much more
robust.

This commit fixes the following bugs:

    https://bugzilla.redhat.com/show_bug.cgi?id=1018251
    https://bugzilla.redhat.com/show_bug.cgi?id=1371617
    https://bugzilla.redhat.com/show_bug.cgi?id=1372581
    https://bugzilla.redhat.com/show_bug.cgi?id=1404627
    https://bugzilla.redhat.com/show_bug.cgi?id=870071

In addition to that, the following bug should be mostly limited to cases
when an unsupported feature is explicitly requested:

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
0bde051f3d domaincapstest: Add test data for QEMU 2.9.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:56 +01:00
Jiri Denemark
390a1e2bfd qemu: Fix CPU model fallback in domain capabilities
Our documentation of the domain capabilities XML says that the fallback
attribute of a CPU model is used to indicate whether the CPU model was
detected by libvirt itself (fallback="allow") or by asking the
hypervisor (fallback="forbid"). We need to properly set
fallback="forbid" when CPU model comes from QEMU to match the
documentation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-24 14:10:57 +01:00
Jiri Denemark
5d513d4659 qemu-caps: Get host model directly from Qemu when available
When qmp query-cpu-model-expansion is available probe Qemu for its view of the
host model. In kvm environments this can provide a more complete view of the
host model because features supported by Qemu and Kvm can be considered.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
2017-01-06 12:24:57 +01:00
Collin L. Walling
9486dbb339 tests: domain capabilities: qemu 2.7 and 2.8 on s390x
Tests domain capabilities on s390x using the Qemu 2.8 capabilities data.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
2017-01-06 12:24:57 +01:00
Jiri Denemark
a1adfb0f06 qemu: Add support for unavailable-features
QEMU 2.8.0 adds support for unavailable-features in
query-cpu-definitions reply. The unavailable-features array lists CPU
features which prevent a corresponding CPU model from being usable on
current host. It can only be used when all the unavailable features are
disabled. Empty array means the CPU model can be used without
modifications.

We can use unavailable-features for providing CPU model usability info
in domain capabilities XML:

    <domainCapabilities>
      ...
      <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'>
          <model fallback='allow'>Skylake-Client</model>
          ...
        </mode>
        <mode name='custom' supported='yes'>
          <model usable='yes'>qemu64</model>
          <model usable='yes'>qemu32</model>
          <model usable='no'>phenom</model>
          <model usable='yes'>pentium3</model>
          <model usable='yes'>pentium2</model>
          <model usable='yes'>pentium</model>
          <model usable='yes'>n270</model>
          <model usable='yes'>kvm64</model>
          <model usable='yes'>kvm32</model>
          <model usable='yes'>coreduo</model>
          <model usable='yes'>core2duo</model>
          <model usable='no'>athlon</model>
          <model usable='yes'>Westmere</model>
          <model usable='yes'>Skylake-Client</model>
          ...
        </mode>
      </cpu>
      ...
    </domainCapabilities>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-28 09:11:22 +01:00
Jiri Denemark
fe66e2fffe tests: Add QEMU 2.8.0 domain capabilities tests
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-28 09:11:22 +01:00
Jiri Denemark
0d2c389fad tests: Update capabilities for QEMU 2.6.0 (ppc64le)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:57 +01:00
Jiri Denemark
f8b7b075b6 tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv3)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:34 +01:00
Jiri Denemark
73411a7ff1 qemu: Avoid reporting "host" as a supported CPU model
"host" CPU model is supported by a special host-passthrough CPU mode and
users is not allowed to specify this model directly with custom mode.
Thus we should not advertise "host" CPU model in domain capabilities.
This worked well on architectures for which libvirt provides a list of
supported CPU models in cpu_map.xml (since "host" is not in the list).
But we need to explicitly filter "host" model out for all other
architectures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:19 +01:00
Jiri Denemark
451dc19353 tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv2)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
e6bad6b63d tests: Update capabilities for QEMU 2.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
58c7620cdc tests: Update capabilities for QEMU 1.7.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
7bf6f345e0 qemu: Probe CPU models for KVM and TCG
CPU models (and especially some additional details which we will start
probing for later) differ depending on the accelerator. Thus we need to
call query-cpu-definitions in both KVM and TCG mode to get all data we
want.

Tests in tests/domaincapstest.c are temporarily switched to TCG to avoid
having to squash even more stuff into this single patch. They will all
be switched back later in separate commits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Eric Farman
fc0e627bac Introduce framework for a hostdev SCSI_host subsystem type
We already have a "scsi" hostdev subsys type, which refers to a single
LUN that is passed through to a guest.  But what of things where
multiple LUNs are passed through via a single SCSI HBA, such as with
the vhost-scsi target?  Create a new hostdev subsys type that will
carry this.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
2016-11-24 12:15:26 -05:00
Pavel Hrdina
34a4447bd4 qemu_capabilities: join capabilities for qxl and qxl-vga devices
This patch simplifies QEMU capabilities for QXL video device.  QEMU
exposes this device as *qxl-vga* and *qxl* and they are both the same
device with the same set of parameters, the only difference is that
*qxl-vga* includes VGA compatibility.

Based on QEMU code they are tied together so it's safe to check only for
presence of only one of them.

This patch also removes an invalid test case "video-qxl-sec-nodevice"
where there is only *qxl-vga* device and *qxl* device is not present.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-10-12 17:46:47 +02:00
Jiri Denemark
14319c81a0 Show host model in domain capabilities
The domain capabilities XML is capable of showing whether each guest CPU
mode is supported or not with a possibility to provide additional
details. This patch enhances host-model capability to advertise the
exact CPU model which will be used as a host-model:

    <cpu>
        ...
        <mode name='host-model' supported='yes'>
            <model fallback='allow'>Broadwell</model>
            <vendor>Intel</vendor>
            <feature policy='disable' name='aes'/>
            <feature policy='require' name='vmx'/>
        </mode>
        ...
    </cpu>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
d4c007e6d5 domcaps: Add CPU usable flag
In case a hypervisor is able to tell us a list of supported CPU models
and whether each CPU models can be used on the current host, we can
propagate this to domain capabilities. This is a better alternative
to calling virConnectCompareCPU for each supported CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
33f9ccc141 domcaps: Show only CPU models supported by libvirt
Listing all CPU models supported by QEMU in domain capabilities makes
little sense when libvirt will refuse any model it doesn't know about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
84d38307fe qemu: Fill in CPU domain capabilities
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
167280e7f6 domcaps: Add support for listing supported CPU models
The patch adds <cpu> element to domain capabilities XML:

    <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'/>
        <mode name='custom' supported='yes'>
            <model>Broadwell</model>
            <model>Broadwell-noTSX</model>
            ...
        </mode>
    </cpu>

Applications can use it to inspect what CPU configuration modes are
supported for a specific combination of domain type, emulator binary,
guest architecture and machine type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jim Fehlig
8bab1e7c05 libxl: add USB to hostdev domcapabilities
Commit 2a58ed0b added support for creating guests with USB
hostdevs. Commit fc21d10 later added support for hotplut of
USB hostdevs. Advertise support for USB hostdevs in the
domcapabilities.

In addition add the appropriate caps for USB support on
domaincapstest when libvirt is built on a Xen with
LIBXL_HAVE_PVUSB. Otherwise domaincapstest would fail i.e.
testing the wrong domain capabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-06-17 14:25:02 -06:00
Jim Fehlig
11567cf66f libxl: implement connectGetDomainCapabilities
Add domain capabilities for PV and HVM domains.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:17 -06:00
Pavel Hrdina
c81415065e qemucapstest: replace caps-1.6.50 with updated caps-1.7.0
The qemu-1.6.50 is a beta before the new minor version, let's replace it with
the release qemu-1.7.0.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-25 17:04:22 +02:00
Pavel Hrdina
750b83137b qemucapstest: update caps for qemu-2.6.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Jiri Denemark
9ac9b039c4 domaincapstest: Give better names to test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 10:37:29 +02:00