[PATCH 2/4] iommu/omap: Replace BUG() in iopgtable_store_entry_core()

2016-04-04 Thread Suman Anna
The iopgtable_store_entry_core() function uses a BUG() statement for an unsupported page size entry programming. Replace this with a less severe WARN_ON() and perform a graceful bailout on error. Signed-off-by: Suman Anna --- drivers/iommu/omap-iommu.c | 4 +++- 1 file changed, 3 insertions(+),

[PATCH 3/4] iommu/omap: Use WARN_ON for page table alignment check

2016-04-04 Thread Suman Anna
The OMAP IOMMU page table needs to be aligned on a 16K boundary, and the current code uses a BUG_ON on the alignment sanity check in the .domain_alloc() ops implementation. Replace this with a less severe WARN_ON and bail out gracefully. Signed-off-by: Suman Anna --- drivers/iommu/omap-iommu.c |

[PATCH 4/4] iommu/omap: Align code with open parenthesis

2016-04-04 Thread Suman Anna
This patch fixes one existing alignment checkpatch check warning of the type "Alignment should match open parenthesis" in the OMAP IOMMU debug source file. Signed-off-by: Suman Anna --- drivers/iommu/omap-iommu-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i

[PATCH 1/4] iommu/omap: Remove iopgtable_clear_entry_all() from driver remove

2016-04-04 Thread Suman Anna
The function iopgtable_clear_entry_all() is used for clearing all the page table entries. These entries are neither created nor initialized during the OMAP IOMMU driver probe, and are managed only when a client device attaches to the IOMMU. So, there is no need to invoke this function on a driver r

[PATCH 0/4] Some OMAP IOMMU Cleanups

2016-04-04 Thread Suman Anna
Hi Joerg, Following are some minor cleanups to the OMAP IOMMU driver intended for the next merge window. Patch 1 fixes a crash when the IOMMU device is attempted to be unbound from the driver using sysfs when no clients were attached to the MMU. This is not a critical failure during normal usage

[PATCH 07/10] x86/cpufeature: Remove cpu_has_apic

2016-04-04 Thread Borislav Petkov
From: Borislav Petkov Signed-off-by: Borislav Petkov Cc: oprofile-l...@lists.sf.net Cc: iommu@lists.linux-foundation.org Cc: linux...@vger.kernel.org --- arch/x86/events/core.c | 2 +- arch/x86/include/asm/cpufeature.h| 1 - arch/x86/include/asm/irq_work.h |

Re: Regression since 4.1

2016-04-04 Thread Tom Wimmenhove
Joerg Roedel writes: > > Hi Tobias, > > On Thu, Dec 10, 2015 at 12:07:57AM +0100, Tobias Geiger wrote: > > It all comes down to kernel > 4.1 && iommu=on = not working here > > > > Hardware is: > > Intel DX58SO, Intel CPU i7 920... all pretty solid running for years now, > > always with iommo

Re: [PATCH 1/4] mm: add is_highmem_addr() helper

2016-04-04 Thread Vignesh R
Hi, On 03/31/2016 05:59 PM, Boris Brezillon wrote: > Add an helper to check if a virtual address is in the highmem region. > > Signed-off-by: Boris Brezillon > --- > include/linux/highmem.h | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/include/linux/highmem.h b/includ

[PATCH 4/6] of: Introduce of_for_each_phandle() helper macro

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel With this macro any user can easily iterate over a list of phandles. The patch also converts __of_parse_phandle_with_args() to make use of the macro. The of_count_phandle_with_args() function is not converted, because the macro hides the return value of of_phandle_iterator_ini

[PATCH 6/6] iommu/arm-smmu: Make use of phandle iterators in device-tree parsing

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel Remove the usage of of_parse_phandle_with_args() and replace it by the phandle-iterator implementation so that we can parse out all of the potentially present 128 stream-ids. Signed-off-by: Joerg Roedel --- drivers/iommu/arm-smmu.c | 38 ++

[PATCH 1/6] of: Introduce struct of_phandle_iterator

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel This struct carrys all necessary information to iterate over a list of phandles and extract the arguments. Add an init-function for the iterator and make use of it in __of_parse_phandle_with_args(). Signed-off-by: Joerg Roedel Acked-by: Rob Herring --- drivers/of/base.c |

[PATCH 3/6] of: Remove counting special case from __of_parse_phandle_with_args()

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel The index = -1 case in __of_parse_phandle_with_args() is used to just return the number of phandles. That special case needs extra handling, so move it to the place where it is needed: of_count_phandle_with_args(). This allows to further simplify __of_parse_phandle_with_args()

