Skip to contentSkip to conversation

ARM: shmobile: enable PMU(Performance Monitoring Unit)

PATCH Superseded Tetsuyuki Kobayshi 3 participants 14 messages Sep 5, 2012 – Sep 11, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Simon-san

ARM core has hardware performance counters and perf command uses these counters for detailed profiling information.
The follewing patches enables PMU(Performance Monitoring Unit) for sh73a0 and emev2 SoCs. I tested these patches on kzm9g board and kzm9d board.

Tetsuyuki Kobayashi (2):
ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
ARM: shmobile: emev2: enable PMU(Performance Monitoring Unit)

 arch/arm/mach-shmobile/setup-emev2.c  |   26 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/setup-sh73a0.c |   26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

v2 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Simon-san

ARM core has hardware performance counters and perf command uses these counters for detailed profiling information.
The follewing patches enables PMU(Performance Monitoring Unit) for sh73a0 and emev2 SoCs. I tested these patches on kzm9g board and kzm9d board.

Tetsuyuki Kobayashi (2):
ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
ARM: shmobile: emev2: enable PMU(Performance Monitoring Unit)

 arch/arm/configs/kzm9d_defconfig      |    1 +
 arch/arm/configs/kzm9g_defconfig      |    1 +
 arch/arm/mach-shmobile/setup-emev2.c  |   22 ++++++++++++++++++++++
 arch/arm/mach-shmobile/setup-sh73a0.c |   22 ++++++++++++++++++++++
 4 files changed, 46 insertions(+)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/2 ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for sh73a0.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9g_defconfig

 arch/arm/configs/kzm9g_defconfig      |    1 +
 arch/arm/mach-shmobile/setup-sh73a0.c |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
