[PATCH v3 3/3] swiotlb: checking whether swiotlb buffer is full with io_tlb_used

2019-01-17 Thread Dongli Zhang
This patch uses io_tlb_used to help check whether swiotlb buffer is full. io_tlb_used is no longer used for only debugfs. It is also used to help optimize swiotlb_tbl_map_single(). Suggested-by: Joe Jin Signed-off-by: Dongli Zhang --- Changed since v2: * move #ifdef folding to previous patch

[PATCH v3 1/3] swiotlb: fix comment on swiotlb_bounce()

2019-01-17 Thread Dongli Zhang
Fix the comment as swiotlb_bounce() is used to copy from original dma location to swiotlb buffer during swiotlb_tbl_map_single(), while to copy from swiotlb buffer to original dma location during swiotlb_tbl_unmap_single(). Signed-off-by: Dongli Zhang --- kernel/dma/swiotlb.c | 2 +- 1 file

[PATCH v3 2/3] swiotlb: add debugfs to track swiotlb buffer usage

2019-01-17 Thread Dongli Zhang
The device driver will not be able to do dma operations once swiotlb buffer is full, either because the driver is using so many IO TLB blocks inflight, or because there is memory leak issue in device driver. To export the swiotlb buffer usage via debugfs would help the user estimate the size of

[PATCH 1/3] PCI: iproc: Add feature to set order mode

2019-01-17 Thread Srinath Mannam via iommu
Order mode in RX header of incoming pcie packets can be override to strict or loose order based on requirement. Sysfs entry is provided to set dynamic and default order modes of upstream traffic. To improve performance in few endpoints we required to modify the ordering attributes. Using this

[PATCH 2/3] PCI: iproc: CRS state check in config request

2019-01-17 Thread Srinath Mannam via iommu
In the current implementation, config read of 0x0001 data is assumed as CRS completion. but sometimes 0x0001 can be a valid data. IPROC PCIe RC has a register to show config request status flags like SC, UR, CRS and CA. So that extra check is added in the code to confirm the CRS state

[PATCH 0/3] Add IPROC PCIe new features

2019-01-17 Thread Srinath Mannam via iommu
Add changes related to IPROC PCIe RC IP new features. This patch set is based on Linux-5.0-rc2. Srinath Mannam (3): PCI: iproc: Add feature to set order mode PCI: iproc: CRS state check in config request PCI: iproc: Add PCIe 32bit outbound memory configuration

[PATCH 3/3] PCI: iproc: Add PCIe 32bit outbound memory configuration

2019-01-17 Thread Srinath Mannam via iommu
IPROC PCIe RC supports outbound memory mapping with SOC address inside 4GB address boundary, which is 32 bit AXI address. This patch add the support. Signed-off-by: Srinath Mannam Signed-off-by: Abhishek Shah Signed-off-by: Ray Jui Reviewed-by: Scott Branden Reviewed-by: Vikram Prakash ---

[PATCH] iommu: amd: call free_iova_fast with pfn in map_sg

2019-01-17 Thread Jerry Snitselaar
In the error path of map_sg, free_iova_fast is being called with address instead of the pfn. This results in a bad value getting into the rcache, and can result in hitting a BUG_ON when iova_magazine_free_pfns is called. Cc: Joerg Roedel Cc: Suravee Suthikulpanit Signed-off-by: Jerry Snitselaar

Re: [PATCH 3/3] videobuf2: replace a layering violation with dma_map_resource

2019-01-17 Thread Christoph Hellwig
On Mon, Jan 14, 2019 at 01:42:26PM +0100, Marek Szyprowski wrote: > Hi Christoph, > > On 2019-01-11 19:17, Christoph Hellwig wrote: > > vb2_dc_get_userptr pokes into arm direct mapping details to get the > > resemblance of a dma address for a a physical address that does is > > not backed by a

[PATCH] arm64/xen: fix xen-swiotlb cache flushing

2019-01-17 Thread Christoph Hellwig
Xen-swiotlb hooks into the arm/arm64 arch code through a copy of the DMA mapping operations stored in the struct device arch data. Switching arm64 to use the direct calls for the merged DMA direct / swiotlb code broke this scheme. Replace the indirect calls with direct-calls in xen-swiotlb as

