15 May, 2019

3 commits

  • Since commit dccd2304cc90 ("ARM: 7430/1: sizes.h: move from asm-generic
    to "), and are just
    wrappers of .

    This commit replaces all and to
    prepare for the removal.

    Link: http://lkml.kernel.org/r/1553267665-27228-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Pull PCI updates from Bjorn Helgaas:
    "Enumeration changes:

    - Add _HPX Type 3 settings support, which gives firmware more
    influence over device configuration (Alexandru Gagniuc)

    - Support fixed bus numbers from bridge Enhanced Allocation
    capabilities (Subbaraya Sundeep)

    - Add "external-facing" DT property to identify cases where we
    require IOMMU protection against untrusted devices (Jean-Philippe
    Brucker)

    - Enable PCIe services for host controller drivers that use managed
    host bridge alloc (Jean-Philippe Brucker)

    - Log PCIe port service messages with pci_dev, not the pcie_device
    (Frederick Lawler)

    - Convert pciehp from pciehp_debug module parameter to generic
    dynamic debug (Frederick Lawler)

    Peer-to-peer DMA:

    - Add whitelist of Root Complexes that support peer-to-peer DMA
    between Root Ports (Christian König)

    Native controller drivers:

    - Add PCI host bridge DMA ranges for bridges that can't DMA
    everywhere, e.g., iProc (Srinath Mannam)

    - Add Amazon Annapurna Labs PCIe host controller driver (Jonathan
    Chocron)

    - Fix Tegra MSI target allocation so DMA doesn't generate unwanted
    MSIs (Vidya Sagar)

    - Fix of_node reference leaks (Wen Yang)

    - Fix Hyper-V module unload & device removal issues (Dexuan Cui)

    - Cleanup R-Car driver (Marek Vasut)

    - Cleanup Keystone driver (Kishon Vijay Abraham I)

    - Cleanup i.MX6 driver (Andrey Smirnov)

    Significant bug fixes:

    - Reset Lenovo ThinkPad P50 GPU so nouveau works after reboot (Lyude
    Paul)

    - Fix Switchtec firmware update performance issue (Wesley Sheng)

    - Work around Pericom switch link retraining erratum (Stefan Mätje)"

    * tag 'pci-v5.2-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (141 commits)
    MAINTAINERS: Add Karthikeyan Mitran and Hou Zhiqiang for Mobiveil PCI
    PCI: pciehp: Remove pointless MY_NAME definition
    PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
    PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
    PCI: pciehp: Log messages with pci_dev, not pcie_device
    PCI: pciehp: Replace pciehp_debug module param with dyndbg
    PCI: pciehp: Remove pciehp_debug uses
    PCI/AER: Log messages with pci_dev, not pcie_device
    PCI/DPC: Log messages with pci_dev, not pcie_device
    PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
    PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
    PCI: Replace dev_printk(KERN_DEBUG) with dev_info(), etc
    PCI: Replace printk(KERN_INFO) with pr_info(), etc
    PCI: Use dev_printk() when possible
    PCI: Cleanup setup-bus.c comments and whitespace
    PCI: imx6: Allow asynchronous probing
    PCI: dwc: Save root bus for driver remove hooks
    PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify code
    PCI: dwc: Free MSI in dw_pcie_host_init() error path
    PCI: dwc: Free MSI IRQ page in dw_pcie_free_msi()
    ...

    Linus Torvalds
     
  • Convert to use vm_map_pages() to map range of kernel memory to user vma.

    Link: http://lkml.kernel.org/r/80c3d220fc6ada73a88ce43ca049afb55a889258.1552921225.git.jrdr.linux@gmail.com
    Signed-off-by: Souptick Joarder
    Cc: Boris Ostrovsky
    Cc: David Airlie
    Cc: Heiko Stuebner
    Cc: Joerg Roedel
    Cc: Joonsoo Kim
    Cc: Juergen Gross
    Cc: Kees Cook
    Cc: "Kirill A. Shutemov"
    Cc: Kyungmin Park
    Cc: Marek Szyprowski
    Cc: Matthew Wilcox
    Cc: Mauro Carvalho Chehab
    Cc: Michal Hocko
    Cc: Mike Rapoport
    Cc: Oleksandr Andrushchenko
    Cc: Pawel Osciak
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Robin Murphy
    Cc: Russell King
    Cc: Sandy Huang
    Cc: Stefan Richter
    Cc: Stephen Rothwell
    Cc: Thierry Reding
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder
     

14 May, 2019

1 commit

  • - Add list of legal DMA address ranges to PCI host bridge (Srinath
    Mannam)

    - Reserve inaccessible DMA ranges so IOMMU doesn't allocate them (Srinath
    Mannam)

    - Parse iProc DT dma-ranges to learn what PCI devices can reach via DMA
    (Srinath Mannam)

    * pci/iova-dma-ranges:
    PCI: iproc: Add sorted dma ranges resource entries to host bridge
    iommu/dma: Reserve IOVA for PCIe inaccessible DMA address
    PCI: Add dma_ranges window list

    # Conflicts:
    # drivers/pci/probe.c

    Bjorn Helgaas
     

