Re: [PATCH 1/1] iommu/vtd: Fix NULL pointer dereference in prq_event_thread()

2018-11-06 Thread Joerg Roedel
On Mon, Nov 05, 2018 at 10:18:58AM +0800, Lu Baolu wrote: > When handling page request without pasid event, go to "no_pasid" > branch instead of "bad_req". Otherwise, a NULL pointer deference > will happen there. > > Cc: Ashok Raj > Cc: Jacob Pan > Cc: Sohil Mehta > Signed-off-by: Lu Baolu > -

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 01:22:52PM +, Robin Murphy wrote: > On 2018-11-07 1:18 pm, Geert Uytterhoeven wrote: > > Fix this by checking if the domain's context already exists, before > > trying to destroy it. > > Reviewed-by: Robin Murphy Does this need a Fixes-tag? If so, which patch should b

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 04:50:40PM +0100, Geert Uytterhoeven wrote: > It only got triggered by the combination of commits 6c2fb2ea76361da9 > ("of/device: Set bus DMA mask as appropriate") and b4ebe6063204da58 > ("dma-direct: implement complete bus_dma_mask handling"), which is being > fixed by "of/

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 02:18:50PM +0100, Geert Uytterhoeven wrote: > Fix this by checking if the domain's context already exists, before > trying to destroy it. > > Signed-off-by: Geert Uytterhoeven > --- > drivers/iommu/ipmmu-vmsa.c | 3 +++ > 1 file changed, 3 insertions(+) Applied, thanks

Re: [PATCH v2] iommu/vt-d: respect max guest address width in agaw

2018-11-07 Thread Joerg Roedel
On Tue, Nov 06, 2018 at 02:47:15PM -0800, Jacob Pan wrote: > drivers/iommu/intel-iommu.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) Applied, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 04:17:09PM +, Robin Murphy wrote: > FWIW it looks like it *has* always been possible to hit this crash by > allocating a domain and freeing it again without attaching any devices, it's > just highly improbable for any sane code to do that explicitly, so the real > latent

Re: [PATCH v2] iommu/vt-d: respect max guest address width in agaw

2018-11-08 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 02:12:25PM -0800, Jacob Pan wrote: > We have found some issues with this patch on some platforms. Please > disregard this patch. Patch dropped. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.

Re: [PATCH -next] iommu/amd: remove set but not used variable 'tag'

2018-11-08 Thread Joerg Roedel
On Thu, Nov 08, 2018 at 06:12:40AM +, YueHaibing wrote: > - tag = event[1] & 0x03FF; > dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x > pasid=0x%05x address=0x%016llx flags=0x%04x]\n", > PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid)

Re: [PATCH -next] iommu/amd: Add missed 'tag' to error msg in iommu_print_event

2018-11-08 Thread Joerg Roedel
On Thu, Nov 08, 2018 at 11:57:33AM +, YueHaibing wrote: > - dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x > pasid=0x%05x address=0x%016llx flags=0x%04x]\n", > + dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x > pasid=0x%05x address=0x%016llx flags=0x%04x

Re: [PATCH 2/2] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support

2018-11-08 Thread Joerg Roedel
On Thu, Nov 08, 2018 at 02:03:33PM +, Fabrizio Castro wrote: > Joerg, does this patch look ok to you? Applied both patches, thanks Fabrizio. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/io

[PATCH 4/7] iommu/amd: Allow downgrading page-sizes in alloc_pte()

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel Before this patch it was not possible the downgrade a mapping established with page-mode 7 to a mapping using smaller page-sizes, because the pte_level != level check prevented that. Treat page-mode 7 like a non-present mapping and allow to overwrite it in alloc_pte

[PATCH 3/7] iommu/amd: Ignore page-mode 7 in free_sub_pt()

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel The page-mode 7 is a special one as it marks a final PTE to a page with an intermediary size. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 4 drivers/iommu/amd_iommu_types.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/iommu

[PATCH 2/7] iommu/amd: Introduce free_sub_pt() function

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel The function is a more generic version of free_pagetable() and will be used to free only specific sub-trees of a page-table. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a

