[GIT PULL] dma-mapping fix for 5.4-rc

2019-10-25 Thread Christoph Hellwig
The following changes since commit 0e2adab6cf285c41e825b6c74a3aa61324d1132c: Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux (2019-10-17 17:00:14 -0700) are available in the Git repository at: git://git.infradead.org/users/hch/dma-mapping.git tags/dma-m

Re: [PATCH] iommu/dma: Add support for DMA_ATTR_SYS_CACHE

2019-10-25 Thread Christoph Hellwig
The definition makes very little sense. Any without a user in the same series it is a complete no-go anyway. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v7 11/11] iommu/vt-d: Add svm/sva invalidate function

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 3:27 PM, Tian, Kevin wrote: From: Jacob Pan [mailto:jacob.jun@linux.intel.com] Sent: Friday, October 25, 2019 3:55 AM When Shared Virtual Address (SVA) is enabled for a guest OS via vIOMMU, we need to provide invalidation support at IOMMU API and driver level. This patch add

Re: [PATCH v7 10/11] iommu/vt-d: Support flushing more translation cache types

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 3:55 AM, Jacob Pan wrote: When Shared Virtual Memory is exposed to a guest via vIOMMU, scalable IOTLB invalidation may be passed down from outside IOMMU subsystems. This patch adds invalidation functions that can be used for additional translation cache types. Signed-off-by: Jac

Re: [PATCH v7 09/11] iommu/vt-d: Add bind guest PASID support

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 3:55 AM, Jacob Pan wrote: When supporting guest SVA with emulated IOMMU, the guest PASID table is shadowed in VMM. Updates to guest vIOMMU PASID table will result in PASID cache flush which will be passed down to the host as bind guest PASID calls. For the SL page tables, it wil

Re: [PATCH v7 08/11] iommu/vt-d: Misc macro clean up for SVM

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 3:55 AM, Jacob Pan wrote: Use combined macros for_each_svm_dev() to simplify SVM device iteration and error checking. Suggested-by: Andy Shevchenko Signed-off-by: Jacob Pan Reviewed-by: Eric Auger --- drivers/iommu/intel-svm.c | 89 ++

[PATCH] iommu/dma: Add support for DMA_ATTR_SYS_CACHE

2019-10-25 Thread Isaac J. Manjarres
Currently, IOMMU_QCOM_SYS_CACHE exists to allow non-coherent I/O masters on Qualcomm SoCs to upgrade to caching their buffers in the outer-level/system cache on these platforms. However, these masters are limited to managing the mapping of these buffers themselves through the IOMMU framework, as op

[PATCH v2 09/10] iommu/io-pgtable-arm: Rationalise TCR handling

2019-10-25 Thread Robin Murphy
Although it's conceptually nice for the io_pgtable_cfg to provide a standard VMSA TCR value, the reality is that no VMSA-compliant IOMMU looks exactly like an Arm CPU, and they all have various other TCR controls which io-pgtable can't be expected to understand. Thus since there is an expectation t

[PATCH v2 10/10] iommu/io-pgtable-arm: Prepare for TTBR1 usage

2019-10-25 Thread Robin Murphy
Now that we can correctly extract top-level indices without relying on the remaining upper bits being zero, the only remaining impediments to using a given table for TTBR1 are the address validation on map/unmap and the awkward TCR translation granule format. Add a quirk so that we can do the right

[PATCH v2 08/10] iommu/io-pgtable-arm: Rationalise TTBRn handling

2019-10-25 Thread Robin Murphy
TTBR1 values have so far been redundant since no users implement any support for split address spaces. Crucially, though, one of the main reasons for wanting to do so is to be able to manage each half entirely independently, e.g. context-switching one set of mappings without disturbing the other. T

[PATCH v2 01/10] iommu/io-pgtable: Make selftest gubbins consistently __init

2019-10-25 Thread Robin Murphy
The selftests run as an initcall, but the annotation of the various callbacks and data seems to be somewhat arbitrary. Add it consistently for everything related to the selftests. Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable-arm-v7s.c | 15 --- drivers/iommu/io-pgtable-ar

[PATCH v2 05/10] iommu/io-pgtable-arm: Simplify PGD size handling

2019-10-25 Thread Robin Murphy
We use data->pgd_size directly for the one-off allocation and freeing of the top-level table, but otherwise it serves for ARM_LPAE_PGD_IDX() to repeatedly re-calculate the effective number of top-level address bits it represents. Flip this around so we store the form we most commonly need, and deri

