07 Apr, 2016

1 commit


01 Mar, 2016

1 commit

  • In the PCI hotplug path of the Intel IOMMU driver, replace
    the usage of the BUS_NOTIFY_DEL_DEVICE notifier, which is
    executed before the driver is unbound from the device, with
    BUS_NOTIFY_REMOVED_DEVICE, which runs after that.

    This fixes a kernel BUG being triggered in the VT-d code
    when the device driver tries to unmap DMA buffers and the
    VT-d driver already destroyed all mappings.

    Reported-by: Stefani Seibold
    Cc: stable@vger.kernel.org # v4.3+
    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

29 Jan, 2016

1 commit


16 Dec, 2015

1 commit

  • commit db0fa0cb0157 "scatterlist: use sg_phys()" did replacements of
    the form:

    phys_addr_t phys = page_to_phys(sg_page(s));
    phys_addr_t phys = sg_phys(s) & PAGE_MASK;

    However, this breaks platforms where sizeof(phys_addr_t) >
    sizeof(unsigned long). Revert for 4.3 and 4.4 to make room for a
    combined helper in 4.5.

    Cc:
    Cc: Jens Axboe
    Cc: Christoph Hellwig
    Cc: Russell King
    Cc: David Woodhouse
    Cc: Andrew Morton
    Fixes: db0fa0cb0157 ("scatterlist: use sg_phys()")
    Suggested-by: Joerg Roedel
    Reported-by: Vitaly Lavrov
    Signed-off-by: Dan Williams

    Dan Williams
     

07 Nov, 2015

1 commit

  • …d avoiding waking kswapd

    __GFP_WAIT has been used to identify atomic context in callers that hold
    spinlocks or are in interrupts. They are expected to be high priority and
    have access one of two watermarks lower than "min" which can be referred
    to as the "atomic reserve". __GFP_HIGH users get access to the first
    lower watermark and can be called the "high priority reserve".

    Over time, callers had a requirement to not block when fallback options
    were available. Some have abused __GFP_WAIT leading to a situation where
    an optimisitic allocation with a fallback option can access atomic
    reserves.

    This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
    cannot sleep and have no alternative. High priority users continue to use
    __GFP_HIGH. __GFP_DIRECT_RECLAIM identifies callers that can sleep and
    are willing to enter direct reclaim. __GFP_KSWAPD_RECLAIM to identify
    callers that want to wake kswapd for background reclaim. __GFP_WAIT is
    redefined as a caller that is willing to enter direct reclaim and wake
    kswapd for background reclaim.

    This patch then converts a number of sites

    o __GFP_ATOMIC is used by callers that are high priority and have memory
    pools for those requests. GFP_ATOMIC uses this flag.

    o Callers that have a limited mempool to guarantee forward progress clear
    __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
    into this category where kswapd will still be woken but atomic reserves
    are not used as there is a one-entry mempool to guarantee progress.

    o Callers that are checking if they are non-blocking should use the
    helper gfpflags_allow_blocking() where possible. This is because
    checking for __GFP_WAIT as was done historically now can trigger false
    positives. Some exceptions like dm-crypt.c exist where the code intent
    is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
    flag manipulations.

    o Callers that built their own GFP flags instead of starting with GFP_KERNEL
    and friends now also need to specify __GFP_KSWAPD_RECLAIM.

    The first key hazard to watch out for is callers that removed __GFP_WAIT
    and was depending on access to atomic reserves for inconspicuous reasons.
    In some cases it may be appropriate for them to use __GFP_HIGH.

    The second key hazard is callers that assembled their own combination of
    GFP flags instead of starting with something like GFP_KERNEL. They may
    now wish to specify __GFP_KSWAPD_RECLAIM. It's almost certainly harmless
    if it's missed in most cases as other activity will wake kswapd.

    Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Vitaly Wool <vitalywool@gmail.com>
    Cc: Rik van Riel <riel@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

    Mel Gorman
     

06 Nov, 2015

