Re: [PATCH] swiotlb: Return error from swiotlb_init_with_tbl()

2019-02-01 Thread Joerg Roedel
On Fri, Feb 01, 2019 at 09:12:08AM +0100, Christoph Hellwig wrote: > On Thu, Jan 31, 2019 at 05:24:24PM +0100, Joerg Roedel wrote: > > - io_tlb_list = memblock_alloc( > > + io_tlb_list = memblock_alloc_nopanic( > > PAGE_ALIGN(io_tl

Re: [PATCH] swiotlb: Return error from swiotlb_init_with_tbl()

2019-02-01 Thread Joerg Roedel
On Fri, Feb 01, 2019 at 05:56:10PM +0100, Christoph Hellwig wrote: > On Fri, Feb 01, 2019 at 05:50:29PM +0100, Joerg Roedel wrote: > > > Mike just killed the _nopanic versions and made the normal ones not > > > panic. > > > > This sounds like a change to brea

Re: [PATCH 0/5 v6] Fix virtio-blk issue with SWIOTLB

2019-02-07 Thread Joerg Roedel
Hi Michael, On Tue, Feb 05, 2019 at 03:52:38PM -0500, Michael S. Tsirkin wrote: > On Thu, Jan 31, 2019 at 05:33:58PM +0100, Joerg Roedel wrote: > > Changes to v5 are: > > > > - Changed patch 3 to uninline dma_max_mapping_size() > > And this lead to problems re

Re: [PATCH 0/5 v6] Fix virtio-blk issue with SWIOTLB

2019-02-07 Thread Joerg Roedel
On Thu, Feb 07, 2019 at 09:46:13AM +0100, Joerg Roedel wrote: > Hmm, I didn't get any kbuild emails for this series. Can you please > forward it me so that I can look into it? Nevermind, just found them in another inbox. Joerg __

[PATCH v7 0/5] Fix virtio-blk issue with SWIOTLB

2019-02-07 Thread Joerg Roedel
CONFIG_SWIOTLB=n Please review. Thanks, Joerg Joerg Roedel (5): swiotlb: Introduce swiotlb_max_mapping_size() swiotlb: Add is_swiotlb_active() function dma: Introduce dma_max_mapping_size() virtio: Introduce virtio_max_dma_size() virtio-blk: Consider virtio_max_dma_size() for

[PATCH v7 1/5] swiotlb: Introduce swiotlb_max_mapping_size()

2019-02-07 Thread Joerg Roedel
From: Joerg Roedel The function returns the maximum size that can be remapped by the SWIOTLB implementation. This function will be later exposed to users through the DMA-API. Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Christoph Hellwig Signed-off-by: Joerg Roedel --- include/linux

[PATCH v7 4/5] virtio: Introduce virtio_max_dma_size()

2019-02-07 Thread Joerg Roedel
From: Joerg Roedel This function returns the maximum segment size for a single dma transaction of a virtio device. The possible limit comes from the SWIOTLB implementation in the Linux kernel, that has an upper limit of (currently) 256kb of contiguous memory it can map. Other DMA-API

[PATCH v7 3/5] dma: Introduce dma_max_mapping_size()

2019-02-07 Thread Joerg Roedel
From: Joerg Roedel The function returns the maximum size that can be mapped using DMA-API functions. The patch also adds the implementation for direct DMA and a new dma_map_ops pointer so that other implementations can expose their limit. Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by

[PATCH v7 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size

2019-02-07 Thread Joerg Roedel
From: Joerg Roedel Segments can't be larger than the maximum DMA mapping size supported on the platform. Take that into account when setting the maximum segment size for a block device. Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Christoph Hellwig Signed-off-by: Joerg Roedel --- dr

[PATCH v7 2/5] swiotlb: Add is_swiotlb_active() function

2019-02-07 Thread Joerg Roedel
From: Joerg Roedel This function will be used from dma_direct code to determine the maximum segment size of a dma mapping. Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Christoph Hellwig Signed-off-by: Joerg Roedel --- include/linux/swiotlb.h | 6 ++ kernel/dma/swiotlb.c| 9

Re: [PATCH] remove unused end_pfn

2019-02-08 Thread Joerg Roedel
On Fri, Feb 08, 2019 at 02:04:38PM +, Tom Murphy wrote: > This variable is useless. > > --- > drivers/iommu/dma-iommu.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) A similar change is already in the iommu tree[1]. Joerg [1] https://git.kernel.org/pub/scm/linux/kernel

Re: [PATCH/RFC] driver core: Postpone DMA tear-down until after devres release

2019-02-08 Thread Joerg Roedel
Hi Geert, On Thu, Feb 07, 2019 at 08:36:53PM +0100, Geert Uytterhoeven wrote: > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index 8ac10af17c0043a3..d62487d024559620 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -968,9 +968,9 @@ static void __device_release_driver(struct

[git pull] IOMMU Fixes for Linux v5.0-rc5

2019-02-08 Thread Joerg Roedel
Hi Linus, The following changes since commit 9825bd94e3a2baae1f4874767ae3a7d4c049720e: iommu/amd: Fix IOMMU page flush when detach device from a domain (2019-01-24 15:24:49 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git tags/iom

Re: [PATCH] iommu: Allow io-pgtable to be used outside of drivers/iommu/

2019-02-11 Thread Joerg Roedel
On Tue, Feb 05, 2019 at 11:20:30AM -0600, Rob Herring wrote: > On Tue, Feb 5, 2019 at 10:55 AM Christoph Hellwig wrote: > > > > On Tue, Feb 05, 2019 at 10:37:31AM -0600, Rob Herring wrote: > > > Move io-pgtable.h to include/linux/ and export alloc_io_pgtable_ops > > > and free_io_pgtable_ops. This

Re: [PATCH] fix flush_tlb_all typo

2019-02-11 Thread Joerg Roedel
On Fri, Feb 08, 2019 at 02:20:44PM +, Tom Murphy wrote: > --- > include/linux/iommu.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) The patch has no Signed-off-by, please add it and a proper commit-message and re-send. ___ iommu mailing l

Re: [PATCH v1 0/7] iommu: Minor cleanups and dev_printk() usage

2019-02-11 Thread Joerg Roedel
On Fri, Feb 08, 2019 at 04:05:33PM -0600, Bjorn Helgaas wrote: > I've had these minor iommu cleanups lying around for a while, but the ugly > dmesg logs from [1] prompted me to finally post them. Take what you like, > ignore the rest, and tell me so I can clear out my queue of old stuff. > > Thes

Re: [PATCHv7] x86/kdump: bugfix, make the behavior of crashkernel=X consistent with kaslr

2019-02-22 Thread Joerg Roedel
On Fri, Feb 22, 2019 at 10:11:01AM +0800, Dave Young wrote: > In case people have a lot of devices need more swiotlb, then he manually > set the ,high with ,low together. The option to specify the high and low values for the crashkernel are important for certain machines. The point is that swiotlb

Re: [PATCHv7] x86/kdump: bugfix, make the behavior of crashkernel=X consistent with kaslr

2019-02-25 Thread Joerg Roedel
On Fri, Feb 22, 2019 at 02:00:26PM +0100, Borislav Petkov wrote: > On Fri, Feb 22, 2019 at 09:42:41AM +0100, Joerg Roedel wrote: > > The current default of 256MB was found by experiments on a bigger > > number of machines, to create a reasonable default that is at least > > li

Re: [PATCH] iommu/io-pgtable-arm-v7s: only kmemleak_ignore L2 tables

2019-02-26 Thread Joerg Roedel
On Mon, Feb 25, 2019 at 08:21:46AM +0800, Nicolas Boichat wrote: > Joerg: Just to make sure, is this patch in your queue? Thanks. It is now, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listin

Re: [PATCH] fix flush_tlb_all typo

2019-02-26 Thread Joerg Roedel
On Mon, Feb 11, 2019 at 03:50:33PM +, Tom Murphy wrote: > Fix typo, flush_tlb_all should be flush_iotlb_all > > Signed-off-by: Tom Murphy Applied, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mai

Re: [PATCH v2 00/12] Support using MSI interrupts in ntb_transport

2019-02-26 Thread Joerg Roedel
On Wed, Feb 13, 2019 at 10:54:42AM -0700, Logan Gunthorpe wrote: > iommu/vt-d: Add helper to set an IRTE to verify only the bus number > iommu/vt-d: Allow interrupts from the entire bus for aliased devices Applied these two to the iommu tree, thanks. ___

Re: MT76x2U crashes XHCI driver on AMD Ryzen system

2019-02-26 Thread Joerg Roedel
On Mon, Feb 18, 2019 at 03:37:48PM +0100, Stanislaw Gruszka wrote: > 0001-mt76x02u-use-usb_bulk_msg-to-upload-firmware.patch > 0002-mt76usb-do-not-use-compound-head-page-for-SG-I-O.patch > > Or problem can be solved by just one of it (either first or second). > > Additionally I'm not 100% sure if

Re: [PATCH v3 0/2] Add PGR response PASID requirement check in Intel IOMMU.

2019-02-26 Thread Joerg Roedel
On Tue, Feb 19, 2019 at 11:04:50AM -0800, sathyanarayanan.kuppusw...@linux.intel.com wrote: > Kuppuswamy Sathyanarayanan (2): > PCI/ATS: Add pci_prg_resp_pasid_required() interface. > iommu/vt-d: Fix PRI/PASID dependency issue. > > drivers/iommu/intel-iommu.c | 4 +++- > drivers/pci/ats.c

Re: [PATCH 0/3] iommu: Kerneldoc improvements

2019-02-26 Thread Joerg Roedel
Hi Geert, On Wed, Feb 20, 2019 at 02:00:50PM +0100, Geert Uytterhoeven wrote: > This series contains a fix for an incorrect kerneldoc parameter, and > adds the missing kerneldoc for two recently added IOMMU methods. > > Thanks! > > Geert Uytterhoeven (3): > iommu: Fix kerneldoc for iommu_ops.f

Re: [PATCH v3 0/2] Add page alignment check in Intel IOMMU.

2019-02-26 Thread Joerg Roedel
On Tue, Feb 19, 2019 at 11:06:08AM -0800, sathyanarayanan.kuppusw...@linux.intel.com wrote: > Kuppuswamy Sathyanarayanan (2): > PCI/ATS: Add pci_ats_page_aligned() interface > iommu/vt-d: Enable ATS only if the device uses page aligned address. > > drivers/iommu/intel-iommu.c | 1 + > dri

Re: [PATCH] iommu: Fix IOMMU debugfs fallout

2019-02-26 Thread Joerg Roedel
On Wed, Feb 20, 2019 at 02:05:05PM +0100, Geert Uytterhoeven wrote: > A change made in the final version of IOMMU debugfs support replaced the > public function iommu_debugfs_new_driver_dir() by the public dentry > iommu_debugfs_dir in , but forgot to update both the > implementation in iommu-debug

Re: [PATCH] iommu/dmar: fix buffer overflow during PCI bus notification

2019-02-26 Thread Joerg Roedel
On Wed, Feb 20, 2019 at 07:17:45PM +, Julia Cartwright wrote: > On Wed, Feb 20, 2019 at 10:46:31AM -0600, Julia Cartwright wrote: > > - size = sizeof(*info) + level * sizeof(struct acpi_dmar_pci_path); > > + size = sizeof(*info) + level * sizeof(info->path[0]); > > This is probably a candi

Re: [PATCH v7 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-26 Thread Joerg Roedel
On Fri, Feb 22, 2019 at 10:19:18AM +0800, Lu Baolu wrote: > Lu Baolu (9): > iommu: Add APIs for multiple domains per device > iommu/vt-d: Move enable pasid out of CONFIG_INTEL_IOMMU_SVM > iommu/vt-d: Add per-device IOMMU feature ops entries > iommu/vt-d: Move common code out of iommu_att

Re: MT76x2U crashes XHCI driver on AMD Ryzen system

2019-02-26 Thread Joerg Roedel
On Tue, Feb 26, 2019 at 11:34:51AM +0100, Stanislaw Gruszka wrote: > On Tue, Feb 26, 2019 at 11:05:36AM +0100, Joerg Roedel wrote: > If sg->offset > PAGE_SIZE is fine then most likely we have problem with > alignment. The map_sg implementation in the AMD IOMMU driver uses sg_phys(

Re: [PATCH 1/1] iommu/vt-d: Check identity map for hot-added devices

2019-02-26 Thread Joerg Roedel
On Mon, Feb 25, 2019 at 10:46:36AM +0800, Lu Baolu wrote: > drivers/iommu/intel-iommu.c | 21 - > 1 file changed, 12 insertions(+), 9 deletions(-) Added a Fixes: tag and applied the patch, thanks. ___ iommu mailing list iommu@lists.

Re: [PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-26 Thread Joerg Roedel
Hi Jean-Philippe, Thanks for the patch! I think this is getting close to be applied after the next merge window. On Wed, Feb 20, 2019 at 02:27:59PM +, Jean-Philippe Brucker wrote: > +int iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, int > *pasid, > + i

Re: [PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-26 Thread Joerg Roedel
On Tue, Feb 26, 2019 at 12:49:15PM +, Jean-Philippe Brucker wrote: > On 26/02/2019 11:17, Joerg Roedel wrote: > > int iommu_sva_get_pasid(struct iommu_sva *handle); > > void iommu_sva_set_exit_handler(struct io

Re: [Resend PATCH V5 0/3] x86/Hyper-V/IOMMU: Add Hyper-V IOMMU driver to support x2apic mode

2019-02-26 Thread Joerg Roedel
On Tue, Feb 26, 2019 at 08:07:17PM +0800, lantianyu1...@gmail.com wrote: > Lan Tianyu (3): > x86/Hyper-V: Set x2apic destination mode to physical when x2apic is > available > HYPERV/IOMMU: Add Hyper-V stub IOMMU driver > MAINTAINERS: Add Hyper-V IOMMU driver into Hyper-V CORE AND DRIV

Re: [PATCH V6 0/3] x86/Hyper-V/IOMMU: Add Hyper-V IOMMU driver to support x2apic mode

2019-02-28 Thread Joerg Roedel
On Wed, Feb 27, 2019 at 10:54:02PM +0800, lantianyu1...@gmail.com wrote: > Lan Tianyu (3): > x86/Hyper-V: Set x2apic destination mode to physical when x2apic is > available > HYPERV/IOMMU: Add Hyper-V stub IOMMU driver > MAINTAINERS: Add Hyper-V IOMMU driver into Hyper-V CORE AND DRIV

Re: MT76x2U crashes XHCI driver on AMD Ryzen system

2019-02-28 Thread Joerg Roedel
On Thu, Feb 28, 2019 at 01:19:48PM +0100, Stanislaw Gruszka wrote: > Nevermind, the patch is wrong, s->dma_address is initalized in sg_num_pages(). Yes, it is. In sg_num_pages() the offset into the IOMMU mapping is stored in s->dma_address, taking also the segment boundary mask into account. map_s

Re: [PATCH 1/1] iommu: Bind process address spaces to devices

2019-02-28 Thread Joerg Roedel
Hi Jacob, On Wed, Feb 27, 2019 at 01:41:29PM -0800, Jacob Pan wrote: > On Tue, 26 Feb 2019 12:17:43 +0100 > Joerg Roedel wrote: > Just trying to understand how to use this API. > So if we bind the same mm to two different devices, we should get two > different iommu_sva handle, r

Re: [PATCH] iommu/mediatek: fix semicolon code style issue

2019-03-01 Thread Joerg Roedel
On Thu, Feb 28, 2019 at 10:45:01PM +0800, Yang Wei wrote: > From: Yang Wei > > Delete a superfluous semicolon in mtk_iommu_add_device(). > > Signed-off-by: Yang Wei > --- > drivers/iommu/mtk_iommu_v1.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks. _

Re: [PATCH 0/4] iommu/vt-d: Several fixes for 5.1

2019-03-01 Thread Joerg Roedel
On Fri, Mar 01, 2019 at 11:23:09AM +0800, Lu Baolu wrote: > Hi Joerg, > > This includes several small fixes. All are stable kernel irrelated. > Please consider it for 5.1-rc1. > > Best regards, > Lu Baolu > > Lu Baolu (4): > iommu/vt-d: Disable ATS support on untrusted devices > iommu/vt-d:

[git pull] IOMMU Fixes for Linux v5.0-rc8

2019-03-01 Thread Joerg Roedel
Hi Linus, The following changes since commit 8950dcd83ae7d62bdc2a60507949acebd85399f2: iommu/vt-d: Leave scalable mode default off (2019-01-30 17:23:58 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git tags/iommu-fix-v5.0-rc8 for y

[git pull] IOMMU Updates for Linux v5.1

2019-03-08 Thread Joerg Roedel
): iommu/vt-d: Support page request in scalable mode Jerry Snitselaar (1): iommu/amd: Print reason for iommu_map_page failure in map_sg Joerg Roedel (1): Merge branches 'iommu/fixes', 'arm/msm', 'arm/tegra', 'arm/mediatek', 'x86/vt-d',

Re: [RESEND][PATCH] iommu/amd: Fix NULL dereference bug in match_hid_uid

2019-03-15 Thread Joerg Roedel
On Wed, Mar 13, 2019 at 09:53:24PM +0800, Aaron Ma wrote: > Add a non-NULL check to fix potential NULL pointer dereference > Cleanup code to call function once. > > Signed-off-by: Aaron Ma > --- > drivers/iommu/amd_iommu.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Applied

Re: [PATCH] iommu/amd: Fix a null pointer dereference for ACPI devices

2019-03-15 Thread Joerg Roedel
Hi Chris, On Fri, Mar 08, 2019 at 12:12:10PM +0800, Chris Chiu wrote: > On ASUS laptop X512DK with the realtek USB card reader, the NULL > pointer dereference happens while bringing up the rtsx_usb driver. Thanks for your patch, but I applied https://lore.kernel.org/lkml/1552485204-1138

[git pull] IOMMU Fix for Linux v5.1-rc1

2019-03-15 Thread Joerg Roedel
Hi Linus, The following changes since commit d05e4c8600c36084ce9de6249bb972c9bdd75b7e: Merge branches 'iommu/fixes', 'arm/msm', 'arm/tegra', 'arm/mediatek', 'x86/vt-d', 'x86/amd', 'hyper-v' and 'core' into next (2019-03-01 11:24:51 +0100) are available in the Git repository at: git://git.

Re: [RFC PATCH v1 04/15] iommu: Add DOMAIN_ATTR_PTBASE

2019-03-18 Thread Joerg Roedel
On Fri, Mar 01, 2019 at 12:38:26PM -0700, Jordan Crouse wrote: > Add an attribute to return the base address of the pagetable. This is used > by auxiliary domains from arm-smmu to return the address of the pagetable > to the leaf driver so that it can set the appropriate pagetable through > it's ow

Re: [PATCH v2] iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE

2019-03-18 Thread Joerg Roedel
Hi Stanislaw, thanks a lot for looking into this and tracking it down! On Wed, Mar 13, 2019 at 10:03:17AM +0100, Stanislaw Gruszka wrote: > - s->dma_address += address + s->offset; > + /* Add in the remaining piece of the scatter-gather offset that > + * was m

Re: [PATCH v1] iommu/vt-d: Switch to bitmap_zalloc()

2019-03-18 Thread Joerg Roedel
On Mon, Mar 04, 2019 at 11:07:37AM +0200, Andy Shevchenko wrote: > Switch to bitmap_zalloc() to show clearly what we are allocating. > Besides that it returns pointer of bitmap type instead of opaque void *. > > Signed-off-by: Andy Shevchenko > --- > drivers/iommu/intel_irq_remapping.c | 7 +++--

Re: [PATCH v2] iommu/iova: Fix tracking of recently failed iova address

2019-03-22 Thread Joerg Roedel
On Wed, Mar 20, 2019 at 06:57:23PM +, Robert Richter wrote: > From: Robert Richter > Subject: [PATCH v2] iommu/iova: Fix tracking of recently failed iova address > size > > If a 32 bit allocation request is too big to possibly succeed, it > early exits with a failure and then should never up

Re: [PATCH 1/2] iommu/vt-d: Check capability before disabling protected memory

2019-03-22 Thread Joerg Roedel
On Wed, Mar 20, 2019 at 09:58:33AM +0800, Lu Baolu wrote: > The spec states in 10.4.16 that the Protected Memory Enable > Register should be treated as read-only for implementations > not supporting protected memory regions (PLMR and PHMR fields > reported as Clear in the Capability register). > >

[git pull] IOMMU Fixes for Linux v5.1-rc1

2019-03-22 Thread Joerg Roedel
Hi Linus, The following changes since commit 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b: Linux 5.1-rc1 (2019-03-17 14:22:26 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git tags/iommu-fixes-v5.1-rc2 for you to fetch changes up to 84

[PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains

2019-03-22 Thread Joerg Roedel
From: Joerg Roedel Print the warning about the fall-back to IOMMU_DOMAIN_DMA in iommu_group_get_for_dev() only when such a domain was actually allocated. Otherwise the user will get misleading warnings in the kernel log when the iommu driver used doesn't support IOMMU_DOMAIN_DM

Re: [PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains

2019-03-25 Thread Joerg Roedel
On Fri, Mar 22, 2019 at 05:04:26PM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Print the warning about the fall-back to IOMMU_DOMAIN_DMA in > iommu_group_get_for_dev() only when such a domain was > actually allocated. > > Otherwise the user will get misleading war

Re: [PATCH 1/1] iommu: Remove iommu_callback_data

2019-03-25 Thread Joerg Roedel
On Wed, Mar 20, 2019 at 09:40:24AM +0800, Lu Baolu wrote: > The iommu_callback_data is not used anywhere, remove it to make > the code more concise. > > Signed-off-by: Lu Baolu > --- > drivers/iommu/iommu.c | 11 ++- > 1 file changed, 2 insertions(+), 9 deletions(-) Applied, thanks. ___

Re: [PATCH v2 1/1] iommu: Bind process address spaces to devices

2019-03-25 Thread Joerg Roedel
Hey Jean-Philippe, thanks for the patch, I think we are on the finish line with this interface. Just one small question below. On Wed, Mar 20, 2019 at 03:02:58PM +, Jean-Philippe Brucker wrote: > +int iommu_sva_set_ops(struct iommu_sva *handle, > + const struct iommu_sva_ops

[PATCH] iommu/amd: Reserve exclusion range in iova-domain

2019-03-28 Thread Joerg Roedel
From: Joerg Roedel If a device has an exclusion range specified in the IVRS table, this region needs to be reserved in the iova-domain of that device. This hasn't happened until now and can cause data corruption on data transfered with these devices. Treat exclusion ranges as reserved re

Re: [PATCH] iommu/amd: Reserve exclusion range in iova-domain

2019-03-29 Thread Joerg Roedel
Hi Gary, On Thu, Mar 28, 2019 at 02:52:19PM +, Gary R Hook wrote: > On 3/28/19 5:44 AM, Joerg Roedel wrote: > > + if (entry->prot & (1 << 2)) > > Could we add #define IOMMU_WRITE_EXCL (1 << 2) to amd_iommu_types.h? Yes, I replace that magic numb

[PATCH v2] iommu/amd: Reserve exclusion range in iova-domain

2019-03-29 Thread Joerg Roedel
From: Joerg Roedel If a device has an exclusion range specified in the IVRS table, this region needs to be reserved in the iova-domain of that device. This hasn't happened until now and can cause data corruption on data transfered with these devices. Treat exclusion ranges as reserved re

[PATCH 5/5] iommu/vt-d: Simplify check in identity_mapping()

2020-02-17 Thread Joerg Roedel
From: Joerg Roedel The function only has one call-site and there it is never called with dummy or deferred devices. Simplify the check in the function to account for that. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function

2020-02-17 Thread Joerg Roedel
From: Joerg Roedel Move the code that does the deferred device attachment into a separate helper function. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH 0/5] iommu/vt-d: Fix kdump boot with VT-d enabled

2020-02-17 Thread Joerg Roedel
will add the tags before applying the patches. Please review. Thanks, Joerg Joerg Roedel (5): iommu/vt-d: Add attach_deferred() helper iommu/vt-d: Move deferred device attachment into helper function iommu/vt-d: Do deferred attachment in iommu_need_mapping() iommu/vt-d: Remove

[PATCH 1/5] iommu/vt-d: Add attach_deferred() helper

2020-02-17 Thread Joerg Roedel
From: Joerg Roedel Implement a helper function to check whether a device's attach process is deferred. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/

[PATCH 4/5] iommu/vt-d: Remove deferred_attach_domain()

2020-02-17 Thread Joerg Roedel
From: Joerg Roedel The function is now only a wrapper around find_domain(). Remove the function and call find_domain() directly at the call-sites. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a

[PATCH 3/5] iommu/vt-d: Do deferred attachment in iommu_need_mapping()

2020-02-17 Thread Joerg Roedel
From: Joerg Roedel The attachment of deferred devices needs to happen before the check whether the device is identity mapped or not. Otherwise the check will return wrong results, cause warnings boot failures in kdump kernels, like WARNING: CPU: 0 PID: 318 at ../drivers/iommu/intel

[PATCH 3/5 v2] iommu/vt-d: Do deferred attachment in iommu_need_mapping()

2020-02-18 Thread Joerg Roedel
ew. Updated patch below. >From 3a5b8a66d288d86ac1fd45092e7d96f842d0cccf Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Mon, 17 Feb 2020 17:20:59 +0100 Subject: [PATCH 3/5] iommu/vt-d: Do deferred attachment in iommu_need_mapping() The attachment of deferred devices needs to happen befor

Re: [PATCH 3/5 v2] iommu/vt-d: Do deferred attachment in iommu_need_mapping()

2020-02-18 Thread Joerg Roedel
On Tue, Feb 18, 2020 at 07:54:52PM +0800, Lu Baolu wrote: > Looks good to me now. For all patches in this series, > > Acked-by: Lu Baolu Thanks, queued the fixes for v5.6. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfound

Re: [PATCH 1/5] iommu/vt-d: Add attach_deferred() helper

2020-02-19 Thread Joerg Roedel
On Tue, Feb 18, 2020 at 09:14:54AM -0800, Christoph Hellwig wrote: > > +static bool attach_deferred(struct device *dev) > > +{ > > + return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO; > > +} > > This is not a very useful helper. Depends on what one considers useful. I think such helpers ma

Re: [RFC PATCH] iommu/dma: Allow drivers to reserve an iova range

2020-02-19 Thread Joerg Roedel
On Fri, Feb 14, 2020 at 02:58:16PM -0800, Isaac J. Manjarres wrote: > From: Liam Mark > > Some devices have a memory map which contains gaps or holes. > In order for the device to have as much IOVA space as possible, > allow its driver to inform the DMA-IOMMU layer that it should > not allocate a

Re: [PATCH v3] iommu/amd: Disable IOMMU on Stoney Ridge systems

2020-02-19 Thread Joerg Roedel
On Mon, Feb 10, 2020 at 03:51:15PM +0800, Kai-Heng Feng wrote: > Serious screen flickering when Stoney Ridge outputs to a 4K monitor. > > Use identity-mapping and PCI ATS doesn't help this issue. > > According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do > the same here to avoid s

Re: [PATCH] iommu/qcom: Replace zero-length array with flexible-array member

2020-02-19 Thread Joerg Roedel
On Wed, Feb 12, 2020 at 06:14:01PM -0600, Gustavo A. R. Silva wrote: > drivers/iommu/qcom_iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfounda

Re: [PATCH] iommu: Use C99 flexible array in fwspec

2020-02-19 Thread Joerg Roedel
On Thu, Feb 13, 2020 at 02:00:21PM +, Robin Murphy wrote: > Although the 1-element array was a typical pre-C99 way to implement > variable-length structures, and indeed is a fundamental construct in the > APIs of certain other popular platforms, there's no good reason for it > here (and in part

Re: [PATCH 00/10] PCI/ATS: Device-tree support and other improvements

2020-02-19 Thread Joerg Roedel
Hi Jean-Philippe, On Thu, Feb 13, 2020 at 05:50:38PM +0100, Jean-Philippe Brucker wrote: > Jean-Philippe Brucker (11): > dt-bindings: PCI: generic: Add ats-supported property > PCI: Add ats_supported host bridge flag > PCI: OF: Check whether the host bridge supports ATS > ACPI/IORT: Check

Re: [PATCH 1/1] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-02-19 Thread Joerg Roedel
On Fri, Feb 14, 2020 at 06:44:51PM +0800, Adrian Huang wrote: > From: Adrian Huang > > The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, > this requires 21 bits (Please see the AMD IOMMU specification). > This leads to the potential failure when the bit 51 of SPA of > the GCR3

Re: [PATCH] iommu/qcom: Fix bogus detach logic

2020-02-19 Thread Joerg Roedel
On Tue, Feb 18, 2020 at 06:12:41PM +, Robin Murphy wrote: > Currently, the implementation of qcom_iommu_domain_free() is guaranteed > to do one of two things: WARN() and leak everything, or dereference NULL > and crash. That alone is terrible, but in fact the whole idea of trying > to track the

Re: [PATCH] iommu/arm-smmu: Restore naming of driver parameter prefix

2020-02-19 Thread Joerg Roedel
On Wed, Feb 19, 2020 at 11:00:46AM +, Will Deacon wrote: > Joerg -- please can you pick this up as a fix for 5.6? I don't have any > other SMMU fixes queued, so it doesn't seem worth sending a pull request > to you just for this. Applied, thanks. ___

Re: [PATCH] iommu/virtio: Build virtio-iommu as module

2020-02-19 Thread Joerg Roedel
On Fri, Feb 14, 2020 at 05:38:27PM +0100, Jean-Philippe Brucker wrote: > From: Jean-Philippe Brucker > > Now that the infrastructure changes are in place, enable virtio-iommu to > be built as a module. Remove the redundant pci_request_acs() call, since > it's not exported but is already invoked d

Re: [PATCH] iommu/virtio: Build virtio-iommu as module

2020-02-19 Thread Joerg Roedel
On Wed, Feb 19, 2020 at 12:41:33PM +0100, Jean-Philippe Brucker wrote: > No, I meant Will's changes in 5.6 to make the SMMU drivers modular. This > patch doesn't depend on the x86 enablement patch-set, but there is a small > conflict in Kconfig since they both modify it (locally I have this patch >

[git pull] IOMMU Fixes for Linux v5.6-rc1

2020-02-19 Thread Joerg Roedel
in QCOM IOMMU driver robust and not leak memory/dereference NULL pointers - Fix ARM-SMMU module parameter prefix names Joerg Roedel (6): iommu/vt-d: Fix compile warning from intel-svm.h iommu/vt-d: Add

[PATCH 06/14] iommu: Move iommu_fwspec to struct dev_iommu

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Move the iommu_fwspec pointer in struct device into struct dev_iommu. This is a step in the effort to reduce the iommu related pointers in struct device to one. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 3 +++ include/linux/device.h | 1 - include/linux

[PATCH 04/14] iommu/arm-smmu: Fix uninitilized variable warning

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Some unrelated changes in the iommu code caused a new warning to appear in the arm-smmu driver: CC drivers/iommu/arm-smmu.o drivers/iommu/arm-smmu.c: In function 'arm_smmu_add_device': drivers/iommu/arm-smmu.c:1441:2: warning: 'smmu' may be used un

[PATCH 13/14] iommu/virtio: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions. Signed-off-by: Joerg Roedel --- drivers/iommu/virtio-iommu.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index cce329d71fba

[PATCH 10/14] iommu/renesas: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions. Signed-off-by: Joerg Roedel --- drivers/iommu/ipmmu-vmsa.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index ecb3f9464dd5..310cf09feea3

[PATCH 01/14] ACPI/IORT: Remove direct access of dev->iommu_fwspec

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Use the accessor functions instead of directly dereferencing dev->iommu_fwspec. Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c in

[PATCH 09/14] iommu/arm-smmu: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions and simplify the code where possible with this change. Signed-off-by: Joerg Roedel --- drivers/iommu/arm-smmu.c | 56 +--- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a

[PATCH 07/14] iommu: Introduce accessors for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Add dev_iommu_priv_get/set() functions to access per-device iommu private data. This makes it easier to move the pointer to a different location. Signed-off-by: Joerg Roedel --- include/linux/iommu.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include

[PATCH 02/14] drm/msm/mdp5: Remove direct access of dev->iommu_fwspec

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Use the accessor functions instead of directly dereferencing dev->iommu_fwspec. Signed-off-by: Joerg Roedel --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/driv

[PATCH 11/14] iommu/mediatek: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions. Signed-off-by: Joerg Roedel --- drivers/iommu/mtk_iommu.c| 13 ++--- drivers/iommu/mtk_iommu_v1.c | 14 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b

[PATCH 12/14] iommu/qcom: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions. Signed-off-by: Joerg Roedel --- drivers/iommu/qcom_iommu.c | 61 ++ 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c

[PATCH 00/14] iommu: Move iommu_fwspec out of 'struct device'

2020-02-28 Thread Joerg Roedel
sting of these drivers is greatly appreciated. I boot-tested these changes on arm-smmu-v3 enabled KVM VM. Please review. Regards, Joerg Joerg Roedel (14): ACPI/IORT: Remove direct access of dev->iommu_fwspec drm/msm/mdp5: Remove direct access of dev->iommu_fwspec iommu

[PATCH 03/14] iommu/tegra-gart: Remove direct access of dev->iommu_fwspec

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Use the accessor functions instead of directly dereferencing dev->iommu_fwspec. Signed-off-by: Joerg Roedel --- drivers/iommu/tegra-gart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c in

[PATCH 05/14] iommu: Rename struct iommu_param to dev_iommu

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel The term dev_iommu aligns better with other existing structures and their accessor functions. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 28 ++-- include/linux/device.h | 6 +++--- include/linux/iommu.h | 4 ++-- 3 files changed, 19

[PATCH 14/14] iommu: Move fwspec->iommu_priv to struct dev_iommu

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Move the pointer for iommu private data from struct iommu_fwspec to struct dev_iommu. Signed-off-by: Joerg Roedel --- include/linux/iommu.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index

[PATCH 08/14] iommu/arm-smmu-v3: Use accessor functions for iommu private data

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel Make use of dev_iommu_priv_set/get() functions in the code. Signed-off-by: Joerg Roedel --- drivers/iommu/arm-smmu-v3.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index

Re: [PATCH V2 3/5] iommu: Add support to change default domain of an iommu_group

2020-03-02 Thread Joerg Roedel
Hello Sai, Baolu, On Sun, Feb 16, 2020 at 01:57:26PM -0800, Sai Praneeth Prakhya wrote: > Hence it will be helpful if there is some way to change the default > domain of a B:D.F dynamically. Since, linux iommu subsystem prefers to > deal at iommu_group level instead of B:D.F level, it might be hel

Re: [PATCH v2 2/4] iommu: Add Allwinner H6 IOMMU driver

2020-03-02 Thread Joerg Roedel
Hi Maxime, On Thu, Feb 20, 2020 at 07:15:14PM +0100, Maxime Ripard wrote: > +struct sun50i_iommu_domain { > + struct iommu_domain domain; > + > + /* Number of devices attached to the domain */ > + refcount_t refcnt; > + > + /* Lock to modify the Directory Table */ > + spinlock_

Re: [PATCH] iommu: silence iommu group prints

2020-03-02 Thread Joerg Roedel
On Thu, Feb 27, 2020 at 11:57:52AM +, Russell King wrote: > On the LX2160A, there are lots (about 160) of IOMMU messages produced > during boot; this is excessive. Reduce the severity of these messages > to debug level. No, these messages are a very useful tool when it comes to debugging IOMM

Re: [PATCH v3] iommu/vt-d: Fix a bug in intel_iommu_iova_to_phys() for huge page

2020-03-02 Thread Joerg Roedel
On Wed, Feb 26, 2020 at 12:30:06PM -0800, Yonghyun Hwang wrote: > intel_iommu_iova_to_phys() has a bug when it translates an IOVA for a huge > page onto its corresponding physical address. This commit fixes the bug by > accomodating the level of page entry for the IOVA and adds IOVA's lower > addre

Re: [PATCH] iommu/io-pgtable-arm: Fix IOVA validation for 32-bit

2020-03-02 Thread Joerg Roedel
On Mon, Mar 02, 2020 at 11:53:01AM +, Will Deacon wrote: > On Fri, Feb 28, 2020 at 02:18:55PM +, Robin Murphy wrote: > > Since we ony support the TTB1 quirk for AArch64 contexts, and > > consequently only for 64-bit builds, the sign-extension aspect of the > > "are all bits above IAS consis

Re: [PATCH v2 1/3] iommu/virtio: Add topology description to virtio-iommu config space

2020-03-02 Thread Joerg Roedel
On Fri, Feb 28, 2020 at 06:25:36PM +0100, Jean-Philippe Brucker wrote: > This solution isn't elegant nor foolproof, but is the best we can do at > the moment and works with existing virtio-iommu implementations. It also > enables an IOMMU for lightweight hypervisors that do not rely on > firmware m

Re: [PATCH v2 1/3] iommu/virtio: Add topology description to virtio-iommu config space

2020-03-03 Thread Joerg Roedel
Hi Eric, On Tue, Mar 03, 2020 at 11:19:20AM +0100, Auger Eric wrote: > Michael has pushed this solution (putting the "configuration in the PCI > config space"), I think for those main reasons: > - ACPI may not be supported on some archs/hyps But on those there is device-tree, right? > - the virt

Re: [PATCH V2 3/5] iommu: Add support to change default domain of an iommu_group

2020-03-03 Thread Joerg Roedel
Hi Baolu, On Tue, Mar 03, 2020 at 02:47:02PM +0800, Lu Baolu wrote: > Theoretically speaking, per-device default domain is impractical. PCI > aliased devices (PCI bridge and all devices beneath it, VMD devices and > various devices quirked with pci_add_dma_alias()) must use the same > domain. It's

Re: [PATCH v2 1/3] iommu/virtio: Add topology description to virtio-iommu config space

2020-03-03 Thread Joerg Roedel
On Tue, Mar 03, 2020 at 09:00:05AM -0500, Michael S. Tsirkin wrote: > Not necessarily. E.g. some power systems have neither. > There are also systems looking to bypass ACPI e.g. for boot speed. If there is no firmware layer between the hardware and the OS the necessary information the OS needs to

<    4   5   6   7   8   9   10   11   12   13   >