Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330730 > unrolled thread

[PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

Started bySuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
First post2016-02-10 00:00 +0100
Last post2016-02-10 20:10 +0100
Articles 6 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-10 00:00 +0100
    Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move  perf_event_amd_iommu header Borislav Petkov <bp@alien8.de> - 2016-02-10 17:50 +0100
      Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move  perf_event_amd_iommu header Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-10 19:50 +0100
        Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move  perf_event_amd_iommu header Borislav Petkov <bp@alien8.de> - 2016-02-10 20:00 +0100
          Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move  perf_event_amd_iommu header Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-10 20:00 +0100
            Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move  perf_event_amd_iommu header Borislav Petkov <bp@alien8.de> - 2016-02-10 20:10 +0100

#1330730 — [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2016-02-10 00:00 +0100
Subject[PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0pqj-251-35@gated-at.bofh.it>
This patch consolidates "arch/x86/kernel/cpu/perf_event_amd_iommu.h" and
"drivers/iommu/amd_iommu_proto.h", which contain duplicate function
declarations, into "include/linux/perf/perf_event_amd_iommu.h"

Reviewed-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
---
 arch/x86/kernel/cpu/perf_event_amd_iommu.c |  2 +-
 arch/x86/kernel/cpu/perf_event_amd_iommu.h | 40 ------------------------------
 drivers/iommu/amd_iommu_init.c             |  2 ++
 drivers/iommu/amd_iommu_proto.h            |  7 ------
 include/linux/perf/perf_event_amd_iommu.h  | 40 ++++++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 48 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h
 create mode 100644 include/linux/perf/perf_event_amd_iommu.h

diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 97242a9..d44525e 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -12,12 +12,12 @@
  */
 
 #include <linux/perf_event.h>
+#include <linux/perf/perf_event_amd_iommu.h>
 #include <linux/module.h>
 #include <linux/cpumask.h>
 #include <linux/slab.h>
 
 #include "perf_event.h"
-#include "perf_event_amd_iommu.h"
 
 #define COUNTER_SHIFT		16
 
diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.h b/arch/x86/kernel/cpu/perf_event_amd_iommu.h
deleted file mode 100644
index 845d173..0000000
--- a/arch/x86/kernel/cpu/perf_event_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/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 013bdff..b6d684c 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 <linux/perf/perf_event_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
diff --git a/include/linux/perf/perf_event_amd_iommu.h b/include/linux/perf/perf_event_amd_iommu.h
new file mode 100644
index 0000000..845d173
--- /dev/null
+++ b/include/linux/perf/perf_event_amd_iommu.h
@@ -0,0 +1,40 @@
+/*
+ * 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_*/
-- 
2.5.0

[toc] | [next] | [standalone]


#1331325 — Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromBorislav Petkov <bp@alien8.de>
Date2016-02-10 17:50 +0100
SubjectRe: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0G7M-4Gb-25@gated-at.bofh.it>
In reply to#1330730
On Tue, Feb 09, 2016 at 04:53:51PM -0600, Suravee Suthikulpanit wrote:
> This patch consolidates "arch/x86/kernel/cpu/perf_event_amd_iommu.h" and
> "drivers/iommu/amd_iommu_proto.h", which contain duplicate function
> declarations, into "include/linux/perf/perf_event_amd_iommu.h"
> 
> Reviewed-by: Joerg Roedel <jroedel@suse.de>
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
>  arch/x86/kernel/cpu/perf_event_amd_iommu.c |  2 +-
>  arch/x86/kernel/cpu/perf_event_amd_iommu.h | 40 ------------------------------
>  drivers/iommu/amd_iommu_init.c             |  2 ++
>  drivers/iommu/amd_iommu_proto.h            |  7 ------
>  include/linux/perf/perf_event_amd_iommu.h  | 40 ++++++++++++++++++++++++++++++
>  5 files changed, 43 insertions(+), 48 deletions(-)
>  delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h
>  create mode 100644 include/linux/perf/perf_event_amd_iommu.h

Is this a header which will be used on something else besides x86 or why
is it being moved to include/linux/ ?

If not, it should go into arch/x86/events/ with the rest of the perf
private headers.

...

> diff --git a/include/linux/perf/perf_event_amd_iommu.h b/include/linux/perf/perf_event_amd_iommu.h
> new file mode 100644
> index 0000000..845d173
> --- /dev/null
> +++ b/include/linux/perf/perf_event_amd_iommu.h
> @@ -0,0 +1,40 @@
> +/*
> + * 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 */

s/maximun/maximum/

> +#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);

You can drop the "extern" qualifiers while at it - they're not needed.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [next] | [standalone]


#1331432 — Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2016-02-10 19:50 +0100
SubjectRe: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0HZU-62x-3@gated-at.bofh.it>
In reply to#1331325
Hi Boris,

On 2/10/16 23:41, Borislav Petkov wrote:
> On Tue, Feb 09, 2016 at 04:53:51PM -0600, Suravee Suthikulpanit wrote:
>> >This patch consolidates "arch/x86/kernel/cpu/perf_event_amd_iommu.h" and
>> >"drivers/iommu/amd_iommu_proto.h", which contain duplicate function
>> >declarations, into "include/linux/perf/perf_event_amd_iommu.h"
>> >
>> >Reviewed-by: Joerg Roedel<jroedel@suse.de>
>> >Signed-off-by: Suravee Suthikulpanit<Suravee.Suthikulpanit@amd.com>
>> >---
>> >  arch/x86/kernel/cpu/perf_event_amd_iommu.c |  2 +-
>> >  arch/x86/kernel/cpu/perf_event_amd_iommu.h | 40 ------------------------------
>> >  drivers/iommu/amd_iommu_init.c             |  2 ++
>> >  drivers/iommu/amd_iommu_proto.h            |  7 ------
>> >  include/linux/perf/perf_event_amd_iommu.h  | 40 ++++++++++++++++++++++++++++++
>> >  5 files changed, 43 insertions(+), 48 deletions(-)
>> >  delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h
>> >  create mode 100644 include/linux/perf/perf_event_amd_iommu.h
> Is this a header which will be used on something else besides x86 or why
> is it being moved to include/linux/ ?
>
> If not, it should go into arch/x86/events/ with the rest of the perf
> private headers.
>
> ...
>

My goal here is to find a place that I can declare a set of function 
prototypes and macros used in the IOMMU driver and IOMMU PERF. These are 
exported by the AMD IOMMU and can be used by other drivers (e.g. IOMMU 
perf).

The reason I picked this location to place the header file is because 
there is already an existing include/linux/perf/arm_pmu.h file there. 
So, I thought it might be alright to put the perf_event_amd_iommu.h here.

Having the information in the file arch/x86/events/amd/iommu.h seems 
strange for having to specify ../../arch/x86/events/amd/iommu.h in the 
IOMMU driver.

So, you think it would be alright if move

include/linux/perf/perf_event_amd_iommu.h
to
arch/x86/include/perf/perf_event_amd_iommu.h


Suravee

Thanks,
Suravee

[toc] | [prev] | [next] | [standalone]


#1331436 — Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromBorislav Petkov <bp@alien8.de>
Date2016-02-10 20:00 +0100
SubjectRe: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0I9A-65O-3@gated-at.bofh.it>
In reply to#1331432
On Thu, Feb 11, 2016 at 01:42:52AM +0700, Suravee Suthikulpanit wrote:
> The reason I picked this location to place the header file is because
> there is already an existing include/linux/perf/arm_pmu.h file there.

I don't think anything arch-specific belongs in generic kernel header
paths.

> So, I thought it might be alright to put the perf_event_amd_iommu.h
> here.
>
> Having the information in the file arch/x86/events/amd/iommu.h seems
> strange for having to specify ../../arch/x86/events/amd/iommu.h in the
> IOMMU driver.
>
> So, you think it would be alright if move
> 
> include/linux/perf/perf_event_amd_iommu.h
> to
> arch/x86/include/perf/perf_event_amd_iommu.h

If it feels strange to you, you can move it to arch/x86/include/asm/
There we put the arch-specific stuff.

Then you can do

#include <asm/perf/amd/iommu.h>

or so. I've moved it to arch/x86/events/amd/iommu.h already anyway.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [next] | [standalone]


#1331437 — Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2016-02-10 20:00 +0100
SubjectRe: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0I9A-65O-5@gated-at.bofh.it>
In reply to#1331436
Hi,

On 2/11/16 01:51, Borislav Petkov wrote:
>> So, I thought it might be alright to put the perf_event_amd_iommu.h
>> >here.
>> >
>> >Having the information in the file arch/x86/events/amd/iommu.h seems
>> >strange for having to specify ../../arch/x86/events/amd/iommu.h in the
>> >IOMMU driver.
>> >
>> >So, you think it would be alright if move
>> >
>> >include/linux/perf/perf_event_amd_iommu.h
>> >to
>> >arch/x86/include/perf/perf_event_amd_iommu.h
> If it feels strange to you, you can move it to arch/x86/include/asm/
> There we put the arch-specific stuff.
>
> Then you can do
>
> #include <asm/perf/amd/iommu.h>
>
> or so. I've moved it to arch/x86/events/amd/iommu.h already anyway.

Ah.. agree then ;) So, I should branch off that tree of yours with the 
file already moved. Could you point me to it?

Thanks,
Suravee

[toc] | [prev] | [next] | [standalone]


#1331443 — Re: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header

FromBorislav Petkov <bp@alien8.de>
Date2016-02-10 20:10 +0100
SubjectRe: [PATCH V3 1/5] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header
Message-ID<r0Ijf-6oz-1@gated-at.bofh.it>
In reply to#1331437
On Thu, Feb 11, 2016 at 01:56:43AM +0700, Suravee Suthikulpanit wrote:
> Ah.. agree then ;) So, I should branch off that tree of yours with the file
> already moved. Could you point me to it?

Not my tree, tip/master:

http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git, the master branch.

Just rediff your stuff ontop.

HTH.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web