1. 16 8月, 2017 4 次提交
  2. 26 7月, 2017 1 次提交
    • J
      iommu/amd: Fix schedule-while-atomic BUG in initialization code · 74ddda71
      Joerg Roedel 提交于
      The register_syscore_ops() function takes a mutex and might
      sleep. In the IOMMU initialization code it is invoked during
      irq-remapping setup already, where irqs are disabled.
      
      This causes a schedule-while-atomic bug:
      
       BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
       in_atomic(): 0, irqs_disabled(): 1, pid: 1, name: swapper/0
       no locks held by swapper/0/1.
       irq event stamp: 304
       hardirqs last  enabled at (303): [<ffffffff818a87b6>] _raw_spin_unlock_irqrestore+0x36/0x60
       hardirqs last disabled at (304): [<ffffffff8235d440>] enable_IR_x2apic+0x79/0x196
       softirqs last  enabled at (36): [<ffffffff818ae75f>] __do_softirq+0x35f/0x4ec
       softirqs last disabled at (31): [<ffffffff810c1955>] irq_exit+0x105/0x120
       CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc2.1.el7a.test.x86_64.debug #1
       Hardware name:          PowerEdge C6145 /040N24, BIOS 3.5.0 10/28/2014
       Call Trace:
        dump_stack+0x85/0xca
        ___might_sleep+0x22a/0x260
        __might_sleep+0x4a/0x80
        __mutex_lock+0x58/0x960
        ? iommu_completion_wait.part.17+0xb5/0x160
        ? register_syscore_ops+0x1d/0x70
        ? iommu_flush_all_caches+0x120/0x150
        mutex_lock_nested+0x1b/0x20
        register_syscore_ops+0x1d/0x70
        state_next+0x119/0x910
        iommu_go_to_state+0x29/0x30
        amd_iommu_enable+0x13/0x23
      
      Fix it by moving the register_syscore_ops() call to the next
      initialization step, which runs with irqs enabled.
      Reported-by: NArtem Savkov <asavkov@redhat.com>
      Tested-by: NArtem Savkov <asavkov@redhat.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Fixes: 2c0ae172 ('iommu/amd: Convert iommu initialization to state machine')
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      74ddda71
  3. 22 6月, 2017 7 次提交
  4. 16 6月, 2017 1 次提交
  5. 08 6月, 2017 1 次提交
    • T
      iommu/amd: Reduce amount of MMIO when submitting commands · d334a563
      Tom Lendacky 提交于
      As newer, higher speed devices are developed, perf data shows that the
      amount of MMIO that is performed when submitting commands to the IOMMU
      causes performance issues. Currently, the command submission path reads
      the command buffer head and tail pointers and then writes the tail
      pointer once the command is ready.
      
      The tail pointer is only ever updated by the driver so it can be tracked
      by the driver without having to read it from the hardware.
      
      The head pointer is updated by the hardware, but can be read
      opportunistically. Reading the head pointer only when it appears that
      there might not be room in the command buffer and then re-checking the
      available space reduces the number of times the head pointer has to be
      read.
      Signed-off-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      d334a563
  6. 30 3月, 2017 4 次提交
  7. 28 2月, 2017 1 次提交
  8. 10 2月, 2017 2 次提交
    • J
      iommu: Add sysfs bindings for struct iommu_device · 39ab9555
      Joerg Roedel 提交于
      There is currently support for iommu sysfs bindings, but
      those need to be implemented in the IOMMU drivers. Add a
      more generic version of this by adding a struct device to
      struct iommu_device and use that for the sysfs bindings.
      
      Also convert the AMD and Intel IOMMU driver to make use of
      it.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      39ab9555
    • J
      iommu: Introduce new 'struct iommu_device' · b0119e87
      Joerg Roedel 提交于
      This struct represents one hardware iommu in the iommu core
      code. For now it only has the iommu-ops associated with it,
      but that will be extended soon.
      
      The register/unregister interface is also added, as well as
      making use of it in the Intel and AMD IOMMU drivers.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      b0119e87
  9. 10 1月, 2017 1 次提交
  10. 21 12月, 2016 1 次提交
    • L
      ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users · 6b11d1d6
      Lv Zheng 提交于
      This patch removes the users of the deprectated APIs:
       acpi_get_table_with_size()
       early_acpi_os_unmap_memory()
      The following APIs should be used instead of:
       acpi_get_table()
       acpi_put_table()
      
      The deprecated APIs are invented to be a replacement of acpi_get_table()
      during the early stage so that the early mapped pointer will not be stored
      in ACPICA core and thus the late stage acpi_get_table() won't return a
      wrong pointer. The mapping size is returned just because it is required by
      early_acpi_os_unmap_memory() to unmap the pointer during early stage.
      
      But as the mapping size equals to the acpi_table_header.length
      (see acpi_tb_init_table_descriptor() and acpi_tb_validate_table()), when
      such a convenient result is returned, driver code will start to use it
      instead of accessing acpi_table_header to obtain the length.
      
      Thus this patch cleans up the drivers by replacing returned table size with
      acpi_table_header.length, and should be a no-op.
      Reported-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6b11d1d6
  11. 10 11月, 2016 1 次提交
  12. 19 9月, 2016 1 次提交
  13. 05 9月, 2016 4 次提交
  14. 07 7月, 2016 1 次提交
    • J
      iommu/amd: Fix unity mapping initialization race · 522e5cb7
      Joerg Roedel 提交于
      There is a race condition in the AMD IOMMU init code that
      causes requested unity mappings to be blocked by the IOMMU
      for a short period of time. This results on boot failures
      and IO_PAGE_FAULTs on some machines.
      
      Fix this by making sure the unity mappings are installed
      before all other DMA is blocked.
      
      Fixes: aafd8ba0 ('iommu/amd: Implement add_device and remove_device')
      Cc: stable@vger.kernel.org # v4.2+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      522e5cb7
  15. 27 6月, 2016 1 次提交
  16. 07 4月, 2016 5 次提交
  17. 25 2月, 2016 2 次提交
    • J
      iommu/amd: Apply workaround for ATS write permission check · 358875fd
      Jay Cornwall 提交于
      The AMD Family 15h Models 30h-3Fh (Kaveri) BIOS and Kernel Developer's
      Guide omitted part of the BIOS IOMMU L2 register setup specification.
      Without this setup the IOMMU L2 does not fully respect write permissions
      when handling an ATS translation request.
      
      The IOMMU L2 will set PTE dirty bit when handling an ATS translation with
      write permission request, even when PTE RW bit is clear. This may occur by
      direct translation (which would cause a PPR) or by prefetch request from
      the ATC.
      
      This is observed in practice when the IOMMU L2 modifies a PTE which maps a
      pagecache page. The ext4 filesystem driver BUGs when asked to writeback
      these (non-modified) pages.
      
      Enable ATS write permission check in the Kaveri IOMMU L2 if BIOS has not.
      Signed-off-by: NJay Cornwall <jay@jcornwall.me>
      Cc: <stable@vger.kernel.org> # v3.19+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      358875fd
    • S
      iommu/amd: Fix boot warning when device 00:00.0 is not iommu covered · 38e45d02
      Suravee Suthikulpanit 提交于
      The setup code for the performance counters in the AMD IOMMU driver
      tests whether the counters can be written. It tests to setup a counter
      for device 00:00.0, which fails on systems where this particular device
      is not covered by the IOMMU.
      
      Fix this by not relying on device 00:00.0 but only on the IOMMU being
      present.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      38e45d02
  18. 21 10月, 2015 2 次提交