Re: [PATCH v2 14/15] docs: fix references for DMA*.txt files

2020-06-23 Thread Christoph Hellwig
On Tue, Jun 23, 2020 at 09:09:10AM +0200, Mauro Carvalho Chehab wrote: > As we moved those files to core-api, fix references to point > to their newer locations. Can we please just revert the RST conversion that I didn't ACK? ___ iommu mailing list

RE: [PATCH v2 14/15] vfio: Document dual stage control

2020-06-23 Thread Liu, Yi L
> From: Stefan Hajnoczi > Sent: Monday, June 22, 2020 8:51 PM > > On Wed, Jun 17, 2020 at 06:27:27AM +, Liu, Yi L wrote: > > > From: Stefan Hajnoczi > > > Sent: Monday, June 15, 2020 5:41 PM > > > On Thu, Jun 11, 2020 at 05:15:33AM -0700, Liu Yi L wrote: > > > > > > > From: Eric Auger > >

[PATCH v2 14/15] docs: fix references for DMA*.txt files

2020-06-23 Thread Mauro Carvalho Chehab
As we moved those files to core-api, fix references to point to their newer locations. Signed-off-by: Mauro Carvalho Chehab --- Documentation/PCI/pci.rst | 6 +++--- Documentation/block/biodoc.rst | 2 +- Documentation/bus-virt-phys-mapping.txt

[PATCH v2 00/15] Documentation fixes

2020-06-23 Thread Mauro Carvalho Chehab
Hi Jon, As requested, this is a rebase of a previous series posted on Jan, 15. Since then, several patches got merged via other trees or became obsolete. There were also 2 patches before that fits better at the ReST conversion patchset. So, I'll be sending it on another patch series together

Re: [PATCH 0/6] [PULL REQUEST] iommu/vt-d: fixes for v5.8

2020-06-23 Thread Joerg Roedel
On Tue, Jun 23, 2020 at 07:13:39AM +0800, Lu Baolu wrote: > Hi Joerg, > > Below fix patches have been piled up for v5.8. Please consider them for > your fix branch. > > Best regards, > Lu Baolu > > Lu Baolu (5): > iommu/vt-d: Make Intel SVM code 64-bit only > iommu/vt-d: Set U/S bit in

Re: [PATCH v6 3/4] iommu/arm-smmu: Add global/context fault implementation hooks

2020-06-23 Thread Thierry Reding
On Thu, Jun 04, 2020 at 04:44:13PM -0700, Krishna Reddy wrote: > Add global/context fault hooks to allow NVIDIA SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy > --- > drivers/iommu/arm-smmu-nvidia.c | 100 >

Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-23 Thread John Garry
. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/John-Garry/iommu-arm-smmu-v3-Improve-cmdq-lock-efficiency/20200623-013438 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git

Re: [PATCH v6 1/4] iommu/arm-smmu: add NVIDIA implementation for dual ARM MMU-500 usage

2020-06-23 Thread Thierry Reding
On Thu, Jun 04, 2020 at 04:44:11PM -0700, Krishna Reddy wrote: > NVIDIA's Tegra194 soc uses two ARM MMU-500s together to interleave s/soc/SoC/ > IOVA accesses across them. > Add NVIDIA implementation for dual ARM MMU-500s and add new compatible > string for Tegra194 soc. Same here. > >

[PATCH v2] dma-remap: Align the size in dma_common_*_remap()

