Re: [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA

2021-01-15 Thread Lu Baolu
Hi Jean, On 2021/1/15 0:41, Jean-Philippe Brucker wrote: I guess detailing what's needed for nested IOPF can help the discussion, although I haven't seen any concrete plan about implementing it, and it still seems a couple of years away. There are two important steps with nested IOPF: (1)

Re: [PATCH v13 08/15] iommu/smmuv3: Implement cache_invalidate

2021-01-15 Thread chenxiang (M)
Hi Eric, 在 2020/11/18 19:21, Eric Auger 写道: Implement domain-selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v7 -> v8: - ASID based invalidation using iommu_inv_pasid_info - check ARCHID/PASID flags in addr based invalidation - use __arm_smmu_tlb_inv_context

Re: [RFC PATCH v3 1/2] iommu: Add capability IOMMU_CAP_VIOMMU

2021-01-15 Thread Lu Baolu
Hi, On 2021/1/15 14:31, Leon Romanovsky wrote: On Fri, Jan 15, 2021 at 07:49:47AM +0800, Lu Baolu wrote: Hi Leon, On 1/14/21 9:26 PM, Leon Romanovsky wrote: On Thu, Jan 14, 2021 at 09:30:02AM +0800, Lu Baolu wrote: Some vendor IOMMU drivers are able to declare that it is running in a VM

Re: [PATCH 6/6] vfio/iommu_type1: Drop parameter "pgsize" of update_user_bitmap

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:44:01 +0800 Keqian Zhu wrote: > We always use the smallest supported page size of vfio_iommu as > pgsize. Drop parameter "pgsize" of update_user_bitmap. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 9 - > 1 file changed, 4

Re: [PATCH 5/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_iova_dirty_bitmap

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:44:00 +0800 Keqian Zhu wrote: > We always use the smallest supported page size of vfio_iommu as > pgsize. Remove parameter "pgsize" of vfio_iova_dirty_bitmap. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 8 > 1 file changed, 4

Re: [PATCH 4/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_dma_bitmap_alloc_all

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:43:59 +0800 Keqian Zhu wrote: > We always use the smallest supported page size of vfio_iommu as > pgsize. Remove parameter "pgsize" of vfio_dma_bitmap_alloc_all. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 8 +++- > 1 file changed, 3

Re: [PATCH 3/6] vfio/iommu_type1: Initially set the pinned_page_dirty_scope

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:43:58 +0800 Keqian Zhu wrote: > For now there are 3 ways to promote the pinned_page_dirty_scope > status of vfio_iommu: > > 1. Through vfio pin interface. > 2. Detach a group without pinned_dirty_scope. > 3. Attach a group with pinned_dirty_scope. > > For point 3, the

Re: [PATCH 2/6] vfio/iommu_type1: Ignore external domain when promote pinned_scope

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:43:57 +0800 Keqian Zhu wrote: > The pinned_scope of external domain's groups are always true, that's > to say we can safely ignore external domain when promote pinned_scope > status of vfio_iommu. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 14

Re: [PATCH 1/6] vfio/iommu_type1: Make an explicit "promote" semantic

2021-01-15 Thread Alex Williamson
On Thu, 7 Jan 2021 12:43:56 +0800 Keqian Zhu wrote: > When we want to promote the pinned_page_dirty_scope of vfio_iommu, > we call the "update" function to visit all vfio_group, but when we > want to downgrade this, we can set the flag as false directly. I agree that the transition can only go

Re: [PATCH v4 3/3] iommu/iova: Flush CPU rcache for when a depot fills

2021-01-15 Thread Robin Murphy
On 2021-01-15 17:32, Jean-Philippe Brucker wrote: On Thu, Dec 10, 2020 at 02:23:09AM +0800, John Garry wrote: Leizhen reported some time ago that IOVA performance may degrade over time [0], but unfortunately his solution to fix this problem was not given attention. To summarize, the issue is

Re: [PATCH v2 2/2] vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma

2021-01-15 Thread Alex Williamson
On Fri, 15 Jan 2021 17:26:43 +0800 Keqian Zhu wrote: > vfio_sanity_check_pfn_list() is used to check whether pfn_list of > vfio_dma is empty when remove the external domain, so it makes a > wrong assumption that only external domain will add pfn to dma pfn_list. > > Now we apply this check when

Re: [GIT PULL] IOMMU fixes for -rc4

2021-01-15 Thread pr-tracker-bot
The pull request you sent on Fri, 15 Jan 2021 11:26:20 +: > git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git tags/iommu-fixes has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/7aec71cd9c1f251ef17eae5f898c10133d49421d Thank you! -- Deet-doot-dot, I am

Re: [PATCH v2 1/2] vfio/iommu_type1: Populate full dirty when detach non-pinned group

2021-01-15 Thread Alex Williamson
On Fri, 15 Jan 2021 17:26:42 +0800 Keqian Zhu wrote: > If a group with non-pinned-page dirty scope is detached with dirty > logging enabled, we should fully populate the dirty bitmaps at the > time it's removed since we don't know the extent of its previous DMA, > nor will the group be present

Re: [PATCH v4 3/3] iommu/iova: Flush CPU rcache for when a depot fills

2021-01-15 Thread Jean-Philippe Brucker
On Thu, Dec 10, 2020 at 02:23:09AM +0800, John Garry wrote: > Leizhen reported some time ago that IOVA performance may degrade over time > [0], but unfortunately his solution to fix this problem was not given > attention. > > To summarize, the issue is that as time goes by, the CPU rcache and

Re: [PATCH v4 2/3] iommu/iova: Avoid double-negatives in magazine helpers

2021-01-15 Thread Jean-Philippe Brucker
On Thu, Dec 10, 2020 at 02:23:08AM +0800, John Garry wrote: > A similar crash to the following could be observed if initial CPU rcache > magazine allocations fail in init_iova_rcaches(): Any idea why that's happening? This fix seems ok but if we're expecting allocation failures for the loaded

Re: [PATCH v4 1/3] iommu/iova: Add free_all_cpu_cached_iovas()

2021-01-15 Thread Jean-Philippe Brucker
On Thu, Dec 10, 2020 at 02:23:07AM +0800, John Garry wrote: > Add a helper function to free the CPU rcache for all online CPUs. > > There also exists a function of the same name in > drivers/iommu/intel/iommu.c, but the parameters are different, and there > should be no conflict. > >

Re: Consult on ARM SMMU debugfs

2021-01-15 Thread Robin Murphy
On 2021-01-15 15:14, Russell King - ARM Linux admin wrote: On Mon, Jan 11, 2021 at 08:01:48PM +, Robin Murphy wrote: On 2021-01-07 02:45, chenxiang (M) wrote: Hi Will,� Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs for

Re: Consult on ARM SMMU debugfs

2021-01-15 Thread Russell King - ARM Linux admin
On Mon, Jan 11, 2021 at 08:01:48PM +, Robin Murphy wrote: > On 2021-01-07 02:45, chenxiang (M) wrote: > > Hi Will,  Robin or other guys, > > > > When debugging SMMU/SVA issue on huawei ARM64 board, we find that it > > lacks of enough debugfs for ARM SMMU driver (such as > > > > the value of

Re: [PATCH] iommu: check for the deferred attach when attaching a device

2021-01-15 Thread Robin Murphy
On 2021-01-15 14:26, lijiang wrote: Hi, Robin Thank you for the comment. 在 2021年01月13日 01:29, Robin Murphy 写道: On 2021-01-05 07:52, lijiang wrote: 在 2021年01月05日 11:55, lijiang 写道: Hi, Also add Joerg to cc list. Also add more people to cc list, Jerry Snitselaar and Tom Lendacky. Thanks.

Re: [PATCH] iommu: check for the deferred attach when attaching a device

2021-01-15 Thread lijiang
Hi, Robin Thank you for the comment. 在 2021年01月13日 01:29, Robin Murphy 写道: > On 2021-01-05 07:52, lijiang wrote: >> 在 2021年01月05日 11:55, lijiang 写道: >>> Hi, >>> >>> Also add Joerg to cc list. >>> >> >> Also add more people to cc list, Jerry Snitselaar and Tom Lendacky. >> >> Thanks. >> >>>

RE: [EXTERNAL] Re: amdgpu error whenever IOMMU is enabled

2021-01-15 Thread Merger, Edgar [AUTOSOL/MAS/AUGS]
Hi Joerg, Thanks. Hope you are doing well now. Edgar -Original Message- From: jroe...@suse.de Sent: Freitag, 15. Januar 2021 09:18 To: Merger, Edgar [AUTOSOL/MAS/AUGS] Cc: iommu@lists.linux-foundation.org Subject: Re: [EXTERNAL] Re: amdgpu error whenever IOMMU is enabled Hi Edgar,

Re: [PATCH v3 5/6] media: uvcvideo: Use dma_alloc_noncontiguos API

2021-01-15 Thread Ricardo Ribalda
On Mon, Jan 11, 2021 at 9:36 AM . Christoph Hellwig wrote: > > On Thu, Jan 07, 2021 at 03:14:08PM +0100, Ricardo Ribalda wrote: > > > So I think we do want these branches for coherent vs non-coherent as they > > > have very different semantics and I do not think that hiding them under > > > the

[PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-01-15 Thread Vivek Gautam
Fault type information can tell about a page request fault or an unreceoverable fault, and further additions to fault reasons and the related PASID information can help in handling faults efficiently. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Michael S. Tsirkin Cc:

[PATCH RFC v1 14/15] iommu/virtio: Add support for Arm LPAE page table format

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker When PASID isn't supported, we can still register one set of tables. Add support to register Arm LPAE based page table. Signed-off-by: Jean-Philippe Brucker [Vivek: Clean-ups to add right tcr definitions and accomodate with parent patches] Signed-off-by:

[PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker When the ARM PASID table format is reported in a probe, send an attach request and install the page tables for iommu_map/iommu_unmap use. Architecture-specific components are already abstracted to libraries. We just need to pass config bits around and setup an

[PATCH RFC v1 12/15] iommu/virtio: Add support for INVALIDATE request

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker Add support for tlb invalidation ops that can send invalidation requests to back-end virtio-iommu when stage-1 page tables are supported. Signed-off-by: Jean-Philippe Brucker [Vivek: Refactoring the iommu_flush_ops, and adding only one pasid sync op that's

[PATCH RFC v1 11/15] iommu/virtio: Add headers for binding pasid table in iommu

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker Add the required UAPI defines for binding pasid tables in virtio-iommu. This mode allows to hand stage-1 page tables over to the guest. Signed-off-by: Jean-Philippe Brucker [Vivek: Refactor to cleanup headers for invalidation] Signed-off-by: Vivek Gautam Cc: Joerg

[PATCH RFC v1 10/15] iommu/virtio: Prepare to add attach pasid table infrastructure

2021-01-15 Thread Vivek Gautam
In preparation to add attach pasid table op, separate out the existing attach request code to a separate method. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Michael S. Tsirkin Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex Williamson Cc: Kevin Tian

[PATCH RFC v1 09/15] iommu/virtio: Update table format probing header

2021-01-15 Thread Vivek Gautam
Add info about asid_bits and additional flags to table format probing header. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Michael S. Tsirkin Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex Williamson Cc: Kevin Tian Cc: Jacob Pan Cc: Liu Yi L Cc:

[PATCH RFC v1 08/15] iommu: Add asid_bits to arm smmu-v3 stage1 table info

2021-01-15 Thread Vivek Gautam
aisd_bits data is required to prepare stage-1 tables for arm-smmu-v3. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex Williamson Cc: Kevin Tian Cc: Jacob Pan Cc: Liu Yi L Cc: Lorenzo Pieralisi Cc:

[PATCH RFC v1 07/15] iommu/virtio: Add table format probing

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker The device may provide information about hardware tables and additional capabilities for each device. Parse the new probe fields. Signed-off-by: Jean-Philippe Brucker [Vivek: Refactor to use "struct virtio_iommu_probe_table_format" rather than separate

[PATCH RFC v1 06/15] iommu/virtio: Add headers for table format probing

2021-01-15 Thread Vivek Gautam
From: Jean-Philippe Brucker Add required UAPI defines for probing table format for underlying iommu hardware. The device may provide information about hardware tables and additional capabilities for each device. This allows guest to correctly fabricate stage-1 page tables. Signed-off-by:

[PATCH RFC v1 05/15] iommu/arm-smmu-v3: Set sync op from consumer driver of cd-lib

2021-01-15 Thread Vivek Gautam
Te change allows different consumers of arm-smmu-v3-cd-lib to set their respective sync op for pasid entries. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex Williamson Cc: Kevin Tian Cc: Jacob Pan Cc: Liu Yi

[PATCH RFC v1 04/15] iommu/arm-smmu-v3: Update CD base address info for user-space

2021-01-15 Thread Vivek Gautam
Update base address information in vendor pasid table info to pass that to user-space for stage1 table management. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex Williamson Cc: Kevin Tian Cc: Jacob Pan Cc:

[PATCH RFC v1 03/15] iommu/arm-smmu-v3: Update drivers to work with iommu-pasid-table

2021-01-15 Thread Vivek Gautam
Update arm-smmu-v3 context descriptor (CD) library driver to work with iommu-pasid-table APIs. These APIs are then used in arm-smmu-v3 drivers to manage CD tables. Signed-off-by: Vivek Gautam Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Cc: Jean-Philippe Brucker Cc: Eric Auger Cc: Alex

[PATCH RFC v1 02/15] iommu: Add a simple PASID table library

2021-01-15 Thread Vivek Gautam
Add a small API in iommu subsystem to handle PASID table allocation requests from different consumer drivers, such as a paravirtualized iommu driver. The API provides ops for allocating and freeing PASID table, writing to it and managing the table caches. This library also provides for

[PATCH RFC v1 01/15] iommu/arm-smmu-v3: Create a Context Descriptor library

2021-01-15 Thread Vivek Gautam
Para-virtualized iommu drivers in guest may require to create and manage context descriptor (CD) tables as part of PASID table allocations. The PASID tables are passed to host to configure stage-1 tables in hardware. Make way for a library driver for CD management to allow para- virtualized iommu

[PATCH RFC v1 00/15] iommu/virtio: Nested stage support with Arm

2021-01-15 Thread Vivek Gautam
This patch-series aims at enabling Nested stage translation in guests using virtio-iommu as the paravirtualized iommu. The backend is supported with Arm SMMU-v3 that provides nested stage-1 and stage-2 translation. This series derives its purpose from various efforts happening to add support for

Re: [RESEND PATCH v3 0/4] iommu/iova: Solve longterm IOVA issue

2021-01-15 Thread John Garry
+ linux-scsi (see https://lore.kernel.org/linux-iommu/1607538189-237944-4-git-send-email-john.ga...@huawei.com/) On 17/11/2020 10:25, John Garry wrote: This series contains a patch to solve the longterm IOVA issue which leizhen originally tried to address at [0]. A sieved kernel log is at the

[GIT PULL] IOMMU fixes for -rc4

2021-01-15 Thread Will Deacon
Hi Linus, Please pull these three IOMMU fixes for -rc4. The main one is a change to the Intel IOMMU driver to fix the handling of unaligned addresses when invalidating the TLB. The fix itself is a bit ugly (the caller does a bunch of shifting which is then effectively undone later in the

Re: Consult on ARM SMMU debugfs

2021-01-15 Thread chenxiang (M)
在 2021/1/12 4:01, Robin Murphy 写道: On 2021-01-07 02:45, chenxiang (M) wrote: Hi Will, Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs for ARM SMMU driver (such as the value of STE/CD which we need to check sometimes).

[RESEND PATCH v2 1/2] vfio/iommu_type1: Populate full dirty when detach non-pinned group

2021-01-15 Thread Keqian Zhu
If a group with non-pinned-page dirty scope is detached with dirty logging enabled, we should fully populate the dirty bitmaps at the time it's removed since we don't know the extent of its previous DMA, nor will the group be present to trigger the full bitmap when the user retrieves the dirty

[RESEND PATCH v2 2/2] vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma

2021-01-15 Thread Keqian Zhu
vfio_sanity_check_pfn_list() is used to check whether pfn_list of vfio_dma is empty when remove the external domain, so it makes a wrong assumption that only external domain will add pfn to dma pfn_list. Now we apply this check when remove a specific vfio_dma and extract the notifier check just

[RESEND PATCH v2 0/2] vfio/iommu_type1: some fixes

2021-01-15 Thread Keqian Zhu
changelog: v2: - Address suggestions from Alex. - Remove unnecessary patches. Keqian Zhu (2): vfio/iommu_type1: Populate full dirty when detach non-pinned group vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma drivers/vfio/vfio_iommu_type1.c | 42

Re: [PATCH 1/5] vfio/iommu_type1: Fixes vfio_dma_populate_bitmap to avoid dirty lose

2021-01-15 Thread Keqian Zhu
On 2021/1/15 1:14, Alex Williamson wrote: > On Thu, 14 Jan 2021 21:05:23 +0800 > Keqian Zhu wrote: > >> Hi Alex, >> >> On 2021/1/13 5:20, Alex Williamson wrote: >>> On Thu, 7 Jan 2021 17:28:57 +0800 >>> Keqian Zhu wrote: >>> Defer checking whether vfio_dma is of fully-dirty in

[PATCH v2 2/2] vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma

2021-01-15 Thread Keqian Zhu
vfio_sanity_check_pfn_list() is used to check whether pfn_list of vfio_dma is empty when remove the external domain, so it makes a wrong assumption that only external domain will add pfn to dma pfn_list. Now we apply this check when remove a specific vfio_dma and extract the notifier check just

[PATCH v2 1/2] vfio/iommu_type1: Populate full dirty when detach non-pinned group

2021-01-15 Thread Keqian Zhu
If a group with non-pinned-page dirty scope is detached with dirty logging enabled, we should fully populate the dirty bitmaps at the time it's removed since we don't know the extent of its previous DMA, nor will the group be present to trigger the full bitmap when the user retrieves the dirty

[PATCH v2 0/2] vfio/iommu_type1: some fixes

2021-01-15 Thread Keqian Zhu
changelog: v2: - Address suggestions from Alex. - Remove unnecessary patches. Keqian Zhu (2): vfio/iommu_type1: Populate full dirty when detach non-pinned group vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma drivers/vfio/vfio_iommu_type1.c | 42

[PATCH 1/2] dt-bindings: arm-smmu: Add sm8350 compatible string

2021-01-15 Thread Vinod Koul
Add compatible string for sm8350 iommu to documentation. Signed-off-by: Vinod Koul --- Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml

[PATCH 2/2] iommu: arm-smmu-impl: Add SM8350 qcom iommu implementation

2021-01-15 Thread Vinod Koul
Add SM8350 qcom iommu implementation to the table of qcom_smmu_impl_of_match table which brings in iommu support for SM8350 SoC Signed-off-by: Vinod Koul --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Re: [EXTERNAL] Re: amdgpu error whenever IOMMU is enabled

2021-01-15 Thread jroe...@suse.de
Hi Edgar, On Mon, Nov 23, 2020 at 06:41:18AM +, Merger, Edgar [AUTOSOL/MAS/AUGS] wrote: > Just wanted to follow-up on that topic. > Is that quirk already put into upstream kernel? Sorry for the late reply, I had to take an extended sick leave. I will take care of sending this fix upstream