[PATCH 7/7] vfio/type1: Remove map_try_harder() code path

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel The AMD IOMMU driver can now map a huge-page where smaller mappings existed before, so this code-path is no longer triggered. Signed-off-by: Joerg Roedel --- drivers/vfio/vfio_iommu_type1.c | 33 ++--- 1 file changed, 2 insertions(+), 31

[PATCH 5/7] iommu/amd: Restart loop if cmpxchg64 succeeded in alloc_pte()

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel This makes sure that __pte always contains the correct value when the pointer to the next page-table level is derived. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu

[PATCH 6/7] iommu/amd: Allow to upgrade page-size

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel Before this patch the iommu_map_page() function failed when it tried to map a huge-page where smaller mappings existed before. With this change the page-table pages of the old mappings are teared down, so that the huge-page can be mapped. Signed-off-by: Joerg Roedel

[PATCH 1/7] iommu/amd: Collect page-table pages in freelist

2018-11-09 Thread Joerg Roedel
From: Joerg Roedel Collect all pages that belong to a page-table in a list and free them after the tree has been traversed. This allows to implement safer page-table updates in subsequent patches. Also move the functions for page-table freeing a bit upwards in the file so that they are usable

[PATCH 0/7] iommu/amd: Always allow to map huge pages

2018-11-09 Thread Joerg Roedel
lease review. Thanks, Joerg Joerg Roedel (7): iommu/amd: Collect page-table pages in freelist iommu/amd: Introduce free_sub_pt() function iommu/amd: Ignore page-mode 7 in free_sub_pt() iommu/amd: Allow downgrading page-sizes in alloc_pte() iommu/amd: Restart loop if cmpx

Re: [PATCH v2 1/1] iommu/vtd: Cleanup dma_remapping.h header

2018-11-12 Thread Joerg Roedel
On Mon, Nov 12, 2018 at 02:40:08PM +0800, Lu Baolu wrote: > arch/x86/kernel/tboot.c| 2 +- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- > drivers/gpu/drm/i915/intel_display.c | 2 +- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c| 2 +- > drivers/misc/mic/scif/

Re: [RFC PATCH 2/6] drivers core: Add I/O ASID allocator

2018-11-12 Thread Joerg Roedel
Hi Jean-Philippe, On Fri, Oct 19, 2018 at 07:11:54PM +0100, Jean-Philippe Brucker wrote: > The allocator doesn't really belong in drivers/iommu because some > drivers would like to allocate PASIDs for devices that aren't managed by > an IOMMU, using the same ID space as IOMMU. It doesn't really be

Re: [PATCH 0/4] PCI / iommu / thunderbolt: IOMMU based DMA protection

2018-11-13 Thread Joerg Roedel
derbolt: Export IOMMU based DMA protection support to userspace Looks good to me. Which tree should go this trough? In case its not the IOMMU tree, for the iommu-parts: Acked-by: Joerg Roedel Reviewed-by: Joerg Roedel Thanks, Joerg

Re: [PATCH 7/7] vfio/type1: Remove map_try_harder() code path

2018-11-15 Thread Joerg Roedel
Hi Alex, On Fri, Nov 09, 2018 at 09:23:29AM -0700, Alex Williamson wrote: > Cool, glad to see this finally fixed. My "should be fixed soon" > comment turned out to be a little optimistic with the fix finally > coming 5 years later. We could of course keep this code as it really > doesn't harm an

Re: [RFC PATCH 2/6] drivers core: Add I/O ASID allocator

2018-11-22 Thread Joerg Roedel
On Wed, Nov 21, 2018 at 07:10:20PM +, Koenig, Christian wrote: > All of that is completely unrelated to IOMMU, but when IOMMU is enabled > you need to use the same allocator because all use cases use the same ID > space. Okay, I see. Is there ever a case where we can have multiple PASIDs for

Re: [RFC PATCH 2/6] drivers core: Add I/O ASID allocator

2018-11-22 Thread Joerg Roedel
Hi Jean-Philippe, On Wed, Nov 21, 2018 at 11:16:07AM +, Jean-Philippe Brucker wrote: > On 12/11/2018 14:40, Joerg Roedel wrote: > > What is the intended use-case for this function? > > I'm using it in sva_bind(), to see if there already exists an io_mm > associated to