2 commits

  • Pull iommu updates from Joerg Roedel:
    "This time including:

    - A new IOMMU driver for s390 pci devices

    - Common dma-ops support based on iommu-api for ARM64. The plan is
    to use this as a basis for ARM32 and hopefully other architectures
    as well in the future.

    - MSI support for ARM-SMMUv3

    - Cleanups and dead code removal in the AMD IOMMU driver

    - Better RMRR handling for the Intel VT-d driver

    - Various other cleanups and small fixes"

    * tag 'iommu-updates-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (41 commits)
    iommu/vt-d: Fix return value check of parse_ioapics_under_ir()
    iommu/vt-d: Propagate error-value from ir_parse_ioapic_hpet_scope()
    iommu/vt-d: Adjust the return value of the parse_ioapics_under_ir
    iommu: Move default domain allocation to iommu_group_get_for_dev()
    iommu: Remove is_pci_dev() fall-back from iommu_group_get_for_dev
    iommu/arm-smmu: Switch to device_group call-back
    iommu/fsl: Convert to device_group call-back
    iommu: Add device_group call-back to x86 iommu drivers
    iommu: Add generic_device_group() function
    iommu: Export and rename iommu_group_get_for_pci_dev()
    iommu: Revive device_group iommu-ops call-back
    iommu/amd: Remove find_last_devid_on_pci()
    iommu/amd: Remove first/last_device handling
    iommu/amd: Initialize amd_iommu_last_bdf for DEV_ALL
    iommu/amd: Cleanup buffer allocation
    iommu/amd: Remove cmd_buf_size and evt_buf_size from struct amd_iommu
    iommu/amd: Align DTE flag definitions
    iommu/amd: Remove old alias handling code
    iommu/amd: Set alias DTE in do_attach/do_detach
    iommu/amd: WARN when __[attach|detach]_device are called with irqs enabled
    ...

    Linus Torvalds
     
  • Pull intel iommu updates from David Woodhouse:
    "This adds "Shared Virtual Memory" (aka PASID support) for the Intel
    IOMMU. This allows devices to do DMA using process address space,
    translated through the normal CPU page tables for the relevant mm.

    With corresponding support added to the i915 driver, this has been
    tested with the graphics device on Skylake. We don't have the
    required TLP support in our PCIe root ports for supporting discrete
    devices yet, so it's only integrated devices that can do it so far"

    * git://git.infradead.org/intel-iommu: (23 commits)
    iommu/vt-d: Fix rwxp flags in SVM device fault callback
    iommu/vt-d: Expose struct svm_dev_ops without CONFIG_INTEL_IOMMU_SVM
    iommu/vt-d: Clean up pasid_enabled() and ecs_enabled() dependencies
    iommu/vt-d: Handle Caching Mode implementations of SVM
    iommu/vt-d: Fix SVM IOTLB flush handling
    iommu/vt-d: Use dev_err(..) in intel_svm_device_to_iommu(..)
    iommu/vt-d: fix a loop in prq_event_thread()
    iommu/vt-d: Fix IOTLB flushing for global pages
    iommu/vt-d: Fix address shifting in page request handler
    iommu/vt-d: shift wrapping bug in prq_event_thread()
    iommu/vt-d: Fix NULL pointer dereference in page request error case
    iommu/vt-d: Implement SVM_FLAG_SUPERVISOR_MODE for kernel access
    iommu/vt-d: Implement SVM_FLAG_PRIVATE_PASID to allocate unique PASIDs
    iommu/vt-d: Add callback to device driver on page faults
    iommu/vt-d: Implement page request handling
    iommu/vt-d: Generalise DMAR MSI setup to allow for page request events
    iommu/vt-d: Implement deferred invalidate for SVM
    iommu/vt-d: Add basic SVM PASID support
    iommu/vt-d: Always enable PASID/PRI PCI capabilities before ATS
    iommu/vt-d: Add initial support for PASID tables
    ...

    Linus Torvalds
     

02 Nov, 2015

