kernel BUG at drivers/iommu/intel-iommu.c:608

2019-04-07 Thread Bart Van Assche
Hi Jiang, If I tell qemu to use PCI pass-through for a PCI adapter and next load the lpfc driver for an lpfc adapter that has not been passed through to any VM a kernel bug is hit. Do you perhaps know whether it should be possible to a load kernel driver in this scenario? If so, do you know what

Re: kernel BUG at drivers/iommu/intel-iommu.c:608

2019-04-07 Thread Alex Williamson
On Sun, 7 Apr 2019 12:10:38 -0700 Bart Van Assche wrote: > Hi Jiang, > > If I tell qemu to use PCI pass-through for a PCI adapter and next load the > lpfc driver for an lpfc adapter that has not been passed through to any VM > a kernel bug is hit. Do you perhaps know whether it should be

Re: kernel BUG at drivers/iommu/intel-iommu.c:608

2019-04-07 Thread Bart Van Assche
On 4/7/19 2:06 PM, Alex Williamson wrote: On Sun, 7 Apr 2019 12:10:38 -0700 Bart Van Assche wrote: If I tell qemu to use PCI pass-through for a PCI adapter and next load the lpfc driver for an lpfc adapter that has not been passed through to any VM a kernel bug is hit. Do you perhaps know

Re: [PATCH v4 0/6] normalize IOMMU dma mode boot options

2019-04-07 Thread Hanjun Guo
Hi Zhen, On 2019/4/7 20:41, Zhen Lei wrote: > As Robin Murphy's suggestion: > "It's also not necessarily obvious to the user how this interacts with > IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it > would be better to refactor the whole lot into a single selection of

Re: [PATCH v2 3/7] iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions

2019-04-07 Thread Lu Baolu
Hi, On 4/6/19 2:02 AM, James Sewart wrote: Hey Lu, My bad, did some debugging on my end. The issue was swapping out find_domain for iommu_get_domain_for_dev. It seems in some situations the domain is not attached to the group but the device is expected to have the domain still stored in its

Re: kernel BUG at drivers/iommu/intel-iommu.c:608

2019-04-07 Thread Alex Williamson
On Sun, 7 Apr 2019 16:02:31 -0700 Bart Van Assche wrote: > On 4/7/19 2:06 PM, Alex Williamson wrote: > > On Sun, 7 Apr 2019 12:10:38 -0700 > > Bart Van Assche wrote: > >> If I tell qemu to use PCI pass-through for a PCI adapter and next load the > >> lpfc driver for an lpfc adapter that has

Re: [PATCH v2 0/2] iommu/arm-smmu-v3: make sure the kdump kernel can work well when smmu is enabled

2019-04-07 Thread Leizhen (ThunderTown)
Hi Will, On 2019/4/4 23:30, Will Deacon wrote: > Hi Zhen Lei, > > On Mon, Mar 18, 2019 at 09:12:41PM +0800, Zhen Lei wrote: >> v1 --> v2: >> 1. Drop part2. Now, we only use the SMMUv3 hardware feature STE.config=0b000 >> (Report abort to device, no event recorded) to suppress the event messages

Re: [PATCH v4 0/6] normalize IOMMU dma mode boot options

2019-04-07 Thread Leizhen (ThunderTown)
On 2019/4/8 9:14, Hanjun Guo wrote: > Hi Zhen, > > On 2019/4/7 20:41, Zhen Lei wrote: >> As Robin Murphy's suggestion: >> "It's also not necessarily obvious to the user how this interacts with >> IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it >> would be better to

[PATCH v4 1/6] iommu: use iommu.dma_mode to replace iommu.passthrough and iommu.strict

2019-04-07 Thread Zhen Lei
Currently the IOMMU dma contains 3 modes: passthrough, lazy, strict. The passthrough mode bypass the IOMMU, the lazy mode defer the invalidation of hardware TLBs, and the strict mode invalidate IOMMU hardware TLBs synchronously. The three modes are mutually exclusive. So people maybe confused

[PATCH v4 4/6] s390/pci: use common boot option iommu.dma_mode

2019-04-07 Thread Zhen Lei
s390_iommu=strict can be replaced with iommu.dma_mode=strict. Signed-off-by: Zhen Lei --- Documentation/admin-guide/kernel-parameters.txt | 7 --- arch/s390/pci/pci_dma.c | 20 +--- drivers/iommu/Kconfig | 1 + 3 files

Re: [PATCH 02/21] arm64/iommu: improve mmap bounds checking

2019-04-07 Thread Christoph Hellwig
On Fri, Apr 05, 2019 at 06:30:52PM +0100, Robin Murphy wrote: > On 27/03/2019 08:04, Christoph Hellwig wrote: >> The nr_pages checks should be done for all mmap requests, not just those >> using remap_pfn_range. > > Hmm, the logic in iommu_dma_mmap() inherently returns an error for the "off > >=

[PATCH v4 3/6] iommu: add iommu_default_dma_mode_get() helper

2019-04-07 Thread Zhen Lei
Add IOMMU_DMA_MODE_IS_LAZY() and IOMMU_DMA_MODE_IS_PASSTHROUGH() to make the code looks cleaner. There is no functional change, just prepare for the following patches. Signed-off-by: Zhen Lei --- drivers/iommu/iommu.c | 12 include/linux/iommu.h | 11 +++ 2 files changed,

[PATCH v4 0/6] normalize IOMMU dma mode boot options

2019-04-07 Thread Zhen Lei
As Robin Murphy's suggestion: "It's also not necessarily obvious to the user how this interacts with IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it would be better to refactor the whole lot into a single selection of something like IOMMU_DEFAULT_MODE anyway." In this

[PATCH v4 2/6] iommu: keep dma mode build options consistent with cmdline options

2019-04-07 Thread Zhen Lei
First, add build option IOMMU_DMA_MODE_LAZY, so that we have the opportunity to set lazy mode as default at build time. Then put the three config options in an choice, make people can only choose one of the three at a time, the same to the boot options iommu.dma_mode. Signed-off-by: Zhen Lei ---

[PATCH v4 5/6] powernv/iommu: use common boot option iommu.dma_mode

2019-04-07 Thread Zhen Lei
iommu=nobypass can be replaced with iommu.dma_mode=strict. Signed-off-by: Zhen Lei --- Documentation/admin-guide/kernel-parameters.txt | 2 -- arch/powerpc/platforms/powernv/pci-ioda.c | 23 +-- drivers/iommu/Kconfig | 1 + 3 files changed,

[PATCH v4 6/6] x86/iommu: use common boot option iommu.dma_mode

2019-04-07 Thread Zhen Lei
iommu=pt can be replaced with iommu.dma_mode=passthrough. iommu=nopt can be replaced with iommu.dma_mode=lazy. intel_iommu=strict can be replaced with iommu.dma_mode=strict. amd_iommu=fullflush can be replaced with iommu.dma_mode=strict. Note: intel_iommu_strict is not deleted because it can also