Re: [GIT PULL] iommu/arm-smmu: Fixes for 4.11

2017-03-22 Thread Joerg Roedel
On Wed, Mar 22, 2017 at 06:38:50PM +, Will Deacon wrote: > The following changes since commit c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201: > > Linux 4.11-rc1 (2017-03-05 12:59:56 -0800) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.

Re: [RFC PATCH 24/30] iommu: Specify PASID state when unbinding a task

2017-03-22 Thread Joerg Roedel
On Wed, Mar 22, 2017 at 06:31:01PM +, Jean-Philippe Brucker wrote: > The problem might be too tied to the specifics of the SMMU. As implemented > in this series, the normal flow for a PPR with the SMMU is the following: > > (1) PCI device issues a PPR for PASID 1 > (2) The PPR is queued by the

Re: [iommu:core 3/3] drivers/iommu/iova.c:36: error: redefinition of 'init_iova_domain'

2017-03-22 Thread Joerg Roedel
On Wed, Mar 22, 2017 at 07:36:52PM +0100, Thierry Reding wrote: > *sigh* I think I messed up the #ifdef line. The attached .config has > CONFIG_IOMMU_IOVA=m, which means that the #ifdef won't be true. I think > the proper fix would be to: > > -#ifdef CONFIG_IOMMU_IOVA > +#ifdef IS_ENABLED(CONFIG_I

[GIT PULL] iommu/arm-smmu: Fixes for 4.11

2017-03-22 Thread Will Deacon
Hi Joerg, Please pull these two ARM io-pgtable fixes from Oleksandr for 4.11. They're not critical, but they mean that we detect misuses in the iommu_{map,unmap} API instead of deferencing junk pointers in the kernel. I've had them queued locally for a while, so Robin and I have given them a fair

Re: [iommu:core 3/3] drivers/iommu/iova.c:36: error: redefinition of 'init_iova_domain'

2017-03-22 Thread Thierry Reding
On Thu, Mar 23, 2017 at 02:28:27AM +0800, kbuild test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git core > head: 21aff52ab2c831c2f07d48e2fa8d4bab26a66992 > commit: 21aff52ab2c831c2f07d48e2fa8d4bab26a66992 [3/3] iommu: Add dummy > implementations for !IOMMU

[iommu:core 3/3] drivers/iommu/iova.c:36: error: redefinition of 'init_iova_domain'

2017-03-22 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git core head: 21aff52ab2c831c2f07d48e2fa8d4bab26a66992 commit: 21aff52ab2c831c2f07d48e2fa8d4bab26a66992 [3/3] iommu: Add dummy implementations for !IOMMU_IOVA config: x86_64-randconfig-a0-03222342 (attached as .config) compiler:

Re: [RFC PATCH 24/30] iommu: Specify PASID state when unbinding a task

2017-03-22 Thread Jean-Philippe Brucker
On 22/03/17 15:44, Joerg Roedel wrote: > On Mon, Feb 27, 2017 at 07:54:35PM +, Jean-Philippe Brucker wrote: >> It is an important distinction because, if the IOMMU driver reassigns a >> PASID while the IOMMU still holds pending PPR targeting that PASID >> internally, the PPR will trigger a faul

Re: [RFC PATCH 22/30] iommu: Bind/unbind tasks to/from devices

2017-03-22 Thread Jean-Philippe Brucker
Hi Joerg, On 22/03/17 15:36, Joerg Roedel wrote: > On Fri, Mar 03, 2017 at 06:39:58PM +, Jean-Philippe Brucker wrote: >> Yes, it would be nice to have a common PASID allocator. But I don't >> think that a system-wide PASID space is workable for us. At the moment >> systems might have a few ide