Re: [PATCH v3 00/15] MT8183 IOMMU SUPPORT

2018-11-22 Thread Joerg Roedel
Hi, On Sat, Nov 17, 2018 at 10:35:27AM +0800, Yong Wu wrote: > Yong Wu (14): > dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI > iommu/mediatek: Use a struct as the platform data > memory: mtk-smi: Use a general config_port interface > iommu/io-pgtable-arm-v7s: Add paddr_to_iop

Re: [PATCH v3 00/15] MT8183 IOMMU SUPPORT

2018-11-22 Thread Joerg Roedel
On Thu, Nov 22, 2018 at 01:35:26PM +, Will Deacon wrote: > Robin already reviewed the pgtable bits, I think. Right, I missed the tags, sorry. Joerg ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/li

Re: [PATCH] iommu: use memunmap to free memremap

2018-11-22 Thread Joerg Roedel
On Wed, Nov 21, 2018 at 05:53:47PM +0800, Pan Bian wrote: > memunmap() should be used to free the return of memremap(), not > iounmap(). > > Fixes: dfddb969edf0("iommu/vt-d: Switch from ioremap_cache to memremap") > Signed-off-by: Pan Bian > --- > drivers/iommu/intel-iommu.c | 2 +- > 1 file cha

Re: [PATCH] iommu/vt-d: Handle domain agaw being less than iommu agaw

2018-11-22 Thread Joerg Roedel
On Wed, Nov 21, 2018 at 03:29:33PM -0800, Sohil Mehta wrote: > drivers/iommu/intel-iommu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied, thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation

Re: [PATCH] iommu/tegra: Change to use DEFINE_SHOW_ATTRIBUTE macro

2018-11-22 Thread Joerg Roedel
On Thu, Nov 22, 2018 at 08:30:47AM -0500, Yangtao Li wrote: > Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. > > Signed-off-by: Yangtao Li > --- > drivers/iommu/tegra-smmu.c | 24 ++-- > 1 file changed, 2 insertions(+), 22 deletions(-) Applied, thanks. __

Re: [PATCH] iommu/omap: remove DEBUG_SEQ_FOPS_RO()

2018-11-22 Thread Joerg Roedel
On Thu, Nov 22, 2018 at 08:54:43AM -0500, Yangtao Li wrote: > Because we already have the DEFINE_SHOW_ATTRIBUTE,there is no need > to define such a macro.So remove DEBUG_SEQ_FOPS_RO. > > Signed-off-by: Yangtao Li > --- > drivers/iommu/omap-iommu-debug.c | 25 ++--- > 1 file c

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Joerg Roedel
On Thu, Nov 22, 2018 at 05:52:15PM +, Robin Murphy wrote: > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > systems in general, "the top 4095" values may well still be valid addresses > - we're relying on a 1-byte mapping of the very top byte of memory/IOVA > space bei

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Joerg Roedel
On Fri, Nov 23, 2018 at 11:01:55AM +, Russell King - ARM Linux wrote: > Yuck. So, if we have a 4GB non-PAE 32-bit system, or a PAE system > where we have valid memory across the 4GB boundary and no IOMMU, > we have to reserve the top 4K page in the first 4GB of RAM? But that is only needed wh

[git pull] IOMMU Fixes for Linux v4.20-rc3

