1. 17 3月, 2016 2 次提交
  2. 16 3月, 2016 38 次提交
    • P
      util/base64.c: Clean includes · 0ebc03bc
      Peter Maydell 提交于
      Remove unnecessary include of config-host.h.
      (This was missed by the clean-includes script because of the
      incorrect use of <> for a QEMU header.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1456237112-32662-5-git-send-email-peter.maydell@linaro.org
      0ebc03bc
    • P
      update-linux-headers.sh: Fake types.h doesn't need to include anything · 8bc92a76
      Peter Maydell 提交于
      We have a fake linux/types.h which we create in update-linux-headers.h.
      Now that every QEMU source file includes osdep.h, this fake header
      doesn't need to include anything at all.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1456237112-32662-4-git-send-email-peter.maydell@linaro.org
      8bc92a76
    • P
      include/config.h: Remove · 8816c600
      Peter Maydell 提交于
      include/config.h just includes config-target.h (and used to also
      include config-host.h).
      It is now obsolete and unused, because osdep.h does this job, so
      remove it.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1456237112-32662-3-git-send-email-peter.maydell@linaro.org
      8816c600
    • P
      slirp/slirp.h: Remove now-empty #ifdefs · 4674da1c
      Peter Maydell 提交于
      After automatic cleanup to remove unnecessary #includes of headers that
      osdep.h provides, slirp.h has a few now unnecessary #ifdef/#endif pairs;
      remove them.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1456237112-32662-2-git-send-email-peter.maydell@linaro.org
      4674da1c
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-03-16' into staging · 6aeda868
      Peter Maydell 提交于
      Error reporting patches for 2016-03-16
      
      # gpg: Signature made Wed 16 Mar 2016 09:57:00 GMT using RSA key ID EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      
      * remotes/armbru/tags/pull-error-2016-03-16:
        error: ensure errno detail is printed with error_abort
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      6aeda868
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2016-03-16' into staging · cad0b273
      Peter Maydell 提交于
      Monitor patches for 2016-03-16
      
      # gpg: Signature made Wed 16 Mar 2016 09:47:23 GMT using RSA key ID EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      
      * remotes/armbru/tags/pull-monitor-2016-03-16:
        qdev-monitor: add missing aliases for virtio device classes
        qdev-monitor: sort alias table by typename
        qdev-monitor: improve error message when alias device is unavailable
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      cad0b273
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160316' into staging · f235538e
      Peter Maydell 提交于
      ppc patch queue for 2016-03-16
      
      Accumulated patches for target-ppc, pseries machine type and related
      devices.  As we are now in soft freeze, these are mostly fixes.
         * Fix KVM migration for several SPRs that qemu didn't handle
         * Clean up handling of SDR1, which allows a fix to the gdbstub
         * Fix a race in spapr_rng
         * Fix a bug with multifunction hotplug
      
      The exception is the 7 patches to allow EEH on spapr-pci-host-bridge
      devices (rather than the special and poorly designed
      spapr-vfio-pci-host-bridge device).  I believe these are low risk of
      breaking non-EEH cases, and EEH cases were little used in practice
      previously (since libvirt did not support the special device amongst
      other things).  It did have a draft posted before the soft freeze,
      removes a very ugly VFIO interface, and removes device we'd like to
      deprecate sooner rather than later.  So, I'm hoping we can squeeze
      these in during the soft freeze.
      
      This includes two patches to the VFIO code, which Alex Williamson has
      indicated he's ok with coming through my tree.
      
      # gpg: Signature made Wed 16 Mar 2016 05:04:52 GMT using RSA key ID 20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.6-20160316:
        vfio: Eliminate vfio_container_ioctl()
        spapr_pci: Remove finish_realize hook
        spapr_pci: (Mostly) remove spapr-pci-vfio-host-bridge
        spapr_pci: Allow EEH on spapr-pci-host-bridge
        spapr_pci: Eliminate class callbacks
        spapr_pci: Switch to vfio_eeh_as_op() interface
        vfio: Start improving VFIO/EEH interface
        spapr_rng: fix race with main loop
        target-ppc: Eliminate kvmppc_kern_htab global
        target-ppc: Add helpers for updating a CPU's SDR1 and external HPT
        target-ppc: Split out SREGS get/put functions
        spapr_pci: fix multifunction hotplug
        target-ppc: Add PVR for POWER8NVL processor
        ppc: Add a few more P8 PMU SPRs
        ppc: Fix migration of the TAR SPR
        ppc: Define the PSPB register on POWER8
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f235538e
    • D
      error: ensure errno detail is printed with error_abort · 20e2dec1
      Daniel P. Berrange 提交于
      When &error_abort is passed in, the error reporting code
      will print the current error message and then abort() the
      process. Unfortunately at the time it aborts, we've not
      yet appended the errno detail. This makes debugging certain
      problems significantly harder as the log is incomplete.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1457544504-8548-22-git-send-email-berrange@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      20e2dec1
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · af1d3ebb
      Peter Maydell 提交于
      acpi: minor fix
      
      Since previous pull acpi test triggers warnings,
      fix it up.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Tue 15 Mar 2016 21:26:38 GMT using RSA key ID D28D5469
      # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
      # gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
      
      * remotes/mst/tags/for_upstream:
        acpi-test: update UID for GSI links
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      af1d3ebb
    • S
      qdev-monitor: add missing aliases for virtio device classes · 588c36ca
      Sascha Silbe 提交于
      virtio-{blk,balloon,net,serial} are aliases for their actual,
      architecture-dependent implementations (*-ccw on s390x, *-pci on other
      architectures supporting virtio). This makes it a lot easier to craft
      qemu invocations that work on all supported architectures. Complete
      the set to cover all existing non-abstract virtio device classes.
      
      For virtio-balloon, only the CCW implementation was missing.
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Message-Id: <1455831854-49013-4-git-send-email-silbe@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      588c36ca
    • S
      qdev-monitor: sort alias table by typename · 36e99168
      Sascha Silbe 提交于
      Sort the alias table by typename so it's easier to see which aliases
      exist.
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Message-Id: <1455831854-49013-3-git-send-email-silbe@linux.vnet.ibm.com>
      Reviewed-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      36e99168
    • S
      qdev-monitor: improve error message when alias device is unavailable · f6b5319d
      Sascha Silbe 提交于
      When trying to instantiate an alias that points to a device class that
      doesn't exist, the error message looks like qemu misunderstood the
      request:
      
      $ s390x-softmmu/qemu-system-s390x -device virtio-gpu
      qemu-system-s390x: -device virtio-gpu: 'virtio-gpu-ccw' is not a valid
      device model name
      
      Special-case the error message to make it explicit that alias
      expansion is going on:
      
      $ s390x-softmmu/qemu-system-s390x -device virtio-gpu
      qemu-system-s390x: -device virtio-gpu: 'virtio-gpu' (alias
      'virtio-gpu-ccw') is not a valid device model name
      Suggested-By: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Message-Id: <1455831854-49013-2-git-send-email-silbe@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      f6b5319d
    • D
      vfio: Eliminate vfio_container_ioctl() · 3356128c
      David Gibson 提交于
      vfio_container_ioctl() was a bad interface that bypassed abstraction
      boundaries, had semantics that sat uneasily with its name, and was unsafe
      in many realistic circumstances.  Now that spapr-pci-vfio-host-bridge has
      been folded into spapr-pci-host-bridge, there are no more users, so remove
      it.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      3356128c
    • D
      spapr_pci: Remove finish_realize hook · a36304fd
      David Gibson 提交于
      Now that spapr-pci-vfio-host-bridge is reduced to just a stub, there is
      only one implementation of the finish_realize hook in sPAPRPHBClass.  So,
      we can fold that implementation into its (single) caller, and remove the
      hook.  That's the last thing left in sPAPRPHBClass, so that can go away as
      well.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      a36304fd
    • D
      spapr_pci: (Mostly) remove spapr-pci-vfio-host-bridge · 72700d7e
      David Gibson 提交于
      Now that the regular spapr-pci-host-bridge can handle EEH, there are only
      two things that spapr-pci-vfio-host-bridge does differently:
          1. automatically sizes its DMA window to match the host IOMMU
          2. checks if the attached VFIO container is backed by the
             VFIO_SPAPR_TCE_IOMMU type on the host
      
      (1) is not particularly useful, since the default window used by the
      regular host bridge will work with the host IOMMU configuration on all
      current systems anyway.
      
      Plus, automatically changing guest visible configuration (such as the DMA
      window) based on host settings is generally a bad idea.  It's not
      definitively broken, since spapr-pci-vfio-host-bridge is only supposed to
      support VFIO devices which can't be migrated anyway, but still.
      
      (2) is not really useful, because if a guest tries to configure EEH on a
      different host IOMMU, the first call will fail and that will be that.
      
      It's possible there are scripts or tools out there which expect
      spapr-pci-vfio-host-bridge, so we don't remove it entirely.  This patch
      reduces it to just a stub for backwards compatibility.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      72700d7e
    • D
      spapr_pci: Allow EEH on spapr-pci-host-bridge · c1fa017c
      David Gibson 提交于
      Now that the EEH code is independent of the special
      spapr-vfio-pci-host-bridge device, we can allow it on all spapr PCI
      host bridges instead.  We do this by changing spapr_phb_eeh_available()
      to be based on the vfio_eeh_as_ok() call instead of the host bridge class.
      
      Because the value of vfio_eeh_as_ok() can change with devices being
      hotplugged or unplugged, this can potentially lead to some strange edge
      cases where the guest starts using EEH, then it starts failing because
      of a change in status.
      
      However, it's not really any worse than the current situation.  Cases that
      would have worked previously will still work (i.e. VFIO devices from at
      most one VFIO IOMMU group per vPHB), it's just that it's no longer
      necessary to use spapr-vfio-pci-host-bridge with the groupid pre-specified.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      c1fa017c
    • D
      spapr_pci: Eliminate class callbacks · fbb4e983
      David Gibson 提交于
      The EEH operations in the spapr-vfio-pci-host-bridge no longer rely on the
      special groupid field in sPAPRPHBVFIOState.  So we can simplify, removing
      the class specific callbacks with direct calls based on a simple
      spapr_phb_eeh_enabled() helper.  For now we implement that in terms of
      a boolean in the class, but we'll continue to clean that up later.
      
      On its own this is a rather strange way of doing things, but it's a useful
      intermediate step to further cleanups.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      fbb4e983
    • D
      spapr_pci: Switch to vfio_eeh_as_op() interface · 76a9e9f6
      David Gibson 提交于
      This switches all EEH on VFIO operations in spapr_pci_vfio.c from the
      broken vfio_container_ioctl() interface to the new vfio_as_eeh_op()
      interface.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      76a9e9f6
    • D
      vfio: Start improving VFIO/EEH interface · 3153119e
      David Gibson 提交于
      At present the code handling IBM's Enhanced Error Handling (EEH) interface
      on VFIO devices operates by bypassing the usual VFIO logic with
      vfio_container_ioctl().  That's a poorly designed interface with unclear
      semantics about exactly what can be operated on.
      
      In particular it operates on a single vfio container internally (hence the
      name), but takes an address space and group id, from which it deduces the
      container in a rather roundabout way.  groupids are something that code
      outside vfio shouldn't even be aware of.
      
      This patch creates new interfaces for EEH operations.  Internally we
      have vfio_eeh_container_op() which takes a VFIOContainer object
      directly.  For external use we have vfio_eeh_as_ok() which determines
      if an AddressSpace is usable for EEH (at present this means it has a
      single container with exactly one group attached), and vfio_eeh_as_op()
      which will perform an operation on an AddressSpace in the unambiguous case,
      and otherwise returns an error.
      
      This interface still isn't great, but it's enough of an improvement to
      allow a number of cleanups in other places.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: NAlex Williamson <alex.williamson@redhat.com>
      3153119e
    • G
      spapr_rng: fix race with main loop · f1a6cf3e
      Greg Kurz 提交于
      Since commit "60253ed1 rng: add request queue support to rng-random",
      the use of a spapr_rng device may hang vCPU threads.
      
      The following path is taken without holding the lock to the main loop mutex:
      
      h_random()
        rng_backend_request_entropy()
          rng_random_request_entropy()
            qemu_set_fd_handler()
      
      The consequence is that entropy_available() may be called before the vCPU
      thread could even queue the request: depending on the scheduling, it may
      happen that entropy_available() does not call random_recv()->qemu_sem_post().
      The vCPU thread will then sleep forever in h_random()->qemu_sem_wait().
      
      This could not happen before 60253ed1 because entropy_available() used
      to call random_recv() unconditionally.
      
      This patch ensures the lock is held to avoid the race.
      Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NCédric Le Goater <clg@fr.ibm.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      f1a6cf3e
    • D
      target-ppc: Eliminate kvmppc_kern_htab global · c18ad9a5
      David Gibson 提交于
      fa48b432 "target-ppc: Remove hack for ppc_hash64_load_hpte*() with HV KVM"
      purports to remove a hack in the handling of hash page tables (HPTs)
      managed by KVM instead of qemu.  However, it actually went in the wrong
      direction.
      
      That patch requires anything looking for an external HPT (that is one not
      managed by the guest itself) to check both env->external_htab (for a qemu
      managed HPT) and kvmppc_kern_htab (for a KVM managed HPT).  That's a
      problem because kvmppc_kern_htab is local to mmu-hash64.c, but some places
      which need to check for an external HPT are outside that, such as
      kvm_arch_get_registers().  The latter was subtly broken by the earlier
      patch such that gdbstub can no longer access memory.
      
      Basically a KVM managed HPT is much more like a qemu managed HPT than it is
      like a guest managed HPT, so the original "hack" was actually on the right
      track.
      
      This partially reverts fa48b432, so we again mark a KVM managed external HPT
      by putting a special but non-NULL value in env->external_htab.  It then
      goes further, using that marker to eliminate the kvmppc_kern_htab global
      entirely.  The ppc_hash64_set_external_hpt() helper function is extended
      to set that marker if passed a NULL value (if you're setting an external
      HPT, but don't have an actual HPT to set, the assumption is that it must
      be a KVM managed HPT).
      
      This also has some flow-on changes to the HPT access helpers, required by
      the above changes.
      Reported-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Tested-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      c18ad9a5
    • D
      target-ppc: Add helpers for updating a CPU's SDR1 and external HPT · e5c0d3ce
      David Gibson 提交于
      When a Power cpu with 64-bit hash MMU has it's hash page table (HPT)
      pointer updated by a write to the SDR1 register we need to update some
      derived variables.  Likewise, when the cpu is configured for an external
      HPT (one not in the guest memory space) some derived variables need to be
      updated.
      
      Currently the logic for this is (partially) duplicated in ppc_store_sdr1()
      and in spapr_cpu_reset().  In future we're going to need it in some other
      places, so make some common helpers for this update.
      
      In addition the new ppc_hash64_set_external_hpt() helper also updates
      SDR1 in KVM - it's not updated by the normal runtime KVM <-> qemu CPU
      synchronization.  In a sense this belongs logically in the
      ppc_hash64_set_sdr1() helper, but that is called from
      kvm_arch_get_registers() so can't itself call cpu_synchronize_state()
      without infinite recursion.  In practice this doesn't matter because
      the only other caller is TCG specific.
      
      Currently there aren't situations where updating SDR1 at runtime in KVM
      matters, but there are going to be in future.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      e5c0d3ce
    • D
      target-ppc: Split out SREGS get/put functions · a7a00a72
      David Gibson 提交于
      Currently the getting and setting of Power MMU registers (sregs) take up
      large inline chunks of the kvm_arch_get_registers() and
      kvm_arch_put_registers() functions.  Especially since there are two
      variants (for Book-E and Book-S CPUs), only one of which will be used in
      practice, this is pretty hard to read.
      
      This patch splits these out into helper functions for clarity.  No
      functional change is expected.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      a7a00a72
    • M
      spapr_pci: fix multifunction hotplug · 788d2599
      Michael Roth 提交于
      Since 3f1e1478, QEMU has adopted a convention of supporting function
      hotplug by deferring hotplug events until func 0 is hotplugged.
      This is likely how management tools like libvirt would expose
      such support going forward.
      
      Since sPAPR guests rely on per-func events rather than
      slot-based, our protocol has been to hotplug func 0 *first* to
      avoid cases where devices appear within guests without func 0
      present to avoid undefined behavior.
      
      To remain compatible with new convention, defer hotplug in a
      similar manner, but then generate events in 0-first order as we
      did in the past. Once func 0 present, fail any attempts to plug
      additional functions (as we do with PCIe).
      
      For unplug, defer unplug operations in a similar manner, but
      generate unplug events such that function 0 is removed last in guest.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      788d2599
    • A
      target-ppc: Add PVR for POWER8NVL processor · a88dced8
      Alexey Kardashevskiy 提交于
      This adds a new POWER8+NVLink CPU PVR which core is identical to POWER8
      but has a different PVR. The only available machine now has PVR
      pvr 004c 0100 so this defines "POWER8NVL" alias as v1.0.
      
      The corresponding kernel commit is
      https://github.com/torvalds/linux/commit/ddee09c099c3
      "powerpc: Add PVR for POWER8NVL processor"
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      a88dced8
    • B
    • T
      ppc: Fix migration of the TAR SPR · 1e440cbc
      Thomas Huth 提交于
      The TAR special purpose register currently does not get migrated
      under KVM because it does not get synchronized with the kernel.
      Use spr_register_kvm() instead of spr_register() to fix this issue.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      1e440cbc
    • T
      ppc: Define the PSPB register on POWER8 · d6f1445f
      Thomas Huth 提交于
      POWER8 / PowerISA 2.07 has a new special purpose register called PSPB
      ("Problem State Priority Boost Register"). The contents of this register
      are currently lost during migration. To be able to migrate this register,
      too, we've got to define this SPR along with the other SPRs of POWER8.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      d6f1445f
    • M
      acpi-test: update UID for GSI links · 3ba6a710
      Michael S. Tsirkin 提交于
      Update acpi test data to match
      commit 6a991e07
      ("hw/acpi: fix GSI links UID").
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      3ba6a710
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · 4caecccb
      Peter Maydell 提交于
      * Miscellaneous exec.c fixes (Markus, myself)
      * Q35 support for -machine kernel_irqchip=split (Rita)
      * Chardev replay support (Pavel)
      * icount "warping" cleanups (Pavel)
      
      # gpg: Signature made Tue 15 Mar 2016 17:24:08 GMT using RSA key ID 78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
      
      * remotes/bonzini/tags/for-upstream:
        icount: decouple warp calls
        icount: remove obsolete warp call
        replay: character devices
        exec: fix early return from ram_block_add
        exec: Fix memory allocation when memory path isn't on hugetlbfs
        exec: Fix memory allocation when memory path names new file
        update-linux-headers: Add userfaultfd.h
        kvm: x86: q35: Add support for -machine kernel_irqchip=split for q35
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      4caecccb
    • P
      icount: decouple warp calls · e76d1798
      Pavel Dovgalyuk 提交于
      qemu_clock_warp function is called to update virtual clock when CPU
      is sleeping. This function includes replay checkpoint to make execution
      deterministic in icount mode.
      Record/replay module flushes async event queue at checkpoints.
      Some of the events (e.g., block devices operations) include interaction
      with hardware. E.g., APIC polled by block devices sets one of IRQ flags.
      Flag to be set depends on currently executed thread (CPU or iothread).
      Therefore in replay mode we have to process the checkpoints in the same thread
      as they were recorded.
      qemu_clock_warp function (and its checkpoint) may be called from different
      thread. This patch decouples two different execution cases of this function:
      call when CPU is sleeping from iothread and call from cpu thread to update
      virtual clock.
      First task is performed by qemu_start_warp_timer function. It sets warp
      timer event to the moment of nearest pending virtual timer.
      Second function (qemu_account_warp_timer) is called from cpu thread
      before execution of the code. It advances virtual clock by adding the length
      of period while CPU was sleeping.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160310115609.4812.44986.stgit@PASHA-ISP>
      [Update docs. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e76d1798
    • P
      icount: remove obsolete warp call · 281b2201
      Pavel Dovgalyuk 提交于
      qemu_clock_warp call in qemu_tcg_wait_io_event function is not needed
      anymore, because it is called in every iteration of main_loop_wait.
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160310115603.4812.67559.stgit@PASHA-ISP>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      281b2201
    • P
      replay: character devices · 33577b47
      Pavel Dovgalyuk 提交于
      This patch implements record and replay of character devices.
      It records chardevs communication in replay mode. Recorded information
      include data read from backend and counter of bytes written
      from frontend to backend to preserve frontend internal state.
      If character device was configured through the command line in record mode,
      then in replay mode it should be also added to command line. Backend of
      the character device could be changed in replay mode.
      Replaying of devices that perform ioctl and get_msgfd operations is not
      supported.
      gdbstub which also acts as a backend is not recorded to allow controlling
      the replaying through gdb. Monitor backends are also not recorded.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160314074436.4980.83856.stgit@PASHA-ISP>
      [Add stubs. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      33577b47
    • P
      exec: fix early return from ram_block_add · 39c350ee
      Paolo Bonzini 提交于
      After reporting an error, ram_block_add was going on with the registration
      of the RAMBlock.  The visible effect is that it unlocked the ramlist
      mutex twice.
      
      Fixes: 528f46afReviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      39c350ee
    • M
      exec: Fix memory allocation when memory path isn't on hugetlbfs · e1fb6471
      Markus Armbruster 提交于
      gethugepagesize() works reliably only when its argument is on
      hugetlbfs.  When it's not, it returns the filesystem's "optimal
      transfer block size", which may or may not be the actual page size
      you'll get when you mmap().
      
      If the value is too small or not a power of two, we fail
      qemu_ram_mmap()'s assertions.  These were added in commit 794e8f30
      (v2.5.0).  The bug's impact before that is currently unknown.  Seems
      fairly unlikely at least when the normal page size is 4KiB.
      
      Else, if the value is too large, we align more strictly than
      necessary.
      
      gethugepagesize() goes back to commit c902760f (v0.13).  That commit
      clearly intended gethugepagesize() to be used on hugetlbfs only.  Not
      only was it named accordingly, it also printed a warning when used on
      anything else.  However, the commit neglected to spell out the
      restriction in user documentation of -mem-path.
      
      Commit bfc2a1a1 (v2.5.0) dropped the warning as bogus "because QEMU
      functions perfectly well with the path on a regular tmpfs filesystem".
      It sure does when you're sufficiently lucky.  In my testing, I was
      lucky, too.
      
      Fix by switching to qemu_fd_getpagesize().  Rename the variable
      holding its result from hpagesize to page_size.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1457378754-21649-3-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e1fb6471
    • M
      exec: Fix memory allocation when memory path names new file · fd97fd44
      Markus Armbruster 提交于
      Commit 8d31d6b6 extended file_ram_alloc() to accept file names in
      addition to directory names.  Even though it passes O_CREAT to open(),
      it actually works only for existing files.  Reproducer adapted from
      the commit's qemu-doc.texi update:
      
          $ qemu-system-x86_64 -object memory-backend-file,size=2M,mem-path=/dev/hugepages/my-shmem-file,id=mb1
          qemu-system-x86_64: -object memory-backend-file,size=2M,mem-path=/dev/hugepages/my-shmem-file,id=mb1: failed to get page size of file /dev/hugepages/my-shmem-file: No such file or directory
      
      This is because we first get the page size for @path, then open the
      actual file.  Unwise even before the flawed commit, because the
      directory could change in between, invalidating the page size.
      Unlikely to bite in practice.
      
      Rearrange the code to create the file (if necessary) before getting
      its page size.  Carefully avoid TOCTTOU conditions with a method
      suggested by Paolo Bonzini.
      
      While there, replace "hugepages" by "guest RAM" in error messages,
      because host memory backends can be used for purposes other than huge
      pages, e.g. /dev/shm/ shared memory.  Help text of -mem-path agrees.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1457378754-21649-2-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fd97fd44
    • A
      update-linux-headers: Add userfaultfd.h · 2ae823d4
      Alexey Kardashevskiy 提交于
      userfailtfd.h is used by post-copy migration so include it to
      the update-linux-headers.sh as we want it updated altogether with
      other kernel headers.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <1455512381-15271-1-git-send-email-aik@ozlabs.ru>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2ae823d4
    • R
      kvm: x86: q35: Add support for -machine kernel_irqchip=split for q35 · b094f2e0
      Rita Sinha 提交于
      The split IRQ chip mode via KVM_CAP_SPLIT_IRQCHIP was introduced with commit
      15eafc2e but was broken for q35. This patch makes kernel_irqchip=split
      functional for q35.
      Signed-off-by: NRita Sinha <rita.sinha89@gmail.com>
      Message-Id: <1457378525-16455-1-git-send-email-rita.sinha89@gmail.com>
      Reviewed-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b094f2e0