[PATCH v2 04/10] iommu/io-pgtable-arm: Simplify start level lookup

2019-10-25 Thread Robin Murphy
Beyond a couple of allocation-time calculations, data->levels is only ever used to derive the start level. Storing the start level directly leads to a small reduction in object code, which should help eke out a little more efficiency, and slightly more readable source to boot. Signed-off-by: Robin

[PATCH v2 07/10] iommu/io-pgtable-arm: Rationalise MAIR handling

2019-10-25 Thread Robin Murphy
Between VMSAv8-64 and the various 32-bit formats, there is either one 64-bit MAIR or a pair of 32-bit MAIR0/MAIR1 or NMRR/PMRR registers. As such, keeping two 64-bit values in io_pgtable_cfg has always been overkill. Signed-off-by: Robin Murphy --- drivers/iommu/arm-smmu-v3.c| 2 +- drivers/

[PATCH v2 06/10] iommu/io-pgtable-arm: Simplify level indexing

2019-10-25 Thread Robin Murphy
The nature of the LPAE format means that data->pg_shift is always redundant with data->bits_per_level, since they represent the size of a page and the number of PTEs per page respectively, and the size of a PTE is constant. Thus it works out more efficient to only store the latter, and derive the f

[PATCH v2 03/10] iommu/io-pgtable-arm: Simplify bounds checks

2019-10-25 Thread Robin Murphy
We're merely checking that the relevant upper bits of each address are all zero, so there are cheaper ways to achieve that. Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable-arm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/dri

[PATCH v2 02/10] iommu/io-pgtable-arm: Rationalise size check

2019-10-25 Thread Robin Murphy
It makes little sense to only validate the requested size after we think we've found a matching block size - making the check up-front is simple, and far more logical than waiting to walk off the bottom of the table to infer that we must have been passed a bogus size to start with. We're missing a

[PATCH v2 00/10] iommu/io-pgtable: Cleanup and prep for split tables

2019-10-25 Thread Robin Murphy
Hi all, Since the flawed first attempt, I've reworked things with an abstracted TCR and an explicit TTBR1 quirk. I originally envisaged the need to pass the quirk all the way down to the TLBI calls, hence getting diverted into trying to make the parameter passing less cluttered in general, but in

Re: [PATCH v7 09/11] iommu/vt-d: Add bind guest PASID support

2019-10-25 Thread Jacob Pan
Hi Kevin, On Fri, 25 Oct 2019 07:19:26 + "Tian, Kevin" wrote: > > From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > > Sent: Friday, October 25, 2019 3:55 AM > > > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU P

Re: [PATCH v7 07/11] iommu/vt-d: Add nested translation helper function

2019-10-25 Thread Jacob Pan
On Fri, 25 Oct 2019 23:04:48 +0800 Lu Baolu wrote: > Hi, > > On 10/25/19 3:55 AM, Jacob Pan wrote: > > Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. > > With PASID granular translation type set to 0x11b, translation > > result from the first level(FL) also subject to a second lev

RE: [PATCH v7 03/11] iommu/vt-d: Add custom allocator for IOASID

