Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()

2021-05-20 Thread Rolf Eike Beer
Am Donnerstag, 22. April 2021, 07:34:17 CEST schrieb Lu Baolu: > Hi Rolf, > > On 4/22/21 1:39 PM, Rolf Eike Beer wrote: > > iommu_device_sysfs_add() is called before, so is has to be cleaned on > > subsequent errors. > > > > Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device

Re: [RFC PATCH v1 0/2] iommu/arm-smmu-v3: Add some parameter check in __arm_smmu_tlb_inv_range()

2021-05-20 Thread Kunkun Jiang
Hi Robin, On 2021/5/19 18:01, Robin Murphy wrote: On 2021-05-19 10:43, Kunkun Jiang wrote: Hi all, This set of patches solves some errors when I tested the SMMU nested mode. Test scenario description: guest kernel: 4KB translation granule host kernel: 16KB translation granule errors: 1. en

Re: [PATCH v15 07/12] iommu/smmuv3: Implement cache_invalidate

2021-05-20 Thread Kunkun Jiang
Hi Eric, On 2021/4/11 19:12, Eric Auger wrote: Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v4 -> v15: - remove the redundant arm_smmu_cmdq_issue_sync(smmu) in IOMMU_INV_GRANU_ADDR case (Zenghui) - if RIL is not supported

Re: [RFC PATCH v3 7/8] vfio/type1: Add selective DMA faulting support

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:19 +0800 > Shenming Lu wrote: > >> Some devices only allow selective DMA faulting. Similar to the selective >> dirty page tracking, the vendor driver can call vfio_pin_pages() to >> indicate the non-faultable scope, we add a new

Re: [RFC PATCH v3 6/8] vfio/type1: No need to statically pin and map if IOPF enabled

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:18 +0800 > Shenming Lu wrote: > >> If IOPF enabled for the VFIO container, there is no need to statically >> pin and map the entire DMA range, we can do it on demand. And unmap >> according to the IOPF mapped bitmap when removin

Re: [RFC PATCH v3 2/8] vfio/type1: Add a page fault handler

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:14 +0800 > Shenming Lu wrote: > >> VFIO manages the DMA mapping itself. To support IOPF (on-demand paging) >> for VFIO (IOMMU capable) devices, we add a VFIO page fault handler to >> serve the reported page faults from the IOMMU

Re: [RFC PATCH v3 5/8] vfio/type1: VFIO_IOMMU_ENABLE_IOPF

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:17 +0800 > Shenming Lu wrote: > >> Since enabling IOPF for devices may lead to a slow ramp up of performance, >> we add an ioctl VFIO_IOMMU_ENABLE_IOPF to make it configurable. And the >> IOPF enabling of a VFIO device includes

Re: [RFC PATCH v3 4/8] vfio/type1: Pre-map more pages than requested in the IOPF handling

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:16 +0800 > Shenming Lu wrote: > >> To optimize for fewer page fault handlings, we can pre-map more pages >> than requested at once. >> >> Note that IOPF_PREMAP_LEN is just an arbitrary value for now, which we >> could try furthe

Re: [RFC PATCH v3 3/8] vfio/type1: Add an MMU notifier to avoid pinning

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:15 +0800 > Shenming Lu wrote: > >> To avoid pinning pages when they are mapped in IOMMU page tables, we >> add an MMU notifier to tell the addresses which are no longer valid >> and try to unmap them. >> >> Signed-off-by: Shenmi

Re: [RFC PATCH v3 1/8] iommu: Evolve the device fault reporting framework

2021-05-20 Thread Shenming Lu
On 2021/5/19 2:58, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:13 +0800 > Shenming Lu wrote: > >> This patch follows the discussion here: >> >> https://lore.kernel.org/linux-acpi/YAaxjmJW+ZMvrhac@myrica/ >> >> Besides SVA/vSVA, such as VFIO may also enable (2nd level) IOPF to remove >> pinn

Re: [RFC PATCH v3 0/8] Add IOPF support for VFIO passthrough

2021-05-20 Thread Shenming Lu
Hi Alex, On 2021/5/19 2:57, Alex Williamson wrote: > On Fri, 9 Apr 2021 11:44:12 +0800 > Shenming Lu wrote: > >> Hi, >> >> Requesting for your comments and suggestions. :-) >> >> The static pinning and mapping problem in VFIO and possible solutions >> have been discussed a lot [1, 2]. One of the

[PATCH] dma-iommu: Add a check to avoid dereference null pointer in function iommu_dma_map_sg()

2021-05-20 Thread chenxiang
From: Xiang Chen The issue is reported by tool TscanCode, and it is possible to deference null pointer when prev is NULL which is the initial value. Signed-off-by: Xiang Chen --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iom

[PATCH v4] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-05-20 Thread Wang Xingang
From: Xingang Wang When booting with devicetree, the pci_request_acs() is called after the enumeration and initialization of PCI devices, thus the ACS is not enabled. And ACS should be enabled when IOMMU is detected for the PCI host bridge, so add check for IOMMU before probe of PCI host and call

Re: [PATCH v2 1/5] dt-bindings: reserved-memory: Document memory region specifier

2021-05-20 Thread Rob Herring
On Fri, Apr 23, 2021 at 06:32:30PM +0200, Thierry Reding wrote: > From: Thierry Reding > > Reserved memory region phandle references can be accompanied by a > specifier that provides additional information about how that specific > reference should be treated. > > One use-case is to mark a memor

Re: i915 and swiotlb_max_segment

