1. 24 9月, 2015 22 次提交
    • P
      intc/gic: Extract some reusable vGIC code · 4b3cfe72
      Pavel Fedin 提交于
      Some functions previously used only by vGICv2 are useful also for vGICv3
      implementation. Untie them from GICState and make accessible from within
      other modules:
      - kvm_arm_gic_set_irq()
      - kvm_gic_supports_attr() - moved to common code and renamed to
        kvm_device_check_attr()
      - kvm_gic_access() - turned into GIC-independent kvm_device_access().
        Data pointer changed to void * because some GICv3 registers are
        64-bit wide
      
      Some of these changes are not used right now, but they will be helpful for
      implementing live migration.
      
      Actually kvm_dist_get() and kvm_dist_put() could also be made reusable, but
      they would require two extra parameters (s->dev_fd and s->num_cpu) as well as
      lots of typecasts of 's' to DeviceState * and back to GICState *. This makes
      the code very ugly so i decided to stop at this point. I tried also an
      approach with making a base class for all possible GICs, but it would contain
      only three variables (dev_fd, cpu_num and irq_num), and accessing them through
      the rest of the code would be again tedious (either ugly casts or qemu-style
      separate object pointer). So i disliked it too.
      Signed-off-by: NPavel Fedin <p.fedin@samsung.com>
      Tested-by: NAshok kumar <ashoks@broadcom.com>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 2ef56d1dd64ffb75ed02a10dcdaf605e5b8ff4f8.1441784344.git.p.fedin@samsung.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      4b3cfe72
    • S
      hw/intc: Implement GIC-500 base class · ff8f06ee
      Shlomo Pongratz 提交于
      This class is to be used by both software and KVM implementations of GICv3
      
      Currently it is mostly a placeholder, but in future it is supposed to hold
      qemu's representation of GICv3 state, which is necessary for migration.
      
      The interface of this class is fully compatible with GICv2 one. This is
      done in order to simplify integration with existing code.
      Signed-off-by: NShlomo Pongratz <shlomo.pongratz@huawei.com>
      Signed-off-by: NPavel Fedin <p.fedin@samsung.com>
      Reviewed-by: NEric Auger <eric.auger@linaro.org>
      Tested-by: NAshok kumar <ashoks@broadcom.com>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: aff8baaee493cdcab0694b4a1d4dd5ff27c37ed2.1441784344.git.p.fedin@samsung.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ff8f06ee
    • P
      Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150923.0' into staging · fefa4b12
      Peter Maydell 提交于
      VFIO updates 2015-09-23
      
       - Tracing improvements to use common prefixes for functional areas
       - Quirks overhaul:
         - Split PCI quirks to separate file
         - Make them understandable and more extensible
         - Improve use of MemoryRegions and eliminate use of target pagesize
       - Eliminate build-time debugging, everything migrated to runtime opts
      
      # gpg: Signature made Wed 23 Sep 2015 21:09:05 BST using RSA key ID 3BB08B22
      # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
      # gpg:                 aka "Alex Williamson <alex@shazbot.org>"
      # gpg:                 aka "Alex Williamson <alwillia@redhat.com>"
      # gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>"
      
      * remotes/awilliam/tags/vfio-update-20150923.0:
        vfio/pci: Add emulated PCI IDs
        vfio/pci: Cache vendor and device ID
        vfio/pci: Move AMD device specific reset to quirks
        vfio/pci: Remove old config window and mirror quirks
        vfio/pci: Config mirror quirk
        vfio/pci: Config window quirks
        vfio/pci: Rework RTL8168 quirk
        vfio/pci: Cleanup Nvidia 0x3d0 quirk
        vfio/pci: Cleanup ATI 0x3c3 quirk
        vfio/pci: Foundation for new quirk structure
        vfio/pci: Cleanup ROM blacklist quirk
        vfio/pci: Split quirks to a separate file
        vfio/pci: Extract PCI structures to a separate header
        vfio: Change polarity of our no-mmap option
        vfio/pci: Make interrupt bypass runtime configurable
        vfio/pci: Rename MSI/X functions for easier tracing
        vfio/pci: Rename INTx functions for easier tracing
        vfio/pci: Cleanup vfio_early_setup_msix() error path
        vfio/pci: Cleanup RTL8168 quirk and tracing
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      fefa4b12
    • A
      vfio/pci: Add emulated PCI IDs · 89dcccc5
      Alex Williamson 提交于
      Specifying an emulated PCI vendor/device ID can be useful for testing
      various quirk paths, even though the behavior and functionality of
      the device with bogus IDs is fully unsupportable.  We need to use a
      uint32_t for the vendor/device IDs, even though the registers
      themselves are only 16-bit in order to be able to determine whether
      the value is valid and user set.
      
      The same support is added for subsystem vendor/device ID, though these
      have the possibility of being useful and supported for more than a
      testing tool.  An emulated platform might want to impose their own
      subsystem IDs or at least hide the physical subsystem ID.  Windows
      guests will often reinstall drivers due to a change in subsystem IDs,
      something that VM users may want to avoid.  Of course careful
      attention would be required to ensure that guest drivers do not rely
      on the subsystem ID as a basis for device driver quirks.
      
      All of these options are added using the standard experimental option
      prefix and should not be considered stable.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      89dcccc5
    • A
      vfio/pci: Cache vendor and device ID · ff635e37
      Alex Williamson 提交于
      Simplify access to commonly referenced PCI vendor and device ID by
      caching it on the VFIOPCIDevice struct.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      ff635e37
    • A
      vfio/pci: Move AMD device specific reset to quirks · c9c50009
      Alex Williamson 提交于
      This is just another quirk, for reset rather than affecting memory
      regions.  Move it to our new quirks file.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      c9c50009
    • A
      vfio/pci: Remove old config window and mirror quirks · 958d5534
      Alex Williamson 提交于
      These are now unused.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      958d5534
    • A
      vfio/pci: Config mirror quirk · 0d38fb1c
      Alex Williamson 提交于
      Re-implement our mirror quirk using the new infrastructure.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      0d38fb1c
    • A
      vfio/pci: Config window quirks · 0e54f24a
      Alex Williamson 提交于
      Config windows make use of an address register and a data register.
      In VGA cards, these are often used to provide real mode code in the
      BIOS an easy way to access MMIO registers since the window often
      resides in an I/O port register.  When the MMIO register has a mirror
      of PCI config space, we need to trap those accesses and redirect them
      to emulated config space.
      
      The previous version of this functionality made use of a single
      MemoryRegion and single match address.  This version uses separate
      MemoryRegions for each of the address and data registers and allows
      for multiple match addresses.  This is useful for Nvidia cards which
      have two ranges which index into PCI config space.
      
      The previous implementation is left for the follow-on patch for a more
      reviewable diff.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      0e54f24a
    • A
      vfio/pci: Rework RTL8168 quirk · 954258a5
      Alex Williamson 提交于
      Another rework of this quirk, this time to update to the new quirk
      structure.  We can handle the address and data registers with
      separate MemoryRegions and a quirk specific data structure, making the
      code much more understandable.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      954258a5
    • A
      vfio/pci: Cleanup Nvidia 0x3d0 quirk · 6029a424
      Alex Williamson 提交于
      The Nvidia 0x3d0 quirk makes use of a two separate registers and gives
      us our first chance to make use of separate memory regions for each to
      simplify the code a bit.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      6029a424
    • A
      vfio/pci: Cleanup ATI 0x3c3 quirk · b946d286
      Alex Williamson 提交于
      This is an easy quirk that really doesn't need a data structure if
      its own.  We can pass vdev as the opaque data and access to the
      MemoryRegion isn't required.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      b946d286
    • A
      vfio/pci: Foundation for new quirk structure · 8c4f2348
      Alex Williamson 提交于
      VFIOQuirk hosts a single memory region and a fixed set of data fields
      that try to handle all the quirk cases, but end up making those that
      don't exactly match really confusing.  This patch introduces a struct
      intended to provide more flexibility and simpler code.  VFIOQuirk is
      stripped to its basics, an opaque data pointer for quirk specific
      data and a pointer to an array of MemoryRegions with a counter.  This
      still allows us to have common teardown routines, but adds much
      greater flexibility to support multiple memory regions and quirk
      specific data structures that are easier to maintain.  The existing
      VFIOQuirk is transformed into VFIOLegacyQuirk, which further patches
      will eliminate entirely.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      8c4f2348
    • A
      vfio/pci: Cleanup ROM blacklist quirk · 056dfcb6
      Alex Williamson 提交于
      Create a vendor:device ID helper that we'll also use as we rework the
      rest of the quirks.  Re-reading the config entries, even if we get
      more blacklist entries, is trivial overhead and only incurred during
      device setup.  There's no need to typedef the blacklist structure,
      it's a static private data type used once.  The elements get bumped
      up to uint32_t to avoid future maintenance issues if PCI_ANY_ID gets
      used for a blacklist entry (avoiding an actual hardware match).  Our
      test loop is also crying out to be simplified as a for loop.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      056dfcb6
    • A
      c00d61d8
    • A
    • A
      vfio: Change polarity of our no-mmap option · 5e15d79b
      Alex Williamson 提交于
      The default should be to allow mmap and new drivers shouldn't need to
      expose an option or set it to other than the allocation default in
      their initfn.  Take advantage of the experimental flag to change this
      option to the correct polarity.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      5e15d79b
    • A
      vfio/pci: Make interrupt bypass runtime configurable · 46746dba
      Alex Williamson 提交于
      Tracing is more effective when we can completely disable all KVM
      bypass paths.  Make these runtime rather than build-time configurable.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      46746dba
    • A
      vfio/pci: Rename MSI/X functions for easier tracing · 0de70dc7
      Alex Williamson 提交于
      This allows vfio_msi* tracing.  The MSI/X interrupt tracing is also
      pulled out of #ifdef DEBUG_VFIO to avoid a recompile for tracing this
      path.  A few cycles to read the message is hardly anything if we're
      already in QEMU.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      0de70dc7
    • A
      vfio/pci: Rename INTx functions for easier tracing · 870cb6f1
      Alex Williamson 提交于
      Rename functions and tracing callbacks so that we can trace vfio_intx*
      to see all the INTx related activities.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      870cb6f1
    • A
      vfio/pci: Cleanup vfio_early_setup_msix() error path · b5bd049f
      Alex Williamson 提交于
      With the addition of the Chelsio quirk we have an error path out of
      vfio_early_setup_msix() that doesn't free the allocated VFIOMSIXInfo
      struct.  This doesn't introduce a leak as it still gets freed in the
      vfio_put_device() path, but it's complicated and sloppy to rely on
      that.  Restructure to free the allocated data on error and only link
      it into the vdev on success.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Reported-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      b5bd049f
    • A
      vfio/pci: Cleanup RTL8168 quirk and tracing · d451008e
      Alex Williamson 提交于
      There's quite a bit of cleanup that can be done to the RTL8168 quirk,
      as well as the tracing to prevent a spew of uninteresting accesses
      for anything else the driver might choose to use the window registers
      for besides the MSI-X table.  There should be no functional change,
      but it's now possible to get compact and useful traces by enabling
      vfio_rtl8168_quirk*, ex:
      
      vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f000
      vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f000
      vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0xfee0100c
      vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f004
      vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f004
      vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x0
      vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f008
      vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f008
      vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x49b1
      vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f00c
      vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f00c
      vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x0
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      d451008e
  2. 23 9月, 2015 18 次提交