[PATCH 2/2] iommu: add qcom_iommu

2017-02-15 Thread Rob Clark
An iommu driver for Qualcomm "B" family devices which do not completely implement the ARM SMMU spec. These devices have context-bank register layout that is similar to ARM SMMU, but no global register space (or at least not one that is accessible). Signed-off-by: Rob Clark

[PATCH 1/2] iommu/arm-smmu: split out register defines

2017-02-15 Thread Rob Clark
I want to re-use some of these for qcom_iommu, which has (roughly) the same context-bank registers. Signed-off-by: Rob Clark --- drivers/iommu/arm-smmu-regs.h | 225 ++ drivers/iommu/arm-smmu.c | 200

Re: [PATCH 2/2] iommu: add warning when sharing groups

2017-02-15 Thread Sinan Kaya
On 2/15/2017 2:36 PM, Alex Williamson wrote: > On Tue, 14 Feb 2017 22:53:35 -0500 > ok...@codeaurora.org wrote: > >> On 2017-02-14 18:51, Alex Williamson wrote: >>> On Tue, 14 Feb 2017 16:25:22 -0500 >>> Sinan Kaya wrote: >>> The ACS requirement has been obscured in

[PATCH v10 9/9] perf/amd/iommu: Enable support for multiple IOMMUs

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

[PATCH v10 8/9] perf/amd/iommu: Fix sysfs perf attribute groups

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

[PATCH v10 6/9] perf/amd/iommu: Modify functions to query max banks and counters

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

[PATCH v10 7/9] perf/amd/iommu: Modify amd_iommu_pc_get_set_reg_val() to allow specifying IOMMU

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

[PATCH v10 2/9] perf/amd/iommu: Clean up bitwise operations

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

[PATCH v10 5/9] iommu/amd: Introduce amd_iommu_get_num_iommus()

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

[PATCH v10 3/9] perf/amd/iommu: Clean up perf_iommu_read()

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

[PATCH v10 4/9] iommu/amd: Clean up iommu_pc_get_set_reg()

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

[PATCH v10 1/9] perf/amd/iommu: Declare pr_fmt and remove unnecessary pr_debug

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

[PATCH v10 0/9] perf/amd/iommu: Enable multi-IOMMU support

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

Re: [PATCH 2/2] iommu: add warning when sharing groups

2017-02-15 Thread Alex Williamson
On Tue, 14 Feb 2017 22:53:35 -0500 ok...@codeaurora.org wrote: > On 2017-02-14 18:51, Alex Williamson wrote: > > On Tue, 14 Feb 2017 16:25:22 -0500 > > Sinan Kaya wrote: > > > >> The ACS requirement has been obscured in the current code and is only > >> known by certain

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

2017-02-15 Thread Jiri Olsa
On Wed, Feb 15, 2017 at 11:13:23AM +0100, Borislav Petkov wrote: > On Tue, Feb 07, 2017 at 02:40:28AM -0600, Suravee Suthikulpanit wrote: > > From: Suravee Suthikulpanit > > > > This patch series modifies the existing IOMMU and Perf drivers to support > > systems

Re: [PATCH v1 2/6] iommu/dmar: Rectify return code handling in detect_intel_iommu()

2017-02-15 Thread Andy Shevchenko
On Wed, 2017-02-15 at 16:42 +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.   > @@ -911,10 +911,9 @@ int __init detect_intel_iommu(void) >   } >  

[PATCH v1 4/6] iommu/dmar: Remove redundant assignment of ret

2017-02-15 Thread Andy Shevchenko
There is no need to assign ret to 0 in some cases. Moreover it might shadow some errors in the future. Remove such assignments. Signed-off-by: Andy Shevchenko --- drivers/iommu/dmar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v1 3/6] iommu/dmar: Return directly from a loop in dmar_dev_scope_status()

2017-02-15 Thread Andy Shevchenko
There is no need to have a temporary variable. Signed-off-by: Andy Shevchenko --- drivers/iommu/dmar.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index

[PATCH v1 5/6] iommu/dmar: Remove redundant ' != 0' when check return code

2017-02-15 Thread Andy Shevchenko
Usual patter when we check for return code, which might be negative errno, is either ret or !ret. Remove extra ' != 0' from condition. Signed-off-by: Andy Shevchenko --- drivers/iommu/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v1 1/6] iommu/dmar: Fix crash on boot when DMAR is disabled

2017-02-15 Thread Andy Shevchenko
By default CONFIG_INTEL_IOMMU_DEFAULT_ON is not set and thus dmar_disabled variable is set. Intel IOMMU driver based on above doesn't set intel_iommu_enabled variable. The commit b0119e870837 ("iommu: Introduce new 'struct iommu_device'") mistakenly assumes it never happens and tries to

[PATCH v1 6/6] iommu/vt-d: Use lo_hi_readq() / lo_hi_writeq()

2017-02-15 Thread Andy Shevchenko
There is already helper functions to do 64-bit I/O on 32-bit machines or buses, thus we don't need to reinvent the wheel. Signed-off-by: Andy Shevchenko --- include/linux/intel-iommu.h | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-)

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

2017-02-15 Thread Borislav Petkov
On Wed, Feb 15, 2017 at 11:44:24AM +0100, Jiri Olsa wrote: > does it say unsupported when you omit -a? Yeah, it does dump the event name like it was counting but then it says . For example: amd_iommu_0/... > [jolsa@krava perf]$ ./perf stat -e 'cpu/cpu-cycles/' ^ Haha, I

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

2017-02-15 Thread Borislav Petkov
On Wed, Feb 15, 2017 at 02:13:29PM +0700, Suravee Suthikulpanit wrote: > > So you can define a static struct pmu in the driver and do struct > > assignment directly instead of writing them one-by-one. > > I believe this is the same suggestion you have made in V8. Here's what I mean: --- diff

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

2017-02-15 Thread Borislav Petkov
On Tue, Feb 07, 2017 at 02:40:28AM -0600, Suravee Suthikulpanit wrote: > 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. >

[bug report] iommu/arm-smmu: Make use of the iommu_register interface

2017-02-15 Thread Dan Carpenter
Hello Joerg Roedel, This is a semi-automatic email about new static checker warnings. The patch 9648cbc9625b: "iommu/arm-smmu: Make use of the iommu_register interface" from Feb 1, 2017, leads to the following Smatch complaint: drivers/iommu/arm-smmu-v3.c:1810 arm_smmu_remove_device()