2021-05-20 Thread Konrad Rzeszutek Wilk
On Mon, May 10, 2021 at 05:25:25PM +0200, Christoph Hellwig wrote: > Hi all, > > swiotlb_max_segment is a rather strange "API" export by swiotlb.c, > and i915 is the only (remaining) user. > > swiotlb_max_segment returns 0 if swiotlb is not in use, 1 if > SWIOTLB_FORCE is set or swiotlb-zen is se

Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook

2021-05-20 Thread Jason Gunthorpe
On Thu, May 20, 2021 at 03:13:55PM +0100, Robin Murphy wrote: > By "mdev-like" I mean it's very similar in shape to the general SIOV-style > mediated device concept - i.e. a physical device with an awareness of > operating on multiple contexts at once, using a Substream ID/PASID for each > one - b

Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook

2021-05-20 Thread Robin Murphy
On 2021-05-20 00:24, Jason Gunthorpe wrote: On Wed, May 19, 2021 at 11:12:46PM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Thursday, May 20, 2021 2:07 AM On Wed, May 19, 2021 at 04:23:21PM +0100, Robin Murphy wrote: On 2021-05-17 16:35, Joerg Roedel wrote: On Mon, May 17, 2021 at 1

Re: [PATCH v3] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-05-20 Thread Rob Herring
On Thu, May 20, 2021 at 2:28 AM Wang Xingang wrote: > > From: Xingang Wang > > When booting with devicetree, the pci_request_acs() is called after the > enumeration and initialization of PCI devices, thus the ACS is not > enabled. And ACS should be enabled when IOMMU is detected for the > PCI hos

Re: [PATCH 3/3] lib/vsprintf: Use pr_crit() instead of long fancy messages

2021-05-20 Thread Petr Mladek via iommu
On Mon 2021-05-17 08:21:12, Geert Uytterhoeven wrote: > On Wed, Mar 31, 2021 at 11:59 AM Geert Uytterhoeven > wrote: > > While long fancy messages have a higher probability of being seen than > > small messages, they may scroll of the screen fast, if visible at all, > > and may still be missed. I

Re: Re: [PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-20 Thread Yongji Xie
On Thu, May 20, 2021 at 2:06 PM Michael S. Tsirkin wrote: > > On Mon, May 17, 2021 at 05:55:01PM +0800, Xie Yongji wrote: > > This series introduces a framework, which can be used to implement > > vDPA Devices in a userspace program. The work consist of two parts: > > control path forwarding and d

Re: [PATCH v2 00/15] dma mapping/iommu: Allow IOMMU IOVA rcache range to be configured

2021-05-20 Thread John Garry
On 10/05/2021 15:17, John Garry wrote: Hi Robin, guys, A friendly reminder on this one... Thanks For streaming DMA mappings involving an IOMMU and whose IOVA len regularly exceeds the IOVA rcache upper limit (meaning that they are not cached), performance can be reduced. This is much more pr

[PATCH v3] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-05-20 Thread Wang Xingang
From: Xingang Wang When booting with devicetree, the pci_request_acs() is called after the enumeration and initialization of PCI devices, thus the ACS is not enabled. And ACS should be enabled when IOMMU is detected for the PCI host bridge, so add check for IOMMU before probe of PCI host and call

[PATCH -next 1/3] iommu/arm-smmu-v3: fix missing a blank line after declarations

2021-05-20 Thread Bixuan Cui
Fixes checkpatch warnings in arm-smmu-v3.c: WARNING: Missing a blank line after declarations Signed-off-by: Bixuan Cui --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smm

[PATCH -next 0/3] iommu/arm-smmu-v3: clean up some code style issues

2021-05-20 Thread Bixuan Cui
Clean up some code style issues. Bixuan Cui (3): iommu/arm-smmu-v3: fix missing a blank line after declarations iommu/arm-smmu-v3: Change *array into *const array iommu/arm-smmu-v3: Prefer unsigned int to bare use of unsigned drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 +++-- 1 fil

[PATCH -next 3/3] iommu/arm-smmu-v3: Prefer unsigned int to bare use of unsigned

2021-05-20 Thread Bixuan Cui
Fix checkpatch warning in arm-smmu-v3.c: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Bixuan Cui --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/

[PATCH -next 2/3] iommu/arm-smmu-v3: Change *array into *const array

2021-05-20 Thread Bixuan Cui
Fix checkpatch warning in arm-smmu-v3.c: static const char * array should probably be static const char * const Signed-off-by: Bixuan Cui --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.

Re: Re: Re: [PATCH v7 04/12] virtio-blk: Add validation for block size in config space

2021-05-20 Thread Yongji Xie
On Thu, May 20, 2021 at 1:43 PM Michael S. Tsirkin wrote: > > On Thu, May 20, 2021 at 01:25:16PM +0800, Yongji Xie wrote: > > On Wed, May 19, 2021 at 10:42 PM Dan Carpenter > > wrote: > > > > > > On Wed, May 19, 2021 at 09:39:20PM +0800, Yongji Xie wrote: > > > > On Mon, May 17, 2021 at 5:56 PM

Re: Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-20 Thread Yongji Xie
On Thu, May 20, 2021 at 2:28 PM Al Viro wrote: > > On Mon, May 17, 2021 at 05:55:12PM +0800, Xie Yongji wrote: > > > + case VDUSE_IOTLB_GET_FD: { > > + struct vduse_iotlb_entry entry; > > + struct vhost_iotlb_map *map; > > + struct vdpa_map_file *map_file; >