RE: [RFC][PATCH v2 00/13] iommu/arm-smmu-v3: Add NVIDIA implementation

2021-08-31 Thread Tian, Kevin
> From: Alex Williamson > Sent: Wednesday, September 1, 2021 12:16 AM > > On Mon, 30 Aug 2021 19:59:10 -0700 > Nicolin Chen wrote: > > > The SMMUv3 devices implemented in the Grace SoC support NVIDIA's > custom > > CMDQ-Virtualization (CMDQV) hardware. Like the new ECMDQ feature first > > introd

[PATCH] swiotlb: allocate memory in a cache-friendly way

2021-08-31 Thread Chao Gao
Currently, swiotlb uses a global index to indicate the starting point of next search. The index increases from 0 to the number of slots - 1 and then wraps around. It is straightforward but not cache-friendly because the "oldest" slot in swiotlb tends to be used first. Freed slots are probably acce

Re: [PATCH v13 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-31 Thread Jason Wang
在 2021/8/31 下午6:36, Xie Yongji 写道: Export eventfd_wake_count so that some modules can use the eventfd_signal_count() to check whether the eventfd_signal() call should be deferred to a safe context. Signed-off-by: Xie Yongji And this matches the comment inside eventfd_signal():     /*  

Re: [PATCH v2 0/8] Support IOMMU page sizes larger than the CPU page size

2021-08-31 Thread Alyssa Rosenzweig
> Some background: On the Apple M1 the IOMMUs are hardwired to only support 16 > KB pages. > We'd still like to boot Linux with 4KB pages though because that's what most > distros > ship these days. This patch series adds support for that setup to the IOMMU > DMA API. This isn't just a distro i

Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-08-31 Thread Alyssa Rosenzweig
> + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { Not a fan of this construction. Could you assign `(1 << __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g min_io_pgsize) so it's clearer what's going on? > + pr_warn("IOMMU page size cannot represent

Re: [PATCH v2 8/8] iommu/dart: Remove force_bypass logic

2021-08-31 Thread Alyssa Rosenzweig
> Now that the dma-iommu API supports IOMMU granules which are larger than > the CPU page size and that the kernel no longer runs into a BUG_ON when > devices are attached to a domain with such a granule there's no need to > force bypass mode anymore. > > Signed-off-by: Sven Peter > --- > driver

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-08-31 Thread Alyssa Rosenzweig
I use this function for cross-device sharing on the M1 display driver. Arguably this is unsafe but it works on 16k kernels and if you want to test the function on 4k, you know where my code is. On Sat, Aug 28, 2021 at 05:36:37PM +0200, Sven Peter wrote: > Pretend that iommu_dma_get_sgtable is not

Re: [PATCH] swiotlb: use depends on for DMA_RESTRICTED_POOL

2021-08-31 Thread Konrad Rzeszutek Wilk
On Tue, Aug 31, 2021 at 04:17:47PM +0100, Will Deacon wrote: > On Fri, Aug 27, 2021 at 11:48:02AM +0800, Claire Chang wrote: > > Use depends on instead of select for DMA_RESTRICTED_POOL; otherwise it > > will make SWIOTLB user configurable and cause compile errors for some > > arch (e.g. mips). > >

RE: [PATCH V4 00/13] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-08-31 Thread Michael Kelley via iommu
From: Christoph Hellwig Sent: Monday, August 30, 2021 5:01 AM > > Sorry for the delayed answer, but I look at the vmap_pfn usage in the > previous version and tried to come up with a better version. This > mostly untested branch: > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/hea

Re: [PATCH 0/3] iommu/amd: Fix unable to handle page fault due to AVIC

2021-08-31 Thread Suthikulpanit, Suravee via iommu
Joerg, Here is an dditional tags for this series: Fixes: 8bda0cfbdc1a ("iommu/amd: Detect and initialize guest vAPIC log") Are there any concerns with this series? Thanks Suravee On 8/20/2021 3:29 PM, Suravee Suthikulpanit wrote: This bug is triggered when rebooting VM on a system which SVM

Re: [RFC][PATCH v2 00/13] iommu/arm-smmu-v3: Add NVIDIA implementation

2021-08-31 Thread Alex Williamson
On Mon, 30 Aug 2021 19:59:10 -0700 Nicolin Chen wrote: > The SMMUv3 devices implemented in the Grace SoC support NVIDIA's custom > CMDQ-Virtualization (CMDQV) hardware. Like the new ECMDQ feature first > introduced in the ARM SMMUv3.3 specification, CMDQV adds multiple VCMDQ > interfaces to suppl

Re: [PATCH V4 00/13] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-08-31 Thread Tianyu Lan
Hi Christoph: On 8/30/2021 8:00 PM, Christoph Hellwig wrote: Sorry for the delayed answer, but I look at the vmap_pfn usage in the previous version and tried to come up with a better version. This mostly untested branch: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hyperv-vm

Re: [PATCH] swiotlb: use depends on for DMA_RESTRICTED_POOL

2021-08-31 Thread Will Deacon
On Fri, Aug 27, 2021 at 11:48:02AM +0800, Claire Chang wrote: > Use depends on instead of select for DMA_RESTRICTED_POOL; otherwise it > will make SWIOTLB user configurable and cause compile errors for some > arch (e.g. mips). > > Fixes: 0b84e4f8b793 ("swiotlb: Add restricted DMA pool initializati

[PATCH] iommu/vt-d: Do not falsely log intel_iommu is unsupported kernel option

2021-08-31 Thread Tvrtko Ursulin
From: Tvrtko Ursulin Handling of intel_iommu kernel command line option should return "true" to indicate option is valid and so avoid logging it as unknown by the core parsing code. Also log unknown sub-options at the notice level to let user know of potential typos or similar. Signed-off-by: T

Re: [PATCH v7 00/12] Clean up "mediatek,larb"

2021-08-31 Thread 吴勇
Hi Matthias, Just ping for this patchset. Thanks. On Fri, 2021-07-30 at 10:52 +0800, Yong Wu wrote: > MediaTek IOMMU block diagram always like below: > > M4U > | > smi-common > | > - > | | ... > | | > larb1 larb2 > |

[PATCH v13 13/13] Documentation: Add documentation for VDUSE

2021-08-31 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/index.rst | 1 + Documentation/u

[PATCH v13 12/13] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-31 Thread Xie Yongji
This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device interface (/dev/vduse/$NAME) is exported to userspace for device emulation. In order to make the device emulation more

[PATCH v13 11/13] vduse: Implement an MMU-based software IOTLB

2021-08-31 Thread Xie Yongji
This implements an MMU-based software IOTLB to support mapping kernel dma buffer into userspace dynamically. The basic idea behind it is treating MMU (VA->PA) as IOMMU (IOVA->PA). The software IOTLB will set up MMU mapping instead of IOMMU mapping for the DMA transfer so that the userspace process

[PATCH v13 10/13] vdpa: Support transferring virtual addressing during DMA mapping

2021-08-31 Thread Xie Yongji
This patch introduces an attribute for vDPA device to indicate whether virtual address can be used. If vDPA device driver set it, vhost-vdpa bus driver will not pin user page and transfer userspace virtual address instead of physical address during DMA mapping. And corresponding vma->vm_file and of

[PATCH v13 09/13] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-08-31 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c | 55 +

[PATCH v13 08/13] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-08-31 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) di

[PATCH v13 07/13] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-08-31 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19 insertions

[PATCH v13 06/13] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-31 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/

[PATCH v13 05/13] vdpa: Add reset callback in vdpa_config_ops

2021-08-31 Thread Xie Yongji
This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting. Signed-off-by: Xie Yongji --- drivers/vdpa/ifcvf/ifcvf_main.c | 35 +++--- drivers/vdpa/mlx5/net/

[PATCH v13 04/13] vdpa: Fix some coding style issues

2021-08-31 Thread Xie Yongji
Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by:

[PATCH v13 01/13] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-31 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji Acked-by: Jason Wang Acked-by: Will Deacon --- drivers/iommu/iova.c | 2 ++ 1 fil

[PATCH v13 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-31 Thread Xie Yongji
Export eventfd_wake_count so that some modules can use the eventfd_signal_count() to check whether the eventfd_signal() call should be deferred to a safe context. Signed-off-by: Xie Yongji --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index e265

[PATCH v13 03/13] file: Export receive_fd() to modules

2021-08-31 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions(

[PATCH v13 00/13] Introduce VDUSE - vDPA Device in Userspace

2021-08-31 Thread Xie Yongji
This series introduces a framework that makes it possible to implement software-emulated vDPA devices in userspace. And to make the device emulation more secure, the emulated vDPA device's control path is handled in the kernel and only the data path is implemented in the userspace. Since the emuld