[PATCH 2/6] of: Move phandle walking to of_phandle_iterator_next()

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel Move the code to walk over the phandles out of the loop in __of_parse_phandle_with_args() to a separate function that just works with the iterator handle: of_phandle_iterator_next(). Signed-off-by: Joerg Roedel Acked-by: Rob Herring --- drivers/of/base.c | 130

[PATCH 5/6] of: Introduce of_phandle_iterator_args()

2016-04-04 Thread Joerg Roedel
From: Joerg Roedel This helper function can be used to copy the arguments of a phandle to an array. Signed-off-by: Joerg Roedel Acked-by: Rob Herring --- drivers/of/base.c | 29 +++-- include/linux/of.h | 10 ++ 2 files changed, 33 insertions(+), 6 deletions(-

[PATCH 0/6 v2] of: Implement iterator for phandles

2016-04-04 Thread Joerg Roedel
Hi, here is a new version of the implementation of the iterator over phandles concept which Rob Herring suggested to me some time ago. My approach is a little bit different from what the diff showed back then, but it gets rid of the allocation and 'struct of_phandle_args' misuse. I also converted

Re: [PATCH 0/6] of: Implement iterator for phandles

2016-04-04 Thread Joerg Roedel
On Wed, Mar 23, 2016 at 03:37:44PM -0500, Rob Herring wrote: > On Wed, Mar 23, 2016 at 6:54 AM, Joerg Roedel wrote: > > Thanks a lot for your fast reply! I guess these patches will go through > > the DT tree, or should I carry them in the IOMMU tree? The DT tree > > probably makes more sense. > >

Re: [PATCH 1/4] mm: add is_highmem_addr() helper

2016-04-04 Thread Boris Brezillon
On Mon, 4 Apr 2016 13:44:11 +0530 Vignesh R wrote: > Hi, > > On 03/31/2016 05:59 PM, Boris Brezillon wrote: > > Add an helper to check if a virtual address is in the highmem region. > > > > Signed-off-by: Boris Brezillon > > --- > > include/linux/highmem.h | 13 + > > 1 file chang

Re: [PATCH v2] iommu/arm-smmu: Make use of phandle iterators in device-tree device-tree parsing

2016-04-04 Thread Joerg Roedel
On Wed, Mar 23, 2016 at 11:18:25PM +0800, kbuild test robot wrote: >drivers/iommu/arm-smmu.c: In function 'arm_smmu_device_dt_probe': >drivers/iommu/arm-smmu.c:1746:29: error: storage size of 'it' isn't known > struct of_phandle_iterator it; > ^ > >> dri

Re: [PATCH 6/6] iommu/arm-smmu: Make use of phandle iterators in device-tree parsing

2016-04-04 Thread Joerg Roedel
Hi Will, On Tue, Mar 29, 2016 at 06:22:16PM +0100, Will Deacon wrote: > > + > > + if (i == 0) > > + goto out_put_masters; > > I'm confused by this hunk. If i == 0, then we shouldn't have registered > any masters and therefore out_put_masters won't have anything to do. The idea was th

Re: AMD-Vi regression with PCIe/PCI bridges in 4.4

2016-04-04 Thread Joerg Roedel
Hi Clemens, On Sun, Apr 03, 2016 at 08:59:53AM +0200, Clemens Ladisch wrote: > there are several reports of Xonar PCIe sound cards failing to work in > kernel 4.4 (including 4.4.5): > > https://bugzilla.redhat.com/show_bug.cgi?id=1313790 > https://bugzilla.kernel.org/show_bug.cgi?id=111711 > http

Re: [PATCH] iommu/arm-smmu: Fix stream-match conflict with IOMMU_DOMAIN_DMA

2016-04-04 Thread Eric Auger
Hi Will, On 04/01/2016 06:19 PM, Will Deacon wrote: > Commit cbf8277ef456 ("iommu/arm-smmu: Treat IOMMU_DOMAIN_DMA as bypass > for now") ignores requests to attach a device to the default domain > since, without IOMMU-basked DMA ops available everywhere, the default > domain will just lead to unexp

Re: [PATCH v6 2/5] vfio: allow the user to register reserved iova range for MSI mapping

2016-04-04 Thread Eric Auger
On 04/04/2016 11:30 AM, kbuild test robot wrote: > Hi Eric, > > [auto build test ERROR on iommu/next] > [also build test ERROR on v4.6-rc2 next-20160404] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url:

Re: [PATCH v6 2/5] vfio: allow the user to register reserved iova range for MSI mapping

2016-04-04 Thread kbuild test robot
Hi Eric, [auto build test ERROR on iommu/next] [also build test ERROR on v4.6-rc2 next-20160404] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Eric-Auger/KVM-PCIe-MSI-passthrough-on-ARM

Re: [PATCH v6 4/4] msi: IOMMU map the doorbell address when needed

2016-04-04 Thread Eric Auger
On 04/04/2016 11:22 AM, kbuild test robot wrote: > Hi Eric, > > [auto build test ERROR on tip/irq/core] > [also build test ERROR on v4.6-rc2 next-20160404] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url:

Re: [PATCH v6 4/4] msi: IOMMU map the doorbell address when needed

2016-04-04 Thread kbuild test robot
Hi Eric, [auto build test ERROR on tip/irq/core] [also build test ERROR on v4.6-rc2 next-20160404] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Eric-Auger/KVM-PCIe-MSI-passthrough-on-ARM

[PATCH v6 3/5] vfio/type1: also check IRQ remapping capability at msi domain

2016-04-04 Thread Eric Auger
On x86 IRQ remapping is abstracted by the IOMMU. On ARM this is abstracted by the msi controller. vfio_safe_irq_domain allows to check whether interrupts are "safe" for a given device. They are if the device does not use MSI or if the device uses MSI and the msi-parent controller supports IRQ remap

[PATCH v6 0/5] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 3/3: vfio changes

2016-04-04 Thread Eric Auger
This series allows the user-space to register a reserved IOVA domain. This completes the kernel integration of the whole functionality on top of part 1 & 2. We reuse the VFIO DMA MAP ioctl with a new flag to bridge to the dma-reserved-iommu API. The number of IOVA pages to provision for MSI bindin

[PATCH v6 2/5] vfio: allow the user to register reserved iova range for MSI mapping

2016-04-04 Thread Eric Auger
The user is allowed to [un]register a reserved IOVA range by using the DMA MAP API and setting the new flag: VFIO_DMA_MAP_FLAG_MSI_RESERVED_IOVA. It provides the base address and the size. This region is stored in the vfio_dma rb tree. At that point the iova range is not mapped to any target addres

[PATCH v6 4/5] iommu/arm-smmu: do not advertise IOMMU_CAP_INTR_REMAP

2016-04-04 Thread Eric Auger
Do not advertise IOMMU_CAP_INTR_REMAP for arm-smmu. Indeed the irq_remapping capability is abstracted on irqchip side for ARM as opposed to Intel IOMMU featuring IRQ remapping HW. So to check IRQ remapping capability, the msi domain needs to be checked instead. This commit needs to be applied aft

[PATCH v6 5/5] vfio/type1: return MSI mapping requirements with VFIO_IOMMU_GET_INFO

2016-04-04 Thread Eric Auger
This patch allows the user-space to know whether MSI addresses need to be mapped in the IOMMU. The user-space uses VFIO_IOMMU_GET_INFO ioctl and IOMMU_INFO_REQUIRE_MSI_MAP gets set if they need to. Also the number of IOMMU pages requested to map those is returned in msi_iova_pages field. User-spac

[PATCH v6 1/5] vfio: introduce VFIO_IOVA_RESERVED vfio_dma type

2016-04-04 Thread Eric Auger
We introduce a vfio_dma type since we will need to discriminate legacy vfio_dma's from new reserved ones. Since those latter are not mapped at registration, some treatments need to be reworked: removal, replay. Currently they are unplugged. In subsequent patches they will be reworked. Signed-off-b

[PATCH v6 3/4] msi: export msi_get_domain_info

2016-04-04 Thread Eric Auger
We plan to use msi_get_domain_info in VFIO module so let's export it. Signed-off-by: Eric Auger --- v2 -> v3: - remove static implementation in case CONFIG_PCI_MSI_IRQ_DOMAIN is not set --- kernel/irq/msi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c

[PATCH v6 4/4] msi: IOMMU map the doorbell address when needed

2016-04-04 Thread Eric Auger
In case the msi is emitted by a device attached to an iommu domain and this iommu domain requires MSI mapping, the msi address (aka doorbell) must be mapped in the IOMMU. Else MSI write transaction will cause a fault. We handle the iommu mapping/unmapping anytime the msi address is updated. In ca

[PATCH v6 0/4] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes

2016-04-04 Thread Eric Auger
This series implements the MSI address mapping/unmapping in the MSI sub-system. binding happens on msi_domain_set_affinity, msi_domain_activate, msi_domain_deactivate. a new MSI domain info flag value is introduced to report whether the msi domain implements IRQ remapping. GIC v3 ITS is the first

[PATCH v6 2/4] irqchip/gic-v3-its: ITS advertises MSI_FLAG_IRQ_REMAPPING

2016-04-04 Thread Eric Auger
The ITS is the first ARM MSI controller advertising the new MSI_FLAG_IRQ_REMAPPING flag. It does so because it supports interrupt translation service. This HW support offers isolation of MSIs, feature used when using KVM device passthrough. Signed-off-by: Eric Auger --- v5: new --- drivers/irq

[PATCH v6 1/4] msi: Add a new MSI_FLAG_IRQ_REMAPPING flag

2016-04-04 Thread Eric Auger
Let's introduce a new msi_domain_info flag value, MSI_FLAG_IRQ_REMAPPING meant to tell the domain supports IRQ REMAPPING, also known as Interrupt Translation Service. On Intel HW this IRQ remapping capability is abstracted on IOMMU side while on ARM it is abstracted on MSI controller side. This fla

[PATCH v6 7/7] dma-reserved-iommu: iommu_unmap_reserved

2016-04-04 Thread Eric Auger
Introduce a new function whose role is to unmap all allocated reserved IOVAs and free the reserved iova domain Signed-off-by: Eric Auger --- v5 -> v6: - use spin_lock instead of mutex v3 -> v4: - previously "iommu/arm-smmu: relinquish reserved resources on domain deletion" --- drivers/iommu/

[PATCH v6 5/7] dma-reserved-iommu: reserved binding rb-tree and helpers

2016-04-04 Thread Eric Auger
we will need to track which host physical addresses are mapped to reserved IOVA. In that prospect we introduce a new RB tree indexed by physical address. This RB tree only is used for reserved IOVA bindings. It is expected this RB tree will contain very few bindings. Those generally correspond to

[PATCH v6 1/7] iommu: Add DOMAIN_ATTR_MSI_MAPPING attribute

2016-04-04 Thread Eric Auger
Introduce a new DOMAIN_ATTR_MSI_MAPPING domain attribute. If supported, this means the MSI addresses need to be mapped in the IOMMU. x86 IOMMUs typically don't expose the attribute since on x86, MSI write transaction addresses always are within the 1MB PA region [FEE0_h - FEF0_000h] window whi

[PATCH v6 6/7] dma-reserved-iommu: iommu_get/put_single_reserved

2016-04-04 Thread Eric Auger
This patch introduces iommu_get/put_single_reserved. iommu_get_single_reserved allows to allocate a new reserved iova page and map it onto the physical page that contains a given physical address. Page size is the IOMMU page one. It is the responsability of the system integrator to make sure the i

[PATCH v6 4/7] dma-reserved-iommu: alloc/free_reserved_iova_domain

2016-04-04 Thread Eric Auger
Introduce alloc/free_reserved_iova_domain in the IOMMU API. alloc_reserved_iova_domain initializes an iova domain at a given iova base address and with a given size. This iova domain will be used to allocate iova within that window. Those IOVAs will be reserved for special purpose, typically MSI fr

[PATCH v6 0/7] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 1/3: iommu changes

2016-04-04 Thread Eric Auger
This series introduces the dma-reserved-iommu api used to: - create/destroy an iova domain dedicated to reserved iova bindings - map/unmap physical addresses onto reserved IOVAs. - unmap and destroy all IOVA reserved bindings Currently reserved IOVAs are meant to map MSI physical doorbells. A sing

[PATCH v6 3/7] iommu: introduce a reserved iova cookie

2016-04-04 Thread Eric Auger
This patch introduces some new fields in the iommu_domain struct, dedicated to reserved iova management. In a similar way as DMA mapping IOVA window, we need to store information related to a reserved IOVA window. The reserved_iova_cookie will store the reserved iova_domain handle. An RB tree ind

[PATCH v6 2/7] iommu/arm-smmu: advertise DOMAIN_ATTR_MSI_MAPPING attribute

2016-04-04 Thread Eric Auger
On ARM, MSI write transactions from device upstream to the smmu are conveyed through the iommu. Therefore target physical addresses must be mapped and DOMAIN_ATTR_MSI_MAPPING is set to advertise this requirement on arm-smmu and arm-smmu-v3. Signed-off-by: Eric Auger Signed-off-by: Bharat Bhushan