1. 23 7月, 2014 10 次提交
  2. 08 7月, 2014 1 次提交
    • A
      iommu: Fix IOMMU sysfs stubs · e09f8ea5
      Alex Williamson 提交于
      0-day kernel build testing reports:
      
         arch/x86/kvm/x86.o: In function `iommu_device_destroy':
      >> (.text+0x7a0a): multiple definition of `iommu_device_destroy'
         arch/x86/kvm/../../../virt/kvm/vfio.o:vfio.c:(.text+0x490): first defined here
         arch/x86/kvm/x86.o: In function `iommu_device_link':
      >> (.text+0x7a15): multiple definition of `iommu_device_link'
         arch/x86/kvm/../../../virt/kvm/vfio.o:vfio.c:(.text+0x49b): first defined here
         arch/x86/kvm/x86.o: In function `iommu_device_unlink':
      >> (.text+0x7a25): multiple definition of `iommu_device_unlink'
         arch/x86/kvm/../../../virt/kvm/vfio.o:vfio.c:(.text+0x4ab): first defined here
         arch/x86/kvm/x86.o: In function `iommu_device_create':
      >> (.text+0x79f8): multiple definition of `iommu_device_create'
         arch/x86/kvm/../../../virt/kvm/vfio.o:vfio.c:(.text+0x47e): first defined here
      
      These are due to failing to define the stubs as static inline.  Fix.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      e09f8ea5
  3. 07 7月, 2014 2 次提交
  4. 04 7月, 2014 18 次提交
    • A
      iommu/amd: Add sysfs support · 066f2e98
      Alex Williamson 提交于
      AMD-Vi support for IOMMU sysfs.  This allows us to associate devices
      with a specific IOMMU device and examine the capabilities and features
      of that IOMMU.  The AMD IOMMU is hosted on and actual PCI device, so
      we make that device the parent for the IOMMU class device.  This
      initial implementaiton exposes only the capability header and extended
      features register for the IOMMU.
      
      # find /sys | grep ivhd
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:00.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:02.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:04.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:09.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:11.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:12.0
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:12.2
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/devices/0000:00:13.0
      ...
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/power
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/power/control
      ...
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/device
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/subsystem
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu/cap
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/amd-iommu/features
      /sys/devices/pci0000:00/0000:00:00.2/iommu/ivhd0/uevent
      /sys/class/iommu/ivhd0
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      066f2e98
    • A
      iommu/vt-d: Make use of IOMMU sysfs support · a5459cfe
      Alex Williamson 提交于
      Register our DRHD IOMMUs, cross link devices, and provide a base set
      of attributes for the IOMMU.  Note that IRQ remapping support parses
      the DMAR table very early in boot, well before the iommu_class can
      reasonably be setup, so our registration is split between
      intel_iommu_init(), which occurs later, and alloc_iommu(), which
      typically occurs much earlier, but may happen at any time later
      with IOMMU hot-add support.
      
      On a typical desktop system, this provides the following (pruned):
      
      $ find /sys | grep dmar
      /sys/devices/virtual/iommu/dmar0
      /sys/devices/virtual/iommu/dmar0/devices
      /sys/devices/virtual/iommu/dmar0/devices/0000:00:02.0
      /sys/devices/virtual/iommu/dmar0/intel-iommu
      /sys/devices/virtual/iommu/dmar0/intel-iommu/cap
      /sys/devices/virtual/iommu/dmar0/intel-iommu/ecap
      /sys/devices/virtual/iommu/dmar0/intel-iommu/address
      /sys/devices/virtual/iommu/dmar0/intel-iommu/version
      /sys/devices/virtual/iommu/dmar1
      /sys/devices/virtual/iommu/dmar1/devices
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:00.0
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:01.0
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:16.0
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:1a.0
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:1b.0
      /sys/devices/virtual/iommu/dmar1/devices/0000:00:1c.0
      ...
      /sys/devices/virtual/iommu/dmar1/intel-iommu
      /sys/devices/virtual/iommu/dmar1/intel-iommu/cap
      /sys/devices/virtual/iommu/dmar1/intel-iommu/ecap
      /sys/devices/virtual/iommu/dmar1/intel-iommu/address
      /sys/devices/virtual/iommu/dmar1/intel-iommu/version
      /sys/class/iommu/dmar0
      /sys/class/iommu/dmar1
      
      (devices also link back to the dmar units)
      
      This makes address, version, capabilities, and extended capabilities
      available, just like printed on boot.  I've tried not to duplicate
      data that can be found in the DMAR table, with the exception of the
      address, which provides an easy way to associate the sysfs device with
      a DRHD entry in the DMAR.  It's tempting to add scopes and RMRR data
      here, but the full DMAR table is already exposed under /sys/firmware/
      and therefore already provides a way for userspace to learn such
      details.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      a5459cfe
    • A
      iommu: Add sysfs support for IOMMUs · c61959ec
      Alex Williamson 提交于
      IOMMUs currently have no common representation to userspace, most
      seem to have no representation at all aside from a few printks
      on bootup.  There are however features of IOMMUs that are useful
      to know about.  For instance the IOMMU might support superpages,
      making use of processor large/huge pages more important in a device
      assignment scenario.  It's also useful to create cross links between
      devices and IOMMU hardware units, so that users might be able to
      load balance their devices to avoid thrashing a single hardware unit.
      
      This patch adds a device create and destroy interface as well as
      device linking, making it very lightweight for an IOMMU driver to add
      basic support.  IOMMU drivers can provide additional attributes
      automatically by using an attribute_group.
      
      The attributes exposed are expected to be relatively device specific,
      the means to retrieve them certainly are, so there are currently no
      common attributes for the new class created here.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      c61959ec
    • A
      iommu: Remove pci.h · fd2852d5
      Alex Williamson 提交于
      The single helper here no longer has any users.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      fd2852d5
    • A
      iommu/fsl: Use iommu_group_get_for_dev() for IOMMU groups · 7319eded
      Alex Williamson 提交于
      Drop custom code and use IOMMU provided grouping support for PCI.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NVarun Sethi <varun.sethi@freescale.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      7319eded
    • A
      iommu/vt-d: Update to use PCI DMA aliases · 579305f7
      Alex Williamson 提交于
      VT-d code currently makes use of pci_find_upstream_pcie_bridge() in
      order to find the topology based alias of a device.  This function has
      a few problems.  First, it doesn't check the entire alias path of the
      device to the root bus, therefore if a PCIe device is masked upstream,
      the wrong result is produced.  Also, it's known to get confused and
      give up when it crosses a bridge from a conventional PCI bus to a PCIe
      bus that lacks a PCIe capability.  The PCI-core provided DMA alias
      support solves both of these problems and additionally adds support
      for DMA function quirks allowing VT-d to work with devices like
      Marvell and Ricoh with known broken requester IDs.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      579305f7
    • A
      iommu/vt-d: Use iommu_group_get_for_dev() · e17f9ff4
      Alex Williamson 提交于
      The IOMMU code now provides a common interface for finding or
      creating an IOMMU group for a device on PCI buses.  Make use of it
      and remove piles of code.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      e17f9ff4
    • A
      iommu/amd: Use iommu_group_get_for_dev() · 65d5352f
      Alex Williamson 提交于
      The common iommu_group_get_for_dev() allows us to greatly simplify
      our group lookup for a new device.  Also, since we insert IVRS
      aliases into the PCI DMA alias quirks, we should alway come up with
      the same results as the existing code.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      65d5352f
    • A
      iommu/amd: Update to use PCI DMA aliases · c1931090
      Alex Williamson 提交于
      AMD-Vi already has a concept of an alias provided via the IVRS table.
      Now that PCI-core also understands aliases, we need to incorporate
      both aspects when programming the IOMMU.  IVRS is generally quite
      reliable, so we continue to prefer it when an alias is present.  For
      cases where we have an IVRS alias that does not match the PCI alias
      or where PCI does not report an alias, report the mismatch to allow
      us to collect more quirks and dynamically incorporate the alias into
      the device alias quirks where possible.
      
      This should allow AMD-Vi to work with devices like Marvell and Ricoh
      with DMA function alias quirks unknown to the BIOS.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      c1931090
    • A
      iommu/core: Create central IOMMU group lookup/creation interface · 104a1c13
      Alex Williamson 提交于
      Currently each IOMMU driver that supports IOMMU groups has its own
      code for discovering the base device used in grouping.  This code
      is generally not specific to the IOMMU hardware, but to the bus of
      the devices managed by the IOMMU.  We can therefore create a common
      interface for supporting devices on different buses.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      104a1c13
    • Y
      iommu/vt-d: Suppress compiler warnings · aa4d066a
      Yijing Wang 提交于
      suppress compiler warnings:
      drivers/iommu/intel-iommu.c: In function ‘device_to_iommu’:
      drivers/iommu/intel-iommu.c:673: warning: ‘segment’ may be used uninitialized in this function
      drivers/iommu/intel-iommu.c: In function ‘get_domain_for_dev.clone.3’:
      drivers/iommu/intel-iommu.c:2217: warning: ‘bridge_bus’ may be used uninitialized in this function
      drivers/iommu/intel-iommu.c:2217: warning: ‘bridge_devfn’ may be used uninitialized in this function
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      aa4d066a
    • Y
      iommu/vt-d: Remove the useless dma_pte_addr · effad4b5
      Yijing Wang 提交于
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      effad4b5
    • J
      iommu/vt-d: Don't use magic number in dma_pte_superpage · c3c75eb7
      Joerg Roedel 提交于
      Use the already defined DMA_PTE_LARGE_PAGE for testing
      instead of hardcoding the value again.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      c3c75eb7
    • Y
      iommu/vt-d: Fix reference count in iommu_prepare_isa · 9b27e82d
      Yijing Wang 提交于
      Decrease the device reference count avoid memory leak.
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      9b27e82d
    • Y
      iommu/vt-d: Use inline function dma_pte_superpage instead of macros · e16922af
      Yijing Wang 提交于
      Use inline function dma_pte_superpage() instead of macro for
      better readability.
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      e16922af
    • Y
      iommu/vt-d: Clear the redundant assignment for domain->nid · 8f9d41b4
      Yijing Wang 提交于
      Alloc_domain() will initialize domain->nid to -1. So the
      initialization for domain->nid in md_domain_init() is redundant,
      clear it.
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      8f9d41b4
    • Y
      iommu/vt-d: Clear the redundant assignment in dmar_enable_qi · 435bbb46
      Yijing Wang 提交于
      __dmar_enable_qi() will initialize free_head,free_tail and
      free_cnt for q_inval. Remove the redundant initialization
      in dmar_enable_qi().
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      435bbb46
    • Y
      iommu/vt-d: Use list_for_each_safe() to simplify code · 3a74ca01
      Yijing Wang 提交于
      Use list_for_each_entry_safe() instead of list_entry()
      to simplify code.
      Signed-off-by: NYijing Wang <wangyijing@huawei.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      3a74ca01
  5. 30 6月, 2014 4 次提交
  6. 29 6月, 2014 5 次提交