Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread David Woodhouse
On Thu, 2015-06-11 at 16:25 +0200, Joerg Roedel wrote: On Thu, Jun 11, 2015 at 03:07:02PM +0100, David Woodhouse wrote: On Thu, 2015-06-11 at 15:47 +0200, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering

Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread David Woodhouse
On Thu, 2015-06-11 at 15:47 +0200, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering them as non-present. This is implemented by setting the first AVL bit (bit 67) in the context entry to one. If this bit is set, the

Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread Joerg Roedel
On Thu, Jun 11, 2015 at 03:07:02PM +0100, David Woodhouse wrote: On Thu, 2015-06-11 at 15:47 +0200, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering them as non-present. This is implemented by setting the first

Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread David Woodhouse
On Thu, 2015-06-11 at 16:12 +0200, Joerg Roedel wrote: On Thu, Jun 11, 2015 at 03:07:02PM +0100, David Woodhouse wrote: On Thu, 2015-06-11 at 15:47 +0200, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering

Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread Joerg Roedel
On Thu, Jun 11, 2015 at 03:07:02PM +0100, David Woodhouse wrote: On Thu, 2015-06-11 at 15:47 +0200, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering them as non-present. This is implemented by setting the first

[PATCH v2 4/4] arm64: Hook up IOMMU dma_ops

2015-06-11 Thread Robin Murphy
With iommu_dma_ops in place, hook them up to the configuration code, so IOMMU-fronted devices will get them automatically. Signed-off-by: Robin Murphy robin.mur...@arm.com --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/dma-mapping.h | 11 ++-

[PATCH v2 0/4] arm64: IOMMU-backed DMA mapping

2015-06-11 Thread Robin Murphy
Hi all, Here's a quick repost of [1] with a couple of minor fixes: - fix scatterlist dma_len for segments with nonzero offset - adjust the bus notifier priority with a less silly value The branch at [2] has been updated as well. Robin. [1]:http://thread.gmane.org/gmane.linux.kernel.iommu/9721

[PATCH v2 1/4] iommu/iova: Avoid over-allocating when size-aligned

2015-06-11 Thread Robin Murphy
Currently, allocating a size-aligned IOVA region quietly adjusts the actual allocation size in the process, returning a rounded-up power-of-two-sized allocation. This results in mismatched behaviour in the IOMMU driver if the original size was not a power of two, where the original size is mapped,

[PATCH v2 2/4] iommu: Implement common IOMMU ops for DMA mapping

2015-06-11 Thread Robin Murphy
Taking inspiration from the existing arch/arm code, break out some generic functions to interface the DMA-API to the IOMMU-API. This will do the bulk of the heavy lifting for IOMMU-backed dma-mapping. Signed-off-by: Robin Murphy robin.mur...@arm.com --- drivers/iommu/Kconfig | 7 +

Re: [RFC/PATCH 0/9] IOMMU probe deferral support

2015-06-11 Thread Will Deacon
Hi Laurent, On Fri, May 15, 2015 at 12:00:01AM +0100, Laurent Pinchart wrote: This patch series attempts to implement support for deferring probe of both IOMMU drivers and bus master drivers. Have you had a chance to look at any of the feedback you've received on this? Will

Re: [PATCH 06/22] iommu: Allocate a default domain for iommu groups

2015-06-11 Thread Robin Murphy
Hi Joerg, On 28/05/15 17:41, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de The default domain will be used (if supported by the iommu driver) when the devices in the iommu group are not attached to any other domain. Signed-off-by: Joerg Roedel jroe...@suse.de ---

Re: [PATCH 06/22] iommu: Allocate a default domain for iommu groups

2015-06-11 Thread Robin Murphy
Hi Joerg, On 28/05/15 17:41, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de The default domain will be used (if supported by the iommu driver) when the devices in the iommu group are not attached to any other domain. Signed-off-by: Joerg Roedel jroe...@suse.de ---

Re: [PATCH 08/22] iommu: Make sure a device is always attached to a domain

2015-06-11 Thread Robin Murphy
On 28/05/15 17:41, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Make use of the default domain and re-attach a device to it when it is detached from another domain. Also enforce that a device has to be in the default domain before it can be attached to a different domain.

Re: [PATCH 10/22] iommu: Introduce direct mapped region handling

2015-06-11 Thread Robin Murphy
On 28/05/15 17:41, Joerg Roedel wrote: From: Joerg Roedel jroe...@suse.de Add two new functions to the IOMMU-API to allow the IOMMU drivers to export the requirements for direct mapped regions per device. This is useful for exporting the information in Intel VT-d's RMRR entries or AMD-Vi's

[PATCH 0/4] More cleanups and fixes for Intel VT-d

2015-06-11 Thread Joerg Roedel
Hi, here are a number of additional fixes for the Intel VT-d driver and its behavior in a kdump kernel. The most important fix is the iommu=pt case, which is broken without these patches. Regards, Joerg Joerg Roedel (4): iommu/vt-d: Remove iommu_attach_domain_with_id() iommu/vt-d:

[PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread Joerg Roedel
From: Joerg Roedel jroe...@suse.de Hide the copied context entries from the IOMMU driver by considering them as non-present. This is implemented by setting the first AVL bit (bit 67) in the context entry to one. If this bit is set, the context_present() function returns false. Signed-off-by:

[PATCH 3/4] iommu/vt-d: Remove unmap_device_dma()

2015-06-11 Thread Joerg Roedel
From: Joerg Roedel jroe...@suse.de This removes the unmap_device_dma() function and the code-path calling it. That code looks like a left-over from Bill Sumners patch-set, as it only makes sense when kdump recovery is implemented like in his original patch-set. With the way it is implemented now

[PATCH 4/4] iommu/vt-d: Make sure si_domain is allocated for kdump kernel

2015-06-11 Thread Joerg Roedel
From: Joerg Roedel jroe...@suse.de The si_domain needs to be allocated in the kdump kernel too. Otherwise the iommu=pt case breaks with a panic of the kdump kernel. Signed-off-by: Joerg Roedel jroe...@suse.de --- drivers/iommu/intel-iommu.c | 23 +++ 1 file changed, 15

[PATCH 1/4] iommu/vt-d: Remove iommu_attach_domain_with_id()

2015-06-11 Thread Joerg Roedel
From: Joerg Roedel jroe...@suse.de We don't re-use domain-ids from the old kernel, so this function is not needed anymore. Remove it. Signed-off-by: Joerg Roedel jroe...@suse.de --- drivers/iommu/intel-iommu.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git

Re: iommu: Introduce iommu_request_dm_for_dev()

2015-06-11 Thread Joerg Roedel
Hi Dan, On Wed, Jun 10, 2015 at 02:02:44PM +0300, Dan Carpenter wrote: This is a semi-automatic email about new static checker warnings. The patch eeae3fba3afe: iommu: Introduce iommu_request_dm_for_dev() from May 28, 2015, leads to the following Smatch complaint:

[PATCH] iommu/amd: Handle errors returned from iommu_init_device

2015-06-11 Thread Joerg Roedel
Hi Dan, On Wed, Jun 10, 2015 at 06:36:18PM +0300, Dan Carpenter wrote: This is a semi-automatic email about new static checker warnings. The patch 0a3da4517107: iommu/amd: Put IOMMUv2 devices in a direct mapped domain from May 28, 2015, leads to the following Smatch complaint:

Re: iommu/amd: Implement dm_region call-backs

2015-06-11 Thread Joerg Roedel
On Wed, Jun 10, 2015 at 06:39:20PM +0300, Dan Carpenter wrote: Hello Joerg Roedel, The patch b61238c4a5e1: iommu/amd: Implement dm_region call-backs from May 28, 2015, leads to the following static checker warning: drivers/iommu/amd_iommu.c:3153 amd_iommu_get_dm_regions()

Re: [patch -next] iommu: checking for NULL instead of IS_ERR

2015-06-11 Thread Joerg Roedel
On Wed, Jun 10, 2015 at 01:59:27PM +0300, Dan Carpenter wrote: The iommu_group_alloc() and iommu_group_get_for_dev() functions return error pointers, they never return NULL. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com Applied, thanks. ___

Re: iommu/amd: Implement dm_region call-backs

2015-06-11 Thread Dan Carpenter
On Thu, Jun 11, 2015 at 09:43:27AM +0200, Joerg Roedel wrote: On Wed, Jun 10, 2015 at 06:39:20PM +0300, Dan Carpenter wrote: Hello Joerg Roedel, The patch b61238c4a5e1: iommu/amd: Implement dm_region call-backs from May 28, 2015, leads to the following static checker warning:

Re: iommu/amd: Implement dm_region call-backs

2015-06-11 Thread Joerg Roedel
On Thu, Jun 11, 2015 at 11:02:51AM +0300, Dan Carpenter wrote: On Thu, Jun 11, 2015 at 09:43:27AM +0200, Joerg Roedel wrote: What static checker do you use, btw? I'm using Smatch. The ERR_PTR stuff requires that you run smatch_scripts/build_kernel_data.sh At the start and that

Re: [PATCH v10 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel

2015-06-11 Thread David Woodhouse
On Fri, 2015-04-10 at 16:42 +0800, Li, Zhen-Hua wrote: This patchset is an update of Bill Sumner's patchset, implements a fix for: If a kernel boots with intel_iommu=on on a system that supports intel vt-d, when a panic happens, the kdump kernel will boot with these faults: But, in the

Re: [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present

2015-06-11 Thread David Woodhouse
On Thu, 2015-06-11 at 15:44 +0100, David Woodhouse wrote: It used to look like this ... Now it looks like this That's not quite right; each root entry is for only *one* bus, and the correct version looks more like this... It used to look like this: Root Table Address Register |