Re: dma_alloc_coherent - cma - and IOMMU question

2015-02-02 Thread Mark Hounschell
On 02/02/2015 12:35 PM, Alex Williamson wrote: [cc +joerg] On Mon, 2015-02-02 at 11:01 -0500, Mark Hounschell wrote: On 01/30/2015 04:51 PM, Alex Williamson wrote: On Fri, 2015-01-30 at 16:07 -0500, Mark Hounschell wrote: On 01/30/2015 03:11 PM, Alex Williamson wrote: On Fri, 2015-01-30 at 1

Re: [PATCH] iommu/arm-smmu: use a threaded handler for context interrupts

2015-02-02 Thread Mitchel Humpherys
On Wed, Jan 28 2015 at 04:07:39 AM, Will Deacon wrote: > On Fri, Jan 23, 2015 at 10:33:20PM +, Mitchel Humpherys wrote: >> On Fri, Jan 23 2015 at 03:24:15 AM, Will Deacon wrote: >> > On Thu, Jan 22, 2015 at 11:48:02PM +, Mitchel Humpherys wrote: >> >> Context interrupts can call domain-sp

Re: dma_alloc_coherent - cma - and IOMMU question

2015-02-02 Thread Alex Williamson
[cc +joerg] On Mon, 2015-02-02 at 11:01 -0500, Mark Hounschell wrote: > On 01/30/2015 04:51 PM, Alex Williamson wrote: > > On Fri, 2015-01-30 at 16:07 -0500, Mark Hounschell wrote: > >> On 01/30/2015 03:11 PM, Alex Williamson wrote: > >>> On Fri, 2015-01-30 at 19:12 +, Mark Hounschell wrote: >

Re: [PATCH 3/5] iommu: Limit iommu_attach/detach_device to devices with their own group

