[PATCH v4] arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU

2017-02-07 Thread Geert Uytterhoeven
Add support for allocating physically contiguous DMA buffers on arm64 systems with an IOMMU. This can be useful when two or more devices with different memory requirements are involved in buffer sharing. Note that as this uses the CMA allocator, setting the DMA_ATTR_FORCE_CONTIGUOUS attribute has

Re: [PATCH v2 05/11] iommu/ipmmu-vmsa: Make use of IOMMU_OF_DECLARE()

2017-02-07 Thread Geert Uytterhoeven
Hi Magnus, On Mon, Jun 6, 2016 at 5:58 AM, Magnus Damm wrote: > From: Magnus Damm > > Hook up IOMMU_OF_DECLARE() support in case CONFIG_IOMMU_DMA > is enabled. The only current supported case for 32-bit ARM > is disabled, however for 64-bit ARM this is required. > > Signed-off-by: Magnus Damm >

Re: [PATCH 09/10] iommu/exynos: Make use of iommu_device_register interface

2017-02-07 Thread Marek Szyprowski
Hi Joerg, On 2017-02-06 17:10, Joerg Roedel wrote: From: Joerg Roedel Register Exynos IOMMUs to the IOMMU core and make them visible in sysfs. This patch does not add the links between IOMMUs and translated devices yet. Cc: Marek Szyprowski Cc: linux-arm-ker...@lists.infradead.org Cc: linux-

[PATCH v9 8/8] perf/amd/iommu: Enable support for multiple IOMMUs

2017-02-07 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 v9 7/8] perf/amd/iommu: Fix sysfs perf attribute groups

2017-02-07 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 v9 1/8] perf/amd/iommu: Declare pr_fmt and remove unnecessary pr_debug

2017-02-07 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 | 20 1 file changed, 8 insertions(+), 12

[PATCH v9 5/8] perf/amd/iommu: Modify functions to query max banks and counters

2017-02-07 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 v9 3/8] perf/amd/iommu: Clean up perf_iommu_read()

2017-02-07 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 v9 4/8] iommu/amd: Introduce amd_iommu_get_num_iommus()

2017-02-07 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 v9 2/8] perf/amd/iommu: Clean up bitwise operations

2017-02-07 Thread Suravee Suthikulpanit
From: Suravee Suthikulpanit Clean up register initialization 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 fi

[PATCH v9 6/8] perf/amd/iommu: Modify amd_iommu_pc_get_set_reg_val() to allow specifying IOMMU

2017-02-07 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-b

[PATCH v9 0/8] perf/amd/iommu: Enable multi-IOMMU support

2017-02-07 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