13 May, 2019

1 commit

  • Pull IOMMU updates from Joerg Roedel:

    - ATS support for ARM-SMMU-v3.

    - AUX domain support in the IOMMU-API and the Intel VT-d driver. This
    adds support for multiple DMA address spaces per (PCI-)device. The
    use-case is to multiplex devices between host and KVM guests in a
    more flexible way than supported by SR-IOV.

    - the rest are smaller cleanups and fixes, two of which needed to be
    reverted after testing in linux-next.

    * tag 'iommu-updates-v5.2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (45 commits)
    Revert "iommu/amd: Flush not present cache in iommu_map_page"
    Revert "iommu/amd: Remove the leftover of bypass support"
    iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path
    iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
    iommu/vt-d: Set intel_iommu_gfx_mapped correctly
    iommu/amd: Flush not present cache in iommu_map_page
    iommu/vt-d: Cleanup: no spaces at the start of a line
    iommu/vt-d: Don't request page request irq under dmar_global_lock
    iommu/vt-d: Use struct_size() helper
    iommu/mediatek: Fix leaked of_node references
    iommu/amd: Remove amd_iommu_pd_list
    iommu/arm-smmu: Log CBFRSYNRA register on context fault
    iommu/arm-smmu-v3: Don't disable SMMU in kdump kernel
    iommu/arm-smmu-v3: Disable tagged pointers
    iommu/arm-smmu-v3: Add support for PCI ATS
    iommu/arm-smmu-v3: Link domains and devices
    iommu/arm-smmu-v3: Add a master->domain pointer
    iommu/arm-smmu-v3: Store SteamIDs in master
    iommu/arm-smmu-v3: Rename arm_smmu_master_data to arm_smmu_master
    ACPI/IORT: Check ATS capability in root complex nodes
    ...

    Linus Torvalds
     

07 May, 2019

3 commits


06 May, 2019

1 commit

  • This reverts commit 7a5dbf3ab2f04905cf8468c66fcdbfb643068bcb.

    This commit not only removes the leftovers of bypass
    support, it also mostly removes the checking of the return
    value of the get_domain() function. This can lead to silent
    data corruption bugs when a device is not attached to its
    dma_ops domain and a DMA-API function is called for that
    device.

    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

03 May, 2019

5 commits

  • If alloc_pages_node() fails, pasid_table is leaked. Free it.

    Fixes: cc580e41260db ("iommu/vt-d: Per PCI device pasid table interfaces")

    Signed-off-by: Eric Auger
    Signed-off-by: Joerg Roedel

    Eric Auger
     
  • The kernel parameter igfx_off is used by users to disable
    DMA remapping for the Intel integrated graphic device. It
    was designed for bare metal cases where a dedicated IOMMU
    is used for graphic. This doesn't apply to virtual IOMMU
    case where an include-all IOMMU is used. This makes the
    kernel parameter work with virtual IOMMU as well.

    Cc: Ashok Raj
    Cc: Jacob Pan
    Suggested-by: Kevin Tian
    Fixes: c0771df8d5297 ("intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.")
    Signed-off-by: Lu Baolu
    Tested-by: Zhenyu Wang
    Signed-off-by: Joerg Roedel

    Lu Baolu
     
  • The intel_iommu_gfx_mapped flag is exported by the Intel
    IOMMU driver to indicate whether an IOMMU is used for the
    graphic device. In a virtualized IOMMU environment (e.g.
    QEMU), an include-all IOMMU is used for graphic device.
    This flag is found to be clear even the IOMMU is used.

    Cc: Ashok Raj
    Cc: Jacob Pan
    Cc: Kevin Tian
    Reported-by: Zhenyu Wang
    Fixes: c0771df8d5297 ("intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.")
    Suggested-by: Kevin Tian
    Signed-off-by: Lu Baolu
    Signed-off-by: Joerg Roedel

    Lu Baolu
     
  • check if there is a not-present cache present and flush it if there is.

    Signed-off-by: Tom Murphy
    Signed-off-by: Joerg Roedel

    Tom Murphy
     
  • Replace the whitespaces at the start of a line with tabs. No
    functional changes.

    Signed-off-by: Lu Baolu
    Signed-off-by: Joerg Roedel

    Lu Baolu
     

