[GIT PULL] dma-mapping updates for 5.7

2020-04-03 Thread Christoph Hellwig
The following changes since commit 11a48a5a18c63fd7621bb050228cebf13566e4d8: Linux 5.6-rc2 (2020-02-16 13:16:59 -0800) are available in the Git repository at: git://git.infradead.org/users/hch/dma-mapping.git tags/dma-mapping-5.7 for you to fetch changes up to fd27a526bb381f43dded6db30b3b01

Re: How to fix WARN from drivers/base/dd.c in next-20200401 if CONFIG_MODULES=y?

2020-04-03 Thread John Stultz
On Fri, Apr 3, 2020 at 4:47 AM Geert Uytterhoeven wrote: > On Thu, Apr 2, 2020 at 7:27 PM John Stultz wrote: > > On Thu, Apr 2, 2020 at 3:17 AM Yoshihiro Shimoda > > wrote: > > > > > > I found an issue after applied the following patches: > > > --- > > > 64c775f driver core: Rename deferred_prob

[PATCH v11 04/10] iommu/vt-d: Add nested translation helper function

2020-04-03 Thread Jacob Pan
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 virtualization, where FL performs guest virtual to guest

[PATCH v11 06/10] iommu/vt-d: Support flushing more translation cache types

2020-04-03 Thread Jacob Pan
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: Jacob Pan --- v9 -> v10: Fix off by 1 in pasid

[PATCH v11 03/10] iommu/vt-d: Use a helper function to skip agaw for SL

2020-04-03 Thread Jacob Pan
An Intel iommu domain uses 5-level page table by default. If the iommu that the domain tries to attach supports less page levels, the top level page tables should be skipped. Add a helper to do this so that it could be used in other places. --- v11 Added Baolu's commit message and squashed 4 & 5 f

[PATCH v11 00/10] Nested Shared Virtual Address (SVA) VT-d support

2020-04-03 Thread Jacob Pan
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 intended to enable SVA virtualization, i.e. enable use of SVA within a gues

[PATCH v11 08/10] iommu/vt-d: Cache virtual command capability register

2020-04-03 Thread Jacob Pan
Virtual command registers are used in the guest only, to prevent vmexit cost, we cache the capability and store it during initialization. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Reviewed-by: Lu Baolu --- v7 Reviewed by Eric & Baolu --- Signed-off-by: Jacob Pan --- drivers/iommu/dma

[PATCH v11 01/10] iommu/vt-d: Move domain helper to header

2020-04-03 Thread Jacob Pan
Move domain helper to header to be used by SVA code. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Reviewed-by: Kevin Tian --- drivers/iommu/intel-iommu.c | 6 -- include/linux/intel-iommu.h | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/intel-i

[PATCH v11 07/10] iommu/vt-d: Add svm/sva invalidate function

2020-04-03 Thread Jacob Pan
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 implement iommu passdown invalidate API for shared virtual address. The use case is for supporting caching

[PATCH v11 09/10] iommu/vt-d: Enlightened PASID allocation

2020-04-03 Thread Jacob Pan
From: Lu Baolu Enabling IOMMU in a guest requires communication with the host driver for certain aspects. Use of PASID ID to enable Shared Virtual Addressing (SVA) requires managing PASID's in the host. VT-d 3.0 spec provides a Virtual Command Register (VCMD) to facilitate this. Writes to this re

[PATCH v11 02/10] iommu/uapi: Define a mask for bind data

2020-04-03 Thread Jacob Pan
Memory type related flags can be grouped together for one simple check. --- v9 renamed from EMT to MTS since these are memory type support flags. --- Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v11 10/10] iommu/vt-d: Add custom allocator for IOASID

2020-04-03 Thread Jacob Pan
When VT-d driver runs in the guest, PASID allocation must be performed via virtual command interface. This patch registers a custom IOASID allocator which takes precedence over the default XArray based allocator. The resulting IOASID allocation will always come from the host. This ensures that PASI

[PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support

2020-04-03 Thread Jacob Pan
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 will be harvested from device's default domain (

Re: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 13:30:49 + "Liu, Yi L" wrote: > Hi Alex, > > > From: Alex Williamson > > Sent: Friday, April 3, 2020 3:57 AM > > To: Liu, Yi L > > > > On Sun, 22 Mar 2020 05:32:03 -0700 > > "Liu, Yi L" wrote: > > > > > From: Liu Yi L > > > > > > VFIO_TYPE1_NESTING_IOMMU is an IOMM

Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 13:12:50 + "Liu, Yi L" wrote: > Hi Alex, > > > From: Alex Williamson > > Sent: Friday, April 3, 2020 1:50 AM > > Subject: Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > > > On Sun, 22 Mar 2020 05:31:58 -0700 > > "Liu, Yi L" wrote: > > > > > Fro

Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to userspace

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 08:17:44 + "Liu, Yi L" wrote: > > From: Alex Williamson < alex.william...@redhat.com > > > Sent: Friday, April 3, 2020 2:01 AM > > To: Liu, Yi L > > Subject: Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to > > userspace > > > > On Sun, 22 Mar 2020 05:32:

Re: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 07:53:55 + "Liu, Yi L" wrote: > Hi Alex, > > > From: Alex Williamson > > Sent: Friday, April 3, 2020 7:00 AM > > To: Liu, Yi L > > Subject: Re: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs > > > > On Sun, 22 Mar 2020 05:33:14 -0700 > > "Liu, Yi L" wrot

Re: [PATCH v2] iommu/qcom: Fix local_base status check

2020-04-03 Thread Markus Elfring
> Release resources when exiting on error. I have got doubts that such a change description fits to the proposed source code adjustment. … > +++ b/drivers/iommu/qcom_iommu.c > @@ -813,8 +813,11 @@ static int qcom_iommu_device_probe(struct > platform_device *pdev) > qcom_iommu->dev = dev;

Re: [PATCH v1 7/8] vfio/type1: Add VFIO_IOMMU_CACHE_INVALIDATE

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 06:39:22 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Friday, April 3, 2020 4:24 AM > > > > On Sun, 22 Mar 2020 05:32:04 -0700 > > "Liu, Yi L" wrote: > > > > > From: Liu Yi L > > > > > > For VFIO IOMMUs with the type VFIO_TYPE1_NESTING_IOMMU, guest >

Re: [PATCH v1 7/8] vfio/type1: Add VFIO_IOMMU_CACHE_INVALIDATE

2020-04-03 Thread Jacob Pan
On Fri, 3 Apr 2020 06:39:22 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Friday, April 3, 2020 4:24 AM > > > > On Sun, 22 Mar 2020 05:32:04 -0700 > > "Liu, Yi L" wrote: > > > > > From: Liu Yi L > > > > > > For VFIO IOMMUs with the type VFIO_TYPE1_NESTING_IOMMU, guest >

Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Alex Williamson
On Fri, 3 Apr 2020 05:58:55 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Friday, April 3, 2020 1:50 AM > > > > On Sun, 22 Mar 2020 05:31:58 -0700 > > "Liu, Yi L" wrote: > > > > > From: Liu Yi L > > > > > > For a long time, devices have only one DMA address space from plat

RE: [PATCH v1 8/8] vfio/type1: Add vSVA support for IOMMU-backed mdevs

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 4:34 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 8/8] vfio/type1: Add vSVA support for IOMMU-backed > mdevs > > On Sun, 22 Mar 2020 05:32:05 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > Recent years, mediated device pa

RE: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 3:57 AM > To: Liu, Yi L > > On Sun, 22 Mar 2020 05:32:03 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > VFIO_TYPE1_NESTING_IOMMU is an IOMMU type which is backed by hardware > > IOMMUs that have nesting DMA translation (

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 1:50 AM > Subject: Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > On Sun, 22 Mar 2020 05:31:58 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > For a long time, devices have only one DMA address space

Re: How to fix WARN from drivers/base/dd.c in next-20200401 if CONFIG_MODULES=y?

2020-04-03 Thread Geert Uytterhoeven
Hi John, On Fri, Apr 3, 2020 at 1:47 PM Geert Uytterhoeven wrote: > On Thu, Apr 2, 2020 at 7:27 PM John Stultz wrote: > > On Thu, Apr 2, 2020 at 3:17 AM Yoshihiro Shimoda > > wrote: > > > > > > I found an issue after applied the following patches: > > > --- > > > 64c775f driver core: Rename def

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Liu, Yi L
> From: Jean-Philippe Brucker > Sent: Friday, April 3, 2020 8:40 PM > Subject: Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > On Fri, Apr 03, 2020 at 11:56:09AM +, Liu, Yi L wrote: > > > > /** > > > > + * VFIO_MM objects - create, release, get, put, search > > > > + *

Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Jean-Philippe Brucker
On Fri, Apr 03, 2020 at 11:56:09AM +, Liu, Yi L wrote: > > > /** > > > + * VFIO_MM objects - create, release, get, put, search > > > + * Caller of the function should have held vfio.vfio_mm_lock. > > > + */ > > > +static struct vfio_mm *vfio_create_mm(struct mm_struct *mm) > > > +{ > > > + str

RE: [PATCH v1 5/8] vfio/type1: Report 1st-level/stage-1 format to userspace

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 3:20 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 5/8] vfio/type1: Report 1st-level/stage-1 format to > userspace > > On Sun, 22 Mar 2020 05:32:02 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > VFIO exposes IOMMU nesting

RE: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free)