2018-11-23 Thread Joerg Roedel
Hi Linus, The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a: Linux 4.20-rc1 (2018-11-04 15:37:52 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git iommu-fixes-v4.20-rc3 for you to fetch changes up to 82938

Re: [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules.

2018-11-27 Thread Joerg Roedel
Hi Paul, thanks for your cleanup! The iommu-tree uses another rule for the subject line of patches. Can you please resend with correct subject lines? See below for what is used. The general format is: iommu/: _C_apital letter starting subject Please also collect the Acks you get and ad

[PATCH 0/3] Driver message cleanups

2018-11-28 Thread Joerg Roedel
ymore. The addresses in the event log messages got rid of the leading 0s to make the messages shorter. Regards, Joerg Joerg Roedel (3): iommu/amd: Use pr_fmt() iommu/amd: Fix line-break in error log reporting iommu/amd: Remove leading 0s in error log messages drivers/iommu/a

[PATCH 2/3] iommu/amd: Fix line-break in error log reporting

2018-11-28 Thread Joerg Roedel
From: Joerg Roedel With the switch to dev_err for reporting errors from the iommu log there was an unwanted newline introduced. The reason was that the reporting was done in multiple dev_err() calls, and dev_err adds a newline after every call. Fix it by printing the log messages with only one

[PATCH 1/3] iommu/amd: Use pr_fmt()

2018-11-28 Thread Joerg Roedel
From: Joerg Roedel Make use of pr_fmt instead of having the 'AMD-Vi' prefix added manually at every printk() call. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 38 ++-- drivers/iommu/amd_iommu_init.c | 64 ++ dri

[PATCH 3/3] iommu/amd: Remove leading 0s in error log messages

2018-11-28 Thread Joerg Roedel
From: Joerg Roedel Remove the leading 0s in the address field of the error log messages. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c

Re: [PATCH] irq_remapping: Remove unused header files

2018-12-03 Thread Joerg Roedel
On Fri, Nov 30, 2018 at 09:35:21AM -0500, Yangtao Li wrote: > seq_file.h does not need to be included,so remove it. > > Signed-off-by: Yangtao Li > --- > drivers/iommu/irq_remapping.c | 1 - > 1 file changed, 1 deletion(-) Applied, thanks. ___ iommu m

Re: [PATCH v2 0/9] iommu: clean up/remove modular stuff from non-modules.

2018-12-03 Thread Joerg Roedel
On Sat, Dec 01, 2018 at 02:19:08PM -0500, Paul Gortmaker wrote: > Paul Gortmaker (9): > iommu: audit and remove any unnecessary uses of module.h > iommu/rockchip: Make it explicitly non-modular > iommu/msm: Make it explicitly non-modular > iommu/mediatek: Make it explicitly non-modular >

Re: [PATCH v5 02/12] iommu/vt-d: Manage scalalble mode PASID tables

2018-12-03 Thread Joerg Roedel
Hi Baolu, On Wed, Nov 28, 2018 at 11:54:39AM +0800, Lu Baolu wrote: > @@ -2482,12 +2482,13 @@ static struct dmar_domain > *dmar_insert_one_dev_info(struct intel_iommu *iommu, > if (dev) > dev->archdata.iommu = info; > > - if (dev && dev_is_pci(dev) && info->pasid_support

Re: [PATCH v5 04/12] iommu/vt-d: Add 256-bit invalidation descriptor support

2018-12-03 Thread Joerg Roedel
On Wed, Nov 28, 2018 at 11:54:41AM +0800, Lu Baolu wrote: > - > - desc_page = alloc_pages_node(iommu->node, GFP_ATOMIC | __GFP_ZERO, 0); > + /* > + * Need two pages to accommodate 256 descriptors of 256 bits each > + * if the remapping hardware supports scalable mode translation.

[PATCH 1/9] iommu: Introduce wrappers around dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel These wrappers will be used to easily change the location of the field later when all users are converted. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 14 +++--- include/linux/iommu.h | 11 +++ 2 files changed, 18 insertions(+), 7 deletions

[PATCH 4/9] iommu/dma: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH 3/9] iommu/arm-smmu: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Will Deacon Cc: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/iommu/arm-smmu-v3.c |

[PATCH 6/9] iommu/mediatek: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Matthias Brugger Signed-off-by: Joerg Roedel --- drivers/iommu/mtk_iommu.c|

[PATCH 5/9] iommu/ipmmu-vmsa: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/ipmmu-vmsa.c | 12 1 file changed, 8 insertions(+)

[PATCH 0/9] Access dev->iommu_fwspec through functions

2018-12-04 Thread Joerg Roedel
Hi, here is a patch-set to wrap accesses to dev->iommu_fwspec into functions. This will make it easier to move the pointer into a separate struct and consolitdate the iommu-related pointers in 'struct device'. Regards, Joerg Joerg Roedel (9): iommu: Introduce wrappe

[PATCH 7/9] iommu/of: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deleti

[PATCH 2/9] ACPI/IORT: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Lorenzo Pieralisi Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 12 +++- 1 file chan

[PATCH 8/9] iommu/qcom: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Rob Clark Signed-off-by: Joerg Roedel --- drivers/iommu/qcom_iommu.c | 18 ++ 1 file chan

[PATCH 9/9] iommu/tegra: Use helper functions to access dev->iommu_fwspec

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Thierry Reding Signed-off-by: Joerg Roedel --- drivers/iommu/tegra-smmu.c | 2 +- 1 file changed, 1 insert

[PATCH 0/5] Introduce device_iommu_maped() function

2018-12-04 Thread Joerg Roedel
its purpose readable. This also starts to remove direct access to the dev->iommu_group pointer outside of iommu-code. This is another move towards consolidating the various iommu-related pointers in 'struct device' into one pointer only. Please review. Thanks, Joerg

[PATCH 3/5] ACPI/IORT: Use device_iommu_mapped()

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Replace the iommu-check with a proper and readable function call. Cc: Lorenzo Pieralisi Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index

[PATCH 1/5] driver core: Introduce device_iommu_mapped() function

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Some places in the kernel check the iommu_group pointer in 'struct device' in order to find ot whether a device is mapped by an IOMMU. This is not good way to make this check, as the pointer will be moved to 'struct dev_iommu_data'. This way to make the ch

[PATCH 4/5] powerpc/iommu: Use device_iommu_mapped()

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use the new function to replace the open-coded iommu check. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Russell Currey Cc: Sam Bobroff Signed-off-by: Joerg Roedel --- arch/powerpc/kernel/eeh.c | 2 +- arch/powerpc/kernel/iommu.c | 6 +++--- 2 files changed, 4

[PATCH 2/5] iommu/of: Use device_iommu_mapped()

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Use Use device_iommu_mapped() to check if the device is already mapped by an IOMMU. Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index

[PATCH 5/5] xhci: Use device_iommu_mapped()

2018-12-04 Thread Joerg Roedel
From: Joerg Roedel Replace the dev->iommu_group check with a proper function call that better reprensents its purpose. Cc: Mathias Nyman Signed-off-by: Joerg Roedel --- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.

[PATCH 4/4] ACPI/IORT: Don't call iommu_ops->add_device directly

2018-12-05 Thread Joerg Roedel
From: Joerg Roedel Make sure to invoke this call-back through the proper function of the IOMMU-API. Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index

[PATCH 3/4] iommu/of: Don't call iommu_ops->add_device directly

2018-12-05 Thread Joerg Roedel
From: Joerg Roedel Make sure to invoke this call-back through the proper function of the IOMMU-API. Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index

[PATCH 0/4] Consolitate iommu_ops->add/remove_device() calls

2018-12-05 Thread Joerg Roedel
Hi, this patch-set consolidates the calls to iommu_ops->add_device() and remove_device() and the necessary checks into probe/release functions that be extended later with more setup work. Regards, Joerg Joerg Roedel (4): iommu/sysfs: Rename iommu_release_device() iommu: Consolit

[PATCH 1/4] iommu/sysfs: Rename iommu_release_device()

2018-12-05 Thread Joerg Roedel
From: Joerg Roedel Remove the iommu_ prefix from the function and a few other static data structures so that the iommu_release_device name can be re-used in iommu core code. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu-sysfs.c | 12 ++-- 1 file changed, 6 insertions(+), 6

[PATCH 2/4] iommu: Consolitate ->add/remove_device() calls

2018-12-05 Thread Joerg Roedel
From: Joerg Roedel Put them into separate functions and call those where the plain ops have been called before. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 54 ++- include/linux/iommu.h | 3 +++ 2 files changed, 31 insertions(+), 26

Re: [PATCH 2/4] iommu: Consolitate ->add/remove_device() calls

2018-12-05 Thread Joerg Roedel
On Wed, Dec 05, 2018 at 06:54:18AM -0800, Christoph Hellwig wrote: > > +void iommu_release_device(struct device *dev) > > Nitpick: there seems to be a double space here. > > > +int iommu_probe_device(struct device *dev); > > +void iommu_release_device(struct device *dev); > > .. and here. Rig

Re: [PATCH v5 02/12] iommu/vt-d: Manage scalalble mode PASID tables

2018-12-05 Thread Joerg Roedel
On Mon, Dec 03, 2018 at 05:23:40PM +, Liu, Yi L wrote: > So for a device without PASID support, we need to at least to have a PASID > entry so that its DMA request (without pasid) can be translated. Thus a PASID > table is needed for such devices. That makes sense, thanks for the explanation.

Re: [PATCH v5 02/12] iommu/vt-d: Manage scalalble mode PASID tables

2018-12-05 Thread Joerg Roedel
On Tue, Dec 04, 2018 at 01:58:06PM +0800, Lu Baolu wrote: > This function is called in an unsleepable context. > > spin_lock(&lock) > [...] > if (pasid_table_is_necessary) > allocate_pasid_table(dev) > [...] > spin_unlock(&lock) > > We can move it out of the lock range. > > How about > >

Re: [PATCH v5 04/12] iommu/vt-d: Add 256-bit invalidation descriptor support

2018-12-05 Thread Joerg Roedel
On Tue, Dec 04, 2018 at 02:13:31PM +0800, Lu Baolu wrote: > The existing code uses GFP_ATOMIC, this patch only changes the size of > the allocated desc_page. > > I don't think we really need GFP_ATOMIC here (and also for some other > places). I will clean up them in a separated patch. Okay, thank

Re: [PATCH] Fix typo. Change tlb_range_add to iotlb_range_add and tlb_sync to iotlb_sync

2018-12-05 Thread Joerg Roedel
On Tue, Dec 04, 2018 at 06:27:34PM +, Tom Murphy wrote: > From: tom > > Someone forgot to update this comment. > > Signed-off-by: Tom Murphy > --- > include/linux/iommu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied, thanks. _

Re: [PATCH] iommu: fix amd_iommu=force_isolation

2018-12-05 Thread Joerg Roedel
On Tue, Dec 04, 2018 at 03:37:16PM -0700, Yu Zhao wrote: > The parameter is still there but it's ignored. We need to check its > value before deciding to go into passthrough mode for AMD IOMMU. > > Fixes: aafd8ba0ca74 ("iommu/amd: Implement add_device and remove_device") > > Signed-off-by: Yu Zha

Re: [PATCH 2/9] ACPI/IORT: Use helper functions to access dev->iommu_fwspec

2018-12-06 Thread Joerg Roedel
Hi Robin, On Wed, Dec 05, 2018 at 05:50:23PM +, Robin Murphy wrote: > This needs to reload the new fwspec initialised by iort_iommu_xlate(), in > the same manner as the OF code. I think the best thing to do is encapsulate > the dev_iommu_fwspec_get() call in iort_fwspec_iommu_ops(), and have t

Re: [PATCH 7/9] iommu/of: Use helper functions to access dev->iommu_fwspec

2018-12-06 Thread Joerg Roedel
On Wed, Dec 05, 2018 at 05:41:51PM +, Robin Murphy wrote: > Nit: I think it makes sense to put this inside the "if (!err)" condition > below rather than out here where it may or may not be relevant. The comment > for that case is already supposed to imply that it's dealing with a fresh > fwspec

Re: [PATCH 2/5] iommu/of: Use device_iommu_mapped()

2018-12-06 Thread Joerg Roedel
Hi Robin, On Wed, Dec 05, 2018 at 05:17:54PM +, Robin Murphy wrote: > FWIW, this check (and its ACPI equivalent in patch #3) is specifically > asking "has .add_device() already been called?", rather than the more > general "is this device managed by an IOMMU?" (to which the exact answer at > t

Re: [PATCH 0/5] Introduce device_iommu_maped() function

2018-12-06 Thread Joerg Roedel
On Wed, Dec 05, 2018 at 05:17:29PM +, Robin Murphy wrote: > On 04/12/2018 17:24, Joerg Roedel wrote: > Nice, we can also clean up a whole load of vague iommu_present() usage and > even one or two odd iommu_get_domain_for_dev() calls once we have this. Right, I didn't think of

Re: [PATCH 1/5] driver core: Introduce device_iommu_mapped() function

2018-12-06 Thread Joerg Roedel
On Thu, Dec 06, 2018 at 01:55:20PM +0100, Greg Kroah-Hartman wrote: > On Tue, Dec 04, 2018 at 06:25:00PM +0100, Joerg Roedel wrote: > > Cc: Greg Kroah-Hartman > > Signed-off-by: Joerg Roedel > > --- > > include/linux/device.h | 10 ++ > > 1 file change

Re: [PATCH 2/4] iommu: Consolitate ->add/remove_device() calls

2018-12-06 Thread Joerg Roedel
On Wed, Dec 05, 2018 at 06:20:50PM +, Robin Murphy wrote: > Is there any good reason to let .add_device/.remove_device be optional > still? Everyone's implemented them for a while now, and on a practical level > I don't really see how else we could expect devices to be taken in and out > of the

Re: [PATCH 3/4] iommu/of: Don't call iommu_ops->add_device directly

2018-12-06 Thread Joerg Roedel
On Wed, Dec 05, 2018 at 06:49:26PM +, Robin Murphy wrote: > if (ops && dev->bus && !dev->iommu_group) > > What I can't quite remember just now is whether it's actually valid to get > here with err == 0 but dev->iommu_fwspec->ops == NULL, so it *might* be OK > to use "!err" instead of "op

Re: [PATCH 2/5] iommu/of: Use device_iommu_mapped()

2018-12-07 Thread Joerg Roedel
On Thu, Dec 06, 2018 at 05:42:16PM +, Robin Murphy wrote: > For sure - although I am now wondering whether "mapped" is perhaps a little > ambiguous in the naming, since the answer to "can I use the API" is yes even > when the device may currently be attached to an identity/passthrough domain >

Re: [PATCH v2] iommu: fix amd_iommu=force_isolation

2018-12-07 Thread Joerg Roedel
On Thu, Dec 06, 2018 at 02:39:15PM -0700, Yu Zhao wrote: > Fixes: aafd8ba0ca74 ("iommu/amd: Implement add_device and remove_device") > > Signed-off-by: Yu Zhao > --- > drivers/iommu/amd_iommu.c | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) Applied, thanks. ___

Re: [PATCH v4] iommu/dma: Use NUMA aware memory allocations in __iommu_dma_alloc_pages()

2018-12-10 Thread Joerg Roedel
On Fri, Dec 07, 2018 at 05:57:42PM +, John Garry wrote: > A friendly reminder. Can you please let me know your position on this patch? I am waiting for a Reviewed-by or at least Acked-by from Robin on it before I put it in my tree. Regards, Joerg

Re: [PATCH v4] iommu/dma: Use NUMA aware memory allocations in __iommu_dma_alloc_pages()

2018-12-11 Thread Joerg Roedel
On Fri, Nov 30, 2018 at 07:14:00PM +0800, John Garry wrote: > From: Ganapatrao Kulkarni > > Change function __iommu_dma_alloc_pages() to allocate pages for DMA from > respective device NUMA node. The ternary operator which would be for > alloc_pages_node() is tidied along with this. > > The moti

Re: [PATCH v6 00/12] iommu/vt-d: Add scalable mode support

2018-12-11 Thread Joerg Roedel
On Mon, Dec 10, 2018 at 09:58:54AM +0800, Lu Baolu wrote: > Lu Baolu (12): > iommu/vt-d: Enumerate the scalable mode capability > iommu/vt-d: Manage scalalble mode PASID tables > iommu/vt-d: Move page table helpers into header > iommu/vt-d: Add 256-bit invalidation descriptor support > io

Re: [PATCH v4 00/18] MT8183 IOMMU SUPPORT

2018-12-11 Thread Joerg Roedel
On Sat, Dec 08, 2018 at 04:39:13PM +0800, Yong Wu wrote: > Arvind Yadav (1): > iommu/mediatek: Constify iommu_ops > > Yong Wu (17): > dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI > iommu/mediatek: Use a struct as the platform data > memory: mtk-smi: Use a general config_port

Re: [PATCH v6 00/21] IOMMU: Tegra GART driver clean up and optimization

2018-12-11 Thread Joerg Roedel
On Sun, Dec 09, 2018 at 11:29:29PM +0300, Dmitry Osipenko wrote: > Dmitry Osipenko (21): > iommu/tegra: gart: Remove pr_fmt and clean up includes > iommu/tegra: gart: Clean up driver probe errors handling > iommu/tegra: gart: Ignore devices without IOMMU phandle in DT > iommu: Introduce iot

[PATCH 6/9] iommu/mediatek: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Matthias Brugger Signed-off-by: Joerg Roedel --- drivers/iommu/mtk_iommu.c|

[PATCH 1/9] iommu: Introduce wrappers around dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel These wrappers will be used to easily change the location of the field later when all users are converted. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 14 +++--- include/linux/iommu.h | 11 +++ 2 files changed, 18 insertions(+), 7 deletions

[PATCH 3/9] iommu/arm-smmu: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Will Deacon Cc: Robin Murphy Acked-by: Will Deacon Signed-off-by: Joerg Roedel --- drivers/iommu/arm-smmu

[PATCH 5/9] iommu/ipmmu-vmsa: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/ipmmu-vmsa.c | 12 1 file changed, 8 insertions(+)

[PATCH 0/9 v2] Access dev->iommu_fwspec through functions

2018-12-11 Thread Joerg Roedel
x27;d like to queue these patches soon. Regards, Joerg Joerg Roedel (9): iommu: Introduce wrappers around dev->iommu_fwspec ACPI/IORT: Use helper functions to access dev->iommu_fwspec iommu/arm-smmu: Use helper functions to access dev->iommu_fwspec iommu/dma: Use helper f

[PATCH 2/9] ACPI/IORT: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Lorenzo Pieralisi Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 19 ++- 1 f

[PATCH 4/9] iommu/dma: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH 7/9] iommu/of: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 10 +++--- 1 file changed, 7 insertions(+)

[PATCH 9/9] iommu/tegra: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Thierry Reding Signed-off-by: Joerg Roedel --- drivers/iommu/tegra-smmu.c | 2 +- 1 file changed, 1 insert

[PATCH 8/9] iommu/qcom: Use helper functions to access dev->iommu_fwspec

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Cc: Rob Clark Signed-off-by: Joerg Roedel --- drivers/iommu/qcom_iommu.c | 18 ++ 1 file chan

[PATCH 0/6 v2] Introduce device_iommu_mapped() function

2018-12-11 Thread Joerg Roedel
d on the first version. Please review and provide Acks, if there are no objections. I have some iommu patches that depend on these, so I'd like to carry this patch-set in the IOMMU tree. Regards, Joerg Joerg Roedel (6): driver core: Introduce device_iommu_mapped() function

[PATCH 2/6] iommu/of: Use device_iommu_mapped()

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use Use device_iommu_mapped() to check if the device is already mapped by an IOMMU. Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu

[PATCH 3/6] ACPI/IORT: Use device_iommu_mapped()

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Replace the iommu-check with a proper and readable function call. Cc: Lorenzo Pieralisi Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/acpi/arm64/iort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers

[PATCH 1/6] driver core: Introduce device_iommu_mapped() function

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Some places in the kernel check the iommu_group pointer in 'struct device' in order to find ot whether a device is mapped by an IOMMU. This is not good way to make this check, as the pointer will be moved to 'struct dev_iommu_data'. This way to make the ch

[PATCH 6/6] dmaengine: sh: rcar-dmac: Use device_iommu_mapped()

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use Use device_iommu_mapped() to check if the device is already mapped by an IOMMU. Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers

[PATCH 4/6] powerpc/iommu: Use device_iommu_mapped()

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Use the new function to replace the open-coded iommu check. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Russell Currey Cc: Sam Bobroff Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- arch/powerpc/kernel/eeh.c | 2 +- arch/powerpc/kernel/iommu.c | 6

[PATCH 5/6] xhci: Use device_iommu_mapped()

2018-12-11 Thread Joerg Roedel
From: Joerg Roedel Replace the dev->iommu_group check with a proper function call that better reprensents its purpose. Cc: Mathias Nyman Acked-by: Robin Murphy Signed-off-by: Joerg Roedel --- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driv

<    2   3   4   5   6   7   8   9   10   11   >