Re: [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA

2017-03-22 Thread Thierry Reding
On Wed, Mar 22, 2017 at 03:55:30PM +0100, Joerg Roedel wrote: > Hi Thierry > > On Mon, Mar 20, 2017 at 08:14:31PM +0100, Thierry Reding wrote: > > I've got a series of patches that I'd like to merge for v4.12 that have > > a build-time dependency on this patch. It would therefore be great to > > g

Re: [PATCH 0/3] IOVA allocation improvements for iommu-dma

2017-03-22 Thread Nate Watterson
On 2017-03-15 09:33, Robin Murphy wrote: Hi all, Hi Robin, Here's the first bit of lock contention removal to chew on - feedback welcome! Note that for the current users of the io-pgtable framework, this is most likely to simply push more contention onto the io-pgtable lock, so may not show a

Re: [RFC PATCH 22/30] iommu: Bind/unbind tasks to/from devices

2017-03-22 Thread Joerg Roedel
Hi Jean-Philippe, On Mon, Feb 27, 2017 at 07:54:33PM +, Jean-Philippe Brucker wrote: > +extern int iommu_set_svm_ops(struct device *dev, > + const struct iommu_svm_ops *svm_ops); > +extern int iommu_bind_task(struct device *dev, struct task_struct *task, > +

Re: [RFC PATCH 24/30] iommu: Specify PASID state when unbinding a task

2017-03-22 Thread Joerg Roedel
On Mon, Feb 27, 2017 at 07:54:35PM +, Jean-Philippe Brucker wrote: > It is an important distinction because, if the IOMMU driver reassigns a > PASID while the IOMMU still holds pending PPR targeting that PASID > internally, the PPR will trigger a fault in the wrong address space. The IOMMU dri

Re: [RFC PATCH 22/30] iommu: Bind/unbind tasks to/from devices

2017-03-22 Thread Joerg Roedel
On Fri, Mar 03, 2017 at 06:39:58PM +, Jean-Philippe Brucker wrote: > Yes, it would be nice to have a common PASID allocator. But I don't > think that a system-wide PASID space is workable for us. At the moment > systems might have a few identical devices all supporting 20 bits of > PASID. But c

Re: [PATCH v2 4/4] iommu/dma: Make PCI window reservation generic

2017-03-22 Thread Joerg Roedel
On Thu, Mar 16, 2017 at 05:00:19PM +, Robin Murphy wrote: > Now that we're applying the IOMMU API reserved regions to our IOVA > domains, we shouldn't need to privately special-case PCI windows, or > indeed anything else which isn't specific to our iommu-dma layer. > However, since those aren't

Re: [PATCH v2 1/4] iommu: Disambiguate MSI region types

2017-03-22 Thread Joerg Roedel
On Thu, Mar 16, 2017 at 05:00:16PM +, Robin Murphy wrote: > The introduction of reserved regions has left a couple of rough edges > which we could do with sorting out sooner rather than later. Since we > are not yet addressing the potential dynamic aspect of software-managed > reservations and

Re: [PATCH v3 0/2] Handle Cavium ThunderX2 PCI topology quirk

2017-03-22 Thread Jon Masters
On 03/22/2017 04:51 AM, Jayachandran C wrote: > Hi Bjorn, Alex, > > Here is v3 of the patchset to handle the PCIe topology quirk of > Cavium ThunderX2 (previously called Broadcom Vulcan). > > The earlier discussions on this can be seen at: > http://www.spinics.net/lists/linux-pci/msg51001.html >

Re: [PATCH 2/2] iommu: Add dummy implementations for !IOMMU_IOVA

2017-03-22 Thread Joerg Roedel
Hi Thierry On Mon, Mar 20, 2017 at 08:14:31PM +0100, Thierry Reding wrote: > I've got a series of patches that I'd like to merge for v4.12 that have > a build-time dependency on this patch. It would therefore be great to > get your Acked-by on this so that I can merge it through the DRM tree > wit

Re: [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache

2017-03-22 Thread Joerg Roedel
On Mon, Mar 20, 2017 at 10:17:56AM +0100, Marek Szyprowski wrote: > Documentation specifies that SYSMMU should be in blocked state while > performing TLB/FLPD cache invalidation, so add needed calls to > sysmmu_block/unblock. > > Fixes: 66a7ed84b345d ("iommu/exynos: Apply workaround of caching fau

Re: [PATCH v2 1/5] iommu/dmar: Rectify return code handling in detect_intel_iommu()

2017-03-22 Thread Joerg Roedel
On Thu, Mar 16, 2017 at 04:23:51PM +0200, Andy Shevchenko wrote: > There is inconsistency in return codes across the functions called from > detect_intel_iommu(). > > Make it consistent and propagate return code to the caller. > > Signed-off-by: Andy Shevchenko Applied all, thanks. ___

Re: IOMMU detection via sysfs

2017-03-22 Thread Alex Williamson
On Wed, 22 Mar 2017 11:06:47 + Gabor Locsei wrote: > Hello, > > I have systems with IOMMU optionally enabled, and I would like to find a > method to check these capabilities that doesn't rely on dmesg. > The evident problem is that dmesg eventually clear boot time messages so the > relevan

Re: [PATCH v3 0/3] iommu/ipmmu-vmsa: r8a7796 support V3

2017-03-22 Thread Geert Uytterhoeven
Hi Jörg, On Wed, Mar 22, 2017 at 3:23 PM, Joerg Roedel wrote: > On Sun, Mar 12, 2017 at 02:38:20PM +0900, Magnus Damm wrote: >> iommu/ipmmu-vmsa: r8a7796 support V3 >> >> [PATCH v3 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding >> [PATCH v3 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48

Re: [PATCH v7 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops

2017-03-22 Thread Joerg Roedel
On Tue, Mar 07, 2017 at 12:17:33PM +0900, Magnus Damm wrote: > From: Magnus Damm > > Introduce an alternative set of iommu_ops suitable for 64-bit ARM > as well as 32-bit ARM when CONFIG_IOMMU_DMA=y. Also adjust the > Kconfig to depend on ARM or IOMMU_DMA. Initialize the device > from ->xlate() w

Re: [PATCH/RFC v2 0/4] iommu/ipmmu-vmsa: IPMMU slave device whitelist V2

2017-03-22 Thread Joerg Roedel
On Fri, Jan 27, 2017 at 03:14:07PM +0900, Magnus Damm wrote: > iommu/ipmmu-vmsa: IPMMU slave device whitelist V2 > > [PATCH/RFC v2 1/4] iommu/of: Skip IOMMU devices disabled in DT > [PATCH/RFC v2 2/4] iommu/ipmmu-vmsa: Get rid of disabled device check > [PATCH/RFC v2 3/4] iommu/ipmmu-vmsa: Check d

Re: [PATCH v3 0/3] iommu/ipmmu-vmsa: r8a7796 support V3

2017-03-22 Thread Joerg Roedel
Hey Magnus, On Sun, Mar 12, 2017 at 02:38:20PM +0900, Magnus Damm wrote: > iommu/ipmmu-vmsa: r8a7796 support V3 > > [PATCH v3 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding > [PATCH v3 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 > [PATCH v3 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT ma

Re: [PATCH v2 5/5] iommu: Allow default domain type to be set on the kernel command line

2017-03-22 Thread Joerg Roedel
On Tue, Mar 21, 2017 at 05:21:37PM +, Will Deacon wrote: > On Tue, Mar 21, 2017 at 04:45:27PM +0100, Joerg Roedel wrote: > > On Fri, Mar 10, 2017 at 08:49:36PM +, Will Deacon wrote: > > > @@ -1014,8 +1027,8 @@ struct iommu_group *iommu_group_get_for_dev(struct > > > device *dev) > > >*

Re: amd-iommu: can't boot with amdgpu, AMD-Vi: Completion-Wait loop timed out

2017-03-22 Thread 'j...@8bytes.org'
On Tue, Mar 21, 2017 at 04:30:55PM +, Deucher, Alexander wrote: > > I am preparing a debug-patch that disables ATS for these GPUs so someone > > with such a chip can test it. > > Thanks Joerg. Here is a debug patch, using the hard hammer of disabling the use of ATS completly in the AMD IOMMU

IOMMU detection via sysfs

2017-03-22 Thread Gabor Locsei
Hello, I have systems with IOMMU optionally enabled, and I would like to find a method to check these capabilities that doesn't rely on dmesg. The evident problem is that dmesg eventually clear boot time messages so the relevant lines may just disappear. Looks like there are sysfs entries that

Re: [PATCH v3 1/2] PCI: Add device flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT

2017-03-22 Thread Jayachandran C
On Wed, Mar 22, 2017 at 08:51:10AM +, Jayachandran C wrote: > From: Jayachandran C Looks like I did not fix up the author to my new mail ID. Please ignore this part. I can send out a clean revision if needed, until then please drop the broadcom.com mail id in any reply to avoid bounces. Sor

[PATCH v3 2/2] PCI: quirks: Fix ThunderX2 dma alias handling

2017-03-22 Thread Jayachandran C
From: Jayachandran C The Cavium ThunderX2 arm64 SoCs (called Broadcom Vulcan earlier), the PCI topology is slightly unusual. For a multi-node system, it looks like: [node level PCI bridges - one per node] [SoC PCI devices with MSI-X but no IOMMU] [PCI-PCIe "glue" bridges - upto 14, one p

[PATCH v3 1/2] PCI: Add device flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT

2017-03-22 Thread Jayachandran C
From: Jayachandran C Add a new quirk flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT to limit the DMA alias search to go no further than the bridge where the IOMMU unit is attached. The flag will be used to indicate a bridge device which forwards the address translation requests to the IOMMU, i.e where the

[PATCH v3 0/2] Handle Cavium ThunderX2 PCI topology quirk

2017-03-22 Thread Jayachandran C
Hi Bjorn, Alex, Here is v3 of the patchset to handle the PCIe topology quirk of Cavium ThunderX2 (previously called Broadcom Vulcan). The earlier discussions on this can be seen at: http://www.spinics.net/lists/linux-pci/msg51001.html https://patchwork.ozlabs.org/patch/582633/ and https://lists.l

[PATCH v12 05/10] iommu/amd: Introduce amd_iommu_get_num_iommus()

2017-03-22 Thread Suravee Suthikulpanit
Introduce amd_iommu_get_num_iommus(), which returns the value of amd_iommus_present. The function is used to replace direct access to the variable, which is now declared as static. This function will also be used by Perf AMD IOMMU driver. Cc: Borislav Petkov Cc: Joerg Roedel Signed-off-by: Sura

[PATCH v12 08/10] perf/amd/iommu: Fix sysfs perf attribute groups

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Introduce static amd_iommu_attr_groups to simplify the sysfs attributes initialization code. Cc: Peter Zijlstra Cc: Borislav Petkov Signed-off-by: Suravee Suthikulpanit --- arch/x86/events/amd/iommu.c | 81 ++--- 1 file chan

[PATCH v12 06/10] perf/amd/iommu: Modify functions to query max banks and counters

2017-03-22 Thread Suravee Suthikulpanit
Currently, amd_iommu_pc_get_max_[banks|counters]() use end-point device ID to locate an IOMMU and check the reported max banks/counters. The logic assumes that the IOMMU_BASE_DEVID belongs to the first IOMMU, and uses it to acquire a reference to the first IOMMU, which does not work on certain syst

[PATCH v12 09/10] perf/amd/iommu: Introduce amd_iommu-specific struct in struct hw_perf_event

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Current AMD IOMMU Perf PMU inappropriately uses hardware struct inside the union inside the struct hw_perf_event, mainly the use of extra_reg. Instead, introduce amd_iommu-specific struct with required parameters to be programmed onto the IOMMU performance counter con

[PATCH v12 07/10] perf/amd/iommu: Modify amd_iommu_pc_get_set_reg_val() to allow specifying IOMMU

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit The current amd_iommu_pc_get_set_reg_val() cannot support multiple IOMMUs. So, modify it to allow callers to specify IOMMU. This prepares the driver for supporting multi-IOMMU in subsequent patch. Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Joerg Roedel Signed-off-

[PATCH v12 10/10] perf/amd/iommu: Enable support for multiple IOMMUs

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Add multi-IOMMU support for perf by exposing an AMD IOMMU PMU for each IOMMU found in the system via: /bus/event_source/devices/amd_iommu_x where x is the IOMMU index. This allows users to specify different events to be programmed onto performance counters of each

[PATCH v12 04/10] iommu/amd: Clean up iommu_pc_get_set_reg()

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Clean up coding style and fix a bug in the 64-bit register read logic since it overwrites the upper 32-bit when reading the lower 32-bit. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd_iommu_init.c | 13 - 1 file changed, 8 insertions(+), 5 d

[PATCH v12 03/10] perf/amd/iommu: Clean up perf_iommu_read()

2017-03-22 Thread Suravee Suthikulpanit
Fix coding style and make use of GENMASK_ULL macro. Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Joerg Roedel Signed-off-by: Suravee Suthikulpanit --- arch/x86/events/amd/iommu.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/x86/events/amd/iommu.c b/

[PATCH v12 01/10] perf/amd/iommu: Declare pr_fmt and remove unnecessary pr_debug

2017-03-22 Thread Suravee Suthikulpanit
Declare pr_fmt for perf/amd_iommu and remove unnecessary pr_debug. Also check return value when _init_events_attrs fails. Cc: Peter Zijlstra Cc: Borislav Petkov Signed-off-by: Suravee Suthikulpanit --- arch/x86/events/amd/iommu.c | 22 +- 1 file changed, 9 insertions(+), 1

[PATCH v12 02/10] perf/amd/iommu: Clean up bitwise operations

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Clean up register initializaton and make use of BIT_ULL(x) where appropriate. This should not affect logic and functionality. Cc: Peter Zijlstra Cc: Borislav Petkov Signed-off-by: Suravee Suthikulpanit --- arch/x86/events/amd/iommu.c | 18 +- 1 fil

[PATCH v12 00/10] perf/amd/iommu: Enable multi-IOMMU support

2017-03-22 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit This patch series modifies the existing IOMMU and Perf drivers to support systems with multiple IOMMUs by allocating an amd_iommu PMU per IOMMU instance. This allows users to specify performance events and filters separately for each IOMMU. This has been tested on the