2020-06-23 Thread Eric Auger
Running a guest with a virtio-iommu protecting virtio devices is broken since commit 515e5b6d90d4 ("dma-mapping: use vmap insted of reimplementing it"). Before the conversion, the size was page aligned in __get_vm_area_node(). Doing so fixes the regression. Fixes: 515e5b6d90d4 ("dma-mapping: use

Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-23 Thread Rikard Falkeborn
Den tis 23 juni 2020 12:21John Garry skrev: > On 23/06/2020 10:35, Rikard Falkeborn wrote: > > > > I'd say that GENMASK_INPUT_CHECK() should be able to handle a l=0 and > > h=unsigned value, so I doubt this warn. > > > > Using GENMASK((int)cmdq->q.llq.max_n_shift, 0) resolves it, but

Re: [PATCH v2] dma-remap: Align the size in dma_common_*_remap()

2020-06-23 Thread Christoph Hellwig
On Tue, Jun 23, 2020 at 02:07:55PM +0200, Eric Auger wrote: > Running a guest with a virtio-iommu protecting virtio devices > is broken since commit 515e5b6d90d4 ("dma-mapping: use vmap insted > of reimplementing it"). Before the conversion, the size was > page aligned in __get_vm_area_node().

Re: [PATCH v6 3/4] iommu/arm-smmu: Add global/context fault implementation hooks

2020-06-23 Thread Thierry Reding
On Tue, Jun 23, 2020 at 12:30:16PM +0100, Robin Murphy wrote: > On 2020-06-23 09:36, Thierry Reding wrote: > [...] > > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > > > index 243bc4cb2705b..d720e1e191176 100644 > > > --- a/drivers/iommu/arm-smmu.c > > > +++

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-06-23 Thread Konrad Rzeszutek Wilk
On Mon, Apr 27, 2020 at 06:53:18PM +, Ashish Kalra wrote: > Hello Konrad, > > On Mon, Mar 30, 2020 at 10:25:51PM +, Ashish Kalra wrote: > > Hello Konrad, > > > > On Tue, Mar 03, 2020 at 12:03:53PM -0500, Konrad Rzeszutek Wilk wrote: > > > On Tue, Feb 04, 2020 at 07:35:00PM +, Ashish

Re: [PATCH v6 1/4] iommu/arm-smmu: add NVIDIA implementation for dual ARM MMU-500 usage

2020-06-23 Thread Thierry Reding
On Tue, Jun 23, 2020 at 12:16:55PM +0100, Robin Murphy wrote: > On 2020-06-23 11:29, Thierry Reding wrote: > [...] > > > diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c > > > index c75b9d957b702..52c84c30f83e4 100644 > > > --- a/drivers/iommu/arm-smmu-impl.c > > > +++

Re: [PATCH] dma-remap: Align the size in dma_common_*_remap()

2020-06-23 Thread Christoph Hellwig
On Mon, Jun 22, 2020 at 10:23:20PM +0200, Eric Auger wrote: > Running a guest with a virtio-iommu protecting virtio devices > is broken since commit 515e5b6d90d4 ("dma-mapping: use vmap insted > of reimplementing it"). Before the conversion, the size was > page aligned in __get_vm_area_node().

Re: [PATCH v6 1/4] iommu/arm-smmu: add NVIDIA implementation for dual ARM MMU-500 usage

2020-06-23 Thread Robin Murphy
On 2020-06-23 11:29, Thierry Reding wrote: [...] diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index c75b9d957b702..52c84c30f83e4 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -160,6 +160,9 @@ struct arm_smmu_device

Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU

2020-06-23 Thread Zhangfei Gao
Hi, Joerg On 2020/6/22 下午7:55, Joerg Roedel wrote: On Thu, Jun 04, 2020 at 09:33:07PM +0800, Zhangfei Gao wrote: +++ b/drivers/iommu/iommu.c @@ -2418,6 +2418,10 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,     fwspec->iommu_fwnode = iommu_fwnode;   

Re: [PATCH v6 4/4] iommu/arm-smmu-nvidia: fix the warning reported by kbuild test robot

2020-06-23 Thread Thierry Reding
On Thu, Jun 04, 2020 at 04:44:14PM -0700, Krishna Reddy wrote: > >> drivers/iommu/arm-smmu-nvidia.c:151:33: sparse: sparse: cast removes > >> address space '' of expression > > Reported-by: kbuild test robot > Signed-off-by: Krishna Reddy > --- > drivers/iommu/arm-smmu-nvidia.c | 2 +- > 1

Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-23 Thread Rikard Falkeborn
-ci/linux/commits/John-Garry/iommu-arm-smmu-v3-Improve-cmdq-lock-efficiency/20200623-013438 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git > next > > config: arm64-randconfig-c024-20200622 (attached as .config) > > compiler: aarch64-linux-gcc (GCC) 9.3

Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-23 Thread John Garry
On 23/06/2020 10:35, Rikard Falkeborn wrote: I'd say that GENMASK_INPUT_CHECK() should be able to handle a l=0 and h=unsigned value, so I doubt this warn. Using GENMASK((int)cmdq->q.llq.max_n_shift, 0) resolves it, but it looks like GENMASK_INPUT_CHECK() could be improved.

Re: [PATCH v6 2/4] dt-bindings: arm-smmu: Add binding for Tegra194 SMMU

2020-06-23 Thread Thierry Reding
On Thu, Jun 04, 2020 at 04:44:12PM -0700, Krishna Reddy wrote: > Add binding for NVIDIA's Tegra194 Soc SMMU that is based > on ARM MMU-500. > > Signed-off-by: Krishna Reddy > --- > Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 5 + > 1 file changed, 5 insertions(+) > > diff --git

Re: [PATCH v6 3/4] iommu/arm-smmu: Add global/context fault implementation hooks

2020-06-23 Thread Robin Murphy
On 2020-06-23 09:36, Thierry Reding wrote: [...] diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 243bc4cb2705b..d720e1e191176 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -673,6 +673,7 @@ static int arm_smmu_init_domain_context(struct

[PATCH 5/7] iommu/vt-d: Fix devTLB flush for vSVA

2020-06-23 Thread Jacob Pan
From: Liu Yi L For guest SVA usage, in order to optimize for less VMEXIT, guest request of IOTLB flush also includes device TLB. On the host side, IOMMU driver performs IOTLB and implicit devTLB invalidation. When PASID-selective granularity is requested by the guest we need to derive the

[PATCH 1/7] iommu/vt-d: Enforce PASID devTLB field mask

2020-06-23 Thread Jacob Pan
From: Liu Yi L Set proper masks to avoid invalid input spillover to reserved bits. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/linux/intel-iommu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/intel-iommu.h

[PATCH 0/7] iommu/vt-d: Misc tweaks and fixes for vSVA

2020-06-23 Thread Jacob Pan
Hi Baolu and all, This a series to address some of the issues we found in vSVA support. Most of the patches deal with exception handling, we also removed some bits that are not currently supported. Many thanks to Kevin Tian's review. Jacob & Yi Jacob Pan (4): iommu/vt-d: Remove global page

[PATCH 4/7] iommu/vt-d: Handle non-page aligned address

2020-06-23 Thread Jacob Pan
From: Liu Yi L Address information for device TLB invalidation comes from userspace when device is directly assigned to a guest with vIOMMU support. VT-d requires page aligned address. This patch checks and enforce address to be page aligned, otherwise reserved bits can be set in the

[PATCH 2/7] iommu/vt-d: Remove global page support in devTLB flush

2020-06-23 Thread Jacob Pan
Global pages support is removed from VT-d spec 3.0 for dev TLB invalidation. This patch is to remove the bits for vSVA. Similar change already made for the native SVA. See the link below. Link: https://lkml.org/lkml/2019/8/26/651 Signed-off-by: Jacob Pan --- drivers/iommu/intel/dmar.c | 4 +---

[PATCH 6/7] iommu/vt-d: Warn on out-of-range invalidation address

2020-06-23 Thread Jacob Pan
For guest requested IOTLB invalidation, address and mask are provided as part of the invalidation data. VT-d HW silently ignores any address bits below the mask. SW shall also allow such case but give warning if address does not align with the mask. This patch relax the fault handling from error

[PATCH 3/7] iommu/vt-d: Fix PASID devTLB invalidation

2020-06-23 Thread Jacob Pan
DevTLB flush can be used for both DMA request with and without PASIDs. The former uses PASID#0 (RID2PASID), latter uses non-zero PASID for SVA usage. This patch adds a check for PASID value such that devTLB flush with PASID is used for SVA case. This is more efficient in that multiple PASIDs can

[PATCH 7/7] iommu/vt-d: Disable multiple GPASID-dev bind

2020-06-23 Thread Jacob Pan
For the unlikely use case where multiple aux domains from the same pdev are attached to a single guest and then bound to a single process (thus same PASID) within that guest, we cannot easily support this case by refcounting the number of users. As there is only one SL page table per PASID while

Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU

2020-06-23 Thread Bjorn Helgaas
On Fri, Jun 19, 2020 at 10:26:54AM +0800, Zhangfei Gao wrote: > Have studied _DSM method, two issues we met comparing using quirk. > > 1. Need change definition of either pci_host_bridge or pci_dev, like adding > member can_stall, > while pci system does not know stall now. > > a, pci devices do

Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-23 Thread Robin Murphy
t WARNING on iommu/next] >> [If your patch is applied to the wrong git tree, kindly drop us a note. >> And when submitting patch, we suggest to use  as documented in >> https://git-scm.com/docs/git-format-patch] >> >> url:    >> https://github.com/0day-ci/li

[kbuild] Re: [PATCH v7 33/36] rapidio: fix common struct sg_table related issues

2020-06-23 Thread Dan Carpenter
Hi Marek, url: https://github.com/0day-ci/linux/commits/Marek-Szyprowski/DRM-fix-struct-sg_table-nents-vs-orig_nents-misuse/20200619-184302 base:ce2cc8efd7a40cbd17841add878cb691d0ce0bba config: i386-randconfig-m021-20200623 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

[PATCH v3 5/5] iommu/uapi: Support both kernel and user unbind guest PASID

2020-06-23 Thread Jacob Pan
Guest SVA unbind data can come from either kernel and user space, if a user pointer is passed in, IOMMU driver must copy from data from user. If the unbind data is assembled in kernel, data can be trusted and directly used. This patch creates a wrapper for unbind gpasid such that user pointer can

[PATCH v3 3/5] iommu/uapi: Use named union for user data

2020-06-23 Thread Jacob Pan
IOMMU UAPI data size is filled by the user space which must be validated by ther kernel. To ensure backward compatibility, user data can only be extended by either re-purpose padding bytes or extend the variable sized union at the end. No size change is allowed before the union. Therefore, the

[PATCH v3 1/5] docs: IOMMU user API

2020-06-23 Thread Jacob Pan
IOMMU UAPI is newly introduced to support communications between guest virtual IOMMU and host IOMMU. There has been lots of discussions on how it should work with VFIO UAPI and userspace in general. This document is indended to clarify the UAPI design and usage. The mechenics of how future

[PATCH v3 0/5] IOMMU user API enhancement

2020-06-23 Thread Jacob Pan
IOMMU user API header was introduced to support nested DMA translation and related fault handling. The current UAPI data structures consist of three areas that cover the interactions between host kernel and guest: - fault handling - cache invalidation - bind guest page tables, i.e. guest PASID

[PATCH v3 4/5] iommu/uapi: Handle data and argsz filled by users

2020-06-23 Thread Jacob Pan
IOMMU UAPI data has a user filled argsz field which indicates the data length comes with the API call. User data is not trusted, argsz must be validated based on the current kernel data size, mandatory data size, and feature flags. User data may also be extended, results in possible argsz

[PATCH v3 2/5] iommu/uapi: Add argsz for user filled data

2020-06-23 Thread Jacob Pan
As IOMMU UAPI gets extended, user data size may increase. To support backward compatibiliy, this patch introduces a size field to each UAPI data structures. It is *always* the responsibility for the user to fill in the correct size. Specific scenarios for user data handling are documented in:

Re: [PATCH 5/7] iommu/vt-d: Fix devTLB flush for vSVA

2020-06-23 Thread kernel test robot
Hi Jacob, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on iommu/next] [also build test WARNING on linux/master linus/master v5.8-rc2 next-20200623] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest

Re: [PATCH 5/7] iommu/vt-d: Fix devTLB flush for vSVA

2020-06-23 Thread Jacob Pan
On Tue, 23 Jun 2020 08:43:14 -0700 Jacob Pan wrote: > From: Liu Yi L > > For guest SVA usage, in order to optimize for less VMEXIT, guest > request of IOTLB flush also includes device TLB. > > On the host side, IOMMU driver performs IOTLB and implicit devTLB > invalidation. When

Re: [PATCH v2] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests.

2020-06-23 Thread Ashish Kalra
Hello Konrad, On Tue, Jun 23, 2020 at 09:38:43AM -0400, Konrad Rzeszutek Wilk wrote: > On Mon, Apr 27, 2020 at 06:53:18PM +, Ashish Kalra wrote: > > Hello Konrad, > > > > On Mon, Mar 30, 2020 at 10:25:51PM +, Ashish Kalra wrote: > > > Hello Konrad, > > > > > > On Tue, Mar 03, 2020 at