2019-10-25 Thread Tian, Kevin
> From: Lu Baolu [mailto:baolu...@linux.intel.com] > Sent: Friday, October 25, 2019 10:39 PM > > Hi, > > On 10/25/19 2:40 PM, Tian, Kevin wrote: > ioasid_register_allocator(&iommu->pasid_allocator); > +if (ret) { > +pr_warn("C

Re: [PATCH v7 07/11] iommu/vt-d: Add nested translation helper function

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 3:55 AM, Jacob Pan wrote: Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. With PASID granular translation type set to 0x11b, translation result from the first level(FL) also subject to a second level(SL) page table translation. This mode is used for SVA virtualizati

Re: [PATCH v7 03/11] iommu/vt-d: Add custom allocator for IOASID

2019-10-25 Thread Lu Baolu
Hi, On 10/25/19 2:40 PM, Tian, Kevin wrote: ioasid_register_allocator(&iommu->pasid_allocator); + if (ret) { + pr_warn("Custom PASID allocator registeration failed\n"); + /* +* Disab

RE: [RFC v2 1/3] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2019-10-25 Thread Liu, Yi L
Hi Kevin, > From: Tian, Kevin > Sent: Friday, October 25, 2019 5:14 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [RFC v2 1/3] vfio: VFIO_IOMMU_CACHE_INVALIDATE > > > From: Liu, Yi L > > Sent: Thursday, October 24, 2019 8:26 PM > > > > From: Liu Yi L > > > > When the guest "own

RE: [RFC v2 0/3] vfio: support Shared Virtual Addressing

2019-10-25 Thread Liu, Yi L
Hi Kevin, > From: Tian, Kevin > Sent: Friday, October 25, 2019 4:59 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [RFC v2 0/3] vfio: support Shared Virtual Addressing > > > From: Liu Yi L > > Sent: Thursday, October 24, 2019 8:26 PM > > > > Shared virtual address (SVA), a.k.a, S

RE: [RFC v2 2/3] vfio/type1: VFIO_IOMMU_PASID_REQUEST(alloc/free)

2019-10-25 Thread Liu, Yi L
Hi Kevin, > From: Tian, Kevin > Sent: Friday, October 25, 2019 6:06 PM > To: Liu, Yi L ; alex.william...@redhat.com; > Subject: RE: [RFC v2 2/3] vfio/type1: VFIO_IOMMU_PASID_REQUEST(alloc/free) > > > From: Liu Yi L > > Sent: Thursday, October 24, 2019 8:26 PM > > > > This patch adds VFIO_IOMMU_PA

RE: [RFC v2 2/3] vfio/type1: VFIO_IOMMU_PASID_REQUEST(alloc/free)

2019-10-25 Thread Tian, Kevin
> From: Liu Yi L > Sent: Thursday, October 24, 2019 8:26 PM > > This patch adds VFIO_IOMMU_PASID_REQUEST ioctl which aims > to passdown PASID allocation/free request from the virtual > iommu. This is required to get PASID managed in system-wide. > > Cc: Kevin Tian > Signed-off-by: Liu Yi L > Si

RE: [RFC v2 1/3] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2019-10-25 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Thursday, October 24, 2019 8:26 PM > > From: Liu Yi L > > When the guest "owns" the stage 1 translation structures, the host > IOMMU driver has no knowledge of caching structure updates unless > the guest invalidation requests are trapped and passed down to the > host.

RE: [RFC v2 0/3] vfio: support Shared Virtual Addressing

2019-10-25 Thread Tian, Kevin
> From: Liu Yi L > Sent: Thursday, October 24, 2019 8:26 PM > > Shared virtual address (SVA), a.k.a, Shared virtual memory (SVM) on Intel > platforms allow address space sharing between device DMA and > applications. > SVA can reduce programming complexity and enhance security. > This series is in

RE: [PATCH] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.

2019-10-25 Thread Wei Hu via iommu
Thanks for the review. Please see my response inline. > > + select DMA_CMA > > Thіs needs to be > > select DMA_CMA if HAVE_DMA_CONTIGUOUS > > > +#include > > > + /* Allocate from CMA */ > > + // request_pages = (request_size >> PAGE_SHIFT) + 1; > > + request_pages = (round_up(re

RE: [PATCH v7 11/11] iommu/vt-d: Add svm/sva invalidate function

2019-10-25 Thread Tian, Kevin
> From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > Sent: Friday, October 25, 2019 3:55 AM > > When Shared Virtual Address (SVA) is enabled for a guest OS via > vIOMMU, we need to provide invalidation support at IOMMU API and > driver > level. This patch adds Intel VT-d specific function to

RE: [PATCH v7 10/11] iommu/vt-d: Support flushing more translation cache types

2019-10-25 Thread Tian, Kevin
> From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > Sent: Friday, October 25, 2019 3:55 AM > > When Shared Virtual Memory is exposed to a guest via vIOMMU, scalable > IOTLB invalidation may be passed down from outside IOMMU subsystems. from outside of host IOMMU subsystem > This patch add

RE: [PATCH v7 09/11] iommu/vt-d: Add bind guest PASID support

2019-10-25 Thread Tian, Kevin
> From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > Sent: Friday, October 25, 2019 3:55 AM > > When supporting guest SVA with emulated IOMMU, the guest PASID > table is shadowed in VMM. Updates to guest vIOMMU PASID table > will result in PASID cache flush which will be passed down to > the

RE: [PATCH v7 07/11] iommu/vt-d: Add nested translation helper function

2019-10-25 Thread Tian, Kevin
> From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > Sent: Friday, October 25, 2019 3:55 AM > > Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. > With PASID granular translation type set to 0x11b, translation > result from the first level(FL) also subject to a second level(SL)