30 Apr, 2019

2 commits


26 Apr, 2019

6 commits

  • Joerg Roedel
     
  • Requesting page reqest irq under dmar_global_lock could cause
    potential lock race condition (caught by lockdep).

    [ 4.100055] ======================================================
    [ 4.100063] WARNING: possible circular locking dependency detected
    [ 4.100072] 5.1.0-rc4+ #2169 Not tainted
    [ 4.100078] ------------------------------------------------------
    [ 4.100086] swapper/0/1 is trying to acquire lock:
    [ 4.100094] 000000007dcbe3c3 (dmar_lock){+.+.}, at: dmar_alloc_hwirq+0x35/0x140
    [ 4.100112] but task is already holding lock:
    [ 4.100120] 0000000060bbe946 (dmar_global_lock){++++}, at: intel_iommu_init+0x191/0x1438
    [ 4.100136] which lock already depends on the new lock.
    [ 4.100146] the existing dependency chain (in reverse order) is:
    [ 4.100155]
    -> #2 (dmar_global_lock){++++}:
    [ 4.100169] down_read+0x44/0xa0
    [ 4.100178] intel_irq_remapping_alloc+0xb2/0x7b0
    [ 4.100186] mp_irqdomain_alloc+0x9e/0x2e0
    [ 4.100195] __irq_domain_alloc_irqs+0x131/0x330
    [ 4.100203] alloc_isa_irq_from_domain.isra.4+0x9a/0xd0
    [ 4.100212] mp_map_pin_to_irq+0x244/0x310
    [ 4.100221] setup_IO_APIC+0x757/0x7ed
    [ 4.100229] x86_late_time_init+0x17/0x1c
    [ 4.100238] start_kernel+0x425/0x4e3
    [ 4.100247] secondary_startup_64+0xa4/0xb0
    [ 4.100254]
    -> #1 (irq_domain_mutex){+.+.}:
    [ 4.100265] __mutex_lock+0x7f/0x9d0
    [ 4.100273] __irq_domain_add+0x195/0x2b0
    [ 4.100280] irq_domain_create_hierarchy+0x3d/0x40
    [ 4.100289] msi_create_irq_domain+0x32/0x110
    [ 4.100297] dmar_alloc_hwirq+0x111/0x140
    [ 4.100305] dmar_set_interrupt.part.14+0x1a/0x70
    [ 4.100314] enable_drhd_fault_handling+0x2c/0x6c
    [ 4.100323] apic_bsp_setup+0x75/0x7a
    [ 4.100330] x86_late_time_init+0x17/0x1c
    [ 4.100338] start_kernel+0x425/0x4e3
    [ 4.100346] secondary_startup_64+0xa4/0xb0
    [ 4.100352]
    -> #0 (dmar_lock){+.+.}:
    [ 4.100364] lock_acquire+0xb4/0x1c0
    [ 4.100372] __mutex_lock+0x7f/0x9d0
    [ 4.100379] dmar_alloc_hwirq+0x35/0x140
    [ 4.100389] intel_svm_enable_prq+0x61/0x180
    [ 4.100397] intel_iommu_init+0x1128/0x1438
    [ 4.100406] pci_iommu_init+0x16/0x3f
    [ 4.100414] do_one_initcall+0x5d/0x2be
    [ 4.100422] kernel_init_freeable+0x1f0/0x27c
    [ 4.100431] kernel_init+0xa/0x110
    [ 4.100438] ret_from_fork+0x3a/0x50
    [ 4.100444]
    other info that might help us debug this:

    [ 4.100454] Chain exists of:
    dmar_lock --> irq_domain_mutex --> dmar_global_lock
    [ 4.100469] Possible unsafe locking scenario:

    [ 4.100476] CPU0 CPU1
    [ 4.100483] ---- ----
    [ 4.100488] lock(dmar_global_lock);
    [ 4.100495] lock(irq_domain_mutex);
    [ 4.100503] lock(dmar_global_lock);
    [ 4.100512] lock(dmar_lock);
    [ 4.100518]
    *** DEADLOCK ***

    Cc: Ashok Raj
    Cc: Jacob Pan
    Cc: Kevin Tian
    Reported-by: Dave Jiang
    Fixes: a222a7f0bb6c9 ("iommu/vt-d: Implement page request handling")
    Signed-off-by: Lu Baolu
    Signed-off-by: Joerg Roedel

    Lu Baolu
     
  • Make use of the struct_size() helper instead of an open-coded version
    in order to avoid any potential type mistakes, in particular in the
    context in which this code is being used.

    So, replace code of the following form:

    size = sizeof(*info) + level * sizeof(info->path[0]);

    with:

    size = struct_size(info, path, level);

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Joerg Roedel

    Gustavo A. R. Silva
     
  • …kernel/git/will/linux into arm/smmu

    Joerg Roedel
     
  • The call to of_parse_phandle returns a node pointer with refcount
    incremented thus it must be explicitly decremented after the last
    usage.

    581 static int mtk_iommu_probe(struct platform_device *pdev)
    582 {
    ...
    626 for (i = 0; i < larb_nr; i++) {
    627 struct device_node *larbnode;
    ...
    631 larbnode = of_parse_phandle(...);
    632 if (!larbnode)
    633 return -EINVAL;
    634
    635 if (!of_device_is_available(larbnode))
    636 continue; ---> leaked here
    637
    ...
    643 if (!plarbdev)
    644 return -EPROBE_DEFER; ---> leaked here
    ...
    647 component_match_add_release(dev, &match, release_of,
    648 compare_of, larbnode);
    ---> release_of will call of_node_put
    649 }
    ...
    650

    Detected by coccinelle with the following warnings:
    ./drivers/iommu/mtk_iommu.c:644:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 631, but without a corresponding object release within this function.

    Signed-off-by: Wen Yang
    Cc: Joerg Roedel
    Cc: Matthias Brugger
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Matthias Brugger
    Signed-off-by: Joerg Roedel

    Wen Yang
     
  • This variable hold a global list of allocated protection
    domains in the AMD IOMMU driver. By now this list is never
    traversed anymore, so the list and the lock protecting it
    can be removed.

    Cc: Tom Murphy
    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

24 Apr, 2019

1 commit

  • drm-misc-next for v5.2:

    UAPI Changes:
    - Document which feature flags belong to which command in virtio_gpu.h
    - Make the FB_DAMAGE_CLIPS available for atomic userspace only, it's useless for legacy.

    Cross-subsystem Changes:
    - Add device tree bindings for lg,acx467akm-7 panel and ST-Ericsson Multi Channel Display Engine MCDE
    - Add parameters to the device tree bindings for tfp410
    - iommu/io-pgtable: Add ARM Mali midgard MMU page table format
    - dma-buf: Only do a 64-bits seqno compare when driver explicitly asks for it, else wraparound.
    - Use the 64-bits compare for dma-fence-chains

    Core Changes:
    - Make the fb conversion functions use __iomem dst.
    - Rename drm_client_add to drm_client_register
    - Move intel_fb_initial_config to core.
    - Add a drm_gem_objects_lookup helper
    - Add drm_gem_fence_array helpers, and use it in lima.
    - Add drm_format_helper.c to kerneldoc.

    Driver Changes:
    - Add panfrost driver for mali midgard/bitfrost.
    - Converts bochs to use the simple display type.
    - Small fixes to sun4i, tinydrm, ti-fp410.
    - Fid aspeed's Kconfig options.
    - Make some symbols/functions static in lima, sun4i and meson.
    - Add a driver for the lg,acx467akm-7 panel.

    Signed-off-by: Dave Airlie

    From: Maarten Lankhorst
    Link: https://patchwork.freedesktop.org/patch/msgid/737ad994-213d-45b5-207a-b99d795acd21@linux.intel.com

    Dave Airlie
     

23 Apr, 2019

8 commits

  • Bits[15:0] in CBFRSYNRA register contain information about
    StreamID of the incoming transaction that generated the
    fault. Dump CBFRSYNRA register to get this info.
    This is specially useful in a distributed SMMU architecture
    where multiple masters are connected to the SMMU.
    SID information helps to quickly identify the faulting
    master device.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Robin Murphy
    Acked-by: Ard Biesheuvel
    Signed-off-by: Vivek Gautam
    Signed-off-by: Will Deacon

    Vivek Gautam
     
  • Disabling the SMMU when probing from within a kdump kernel so that all
    incoming transactions are terminated can prevent the core of the crashed
    kernel from being transferred off the machine if all I/O devices are
    behind the SMMU.

    Instead, continue to probe the SMMU after it is disabled so that we can
    reinitialise it entirely and re-attach the DMA masters as they are reset.
    Since the kdump kernel may not have drivers for all of the active DMA
    masters, we suppress fault reporting to avoid spamming the console and
    swamping the IRQ threads.

    Reported-by: "Leizhen (ThunderTown)"
    Tested-by: "Leizhen (ThunderTown)"
    Tested-by: Bhupesh Sharma
    Signed-off-by: Will Deacon

    Will Deacon
     
  • The ARM architecture has a "Top Byte Ignore" (TBI) option that makes the
    MMU mask out bits [63:56] of an address, allowing a userspace application
    to store data in its pointers. This option is incompatible with PCI ATS.

    If TBI is enabled in the SMMU and userspace triggers DMA transactions on
    tagged pointers, the endpoint might create ATC entries for addresses that
    include a tag. Software would then have to send ATC invalidation packets
    for each 255 possible alias of an address, or just wipe the whole address
    space. This is not a viable option, so disable TBI.

    The impact of this change is unclear, since there are very few users of
    tagged pointers, much less SVA. But the requirement introduced by this
    patch doesn't seem excessive: a userspace application using both tagged
    pointers and SVA should now sanitize addresses (clear the tag) before
    using them for device DMA.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     
  • PCIe devices can implement their own TLB, named Address Translation Cache
    (ATC). Enable Address Translation Service (ATS) for devices that support
    it and send them invalidation requests whenever we invalidate the IOTLBs.

    ATC invalidation is allowed to take up to 90 seconds, according to the
    PCIe spec, so it is possible to get a SMMU command queue timeout during
    normal operations. However we expect implementations to complete
    invalidation in reasonable time.

    We only enable ATS for "trusted" devices, and currently rely on the
    pci_dev->untrusted bit. For ATS we have to trust that:

    (a) The device doesn't issue "translated" memory requests for addresses
    that weren't returned by the SMMU in a Translation Completion. In
    particular, if we give control of a device or device partition to a VM
    or userspace, software cannot program the device to access arbitrary
    "translated" addresses.

    (b) The device follows permissions granted by the SMMU in a Translation
    Completion. If the device requested read+write permission and only
    got read, then it doesn't write.

    (c) The device doesn't send Translated transactions for an address that
    was invalidated by an ATC invalidation.

    Note that the PCIe specification explicitly requires all of these, so we
    can assume that implementations will cleanly shield ATCs from software.

    All ATS translated requests still go through the SMMU, to walk the stream
    table and check that the device is actually allowed to send translated
    requests.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     
  • When removing a mapping from a domain, we need to send an invalidation to
    all devices that might have stored it in their Address Translation Cache
    (ATC). In addition when updating the context descriptor of a live domain,
    we'll need to send invalidations for all devices attached to it.

    Maintain a list of devices in each domain, protected by a spinlock. It is
    updated every time we attach or detach devices to and from domains.

    It needs to be a spinlock because we'll invalidate ATC entries from
    within hardirq-safe contexts, but it may be possible to relax the read
    side with RCU later.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     
  • As we're going to track domain-master links more closely for ATS and CD
    invalidation, add pointer to the attached domain in struct
    arm_smmu_master. As a result, arm_smmu_strtab_ent is redundant and can be
    removed.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     
  • Simplify the attach/detach code a bit by keeping a pointer to the stream
    IDs in the master structure. Although not completely obvious here, it does
    make the subsequent support for ATS, PRI and PASID a bit simpler.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     
  • The arm_smmu_master_data structure already represents more than just the
    firmware data associated to a master, and will be used extensively to
    represent a device's state when implementing more SMMU features. Rename
    the structure to arm_smmu_master.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon

    Jean-Philippe Brucker
     

13 Apr, 2019

1 commit

  • ARM Mali midgard GPU is similar to standard 64-bit stage 1 page tables, but
    have a few differences. Add a new format type to represent the format. The
    input address size is 48-bits and the output address size is 40-bits (and
    possibly less?). Note that the later bifrost GPUs follow the standard
    64-bit stage 1 format.

    The differences in the format compared to 64-bit stage 1 format are:

    The 3rd level page entry bits are 0x1 instead of 0x3 for page entries.

    The access flags are not read-only and unprivileged, but read and write.
    This is similar to stage 2 entries, but the memory attributes field matches
    stage 1 being an index.

    The nG bit is not set by the vendor driver. This one didn't seem to matter,
    but we'll keep it aligned to the vendor driver.

    Cc: Will Deacon
    Acked-by: Robin Murphy
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: iommu@lists.linux-foundation.org
    Acked-by: Alyssa Rosenzweig
    Acked-by: Joerg Roedel
    Signed-off-by: Rob Herring
    Link: https://patchwork.freedesktop.org/patch/msgid/20190409205427.6943-2-robh@kernel.org

    Rob Herring
     

12 Apr, 2019

2 commits

  • By default, for performance consideration, Intel IOMMU
    driver won't flush IOTLB immediately after a buffer is
    unmapped. It schedules a thread and flushes IOTLB in a
    batched mode. This isn't suitable for untrusted device
    since it still can access the memory even if it isn't
    supposed to do so.

    Cc: Ashok Raj
    Cc: Jacob Pan
    Signed-off-by: Lu Baolu
    Tested-by: Xu Pengfei
    Tested-by: Mika Westerberg
    Signed-off-by: Joerg Roedel

    Lu Baolu
     
  • The exlcusion range limit register needs to contain the
    base-address of the last page that is part of the range, as
    bits 0-11 of this register are treated as 0xfff by the
    hardware for comparisons.

    So correctly set the exclusion range in the hardware to the
    last page which is _in_ the range.

    Fixes: b2026aa2dce44 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space')
    Signed-off-by: Joerg Roedel

    Joerg Roedel
     

11 Apr, 2019

6 commits

  • We already do this in the caller.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Joerg Roedel

    Christoph Hellwig
     
  • The intel-iommu driver currently has a partial reimplementation
    of the direct mapping code for devices that use pass through
    mode. Replace that code with calls to the relevant dma_direct
    routines at the highest level. This means we have exactly the
    same behvior as the dma direct code itself, and can prepare for
    eventually only attaching the intel_iommu ops to devices that
    actually need dynamic iommu mappings.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Joerg Roedel

    Christoph Hellwig
     
  • Invert the return value to avoid double negatives, use a bool
    instead of int as the return value, and reduce some indentation
    after early returns.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Joerg Roedel

    Christoph Hellwig
     
  • The AMD iommu dma_ops are only attached on a per-device basis when an
    actual translation is needed. Remove the leftover bypass support which
    in parts was already broken (e.g. it always returns 0 from ->map_sg).

    Use the opportunity to remove a few local variables and move assignments
    into the declaration line where they were previously separated by the
    bypass check.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Joerg Roedel

    Christoph Hellwig
     
  • Commit e5567f5f6762 ("PCI/ATS: Add pci_prg_resp_pasid_required()
    interface.") added a common interface to check the PASID bit in the PRI
    capability. Use it in the AMD driver.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Joerg Roedel

    Jean-Philippe Brucker
     
  • This adds support to return the default pasid associated with
    an auxiliary domain. The PCI device which is bound with this
    domain should use this value as the pasid for all DMA requests
    of the subset of device which is isolated and protected with
    this domain.

    Cc: Ashok Raj
    Cc: Jacob Pan
    Cc: Kevin Tian
    Signed-off-by: Sanjay Kumar
    Signed-off-by: Liu Yi L
    Signed-off-by: Lu Baolu
    Signed-off-by: Joerg Roedel

    Lu Baolu