RE: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
Hi guys, I provide more information, please see below > -Original Message- > From: Lu Baolu [mailto:baolu...@linux.intel.com] > Sent: Thursday, March 18, 2021 10:59 AM > To: Alex Williamson > Cc: baolu...@linux.intel.com; Longpeng (Mike, Cloud Infrastructure Service > Product > Dept.)

[PATCH] iommu/dma: Fix a typo in a comment

2021-03-17 Thread chenxiang
From: Xiang Chen Fix a type "SAC" to "DAC" in the comment of function iommu_dma_alloc_iova(). Signed-off-by: Xiang Chen --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index

Re: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Lu Baolu
Hi Nadav, On 3/18/21 2:12 AM, Nadav Amit wrote: On Mar 17, 2021, at 2:35 AM, Longpeng (Mike, Cloud Infrastructure Service Product Dept.) wrote: Hi Nadav, -Original Message- From: Nadav Amit [mailto:nadav.a...@gmail.com] reproduce the problem with high probability (~50%). I

Re: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Lu Baolu
Hi Alex, On 3/17/21 11:18 PM, Alex Williamson wrote: {MAP, 0x0, 0xc000}, - (b) use GDB to pause at here, and then DMA read IOVA=0, IOVA 0 seems to be a special one. Have you verified with other addresses than IOVA 0? It is???

[PATCH 1/1] iommu/vt-d: Report more information about invalidation errors

2021-03-17 Thread Lu Baolu
When the invalidation queue errors are encountered, dump the information logged by the VT-d hardware together with the pending queue invalidation descriptors. Signed-off-by: Ashok Raj Tested-by: Guo Kaijie Signed-off-by: Lu Baolu --- drivers/iommu/intel/dmar.c | 68

RE: [PATCH v13 00/10] iommu: I/O page faults for SMMUv3

2021-03-17 Thread Krishna Reddy
Tested-by: Krishna Reddy Validated v13 patches in context of nested translations validation for NVMe PCIe device assigned to Guest VM. V12 patches(v13 is yet to be tested) has been tested for SVA functionality on Native OS and is functional. -KR

RE: [PATCH v14 00/13] SMMUv3 Nested Stage Setup (IOMMU part)

2021-03-17 Thread Krishna Reddy
Tested-by: Krishna Reddy Validated nested translations with NVMe PCI device assigned to Guest VM. Tested with both v12 and v13 of Jean-Philippe's patches as base. > This is based on Jean-Philippe's > [PATCH v12 00/10] iommu: I/O page faults for SMMUv3 >

RE: [PATCH v12 00/13] SMMUv3 Nested Stage Setup (VFIO part)

2021-03-17 Thread Krishna Reddy
Tested-by: Krishna Reddy Validated Nested SMMUv3 translations for NVMe PCIe device from Guest VM and is functional. This patch series resolved the mismatch(seen with v11 patches) for VFIO_IOMMU_SET_PASID_TABLE and VFIO_IOMMU_CACHE_INVALIDATE Ioctls between linux and QEMU patch series

Re: [PATCH v4 0/2] VMD MSI Remapping Bypass

2021-03-17 Thread Derrick, Jonathan
Gentle reminder, for v5.13 ? On Wed, 2021-02-10 at 09:13 -0700, Jon Derrick wrote: > The Intel Volume Management Device acts similar to a PCI-to-PCI bridge in that > it changes downstream devices' requester-ids to its own. As VMD supports PCIe > devices, it has its own MSI-X table and transmits

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-03-17 Thread Konrad Rzeszutek Wilk
On Wed, Mar 17, 2021 at 06:57:42PM +0100, Christoph Hellwig wrote: > On Wed, Mar 17, 2021 at 01:51:56PM -0400, Konrad Rzeszutek Wilk wrote: > > On Wed, Mar 17, 2021 at 02:53:27PM +0100, Christoph Hellwig wrote: > > > On Wed, Mar 17, 2021 at 01:42:07PM +, Konrad Rzeszutek Wilk wrote: > > > > >

