Re: [PATCH] of/device: add blacklist for iommu dma_ops

2019-06-02 Thread Rob Clark
On Fri, May 10, 2019 at 7:35 AM Rob Clark wrote: > > On Tue, Dec 4, 2018 at 2:29 PM Rob Herring wrote: > > > > On Sat, Dec 1, 2018 at 10:54 AM Rob Clark wrote: > > > > > > This solves a problem we see with drm/msm, caused by getting > > > iommu_dma_ops while we attach our own domain and manage

[PATCH v4 4/9] iommu: Add bounce page APIs

2019-06-02 Thread Lu Baolu
IOMMU hardware always use paging for DMA remapping. The minimum mapped window is a page size. The device drivers may map buffers not filling whole IOMMU window. It allows device to access to possibly unrelated memory and various malicious devices can exploit this to perform DMA attack. This

[PATCH v4 2/9] swiotlb: Split size parameter to map/unmap APIs

2019-06-02 Thread Lu Baolu
This splits the size parameter to swiotlb_tbl_map_single() and swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size parameter, where the latter one is rounded up to the iommu page size. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu --- drivers/xen/swiotlb-xen.c | 8

[PATCH v4 3/9] swiotlb: Zero out bounce buffer for untrusted device

2019-06-02 Thread Lu Baolu
This is necessary to avoid exposing valid kernel data to any milicious device. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu --- kernel/dma/swiotlb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index f956f785645a..ed41eb7f6131

[PATCH v4 5/9] iommu/vt-d: Don't switch off swiotlb if use direct dma

2019-06-02 Thread Lu Baolu
The direct dma implementation depends on swiotlb. Hence, don't switch of swiotlb since direct dma interfaces are used in this driver. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Mika Westerberg Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 -- 1 file changed, 6

[PATCH v4 7/9] iommu/vt-d: Add trace events for domain map/unmap

2019-06-02 Thread Lu Baolu
This adds trace support for the Intel IOMMU driver. It also declares some events which could be used to trace the events when an IOVA is being mapped or unmapped in a domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Mika Westerberg Signed-off-by: Lu Baolu ---

[PATCH v4 1/9] PCI: Add dev_is_untrusted helper

2019-06-02 Thread Lu Baolu
There are several places in the kernel where it is necessary to check whether a device is a pci untrusted device. Add a helper to simplify the callers. Signed-off-by: Lu Baolu --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h

[PATCH v4 6/9] iommu/vt-d: Check whether device requires bounce buffer

2019-06-02 Thread Lu Baolu
This adds a helper to check whether a device needs to use bounce buffer. It also provides a boot time option to disable the bounce buffer. Users can use this to prevent the iommu driver from using the bounce buffer for performance gain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by:

[PATCH v4 0/9] iommu: Bounce page for untrusted devices

2019-06-02 Thread Lu Baolu
The Thunderbolt vulnerabilities are public and have a nice name as Thunderclap [1] [3] nowadays. This patch series aims to mitigate those concerns. An external PCI device is a PCI peripheral device connected to the system through an external bus, such as Thunderbolt. What makes it different is

[PATCH v4 8/9] iommu/vt-d: Code refactoring for bounce map and unmap

2019-06-02 Thread Lu Baolu
In order to making it ready for calling iommu_bounce_map() and iommu_bounce_unmap() in __intel_map_single() and intel_unmap(), we need to do some code refactoring. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Mika Westerberg Signed-off-by: Lu Baolu ---

[PATCH v4 9/9] iommu/vt-d: Use bounce buffer for untrusted devices

2019-06-02 Thread Lu Baolu
The Intel VT-d hardware uses paging for DMA remapping. The minimum mapped window is a page size. The device drivers may map buffers not filling the whole IOMMU window. This allows the device to access to possibly unrelated memory and a malicious device could exploit this to perform DMA attacks. To

Re: [PATCH v4 10/15] iommu/vt-d: Probe DMA-capable ACPI name space devices

2019-06-02 Thread Lu Baolu
Hi, On 5/29/19 2:16 PM, Christoph Hellwig wrote: On Sat, May 25, 2019 at 01:41:31PM +0800, Lu Baolu wrote: Some platforms may support ACPI name-space enumerated devices that are capable of generating DMA requests. Platforms which support DMA remapping explicitly declares any such DMA-capable