1. 23 Jul, 2014 2 commits
  2. 08 Jul, 2014 1 commit
    • Alex Williamson's avatar
      iommu: Fix IOMMU sysfs stubs · e09f8ea5
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      e09f8ea5
  3. 07 Jul, 2014 2 commits
  4. 04 Jul, 2014 18 commits
    • Alex Williamson's avatar
      iommu/amd: Add sysfs support · 066f2e98
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      066f2e98
    • Alex Williamson's avatar
      iommu/vt-d: Make use of IOMMU sysfs support · a5459cfe
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      a5459cfe
    • Alex Williamson's avatar
      iommu: Add sysfs support for IOMMUs · c61959ec
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      c61959ec
    • Alex Williamson's avatar
      iommu: Remove pci.h · fd2852d5
      Alex Williamson authored
      The single helper here no longer has any users.
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      fd2852d5
    • Alex Williamson's avatar
      iommu/fsl: Use iommu_group_get_for_dev() for IOMMU groups · 7319eded
      Alex Williamson authored
      Drop custom code and use IOMMU provided grouping support for PCI.
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Acked-by: default avatarVarun Sethi <varun.sethi@freescale.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      7319eded
    • Alex Williamson's avatar
      iommu/vt-d: Update to use PCI DMA aliases · 579305f7
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      579305f7
    • Alex Williamson's avatar
      iommu/vt-d: Use iommu_group_get_for_dev() · e17f9ff4
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      e17f9ff4
    • Alex Williamson's avatar
      iommu/amd: Use iommu_group_get_for_dev() · 65d5352f
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      65d5352f
    • Alex Williamson's avatar
      iommu/amd: Update to use PCI DMA aliases · c1931090
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      c1931090
    • Alex Williamson's avatar
      iommu/core: Create central IOMMU group lookup/creation interface · 104a1c13
      Alex Williamson authored
      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: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      104a1c13
    • Yijing Wang's avatar
      iommu/vt-d: Suppress compiler warnings · aa4d066a
      Yijing Wang authored
      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: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      aa4d066a
    • Yijing Wang's avatar
      effad4b5
    • Joerg Roedel's avatar
      iommu/vt-d: Don't use magic number in dma_pte_superpage · c3c75eb7
      Joerg Roedel authored
      Use the already defined DMA_PTE_LARGE_PAGE for testing
      instead of hardcoding the value again.
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      c3c75eb7
    • Yijing Wang's avatar
      iommu/vt-d: Fix reference count in iommu_prepare_isa · 9b27e82d
      Yijing Wang authored
      Decrease the device reference count avoid memory leak.
      Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      9b27e82d
    • Yijing Wang's avatar
      iommu/vt-d: Use inline function dma_pte_superpage instead of macros · e16922af
      Yijing Wang authored
      Use inline function dma_pte_superpage() instead of macro for
      better readability.
      Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      e16922af
    • Yijing Wang's avatar
      iommu/vt-d: Clear the redundant assignment for domain->nid · 8f9d41b4
      Yijing Wang authored
      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: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      8f9d41b4
    • Yijing Wang's avatar
      iommu/vt-d: Clear the redundant assignment in dmar_enable_qi · 435bbb46
      Yijing Wang authored
      __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: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      435bbb46
    • Yijing Wang's avatar
      iommu/vt-d: Use list_for_each_safe() to simplify code · 3a74ca01
      Yijing Wang authored
      Use list_for_each_entry_safe() instead of list_entry()
      to simplify code.
      Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      3a74ca01
  5. 29 Jun, 2014 10 commits
  6. 28 Jun, 2014 7 commits
    • Linus Torvalds's avatar
      Merge tag 'spi-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 24b414d5
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A few driver specific fixes, the biggest one being a fix for the newly
        added Qualcomm SPI controller driver to make it not use its internal
        chip select due to hardware bugs, replacing it with GPIOs"
      
      * tag 'spi-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: qup: Remove chip select function
        spi: qup: Fix order of spi_register_master
        spi: sh-sci: fix use-after-free in sh_sci_spi_remove()
        spi/pxa2xx: fix incorrect SW mode chipselect setting for BayTrail LPSS SPI
      24b414d5
    • Linus Torvalds's avatar
      Merge tag 'regulator-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 4194976b
      Linus Torvalds authored
      Pull regulator fixes from Mark Brown:
       "Several driver specific fixes here, the palmas fixes being especially
        important for a range of boards - the recent updates to support new
        devices have introduced several regressions"
      
      * tag 'regulator-v3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: tps65218: Correct the the config register for LDO1
        regulator: tps65218: Add the missing of_node assignment in probe
        regulator: palmas: fix typo in enable_reg calculation
        regulator: bcm590xx: fix vbus name
        regulator: palmas: Fix SMPS enable/disable/is_enabled
      4194976b
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · eb477e03
      Linus Torvalds authored
      Pull SCSI target fixes from Nicholas Bellinger:
       "Mostly minor fixes this time around.  The highlights include:
      
         - iscsi-target CHAP authentication fixes to enforce explicit key
           values (Tejas Vaykole + rahul.rane)
         - fix a long-standing OOPs in target-core when a alua configfs
           attribute is accessed after port symlink has been removed.
           (Sebastian Herbszt)
         - fix a v3.10.y iscsi-target regression causing the login reject
           status class/detail to be ignored (Christoph Vu-Brugier)
         - fix a v3.10.y iscsi-target regression to avoid rejecting an
           existing ITT during Data-Out when data-direction is wrong (Santosh
           Kulkarni + Arshad Hussain)
         - fix a iscsi-target related shutdown deadlock on UP kernels (Mikulas
           Patocka)
         - fix a v3.16-rc1 build issue with vhost-scsi + !CONFIG_NET (MST)"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
        iscsi-target: fix iscsit_del_np deadlock on unload
        iovec: move memcpy_from/toiovecend to lib/iovec.c
        iscsi-target: Avoid rejecting incorrect ITT for Data-Out
        tcm_loop: Fix memory leak in tcm_loop_submission_work error path
        iscsi-target: Explicily clear login response PDU in exception path
        target: Fix left-over se_lun->lun_sep pointer OOPs
        iscsi-target; Enforce 1024 byte maximum for CHAP_C key value
        iscsi-target: Convert chap_server_compute_md5 to use kstrtoul
      eb477e03
    • Mark Brown's avatar
    • Mark Brown's avatar
      Merge remote-tracking branches 'regulator/fix/bcm590xx',... · 11767484
      Mark Brown authored
      Merge remote-tracking branches 'regulator/fix/bcm590xx', 'regulator/fix/palmas' and 'regulator/fix/tps65218' into regulator-linus
      11767484
    • Mikulas Patocka's avatar
      iscsi-target: fix iscsit_del_np deadlock on unload · 81a9c5e7
      Mikulas Patocka authored
      On uniprocessor preemptible kernel, target core deadlocks on unload. The
      following events happen:
      * iscsit_del_np is called
      * it calls send_sig(SIGINT, np->np_thread, 1);
      * the scheduler switches to the np_thread
      * the np_thread is woken up, it sees that kthread_should_stop() returns
        false, so it doesn't terminate
      * the np_thread clears signals with flush_signals(current); and goes back
        to sleep in iscsit_accept_np
      * the scheduler switches back to iscsit_del_np
      * iscsit_del_np calls kthread_stop(np->np_thread);
      * the np_thread is waiting in iscsit_accept_np and it doesn't respond to
        kthread_stop
      
      The deadlock could be resolved if the administrator sends SIGINT signal to
      the np_thread with killall -INT iscsi_np
      
      The reproducible deadlock was introduced in commit
      db6077fd, but the thread-stopping code was
      racy even before.
      
      This patch fixes the problem. Using kthread_should_stop to stop the
      np_thread is unreliable, so we test np_thread_state instead. If
      np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      81a9c5e7
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 3e7b256c
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - fix VT-d regression with handling multiple RMRR entries per device
      
       - fix a small race that was left in the mmu_notifier handling in the
         AMD IOMMUv2 driver
      
      * tag 'iommu-fixes-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Fix small race between invalidate_range_end/start
        iommu/vt-d: fix bug in handling multiple RMRRs for the same PCI device
      3e7b256c