Re: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Nadav Amit
> On Mar 17, 2021, at 2:35 AM, Longpeng (Mike, Cloud Infrastructure Service > Product Dept.) wrote: > > Hi Nadav, > >> -Original Message- >> From: Nadav Amit [mailto:nadav.a...@gmail.com] >>> reproduce the problem with high probability (~50%). >> >> I saw Lu replied, and he is much

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-03-17 Thread Christoph Hellwig
On Wed, Mar 17, 2021 at 01:51:56PM -0400, Konrad Rzeszutek Wilk wrote: > On Wed, Mar 17, 2021 at 02:53:27PM +0100, Christoph Hellwig wrote: > > On Wed, Mar 17, 2021 at 01:42:07PM +, Konrad Rzeszutek Wilk wrote: > > > > - alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(size_t)); > > > > -

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-03-17 Thread Konrad Rzeszutek Wilk
On Wed, Mar 17, 2021 at 02:53:27PM +0100, Christoph Hellwig wrote: > On Wed, Mar 17, 2021 at 01:42:07PM +, Konrad Rzeszutek Wilk wrote: > > > - alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(size_t)); > > > - io_tlb_alloc_size = memblock_alloc(alloc_size, PAGE_SIZE); > > > - if

Re: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Alex Williamson
On Wed, 17 Mar 2021 13:16:58 +0800 Lu Baolu wrote: > Hi Longpeng, > > On 3/17/21 11:16 AM, Longpeng (Mike, Cloud Infrastructure Service > Product Dept.) wrote: > > Hi guys, > > > > We find the Intel iommu cache (i.e. iotlb) maybe works wrong in a special > > situation, it would cause DMA

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread Joerg Roedel
On Wed, Mar 17, 2021 at 01:37:16PM +, David Woodhouse wrote: > If we can get to the point where we don't even need to check > amd_iommu_irq_remap in the ...select() function because the IRQ domain > is never even registered in the case where the flag ends up false, all > the better :) This

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread David Woodhouse
On 17 March 2021 13:32:35 GMT, Joerg Roedel wrote: >On Wed, Mar 17, 2021 at 11:47:11AM +, David Woodhouse wrote: >> If you've already moved the Stoney Ridge check out of the way, >there's >> no real reason why you can't just set >init_state=IOMMU_CMDLINE_DISABLED >> directly from

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-03-17 Thread Christoph Hellwig
On Wed, Mar 17, 2021 at 01:42:07PM +, Konrad Rzeszutek Wilk wrote: > > - alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(size_t)); > > - io_tlb_alloc_size = memblock_alloc(alloc_size, PAGE_SIZE); > > - if (!io_tlb_alloc_size) > > - panic("%s: Failed to allocate %zu bytes

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-03-17 Thread Konrad Rzeszutek Wilk
..snip.. > int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int > verbose) > { ..snip.. > /* >* Allocate and initialize the free list array. This array is used >* to find contiguous free memory regions of size up to IO_TLB_SEGSIZE > - * between

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread Joerg Roedel
On Wed, Mar 17, 2021 at 11:47:11AM +, David Woodhouse wrote: > If you've already moved the Stoney Ridge check out of the way, there's > no real reason why you can't just set init_state=IOMMU_CMDLINE_DISABLED > directly from parse_amd_iommu_options(), is there? Then you don't need > the

Re: [PATCH v2 06/11] iommu/arm-smmu-v3: Scan leaf TTD to sync hardware dirty log

2021-03-17 Thread Keqian Zhu
On 2021/3/17 18:44, Yi Sun wrote: > On 21-03-10 17:06:09, Keqian Zhu wrote: >> From: jiangkunkun >> >> During dirty log tracking, user will try to retrieve dirty log from >> iommu if it supports hardware dirty log. >> >> This adds a new interface named sync_dirty_log in iommu layer and >> arm

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread David Woodhouse
On Wed, 2021-03-17 at 10:10 +0100, Joerg Roedel wrote: > diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c > index 3280e6f5b720..61dae1800b7f 100644 > --- a/drivers/iommu/amd/init.c > +++ b/drivers/iommu/amd/init.c > @@ -2919,12 +2919,12 @@ static int __init state_next(void) >

Re: [PATCH v2 06/11] iommu/arm-smmu-v3: Scan leaf TTD to sync hardware dirty log

2021-03-17 Thread Yi Sun
On 21-03-10 17:06:09, Keqian Zhu wrote: > From: jiangkunkun > > During dirty log tracking, user will try to retrieve dirty log from > iommu if it supports hardware dirty log. > > This adds a new interface named sync_dirty_log in iommu layer and > arm smmuv3 implements it, which scans leaf TTD

Re: [PATCH 0/3] iommu/amd: Fix booting with amd_iommu=off

2021-03-17 Thread Huang Rui
On Wed, Mar 17, 2021 at 05:10:34PM +0800, Joerg Roedel wrote: > From: Joerg Roedel > > Hi, > > it turned out that booting a kernel with amd_iommu=off on a machine > that has an AMD IOMMU causes an early kernel crash. There are two > reasons for this, and fixing one of them is already

Re: [PATCH] iommu/amd: Fix iommu remap panic while amd_iommu is set to disable

2021-03-17 Thread Huang Rui
On Tue, Mar 16, 2021 at 11:00:26PM +0800, Joerg Roedel wrote: > On Tue, Mar 16, 2021 at 09:36:02PM +0800, Huang Rui wrote: > > Thanks for the comments. Could you please elaborate this? > > > > Do you mean while amd_iommu=off, we won't prepare the IVRS, and even > > needn't get all ACPI talbes.

RE: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
Hi Baolu, > -Original Message- > From: Lu Baolu [mailto:baolu...@linux.intel.com] > Sent: Wednesday, March 17, 2021 1:17 PM > To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.) > ; dw...@infradead.org; j...@8bytes.org; > w...@kernel.org; alex.william...@redhat.com > Cc:

RE: A problem of Intel IOMMU hardware ?

2021-03-17 Thread Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
Hi Nadav, > -Original Message- > From: Nadav Amit [mailto:nadav.a...@gmail.com] > Sent: Wednesday, March 17, 2021 1:46 PM > To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.) > > Cc: David Woodhouse ; Lu Baolu > ; Joerg Roedel ; w...@kernel.org; > alex.william...@redhat.com;

[PATCH 3/3] iommu/amd: Keep track of amd_iommu_irq_remap state

2021-03-17 Thread Joerg Roedel
From: Joerg Roedel The amd_iommu_irq_remap variable is set to true in amd_iommu_prepare(). But if initialization fails it is not set to false. Fix that and correctly keep track of whether irq remapping is enabled or not. References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 References:

[PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread Joerg Roedel
From: Joerg Roedel Don't even try to initialize the AMD IOMMU hardware when amd_iommu=off has been passed on the kernel command line. References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 Cc: sta...@vger.kernel.org # v5.11

[PATCH 1/3] iommu/amd: Move Stoney Ridge check to detect_ivrs()

2021-03-17 Thread Joerg Roedel
From: Joerg Roedel The AMD IOMMU will not be enabled on AMD Stoney Ridge systems. Bail out even earlier and refuse to even detect the IOMMU there. References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 Cc:

[PATCH 0/3] iommu/amd: Fix booting with amd_iommu=off

2021-03-17 Thread Joerg Roedel
From: Joerg Roedel Hi, it turned out that booting a kernel with amd_iommu=off on a machine that has an AMD IOMMU causes an early kernel crash. There are two reasons for this, and fixing one of them is already sufficient, but both reasons deserve fixing, which is done in this patch-set.