1 commit


25 Oct, 2015

1 commit

  • When booted with intel_iommu=ecs_off we were still allocating the PASID
    tables even though we couldn't actually use them. We really want to make
    the pasid_enabled() macro depend on ecs_enabled().

    Which is unfortunate, because currently they're the other way round to
    cope with the Broadwell/Skylake problems with ECS.

    Instead of having ecs_enabled() depend on pasid_enabled(), which was never
    something that made me happy anyway, make it depend in the normal case
    on the "broken PASID" bit 28 *not* being set.

    Then pasid_enabled() can depend on ecs_enabled() as it should. And we also
    don't need to mess with it if we ever see an implementation that has some
    features requiring ECS (like PRI) but which *doesn't* have PASID support.

    Signed-off-by: David Woodhouse

    David Woodhouse
     

22 Oct, 2015

2 commits

  • Set the device_group call-back to pci_device_group() for the
    Intel VT-d and the AMD IOMMU driver.

    Signed-off-by: Joerg Roedel

    Joerg Roedel
     
  • Pull intel-iommu bugfix from David Woodhouse:
    "This contains a single fix, for when the IOMMU API is used to overlay
    an existing mapping comprised of 4KiB pages, with a mapping that can
    use superpages.

    For the *first* superpage in the new mapping, we were correctly¹
    freeing the old bottom-level page table page and clearing the link to
    it, before installing the superpage. For subsequent superpages,
    however, we weren't. This causes a memory leak, and a warning about
    setting a PTE which is already set.

    ¹ Well, not *entirely* correctly. We just free the page table pages
    right there and then, which is wrong. In fact they should only be
    freed *after* the IOTLB is flushed so we know the hardware will no
    longer be looking at them.... and in fact I note that the IOTLB
    flush is completely missing from the intel_iommu_map() code path,
    although it needs to be there if it's permitted to overwrite
    existing mappings.

    Fixing those is somewhat more intrusive though, and will probably
    need to wait for 4.4 at this point"

    * tag 'for-linus-20151021' of git://git.infradead.org/intel-iommu:
    iommu/vt-d: fix range computation when making room for large pages

    Linus Torvalds
     

19 Oct, 2015

1 commit


15 Oct, 2015

7 commits


14 Oct, 2015

3 commits

  • In preparation for deprecating ioremap_cache() convert its usage in
    intel-iommu to memremap. This also eliminates the mishandling of the
    __iomem annotation in the implementation.

    Cc: David Woodhouse
    Signed-off-by: Dan Williams
    Signed-off-by: Joerg Roedel

    Dan Williams
     
  • In preparation for the installation of a large page, any small page
    tables that may still exist in the target IOV address range are
    removed. However, if a scatter/gather list entry is large enough to
    fit more than one large page, the address space for any subsequent
    large pages is not cleared of conflicting small page tables.

    This can cause legitimate mapping requests to fail with errors of the
    form below, potentially followed by a series of IOMMU faults:

    ERROR: DMA PTE for vPFN 0xfde00 already set (to 7f83a4003 not 7e9e00083)

    In this example, a 4MiB scatter/gather list entry resulted in the
    successful installation of a large page @ vPFN 0xfdc00, followed by
    a failed attempt to install another large page @ vPFN 0xfde00, due to
    the presence of a pointer to a small page table @ 0x7f83a4000.

    To address this problem, compute the number of large pages that fit
    into a given scatter/gather list entry, and use it to derive the
    last vPFN covered by the large page(s).

    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Zander
    Signed-off-by: David Woodhouse

    Christian Zander
     
  • Pull IOMMU fixes from Joerg Roedel:
    "A few fixes piled up:

    - Fix for a suspend/resume issue where PCI probing code overwrote
    dev->irq for the MSI irq of the AMD IOMMU.

    - Fix for a kernel crash when a 32 bit PCI device was assigned to a
    KVM guest.

    - Fix for a possible memory leak in the VT-d driver

    - A couple of fixes for the ARM-SMMU driver"

    * tag 'iommu-fixes-v4.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
    iommu/amd: Fix NULL pointer deref on device detach
    iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices
    iommu/vt-d: Fix memory leak in dmar_insert_one_dev_info()
    iommu/arm-smmu: Use correct address mask for CMD_TLBI_S2_IPA
    iommu/arm-smmu: Ensure IAS is set correctly for AArch32-capable SMMUs
    iommu/io-pgtable-arm: Don't use dma_to_phys()

    Linus Torvalds
     