arch/arm/configs/kzm9g_defconfig +1 -0
index 2388c86..5d0c667 100644
@@ -14,6 +14,7 @@ CONFIG_NAMESPACES=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
arch/arm/mach-shmobile/setup-sh73a0.c +22 -0
index d230af6..8186a08 100644
@@ -39,6 +39,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/pmu.h>
 
 static struct map_desc sh73a0_io_desc[] __initdata = {
 	/* create a 1:1 entity map for 0xe6xxxxxx
@@ -734,6 +735,26 @@ static struct platform_device mpdma0_device = {
 	},
 };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= gic_spi(55),
+		.end	= gic_spi(55),
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= gic_spi(56),
+		.end	= gic_spi(56),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
+	.id		= ARM_PMU_DEVICE_CPU,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};
+
 static struct platform_device *sh73a0_early_devices[] __initdata = {
 	&scif0_device,
 	&scif1_device,
@@ -757,6 +778,7 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
 	&i2c4_device,
 	&dma0_device,
 	&mpdma0_device,
+	&pmu_device,
 };
 
 #define SRCR2          0xe61580b0
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v2 1/2 ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)

Quoted 51 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for sh73a0.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9g_defconfig

 arch/arm/configs/kzm9g_defconfig      |    1 +
 arch/arm/mach-shmobile/setup-sh73a0.c |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
arch/arm/configs/kzm9g_defconfig +1 -0
index 2388c86..5d0c667 100644
@@ -14,6 +14,7 @@ CONFIG_NAMESPACES=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
arch/arm/mach-shmobile/setup-sh73a0.c +10 -0
index d230af6..8186a08 100644
@@ -39,6 +39,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/pmu.h>
 
 static struct map_desc sh73a0_io_desc[] __initdata = {
 	/* create a 1:1 entity map for 0xe6xxxxxx
@@ -734,6 +735,26 @@ static struct platform_device mpdma0_device = {
 	},
 };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= gic_spi(55),
+		.end	= gic_spi(55),
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= gic_spi(56),
+		.end	= gic_spi(56),

arch/arm/mach-shmobile/setup-sh73a0.c static struct platform_device mpdma0_device = { · line 756

Quoted 10 lines
arch/arm/mach-shmobile/setup-sh73a0.c +10 -0
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
+	.id		= ARM_PMU_DEVICE_CPU,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};

Please check my latest perf stuff to go into arm-soc (pmu/cleanup). The ARM_PMU_DEVICE_CPU crap has disappeared and you won't need to include asm/pmu.h anymore.

Will

#4 lore raw

PATCH v2 1/2 ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)

Hello, Will

Quoted 58 lines · Will Deacon
Quoted 57 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for sh73a0.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9g_defconfig

  arch/arm/configs/kzm9g_defconfig      |    1 +
  arch/arm/mach-shmobile/setup-sh73a0.c |   22 ++++++++++++++++++++++
  2 files changed, 23 insertions(+)
arch/arm/configs/kzm9g_defconfig +1 -0
index 2388c86..5d0c667 100644
@@ -14,6 +14,7 @@ CONFIG_NAMESPACES=y
  CONFIG_CC_OPTIMIZE_FOR_SIZE=y
  CONFIG_SYSCTL_SYSCALL=y
  CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
  CONFIG_SLAB=y
  CONFIG_MODULES=y
  CONFIG_MODULE_FORCE_LOAD=y
arch/arm/mach-shmobile/setup-sh73a0.c +16 -0
index d230af6..8186a08 100644
@@ -39,6 +39,7 @@
  #include <asm/mach/map.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/time.h>
+#include <asm/pmu.h>
 
  static struct map_desc sh73a0_io_desc[] __initdata = {
  	/* create a 1:1 entity map for 0xe6xxxxxx
@@ -734,6 +735,26 @@ static struct platform_device mpdma0_device = {
  	},
  };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= gic_spi(55),
+		.end	= gic_spi(55),
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= gic_spi(56),
+		.end	= gic_spi(56),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
Quoted 9 lines

arch/arm/mach-shmobile/setup-sh73a0.c static struct platform_device mpdma0_device = { · line 756

Quoted 4 lines
arch/arm/mach-shmobile/setup-sh73a0.c +4 -0
+	.id		= ARM_PMU_DEVICE_CPU,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};

Please check my latest perf stuff to go into arm-soc (pmu/cleanup). The ARM_PMU_DEVICE_CPU crap has disappeared and you won't need to include asm/pmu.h anymore.

Thak you, Will. I'm checking out pmu/cleanup branch of arm-soc. I will post v3 patch based on it.

#5 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Will

Could you apply this patch set to your pmu/cleanup branch on arm-soc?

The follewing patches enables PMU(Performance Monitoring Unit) for sh73a0 and emev2 SoCs. I tested these patches on kzm9g board and kzm9d board.

Tetsuyuki Kobayashi (2):
ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)
ARM: shmobile: emev2: enable PMU(Performance Monitoring Unit)

 arch/arm/configs/kzm9d_defconfig      |    1 +
 arch/arm/configs/kzm9g_defconfig      |    1 +
 arch/arm/mach-shmobile/setup-emev2.c  |   21 +++++++++++++++++++++
 arch/arm/mach-shmobile/setup-sh73a0.c |   21 +++++++++++++++++++++
 4 files changed, 44 insertions(+)
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v3 1/2 ARM: shmobile: sh73a0: enable PMU(Performance Monitoring Unit)

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for sh73a0.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9g_defconfig

Changes for v3:
- Rebased to pmu/clean on arm-soc.

 arch/arm/configs/kzm9g_defconfig      |    1 +
 arch/arm/mach-shmobile/setup-sh73a0.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
arch/arm/configs/kzm9g_defconfig +1 -0
index 2388c86..5d0c667 100644
@@ -14,6 +14,7 @@ CONFIG_NAMESPACES=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_FORCE_LOAD=y
arch/arm/mach-shmobile/setup-sh73a0.c +21 -0
index d230af6..38ed2dd 100644
@@ -734,6 +734,26 @@ static struct platform_device mpdma0_device = {
 	},
 };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= gic_spi(55),
+		.end	= gic_spi(55),
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= gic_spi(56),
+		.end	= gic_spi(56),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};
+
 static struct platform_device *sh73a0_early_devices[] __initdata = {
 	&scif0_device,
 	&scif1_device,
@@ -757,6 +777,7 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
 	&i2c4_device,
 	&dma0_device,
 	&mpdma0_device,
+	&pmu_device,
 };
 
 #define SRCR2          0xe61580b0
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v3 2/2 ARM: shmobile: emev2: enable PMU(Performance Monitoring Unit)

In reply to Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for emev2.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9d_defconfig

Changes for v3:
- Rebased to pmu/clean on arm-soc.

 arch/arm/configs/kzm9d_defconfig     |    1 +
 arch/arm/mach-shmobile/setup-emev2.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
arch/arm/configs/kzm9d_defconfig +1 -0
index 26146ff..8c49df6 100644
@@ -8,6 +8,7 @@ CONFIG_LOG_BUF_SHIFT=16
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
arch/arm/mach-shmobile/setup-emev2.c +21 -0
index dae9aa6..61446f3 100644
@@ -356,6 +356,26 @@ static struct platform_device gio4_device = {
 	},
 };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= 152,
+		.end	= 152,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= 153,
+		.end	= 153,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};
+
 static struct platform_device *emev2_early_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
@@ -370,6 +390,7 @@ static struct platform_device *emev2_late_devices[] __initdata = {
 	&gio2_device,
 	&gio3_device,
 	&gio4_device,
+	&pmu_device,
 };
 
 void __init emev2_add_standard_devices(void)
Signature · 1 line
1.7.9.5
#8 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

In reply to Tetsuyuki Kobayshi
Quoted 3 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Will

Hi,

Thanks for updating the patches.

Quoted 1 line

Could you apply this patch set to your pmu/cleanup branch on arm-soc?

Actually, it's better if you just base your branch against that one when you send it to arm-soc for merging. That way, other SoCs can also develop against that branch without having to worry about each other.

Cheers,

Will

#9 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

Hi, Will
Hi, Simon

Quoted 7 lines · Will Deacon
Quoted 3 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Will

Hi,

Quoted 8 lines

Thanks for updating the patches.

Quoted 1 line

Could you apply this patch set to your pmu/cleanup branch on arm-soc?

Actually, it's better if you just base your branch against that one when you send it to arm-soc for merging. That way, other SoCs can also develop against that branch without having to worry about each other.

I see.
I thought that removing ARM_PMU_DEVICE_CPU depends on your pmu/cleanup branch, but I found it does not.
I verified this v3 patch can apply cleanly to soc branch on renesus.git and works fine.

Simon-san, could you apply this v3 patch to soc branch after review ?

#10 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

Quoted 10 lines · Tetsuyuki Kobayashi
Quoted 6 lines · Will Deacon
Quoted 1 line · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

Actually, it's better if you just base your branch against that one when you send it to arm-soc for merging. That way, other SoCs can also develop against that branch without having to worry about each other.

I see.
I thought that removing ARM_PMU_DEVICE_CPU depends on your pmu/cleanup branch, but I found it does not.

It will probably build alright for you without my patches, but I don't thinkt it will work correctly as we'll fail to reserve the PMU.

Will

#11 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

In reply to Tetsuyuki Kobayashi
Quoted 19 lines · Tetsuyuki Kobayashi

Hi, Will
Hi, Simon

Quoted 7 lines · Will Deacon
Quoted 3 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Will

Hi,

Quoted 8 lines

Thanks for updating the patches.

Quoted 1 line

Could you apply this patch set to your pmu/cleanup branch on arm-soc?

Actually, it's better if you just base your branch against that one when you send it to arm-soc for merging. That way, other SoCs can also develop against that branch without having to worry about each other.

Quoted 7 lines

I see.
I thought that removing ARM_PMU_DEVICE_CPU depends on your pmu/cleanup branch, but I found it does not.
I verified this v3 patch can apply cleanly to soc branch on renesus.git and works fine.

Simon-san, could you apply this v3 patch to soc branch after review ?

Sure, will do.

#12 lore raw

v3 cover ARM: shmobile: enable PMU(Performance Monitoring Unit)

In reply to Tetsuyuki Kobayshi
Quoted 7 lines · Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

Hello, Will

Could you apply this patch set to your pmu/cleanup branch on arm-soc?

The follewing patches enables PMU(Performance Monitoring Unit) for sh73a0 and emev2 SoCs. I tested these patches on kzm9g board and kzm9d board.

Thanks, I have pushed this to the pmu/cleanup branch of my renesas tree and sent a pull-request to Will.

#13 lore raw

PATCH v2 2/2 ARM: shmobile: emev2: enable PMU(Performance Monitoring Unit)

In reply to Tetsuyuki Kobayshi

From: Tetsuyuki Kobayashi <[email protected]>

This patch enables PMU(Performance Monitoring Unit) for emev2.

---
Changes for v2:
- Removed #ifdef CONFIG_HW_PERF_EVENTS
- Added kzm9d_defconfig

 arch/arm/configs/kzm9d_defconfig     |    1 +
 arch/arm/mach-shmobile/setup-emev2.c |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
arch/arm/configs/kzm9d_defconfig +1 -0
index 26146ff..8c49df6 100644
@@ -8,6 +8,7 @@ CONFIG_LOG_BUF_SHIFT=16
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
arch/arm/mach-shmobile/setup-emev2.c +22 -0
index dae9aa6..e1219a3 100644
@@ -36,6 +36,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/hardware/gic.h>
+#include <asm/pmu.h>
 
 static struct map_desc emev2_io_desc[] __initdata = {
 #ifdef CONFIG_SMP
@@ -356,6 +357,26 @@ static struct platform_device gio4_device = {
 	},
 };
 
+static struct resource pmu_resources[] = {
+	[0] = {
+		.start	= 152,
+		.end	= 152,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[1] = {
+		.start	= 153,
+		.end	= 153,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device pmu_device = {
+	.name		= "arm-pmu",
+	.id		= ARM_PMU_DEVICE_CPU,
+	.num_resources	= ARRAY_SIZE(pmu_resources),
+	.resource	= pmu_resources,
+};
+
 static struct platform_device *emev2_early_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
@@ -370,6 +391,7 @@ static struct platform_device *emev2_late_devices[] __initdata = {
 	&gio2_device,
 	&gio3_device,
 	&gio4_device,
+	&pmu_device,
 };
 
 void __init emev2_add_standard_devices(void)
Signature · 1 line
1.7.9.5