Re: [PATCH 5/5] iommu/tegra-smmu: Add resv_regions ops

2019-01-17 Thread Robin Murphy
On 16/01/2019 20:50, Navneet Kumar wrote: Add support for get/put reserved regions. For any particular reason? If you're aiming to get VFIO-passthrough-with-MSIs working on Tegra, this probably won't be correct anyway... Signed-off-by: Navneet Kumar --- drivers/iommu/tegra-smmu.c | 31

Re: [PATCH 1/5] iommu/tegra-smmu: Fix domain_alloc

2019-01-17 Thread Robin Murphy
On 17/01/2019 15:13, Dmitry Osipenko wrote: 16.01.2019 23:50, Navneet Kumar пишет: * Allocate dma iova cookie for a domain while adding dma iommu devices. * Perform a stricter check for domain type parameter. Commit message should tell what exactly is getting "fixed". Apparently you're

Re: [PATCH v2 2/2] swiotlb: checking whether swiotlb buffer is full with io_tlb_used

2019-01-17 Thread Konrad Rzeszutek Wilk
On Mon, Dec 10, 2018 at 08:37:58AM +0800, Dongli Zhang wrote: > This patch uses io_tlb_used to help check whether swiotlb buffer is full. > io_tlb_used is no longer used for only debugfs. It is also used to help > optimize swiotlb_tbl_map_single(). Please split this up. That is have the 'if

Re: [PATCH 2/5] iommu/tegra-smmu: Use non-secure register for flushing

2019-01-17 Thread Dmitry Osipenko
16.01.2019 23:50, Navneet Kumar пишет: > Use PTB_ASID instead of SMMU_CONFIG to flush smmu. > PTB_ASID can be accessed from non-secure mode, SMMU_CONFIG cannot be. > Using SMMU_CONFIG could pose a problem when kernel doesn't have secure > mode access enabled from boot. > > Signed-off-by: Navneet

Re: [PATCH 1/5] iommu/tegra-smmu: Fix domain_alloc

2019-01-17 Thread Dmitry Osipenko
16.01.2019 23:50, Navneet Kumar пишет: > * Allocate dma iova cookie for a domain while adding dma iommu > devices. > * Perform a stricter check for domain type parameter. > Commit message should tell what exactly is getting "fixed". Apparently you're trying to support T132 ARM64 here. >

Re: Fail to boot Dom0 on Xen Arm64 after "dma-mapping: bypass indirect calls for dma-direct"

2019-01-17 Thread Christoph Hellwig
On Thu, Jan 17, 2019 at 11:43:49AM +, Julien Grall wrote: > Looking at the change for arm64, you will always call dma-direct API. In > previous Linux version, xen-swiotlb will call dev->archdata.dev_dma_ops (a > copy of dev->dma_ops before setting Xen DMA ops) if not NULL. Does it mean > we

Re: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions

2019-01-17 Thread Robin Murphy
On 15/01/2019 17:37, Pierre Morel wrote: The s390 iommu can only allow DMA transactions between the zPCI device entries start_dma and end_dma. Let's declare the regions before start_dma and after end_dma as reserved regions using the appropriate callback in iommu_ops. The reserved region may

Re: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions

2019-01-17 Thread Pierre Morel
On 17/01/2019 10:23, Shameerali Kolothum Thodi wrote: Hi Pierre, -Original Message- From: Pierre Morel [mailto:pmo...@linux.ibm.com] Sent: 15 January 2019 17:37 To: gerald.schae...@de.ibm.com Cc: j...@8bytes.org; linux-s...@vger.kernel.org; iommu@lists.linux-foundation.org;

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-17 Thread Suthikulpanit, Suravee
Joerg, On 1/17/19 3:44 PM, Suravee Suthikulpanit wrote: > Joerg, > > On 1/17/19 12:08 AM, j...@8bytes.org wrote: >> On Wed, Jan 16, 2019 at 02:08:55PM +, Suthikulpanit, Suravee wrote: >>> Actually, I am not sure how we would be missing the flush on the last >>> device. >>> In my test, I am

[PATCH v2] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-17 Thread Suthikulpanit, Suravee
From: Suravee Suthikulpanit When a VM is terminated, the VFIO driver detaches all pass-through devices from VFIO domain by clearing domain id and page table root pointer from each device table entry (DTE), and then invalidates the DTE. Then, the VFIO driver unmap pages and invalidate IOMMU