05 Oct, 2015

2 commits


02 Oct, 2015

1 commit

  • Pull IOVA fixes from David Woodhouse:
    "The main fix here is the first one, fixing the over-allocation of
    size-aligned requests. The other patches simply make the existing
    IOVA code available to users other than the Intel VT-d driver, with no
    functional change.

    I concede the latter really *should* have been submitted during the
    merge window, but since it's basically risk-free and people are
    waiting to build on top of it and it's my fault I didn't get it in, I
    (and they) would be grateful if you'd take it"

    * git://git.infradead.org/intel-iommu:
    iommu: Make the iova library a module
    iommu: iova: Export symbols
    iommu: iova: Move iova cache management to the iova library
    iommu/iova: Avoid over-allocating when size-aligned

    Linus Torvalds
     

29 Sep, 2015

1 commit


09 Sep, 2015

1 commit

  • Pull iommu updates for from Joerg Roedel:
    "This time the IOMMU updates are mostly cleanups or fixes. No big new
    features or drivers this time. In particular the changes include:

    - Bigger cleanup of the DomainIOMMU data structures and the code
    that manages them in the Intel VT-d driver. This makes the code
    easier to understand and maintain, and also easier to keep the data
    structures in sync. It is also a preparation step to make use of
    default domains from the IOMMU core in the Intel VT-d driver.

    - Fixes for a couple of DMA-API misuses in ARM IOMMU drivers, namely
    in the ARM and Tegra SMMU drivers.

    - Fix for a potential buffer overflow in the OMAP iommu driver's
    debug code

    - A couple of smaller fixes and cleanups in various drivers

    - One small new feature: Report domain-id usage in the Intel VT-d
    driver to easier detect bugs where these are leaked"

    * tag 'iommu-updates-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (83 commits)
    iommu/vt-d: Really use upper context table when necessary
    x86/vt-d: Fix documentation of DRHD
    iommu/fsl: Really fix init section(s) content
    iommu/io-pgtable-arm: Unmap and free table when overwriting with block
    iommu/io-pgtable-arm: Move init-fn declarations to io-pgtable.h
    iommu/msm: Use BUG_ON instead of if () BUG()
    iommu/vt-d: Access iomem correctly
    iommu/vt-d: Make two functions static
    iommu/vt-d: Use BUG_ON instead of if () BUG()
    iommu/vt-d: Return false instead of 0 in irq_remapping_cap()
    iommu/amd: Use BUG_ON instead of if () BUG()
    iommu/amd: Make a symbol static
    iommu/amd: Simplify allocation in irq_remapping_alloc()
    iommu/tegra-smmu: Parameterize number of TLB lines
    iommu/tegra-smmu: Factor out tegra_smmu_set_pde()
    iommu/tegra-smmu: Extract tegra_smmu_pte_get_use()
    iommu/tegra-smmu: Use __GFP_ZERO to allocate zeroed pages
    iommu/tegra-smmu: Remove PageReserved manipulation
    iommu/tegra-smmu: Convert to use DMA API
    iommu/tegra-smmu: smmu_flush_ptc() wants device addresses
    ...

    Linus Torvalds
     

03 Sep, 2015

