Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1331771 > unrolled thread
| Started by | Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> |
|---|---|
| First post | 2016-02-11 10:20 +0100 |
| Last post | 2016-02-18 03:40 +0100 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH V4 0/6] perf/amd/iommu: Enable multi-IOMMU support Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-11 10:20 +0100
[PATCH V4 1/6] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-11 10:20 +0100
Re: [PATCH V4 0/6] perf/amd/iommu: Enable multi-IOMMU support Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-18 03:40 +0100
| From | Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> |
|---|---|
| Date | 2016-02-11 10:20 +0100 |
| Subject | [PATCH V4 0/6] perf/amd/iommu: Enable multi-IOMMU support |
| Message-ID | <r0VzP-6IR-5@gated-at.bofh.it> |
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
This patch series modifies the existing perf_event_amd_iommu driver
to support systems with multiple IOMMUs. It introduces new AMD IOMMU APIs,
which are used by the AMD IOMMU Perf driver to access performance
counters in multiple IOMMUs.
In addition, this series should also fix current AMD IOMMU PMU driver
initialization issue in some existing KV and CZ platform, where it fails
to write to IOMMU perf counter as reported by Andreas Hartmann here
(http://comments.gmane.org/gmane.linux.kernel.pci/49147).
Git branch containing this patch series is available here:
https://github.com/ssuthiku/linux.git perf-iommu-v4
Changes from V3 (https://lkml.org/lkml/2016/2/9/845)
* Rebase the code to tip/master per Boris suggestion
* Most changes are in patch 5/6:
* Fix several spelling and styling issues per Boris review comment
* Remove unnecessary pr_debug in the perf amd iommu driver (per Boris)
* Rename several function to make it less confusing (per Boris)
* Properly handle errors when fails to set registers/counters
on multiple IOMMUs. (per Boris)
Changes from V2 ( https://lkml.org/lkml/2016/1/1/141)
* Ported to 4.5.0-rc2
* Add reviewed by Joerg for patch 1 and 2
* Remove EXPORT_SYMBOL from patch 3 (per Joerg suggestion)
* Merge patch 4/6 and 6/6 from V2 into 5/5 in V3 and add
more description in the commit message and in code comment.
* Patch 5: modify the logic to update counts to get rid off
un-necessary local64_cmpxchg().
Changes from V1 (https://lkml.org/lkml/2015/12/22/535):
* Update patch3 and 6 to use amd_iommus_present instead of introducing
amd_iommu_cnt static variable since they are the same thing
Suravee Suthikulpanit (6):
perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
perf/amd/iommu: Modify functions to query max banks and counters
iommu/amd: Introduce amd_iommu_get_num_iommus()
perf/amd/iommu: Introduce get_iommu_bnk_cnt_evt_idx
perf/amd/iommu: Enable support for multiple IOMMUs
perf/amd/iommu: Declar pr_fmt and remove unnecessary pr_debug
arch/x86/events/amd/iommu.c | 197 ++++++++++++++++++++++------------
arch/x86/events/amd/iommu.h | 40 -------
arch/x86/include/asm/perf/amd/iommu.h | 42 ++++++++
drivers/iommu/amd_iommu_init.c | 136 +++++++++++++++++++----
drivers/iommu/amd_iommu_proto.h | 7 --
5 files changed, 286 insertions(+), 136 deletions(-)
delete mode 100644 arch/x86/events/amd/iommu.h
create mode 100644 arch/x86/include/asm/perf/amd/iommu.h
--
2.5.0
[toc] | [next] | [standalone]
| From | Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> |
|---|---|
| Date | 2016-02-11 10:20 +0100 |
| Subject | [PATCH V4 1/6] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header |
| Message-ID | <r0VzR-6IR-41@gated-at.bofh.it> |
| In reply to | #1331771 |
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> First, this patch move arch/x86/events/amd/iommu.h to arch/x86/include/asm/perf/amd/iommu.h so that we easily include it in both perf-amd-iommu and amd-iommu drivers. Then, we consolidate declarion of AMD IOMMU performance counter APIs into one file. Reviewed-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> --- arch/x86/events/amd/iommu.c | 2 +- arch/x86/events/amd/iommu.h | 40 --------------------------------- arch/x86/include/asm/perf/amd/iommu.h | 42 +++++++++++++++++++++++++++++++++++ drivers/iommu/amd_iommu_init.c | 2 ++ drivers/iommu/amd_iommu_proto.h | 7 ------ 5 files changed, 45 insertions(+), 48 deletions(-) delete mode 100644 arch/x86/events/amd/iommu.h create mode 100644 arch/x86/include/asm/perf/amd/iommu.h diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c index 629bc70..2f96072 100644 --- a/arch/x86/events/amd/iommu.c +++ b/arch/x86/events/amd/iommu.c @@ -15,9 +15,9 @@ #include <linux/module.h> #include <linux/cpumask.h> #include <linux/slab.h> +#include <asm/perf/amd/iommu.h> #include "../../kernel/cpu/perf_event.h" -#include "iommu.h" #define COUNTER_SHIFT 16 diff --git a/arch/x86/events/amd/iommu.h b/arch/x86/events/amd/iommu.h deleted file mode 100644 index 845d173..0000000 --- a/arch/x86/events/amd/iommu.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013 Advanced Micro Devices, Inc. - * - * Author: Steven Kinney <Steven.Kinney@amd.com> - * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _PERF_EVENT_AMD_IOMMU_H_ -#define _PERF_EVENT_AMD_IOMMU_H_ - -/* iommu pc mmio region register indexes */ -#define IOMMU_PC_COUNTER_REG 0x00 -#define IOMMU_PC_COUNTER_SRC_REG 0x08 -#define IOMMU_PC_PASID_MATCH_REG 0x10 -#define IOMMU_PC_DOMID_MATCH_REG 0x18 -#define IOMMU_PC_DEVID_MATCH_REG 0x20 -#define IOMMU_PC_COUNTER_REPORT_REG 0x28 - -/* maximun specified bank/counters */ -#define PC_MAX_SPEC_BNKS 64 -#define PC_MAX_SPEC_CNTRS 16 - -/* iommu pc reg masks*/ -#define IOMMU_BASE_DEVID 0x0000 - -/* amd_iommu_init.c external support functions */ -extern bool amd_iommu_pc_supported(void); - -extern u8 amd_iommu_pc_get_max_banks(u16 devid); - -extern u8 amd_iommu_pc_get_max_counters(u16 devid); - -extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, - u8 fxn, u64 *value, bool is_write); - -#endif /*_PERF_EVENT_AMD_IOMMU_H_*/ diff --git a/arch/x86/include/asm/perf/amd/iommu.h b/arch/x86/include/asm/perf/amd/iommu.h new file mode 100644 index 0000000..72f64b7 --- /dev/null +++ b/arch/x86/include/asm/perf/amd/iommu.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 Advanced Micro Devices, Inc. + * + * Author: Steven Kinney <Steven.Kinney@amd.com> + * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _PERF_EVENT_AMD_IOMMU_H_ +#define _PERF_EVENT_AMD_IOMMU_H_ + +/* iommu pc mmio region register indexes */ +#define IOMMU_PC_COUNTER_REG 0x00 +#define IOMMU_PC_COUNTER_SRC_REG 0x08 +#define IOMMU_PC_PASID_MATCH_REG 0x10 +#define IOMMU_PC_DOMID_MATCH_REG 0x18 +#define IOMMU_PC_DEVID_MATCH_REG 0x20 +#define IOMMU_PC_COUNTER_REPORT_REG 0x28 + +/* maximum specified bank/counters */ +#define PC_MAX_SPEC_BNKS 64 +#define PC_MAX_SPEC_CNTRS 16 + +/* iommu pc reg masks*/ +#define IOMMU_BASE_DEVID 0x0000 + +/* amd_iommu_init.c external support functions */ +bool amd_iommu_pc_supported(void); + +u8 amd_iommu_pc_get_max_banks(u16 devid); + +u8 amd_iommu_pc_get_max_counters(u16 devid); + +int amd_iommu_pc_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, u64 *value); + +int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, + u64 *value, bool is_write); + +#endif /*_PERF_EVENT_AMD_IOMMU_H_*/ diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 013bdff..d30f4b2 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -27,6 +27,8 @@ #include <linux/amd-iommu.h> #include <linux/export.h> #include <linux/iommu.h> +#include <asm/perf/amd/iommu.h> + #include <asm/pci-direct.h> #include <asm/iommu.h> #include <asm/gart.h> diff --git a/drivers/iommu/amd_iommu_proto.h b/drivers/iommu/amd_iommu_proto.h index 0bd9eb3..ac2da91 100644 --- a/drivers/iommu/amd_iommu_proto.h +++ b/drivers/iommu/amd_iommu_proto.h @@ -55,13 +55,6 @@ extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid); extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev); -/* IOMMU Performance Counter functions */ -extern bool amd_iommu_pc_supported(void); -extern u8 amd_iommu_pc_get_max_banks(u16 devid); -extern u8 amd_iommu_pc_get_max_counters(u16 devid); -extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, - u64 *value, bool is_write); - #ifdef CONFIG_IRQ_REMAP extern int amd_iommu_create_irq_domain(struct amd_iommu *iommu); #else -- 2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> |
|---|---|
| Date | 2016-02-18 03:40 +0100 |
| Message-ID | <r3mFA-7hh-17@gated-at.bofh.it> |
| In reply to | #1331771 |
Hi All, I am wondering if there are any other concerns for this patch series. Thanks, Suravee On 2/11/16 16:15, Suravee Suthikulpanit wrote: > From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> > > This patch series modifies the existing perf_event_amd_iommu driver > to support systems with multiple IOMMUs. It introduces new AMD IOMMU APIs, > which are used by the AMD IOMMU Perf driver to access performance > counters in multiple IOMMUs. > > In addition, this series should also fix current AMD IOMMU PMU driver > initialization issue in some existing KV and CZ platform, where it fails > to write to IOMMU perf counter as reported by Andreas Hartmann here > (http://comments.gmane.org/gmane.linux.kernel.pci/49147). > > Git branch containing this patch series is available here: > > https://github.com/ssuthiku/linux.git perf-iommu-v4 > > Changes from V3 (https://lkml.org/lkml/2016/2/9/845) > * Rebase the code to tip/master per Boris suggestion > * Most changes are in patch 5/6: > * Fix several spelling and styling issues per Boris review comment > * Remove unnecessary pr_debug in the perf amd iommu driver (per Boris) > * Rename several function to make it less confusing (per Boris) > * Properly handle errors when fails to set registers/counters > on multiple IOMMUs. (per Boris) > > Changes from V2 ( https://lkml.org/lkml/2016/1/1/141) > * Ported to 4.5.0-rc2 > * Add reviewed by Joerg for patch 1 and 2 > * Remove EXPORT_SYMBOL from patch 3 (per Joerg suggestion) > * Merge patch 4/6 and 6/6 from V2 into 5/5 in V3 and add > more description in the commit message and in code comment. > * Patch 5: modify the logic to update counts to get rid off > un-necessary local64_cmpxchg(). > > Changes from V1 (https://lkml.org/lkml/2015/12/22/535): > * Update patch3 and 6 to use amd_iommus_present instead of introducing > amd_iommu_cnt static variable since they are the same thing > > Suravee Suthikulpanit (6): > perf/amd/iommu: Consolidate and move perf_event_amd_iommu header > perf/amd/iommu: Modify functions to query max banks and counters > iommu/amd: Introduce amd_iommu_get_num_iommus() > perf/amd/iommu: Introduce get_iommu_bnk_cnt_evt_idx > perf/amd/iommu: Enable support for multiple IOMMUs > perf/amd/iommu: Declar pr_fmt and remove unnecessary pr_debug > > arch/x86/events/amd/iommu.c | 197 ++++++++++++++++++++++------------ > arch/x86/events/amd/iommu.h | 40 ------- > arch/x86/include/asm/perf/amd/iommu.h | 42 ++++++++ > drivers/iommu/amd_iommu_init.c | 136 +++++++++++++++++++---- > drivers/iommu/amd_iommu_proto.h | 7 -- > 5 files changed, 286 insertions(+), 136 deletions(-) > delete mode 100644 arch/x86/events/amd/iommu.h > create mode 100644 arch/x86/include/asm/perf/amd/iommu.h >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web