1. 28 4月, 2017 2 次提交
    • P
      5237a74d
    • J
      qemu: Add support for guest CPU cache · df13c0b4
      Jiri Denemark 提交于
      This patch maps /domain/cpu/cache element into -cpu parameters:
      
      - <cache mode='passthrough'/> is translated to host-cache-info=on
      - <cache level='3' mode='emulate'/> is transformed into l3-cache=on
      - <cache mode='disable'/> is turned in host-cache-info=off,l3-cache=off
      
      Any other <cache> element is forbidden.
      
      The tricky part is detecting whether QEMU supports the CPU properties.
      
      The 'host-cache-info' property is introduced in v2.4.0-1389-ge265e3e480,
      earlier QEMU releases enabled host-cache-info by default and had no way
      to disable it. If the property is present, it defaults to 'off' for any
      QEMU until at least 2.9.0.
      
      The 'l3-cache' property was introduced later by v2.7.0-200-g14c985cffa.
      Earlier versions worked as if l3-cache=off was passed. For any QEMU
      until at least 2.9.0 l3-cache is 'off' by default.
      
      QEMU 2.9.0 was the first release which supports probing both properties
      by running device-list-properties with typename=host-x86_64-cpu. Older
      QEMU releases did not support device-list-properties command for CPU
      devices. Thus we can't really rely on probing them and we can just use
      query-cpu-model-expansion QMP command as a witness.
      
      Because the cache property probing is only reliable for QEMU >= 2.9.0
      when both are already supported for quite a few releases, we let QEMU
      report an error if a specific cache mode is explicitly requested. The
      other mode (or both if a user requested CPU cache to be disabled) is
      explicitly turned off for QEMU >= 2.9.0 to avoid any surprises in case
      the QEMU defaults change. Any older QEMU already turns them off so not
      doing so explicitly does not make any harm.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      df13c0b4
  2. 19 4月, 2017 3 次提交
    • J
      qemu: Use more data for comparing CPUs · 5b4a6adb
      Jiri Denemark 提交于
      With QEMU older than 2.9.0 libvirt uses CPUID instruction to determine
      what CPU features are supported on the host. This was later used when
      checking compatibility of guest CPUs. Since QEMU 2.9.0 we ask QEMU for
      the host CPU data. But the two methods we use usually provide disjoint
      sets of CPU features because QEMU/KVM does not support all features
      provided by the host CPU and on the other hand it can enable some
      feature even if the host CPU does not support them.
      
      So if there is a domain which requires a CPU features disabled by
      QEMU/KVM, libvirt will refuse to start it with QEMU > 2.9.0 as its guest
      CPU is incompatible with the host CPU data we got from QEMU. But such
      domain would happily start on older QEMU (of course, the features would
      be missing the guest CPU). To fix this regression, we need to combine
      both CPU feature sets when checking guest CPU compatibility.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1439933Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      5b4a6adb
    • J
      qemu: Pass migratable host CPU model to virCPUUpdate · 56bd7edc
      Jiri Denemark 提交于
      We already know from QEMU which CPU features will block migration. Let's
      use this information to make a migratable copy of the host CPU model and
      use it for updating guest CPU specification. This will allow us to drop
      feature filtering from virCPUUpdate where it was just a hack.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      56bd7edc
    • J
      qemu: Prepare qemuCaps for multiple host CPU defs · 1fe517c6
      Jiri Denemark 提交于
      Soon we will need to store multiple host CPU definitions in
      virQEMUCapsHostCPUData and qemuCaps users will want to request the one
      they need. This patch introduces virQEMUCapsHostCPUType enum which will
      be used for specifying the requested CPU definition.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1fe517c6
  3. 07 4月, 2017 2 次提交
  4. 06 4月, 2017 1 次提交
    • A
      qemu: Move some functions to qemu_capspriv.h · 2e5de445
      Andrea Bolognani 提交于
      This header file has been created so that we can expose
      internal functions to the test suite without making them
      public: those in qemu_capabilities.h bearing the comment
      
        /* Only for use by test suite */
      
      are obvious candidates for being moved over.
      2e5de445
  5. 03 4月, 2017 1 次提交
    • A
      tests: Initialize basic capabilities properly · 1cf3e52a
      Andrea Bolognani 提交于
      The capabilities used in test cases should match those used
      during normal operation for the tests to make any sense.
      
      This results in the generated command line for a few test
      cases (most notably non-x86 test cases that were wrongly
      assuming they could use -no-acpi) changing.
      1cf3e52a
  6. 27 3月, 2017 2 次提交
  7. 17 3月, 2017 2 次提交
  8. 15 3月, 2017 1 次提交
  9. 04 3月, 2017 1 次提交
  10. 03 3月, 2017 1 次提交
    • A
      qemu: Drop QEMU_CAPS_PCI_MULTIBUS · 5b783379
      Andrea Bolognani 提交于
      Due to the extra architecture-specific logic, it's already
      necessary for users to call virQEMUCapsHasPCIMultiBus(),
      so the capability itself is just a pointless distraction.
      5b783379
  11. 17 2月, 2017 1 次提交
  12. 26 1月, 2017 1 次提交
  13. 06 1月, 2017 1 次提交
  14. 06 12月, 2016 1 次提交
  15. 28 11月, 2016 2 次提交
    • P
      qemu: capabilities: Don't partially reprope caps on process reconnect · b87a1134
      Peter Krempa 提交于
      Thanks to the complex capability caching code virQEMUCapsProbeQMP was
      never called when we were starting a new qemu VM. On the other hand,
      when we are reconnecting to the qemu process we reload the capability
      list from the status XML file. This means that the flag preventing the
      function being called was not set and thus we partially reprobed some of
      the capabilities.
      
      The recent addition of CPU hotplug clears the
      QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS if the machine does not support it.
      The partial re-probe on reconnect results into attempting to call the
      unsupported command and then killing the VM.
      
      Remove the partial reprobe and depend on the stored capabilities. If it
      will be necessary to reprobe the capabilities in the future, we should
      do a full reprobe rather than this partial one.
      b87a1134
    • J
      qemu: Add support for unavailable-features · a1adfb0f
      Jiri Denemark 提交于
      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: NJiri Denemark <jdenemar@redhat.com>
      a1adfb0f
  16. 26 11月, 2016 4 次提交
    • J
      qemu: Probe CPU models for KVM and TCG · 7bf6f345
      Jiri Denemark 提交于
      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: NJiri Denemark <jdenemar@redhat.com>
      7bf6f345
    • J
      qemu: Refresh caps in virQEMUCapsCacheLookupByArch · f9d57f2b
      Jiri Denemark 提交于
      The function just returned cached capabilities without checking whether
      they are still valid. We should check that and refresh the capabilities
      to make sure we don't return stale data. In other words, we should do
      what all other lookup functions do.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      f9d57f2b
    • J
      qemu: Discard caps cache when KVM availability changes · d87df9bd
      Jiri Denemark 提交于
      Since some may depend on the accelerator used when probing QEMU the
      cache becomes invalid when KVM becomes available or if it is not
      available anymore.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      d87df9bd
    • J
      qemu: Enable KVM when probing capabilities · 25ba9c31
      Jiri Denemark 提交于
      CPU related capabilities may differ depending on accelerator used when
      probing. Let's use KVM if available when probing QEMU and fall back to
      TCG. The created capabilities already contain all we need to distinguish
      whether KVM or TCG was used:
      
          - KVM was used when probing capabilities:
              QEMU_CAPS_KVM is set
              QEMU_CAPS_ENABLE_KVM is not set
      
          - TCG was used and QEMU supports KVM, but it failed (e.g., missing
            kernel module or wrong /dev/kvm permissions)
              QEMU_CAPS_KVM is not set
              QEMU_CAPS_ENABLE_KVM is set
      
          - KVM was not used and QEMU does not support it
              QEMU_CAPS_KVM is not set
              QEMU_CAPS_ENABLE_KVM is not set
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      25ba9c31
  17. 25 11月, 2016 1 次提交
  18. 10 11月, 2016 1 次提交
  19. 09 11月, 2016 2 次提交
  20. 04 11月, 2016 1 次提交
  21. 02 11月, 2016 1 次提交
  22. 26 10月, 2016 1 次提交
  23. 12 10月, 2016 4 次提交
    • P
      qemu_capabilities: check for existence of virtio-vga · 6869428c
      Pavel Hrdina 提交于
      Commit 21373feb added support for primary virtio-vga device but it was
      checking for virtio-gpu.  Let's check for existence of virtio-vga if we
      want to use it.
      
      Virtio video device is currently represented by three different models
      *virtio-gpu-device*, *virtio-gpu-pci* and *virtio-vga*.  The first two
      models are tied together and if virtio video devices is compiled in they
      both exist.  However, the *virtio-vga* model doesn't have to exist on
      some architectures even if the first two models exist.  So we cannot
      group all three together.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      6869428c
    • P
      qemu_capabilities: rename QEMU_CAPS_VIRTIO_GPU_VIRGL · db449157
      Pavel Hrdina 提交于
      We generally uses QEMU_CAPS_DEVICE_$NAME to probe for existence of some
      device and QEMU_CAPS_$NAME_$PROP to probe for existence of some property
      of that device.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      db449157
    • P
      qemu_capabilities: mark QEMU_CAPS_VGA_QXL capability as deprecated · 05af6784
      Pavel Hrdina 提交于
      If QEMU in question supports QMP, this capability is set if
      QEMU_CAPS_DEVICE_QXL was set based on existence of "-device qxl". If
      libvirt needs to parse *help*, because there is no QMP support, it
      checks for existence of "-vga qxl", but it also parses output of
      "-device ?" and sets QEMU_CAPS_DEVICE_QXL too.
      
      Now that libvirt supports only QEMU that has "-device" implemented it's
      safe to drop this capability and stop using it.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      05af6784
    • P
      qemu_capabilities: join capabilities for qxl and qxl-vga devices · 34a4447b
      Pavel Hrdina 提交于
      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: NPavel Hrdina <phrdina@redhat.com>
      34a4447b
  24. 07 10月, 2016 1 次提交
    • D
      qemu: fix command line building for iommu devices · 5dee6686
      Daniel P. Berrange 提交于
      The intel-iommu device has existed since QEMU 2.2.0, but
      it was only possible to create it with -device since
      QEMU 2.7.0, thanks to:
      
        commit 621d983a1f9051f4cfc3f402569b46b77d8449fc
        Author: Marcel Apfelbaum <marcel@redhat.com>
        Date:   Mon Jun 27 18:38:34 2016 +0300
      
          hw/iommu: enable iommu with -device
      
          Use the standard '-device intel-iommu' to create the IOMMU device.
          The legacy '-machine,iommu=on' can still be used.
      
      The libvirt capability check & command line formatting code
      is thus broken for all QEMU versions 2.2.0 -> 2.6.0 inclusive.
      
      This fixes it to use iommu=on instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5dee6686
  25. 22 9月, 2016 2 次提交