1 commit

  • Pull SG updates from Jens Axboe:
    "This contains a set of scatter-gather related changes/fixes for 4.3:

    - Add support for limited chaining of sg tables even for
    architectures that do not set ARCH_HAS_SG_CHAIN. From Christoph.

    - Add sg chain support to target_rd. From Christoph.

    - Fixup open coded sg->page_link in crypto/omap-sham. From
    Christoph.

    - Fixup open coded crypto ->page_link manipulation. From Dan.

    - Also from Dan, automated fixup of manual sg_unmark_end()
    manipulations.

    - Also from Dan, automated fixup of open coded sg_phys()
    implementations.

    - From Robert Jarzmik, addition of an sg table splitting helper that
    drivers can use"

    * 'for-4.3/sg' of git://git.kernel.dk/linux-block:
    lib: scatterlist: add sg splitting function
    scatterlist: use sg_phys()
    crypto/omap-sham: remove an open coded access to ->page_link
    scatterlist: remove open coded sg_unmark_end instances
    crypto: replace scatterwalk_sg_chain with sg_chain
    target/rd: always chain S/G list
    scatterlist: allow limited chaining without ARCH_HAS_SG_CHAIN

    Linus Torvalds
     

01 Sep, 2015

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for the v4.3 merge window:

    Enumeration:
    - Allocate ATS struct during enumeration (Bjorn Helgaas)
    - Embed ATS info directly into struct pci_dev (Bjorn Helgaas)
    - Reduce size of ATS structure elements (Bjorn Helgaas)
    - Stop caching ATS Invalidate Queue Depth (Bjorn Helgaas)
    - iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth (Bjorn Helgaas)
    - Move MPS configuration check to pci_configure_device() (Bjorn Helgaas)
    - Set MPS to match upstream bridge (Keith Busch)
    - ARM/PCI: Set MPS before pci_bus_add_devices() (Murali Karicheri)
    - Add pci_scan_root_bus_msi() (Lorenzo Pieralisi)
    - ARM/PCI, designware, xilinx: Use pci_scan_root_bus_msi() (Lorenzo Pieralisi)

    Resource management:
    - Call pci_read_bridge_bases() from core instead of arch code (Lorenzo Pieralisi)

    PCI device hotplug:
    - pciehp: Remove unused interrupt events (Bjorn Helgaas)
    - pciehp: Remove ignored MRL sensor interrupt events (Bjorn Helgaas)
    - pciehp: Handle invalid data when reading from non-existent devices (Jarod Wilson)
    - pciehp: Simplify pcie_poll_cmd() (Yijing Wang)
    - Use "slot" and "pci_slot" for struct hotplug_slot and struct pci_slot (Yijing Wang)
    - Protect pci_bus->slots with pci_slot_mutex, not pci_bus_sem (Yijing Wang)
    - Hold pci_slot_mutex while searching bus->slots list (Yijing Wang)

    Power management:
    - Disable async suspend/resume for JMicron multi-function SATA/AHCI (Zhang Rui)

    Virtualization:
    - Add ACS quirks for Intel I219-LM/V (Alex Williamson)
    - Restore ACS configuration as part of pci_restore_state() (Alexander Duyck)

    MSI:
    - Add pcibios_alloc_irq() and pcibios_free_irq() (Jiang Liu)
    - x86: Implement pcibios_alloc_irq() and pcibios_free_irq() (Jiang Liu)
    - Add helpers to manage pci_dev->irq and pci_dev->irq_managed (Jiang Liu)
    - Free legacy IRQ when enabling MSI/MSI-X (Jiang Liu)
    - ARM/PCI: Remove msi_controller from struct pci_sys_data (Lorenzo Pieralisi)
    - Remove unused pcibios_msi_controller() hook (Lorenzo Pieralisi)

    Generic host bridge driver:
    - Remove dependency on ARM-specific struct hw_pci (Jayachandran C)
    - Build setup-irq.o for arm64 (Jayachandran C)
    - Add arm64 support (Jayachandran C)

    APM X-Gene host bridge driver:
    - Add APM X-Gene PCIe 64-bit prefetchable window (Duc Dang)
    - Add support for a 64-bit prefetchable memory window (Duc Dang)
    - Drop owner assignment from platform_driver (Krzysztof Kozlowski)

    Broadcom iProc host bridge driver:
    - Allow BCMA bus driver to be built as module (Hauke Mehrtens)
    - Delete unnecessary checks before phy calls (Markus Elfring)
    - Add arm64 support (Ray Jui)

    Synopsys DesignWare host bridge driver:
    - Don't complain missing *config* reg space if va_cfg0 is set (Murali Karicheri)

    TI DRA7xx host bridge driver:
    - Disable pm_runtime on get_sync failure (Kishon Vijay Abraham I)
    - Add PM support (Kishon Vijay Abraham I)
    - Clear MSE bit during suspend so clocks will idle (Kishon Vijay Abraham I)
    - Add support to make GPIO drive PERST# line (Kishon Vijay Abraham I)

    Xilinx AXI host bridge driver:
    - Check for MSI interrupt flag before handling as INTx (Russell Joyce)

    Miscellaneous:
    - Fix Intersil/Techwell TW686[4589] AV capture class code (Krzysztof Hałasa)
    - Use PCI_CLASS_SERIAL_USB instead of bare number (Bjorn Helgaas)
    - Fix generic NCR 53c810 class code quirk (Bjorn Helgaas)
    - Fix TI816X class code quirk (Bjorn Helgaas)
    - Remove unused "pci_probe" flags (Bjorn Helgaas)
    - Host bridge driver code simplifications (Fabio Estevam)
    - Add dev_flags bit to access VPD through function 0 (Mark Rustad)
    - Add VPD function 0 quirk for Intel Ethernet devices (Mark Rustad)
    - Kill off set_irq_flags() usage (Rob Herring)
    - Remove Intel Cherrytrail D3 delays (Srinidhi Kasagar)
    - Clean up pci_find_capability() (Wei Yang)"

    * tag 'pci-v4.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (72 commits)
    PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI
    PCI: Set MPS to match upstream bridge
    PCI: Move MPS configuration check to pci_configure_device()
    PCI: Drop references acquired by of_parse_phandle()
    PCI/MSI: Remove unused pcibios_msi_controller() hook
    ARM/PCI: Remove msi_controller from struct pci_sys_data
    ARM/PCI, designware, xilinx: Use pci_scan_root_bus_msi()
    PCI: Add pci_scan_root_bus_msi()
    ARM/PCI: Replace panic with WARN messages on failures
    PCI: generic: Add arm64 support
    PCI: Build setup-irq.o for arm64
    PCI: generic: Remove dependency on ARM-specific struct hw_pci
    PCI: imx6: Simplify a trivial if-return sequence
    PCI: spear: Use BUG_ON() instead of condition followed by BUG()
    PCI: dra7xx: Remove unneeded use of IS_ERR_VALUE()
    PCI: Remove pci_ats_enabled()
    PCI: Stop caching ATS Invalidate Queue Depth
    PCI: Move ATS declarations to linux/pci.h so they're all together
    PCI: Clean up ATS error handling
    PCI: Use pci_physfn() rather than looking up physfn by hand
    ...

    Linus Torvalds
     

25 Aug, 2015

1 commit


17 Aug, 2015

1 commit

  • Coccinelle cleanup to replace open coded sg to physical address
    translations. This is in preparation for introducing scatterlists that
    reference __pfn_t.

    // sg_phys.cocci: convert usage page_to_phys(sg_page(sg)) to sg_phys(sg)
    // usage: make coccicheck COCCI=sg_phys.cocci MODE=patch

    virtual patch

    @@
    struct scatterlist *sg;
    @@

    - page_to_phys(sg_page(sg)) + sg->offset
    + sg_phys(sg)

    @@
    struct scatterlist *sg;
    @@

    - page_to_phys(sg_page(sg))
    + sg_phys(sg) & PAGE_MASK

    Signed-off-by: Dan Williams
    Signed-off-by: Jens Axboe

    Dan Williams
     

14 Aug, 2015

3 commits


12 Aug, 2015

6 commits