2015-02-02 Thread Will Deacon
On Fri, Jan 30, 2015 at 12:28:14PM +, Joerg Roedel wrote: > On Wed, Jan 28, 2015 at 02:35:24PM +, Will Deacon wrote: > > On Tue, Jan 27, 2015 at 12:08:57AM +, Joerg Roedel wrote: > > > @@ -51,6 +51,7 @@ struct iommu_group { > > > void (*iommu_data_release)(void *iommu_data); > > > c

Re: [PATCH v4 3/6] of: fix size when dma-range is not used

2015-02-02 Thread Murali Karicheri
On 02/02/2015 07:18 AM, Catalin Marinas wrote: On Fri, Jan 30, 2015 at 06:06:27PM +, Murali Karicheri wrote: On 01/28/2015 12:30 PM, Catalin Marinas wrote: I think we can remove this check altogether (we leaved without it for a while) but we need to add 1 when calculating the mask:

Re: dma_alloc_coherent - cma - and IOMMU question

2015-02-02 Thread Mark Hounschell
On 01/30/2015 04:51 PM, Alex Williamson wrote: On Fri, 2015-01-30 at 16:07 -0500, Mark Hounschell wrote: On 01/30/2015 03:11 PM, Alex Williamson wrote: On Fri, 2015-01-30 at 19:12 +, Mark Hounschell wrote: I've posted the following email to vger.kernel.org but got no response. I am trying

Re: [PATCH v4 3/6] of: fix size when dma-range is not used

2015-02-02 Thread Catalin Marinas
On Fri, Jan 30, 2015 at 06:06:27PM +, Murali Karicheri wrote: > On 01/28/2015 12:30 PM, Catalin Marinas wrote: > > I think we can remove this check altogether (we leaved without it for a > > while) but we need to add 1 when calculating the mask: > > > > dev->coherent_dma_mask = min(DMA_BIT_

Re: [PATCH] iommu: arm-smmu: avoid build warning

2015-02-02 Thread Will Deacon
On Fri, Jan 30, 2015 at 09:55:55PM +, Arnd Bergmann wrote: > ARM allmodconfig gained a new warning when dma_addr_t is 32-bit wide: > > drivers/iommu/arm-smmu.c: In function 'arm_smmu_iova_to_phys_hard': > drivers/iommu/arm-smmu.c:1255:3: warning: right shift count >= width of type > > This ch

[v4 7/8] iommu, x86: define irq_remapping_cap()

2015-02-02 Thread Feng Wu
This patch adds a new interface irq_remapping_cap() to detect whether irq remapping supports new features, such as VT-d Posted-Interrupts. We export this function out, so that KVM code can check this and use this mechanism properly. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu --- arch/x86/inc

[v4 2/8] iommu, x86: Define new irte structure for VT-d Posted-Interrupts

2015-02-02 Thread Feng Wu
Add a new irte_pi structure for VT-d Posted-Interrupts. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- include/linux/dmar.h | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/include/linux/dmar.h b/include/linux

[v4 6/8] iommu, x86: Setup Posted-Interrupts capability for Intel iommu

2015-02-02 Thread Feng Wu
Set Posted-Interrupts capability for Intel iommu when IR is enabled, clear it when IR is disabled. Signed-off-by: Feng Wu --- drivers/iommu/intel_irq_remapping.c | 34 ++ drivers/iommu/irq_remapping.c |2 ++ drivers/iommu/irq_remapping.h |3 +

[v4 3/8] iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip

2015-02-02 Thread Feng Wu
Implement irq_set_vcpu_affinity for intel_ir_chip. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- arch/x86/include/asm/irq_remapping.h |5 drivers/iommu/intel_irq_remapping.c | 35 ++ 2 files changed, 40 insertions(+), 0

[v4 4/8] iommu, x86: No need to migrating irq for VT-d Posted-Interrupts

2015-02-02 Thread Feng Wu
We don't need to migrate the irqs for VT-d Posted-Interrupts here. When 'pst' is set in IRTE, the associated irq will be posted to guests instead of interrupt remapping. The destination of the interrupt is set in Posted-Interrupts Descriptor, and the migration happens during vCPU scheduling. Howev

[v4 1/8] iommu: Add new member capability to struct irq_remap_ops

2015-02-02 Thread Feng Wu
This patch adds a new member capability to struct irq_remap_ops, this new function ops can be used to check whether some features are supported, such as VT-d Posted-Interrupts. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu --- arch/x86/include/asm/irq_remapping.h |4 drivers/iommu/irq_

[v4 0/8] Add VT-d Posted-Interrupts support - IOMMU part

2015-02-02 Thread Feng Wu
VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. With VT-d Posted-Interrupts enabled, external interrupts from direct-assigned devices can be delivered to guests without VMM intervention when guest is running in non-root mode. You can find the VT-d Posted-Interrtups Spec. in

[v4 5/8] iommu, x86: Add cap_pi_support() to detect VT-d PI capability

2015-02-02 Thread Feng Wu
Add helper function to detect VT-d Posted-Interrupts capability. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- include/linux/intel-iommu.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/linux/intel-iommu.h b/include/linux/intel-io

[v4 8/8] iommu, x86: Properly handler PI for IOMMU hotplug

2015-02-02 Thread Feng Wu
Return error when inserting a new IOMMU which doesn't support PI if PI is currently in use. Signed-off-by: Feng Wu --- drivers/iommu/intel_irq_remapping.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_rem

RE: [v4 0/8] Add VT-d Posted-Interrupts support - IOMMU part

2015-02-02 Thread Wu, Feng
Made a mistake with Joro's address, will resend this series again, Sorry for this! Thanks, Feng > -Original Message- > From: Wu, Feng > Sent: Monday, February 02, 2015 4:02 PM > To: dw...@infradead.org; j...@8bytes.or > Cc: jiang@linux.intel.com; iommu@lists.linux-foundation.org; > l

[v4 8/8] iommu, x86: Properly handler PI for IOMMU hotplug

2015-02-02 Thread Feng Wu
Return error when inserting a new IOMMU which doesn't support PI if PI is currently in use. Signed-off-by: Feng Wu --- drivers/iommu/intel_irq_remapping.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_rem

[v4 7/8] iommu, x86: define irq_remapping_cap()

2015-02-02 Thread Feng Wu
This patch adds a new interface irq_remapping_cap() to detect whether irq remapping supports new features, such as VT-d Posted-Interrupts. We export this function out, so that KVM code can check this and use this mechanism properly. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu --- arch/x86/inc

[v4 6/8] iommu, x86: Setup Posted-Interrupts capability for Intel iommu

2015-02-02 Thread Feng Wu
Set Posted-Interrupts capability for Intel iommu when IR is enabled, clear it when IR is disabled. Signed-off-by: Feng Wu --- drivers/iommu/intel_irq_remapping.c | 34 ++ drivers/iommu/irq_remapping.c |2 ++ drivers/iommu/irq_remapping.h |3 +

[v4 4/8] iommu, x86: No need to migrating irq for VT-d Posted-Interrupts

2015-02-02 Thread Feng Wu
We don't need to migrate the irqs for VT-d Posted-Interrupts here. When 'pst' is set in IRTE, the associated irq will be posted to guests instead of interrupt remapping. The destination of the interrupt is set in Posted-Interrupts Descriptor, and the migration happens during vCPU scheduling. Howev

[v4 3/8] iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip

2015-02-02 Thread Feng Wu
Implement irq_set_vcpu_affinity for intel_ir_chip. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- arch/x86/include/asm/irq_remapping.h |5 drivers/iommu/intel_irq_remapping.c | 35 ++ 2 files changed, 40 insertions(+), 0

[v4 2/8] iommu, x86: Define new irte structure for VT-d Posted-Interrupts

2015-02-02 Thread Feng Wu
Add a new irte_pi structure for VT-d Posted-Interrupts. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- include/linux/dmar.h | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/include/linux/dmar.h b/include/linux

[v4 0/8] Add VT-d Posted-Interrupts support - IOMMU part

2015-02-02 Thread Feng Wu
VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. With VT-d Posted-Interrupts enabled, external interrupts from direct-assigned devices can be delivered to guests without VMM intervention when guest is running in non-root mode. You can find the VT-d Posted-Interrtups Spec. in

[v4 1/8] iommu: Add new member capability to struct irq_remap_ops

2015-02-02 Thread Feng Wu
This patch adds a new member capability to struct irq_remap_ops, this new function ops can be used to check whether some features are supported, such as VT-d Posted-Interrupts. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu --- arch/x86/include/asm/irq_remapping.h |4 drivers/iommu/irq_

[v4 5/8] iommu, x86: Add cap_pi_support() to detect VT-d PI capability

2015-02-02 Thread Feng Wu
Add helper function to detect VT-d Posted-Interrupts capability. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse --- include/linux/intel-iommu.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/linux/intel-iommu.h b/include/linux/intel-io