Re: Fail to boot Dom0 on Xen Arm64 after "dma-mapping: bypass indirect calls for dma-direct"

2019-01-17 Thread Julien Grall
(+ Leo Yan who reported a similar issues on xen-devel) Hi Christoph, On 16/01/2019 18:19, Christoph Hellwig wrote: Does this fix your problem? Thank you for the patch. This allows me to boot Dom0 on Juno r2. My knowledge of DMA is quite limited, so I may have missed something. Looking at

Re: [PATCH 0/9] Use vm_insert_range and vm_insert_range_buggy

2019-01-17 Thread Souptick Joarder
On Fri, Jan 11, 2019 at 8:31 PM Souptick Joarder wrote: > > Previouly drivers have their own way of mapping range of > kernel pages/memory into user vma and this was done by > invoking vm_insert_page() within a loop. > > As this pattern is common across different drivers, it can > be generalized

Re: [RFC PATCH] i2c: imx: dma map the i2c data i/o register

2019-01-17 Thread Laurentiu Tudor
Hi Robin, On 16.01.2019 19:55, Robin Murphy wrote: > On 16/01/2019 16:17, Laurentiu Tudor wrote: >> This is an attempt to fix an iommu exception when doing dma to the >> i2c controller with EDMA. Without these mappings the smmu raises a >> context fault [1] exactly with the address of the i2c

Re: use generic DMA mapping code in powerpc V4

2019-01-17 Thread Christoph Hellwig
On Thu, Jan 17, 2019 at 10:21:11AM +0100, Christian Zigotzky wrote: > The X1000 boots and the PASEMI onboard ethernet works! > > Bad news for the X5000 (P5020 board). U-Boot loads the kernel and the dtb > file. Then the kernel starts but it doesn't find any hard disks > (partitions). Thanks for

[PATCH 2/2] iommu/arm-smmu: Add support for non-coherent page table mappings

2019-01-17 Thread Vivek Gautam
Adding a device tree option for arm smmu to enable non-cacheable memory for page tables. We already enable a smmu feature for coherent walk based on whether the smmu device is dma-coherent or not. Have an option to enable non-cacheable page table memory to force set it for particular smmu devices.

[PATCH 0/2] iommu/arm: Add support for non-coherent page tables

2019-01-17 Thread Vivek Gautam
As discussed in the Qcom system cache support thread [1], it is imperative that we enable the support for non-cacheable page tables for SMMU implementations for which removing snoop latency on walks by making mappings as non-cacheable, outweighs the cost of cache maintenance on PTE updates. This

[PATCH 1/2] iommu/io-pgtable-arm: Add support for non-coherent page tables

2019-01-17 Thread Vivek Gautam
>From Robin's comment [1] about touching TCR configurations - "TBH if we're going to touch the TCR attributes at all then we should probably correct that sloppiness first - there's an occasional argument for using non-cacheable pagetables even on a coherent SMMU if reducing snoop traffic/latency

RE: [PATCH v1] iommu/s390: Declare s390 iommu reserved regions

2019-01-17 Thread Shameerali Kolothum Thodi
Hi Pierre, > -Original Message- > From: Pierre Morel [mailto:pmo...@linux.ibm.com] > Sent: 15 January 2019 17:37 > To: gerald.schae...@de.ibm.com > Cc: j...@8bytes.org; linux-s...@vger.kernel.org; > iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org; >

Re: use generic DMA mapping code in powerpc V4

2019-01-17 Thread Christian Zigotzky
Hi All, I compiled the fixed '257002094bc5935dd63207a380d9698ab81f0775' (powerpc/dma: use the dma-direct allocator for coherent platforms) today. git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a git checkout 257002094bc5935dd63207a380d9698ab81f0775 Link to the Git:

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-17 Thread Suthikulpanit, Suravee
Joerg, On 1/17/19 12:08 AM, j...@8bytes.org wrote: > On Wed, Jan 16, 2019 at 02:08:55PM +, Suthikulpanit, Suravee wrote: >> Actually, I am not sure how we would be missing the flush on the last device. >> In my test, I am seeing the flush command being issued correctly during >>