2020-04-03 Thread Liu, Yi L
Hi Jean, > From: Jean-Philippe Brucker > Sent: Thursday, April 2, 2020 9:53 PM > To: Liu, Yi L > Subject: Re: [PATCH v1 1/8] vfio: Add VFIO_IOMMU_PASID_REQUEST(alloc/free) > > Hi Yi, > > On Sun, Mar 22, 2020 at 05:31:58AM -0700, Liu, Yi L wrote: > > From: Liu Yi L > > > > For a long time, dev

Re: How to fix WARN from drivers/base/dd.c in next-20200401 if CONFIG_MODULES=y?

2020-04-03 Thread Geert Uytterhoeven
Hi John, On Thu, Apr 2, 2020 at 7:27 PM John Stultz wrote: > On Thu, Apr 2, 2020 at 3:17 AM Yoshihiro Shimoda > wrote: > > > > I found an issue after applied the following patches: > > --- > > 64c775f driver core: Rename deferred_probe_timeout and make it global > > 0e9f8d0 driver core: Remove d

RE: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 7:00 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs > > On Sun, 22 Mar 2020 05:33:14 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > Per PCIe r5.0, sec 9.3.7.14, if a PF im

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-03 Thread Alexey Kardashevskiy
On 26/03/2020 12:26, Alexey Kardashevskiy wrote: > > > On 25/03/2020 19:37, Christoph Hellwig wrote: >> On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: > This is for persistent memory which you can DMA to/from but yet it does > not appear in the system as a normal

Re: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host

2020-04-03 Thread Jean-Philippe Brucker
On Thu, Apr 02, 2020 at 08:05:29AM +, Liu, Yi L wrote: > > > > > static long vfio_iommu_type1_ioctl(void *iommu_data, > > > > > default: > > > > > return -EINVAL; > > > > > } > > > > > + > > > > > + } else if (cmd == VFIO_IOMMU_BIND) { > > >

Re: [PATCH v1 5/8] vfio/type1: Report 1st-level/stage-1 format to userspace

2020-04-03 Thread Jean-Philippe Brucker
On Wed, Apr 01, 2020 at 03:01:12PM +0200, Auger Eric wrote: > >>> header = vfio_info_cap_add(caps, sizeof(*nesting_cap), > >>> VFIO_IOMMU_TYPE1_INFO_CAP_NESTING, 1); > >>> @@ -2254,6 +2309,7 @@ static int vfio_iommu_info_add_nesting_cap(struct > >> vfio_iommu *iommu,

RE: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to userspace

2020-04-03 Thread Liu, Yi L
> From: Alex Williamson < alex.william...@redhat.com > > Sent: Friday, April 3, 2020 2:01 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to > userspace > > On Sun, 22 Mar 2020 05:32:00 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > This pa

RE: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for quota tuning

2020-04-03 Thread Liu, Yi L
> From: Alex Williamson > Sent: Friday, April 3, 2020 1:59 AM > To: Tian, Kevin > Subject: Re: [PATCH v1 2/8] vfio/type1: Add vfio_iommu_type1 parameter for > quota > tuning > > On Mon, 30 Mar 2020 11:44:08 + > "Tian, Kevin" wrote: > > > > From: Liu, Yi L > > > Sent: Monday, March 30, 20

RE: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs

2020-04-03 Thread Liu, Yi L
Hi Alex, > From: Alex Williamson > Sent: Friday, April 3, 2020 7:00 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs > > On Sun, 22 Mar 2020 05:33:14 -0700 > "Liu, Yi L" wrote: > > > From: Liu Yi L > > > > Per PCIe r5.0, sec 9.3.7.14, if a PF im