From: Jeremy Linton <jeremy.linton@arm.com> To: linux-arm-kernel@lists.infradead.org Cc: linux-acpi@vger.kernel.org, will.deacon@arm.com, mark.rutland@arm.com, punit.agrawal@arm.com, steve.capper@arm.com, msalter@redhat.com, mlangsdorf@redhat.com, linux@armlinux.org.uk, lorenzo.pieralisi@arm.com, bamvor.zhangjian@linaro.org Subject: [PATCH v14 2/6] arm64: pmu: Cache PMU interrupt numbers from MADT parse Date: Mon, 23 Jan 2017 16:32:41 -0600 [thread overview] Message-ID: <1485210765-9422-3-git-send-email-jeremy.linton@arm.com> (raw) In-Reply-To: <1485210765-9422-1-git-send-email-jeremy.linton@arm.com> From: Mark Salter <msalter@redhat.com> In the case of ACPI, the PMU IRQ information is contained in the MADT table. Also, since the PMU does not exist as a device in the ACPI DSDT table, it is necessary to create a platform device so that the appropriate driver probing is triggered. Since the platform device creation needs to happen after the CPU's have been started, and the MADT parsing needs to happen before, we save off the interrupt numbers discovered during the parsing. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> --- arch/arm64/kernel/smp.c | 5 +++++ drivers/perf/Kconfig | 4 ++++ drivers/perf/Makefile | 1 + drivers/perf/arm_pmu_acpi.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/perf/arm_pmu.h | 7 +++++++ 5 files changed, 53 insertions(+) create mode 100644 drivers/perf/arm_pmu_acpi.c diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index cb87234..789587d 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -37,6 +37,7 @@ #include <linux/completion.h> #include <linux/of.h> #include <linux/irq_work.h> +#include <linux/perf/arm_pmu.h> #include <asm/alternative.h> #include <asm/atomic.h> @@ -551,6 +552,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) } bootcpu_valid = true; early_map_cpu_to_node(0, acpi_numa_get_nid(0, hwid)); + arm_pmu_parse_acpi(0, processor); return; } @@ -571,6 +573,9 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) */ acpi_set_mailbox_entry(cpu_count, processor); + /* get PMU irq info */ + arm_pmu_parse_acpi(cpu_count, processor); + early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count, hwid)); cpu_count++; diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig index 4d5c5f9..697df05 100644 --- a/drivers/perf/Kconfig +++ b/drivers/perf/Kconfig @@ -19,4 +19,8 @@ config XGENE_PMU help Say y if you want to use APM X-Gene SoC performance monitors. +config ARM_PMU_ACPI + def_bool y + depends on ARM_PMU && ACPI + endmenu diff --git a/drivers/perf/Makefile b/drivers/perf/Makefile index b116e98..d1d7762 100644 --- a/drivers/perf/Makefile +++ b/drivers/perf/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_ARM_PMU) += arm_pmu.o obj-$(CONFIG_XGENE_PMU) += xgene_pmu.o +obj-$(CONFIG_ARM_PMU_ACPI) += arm_pmu_acpi.o diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c new file mode 100644 index 0000000..becc861 --- /dev/null +++ b/drivers/perf/arm_pmu_acpi.c @@ -0,0 +1,36 @@ +/* + * ARM ACPI PMU support + * + * Copyright (C) 2015 Red Hat Inc. + * Author: Mark Salter <msalter@redhat.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include <asm/cpu.h> +#include <linux/acpi.h> +#include <linux/irq.h> + +struct pmu_irq { + int gsi; + int trigger; + bool used; +}; + +static struct pmu_irq pmu_irqs[NR_CPUS]; + +/* + * Called from acpi_map_gic_cpu_interface()'s MADT parsing during boot. + * This routine saves off the GSI's and their trigger state for use when we are + * ready to build the PMU platform device. + */ +void __init arm_pmu_parse_acpi(int cpu, struct acpi_madt_generic_interrupt *gic) +{ + pmu_irqs[cpu].gsi = gic->performance_interrupt; + if (gic->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) + pmu_irqs[cpu].trigger = ACPI_EDGE_SENSITIVE; + else + pmu_irqs[cpu].trigger = ACPI_LEVEL_SENSITIVE; +} diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 8462da2..df1ba55 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -164,4 +164,11 @@ int arm_pmu_device_probe(struct platform_device *pdev, #endif /* CONFIG_ARM_PMU */ +#ifdef CONFIG_ARM_PMU_ACPI +struct acpi_madt_generic_interrupt; +void arm_pmu_parse_acpi(int cpu, struct acpi_madt_generic_interrupt *gic); +#else +#define arm_pmu_parse_acpi(a, b) do { } while (0) +#endif /* CONFIG_ARM_PMU_ACPI */ + #endif /* __ARM_PMU_H__ */ -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: jeremy.linton@arm.com (Jeremy Linton) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v14 2/6] arm64: pmu: Cache PMU interrupt numbers from MADT parse Date: Mon, 23 Jan 2017 16:32:41 -0600 [thread overview] Message-ID: <1485210765-9422-3-git-send-email-jeremy.linton@arm.com> (raw) In-Reply-To: <1485210765-9422-1-git-send-email-jeremy.linton@arm.com> From: Mark Salter <msalter@redhat.com> In the case of ACPI, the PMU IRQ information is contained in the MADT table. Also, since the PMU does not exist as a device in the ACPI DSDT table, it is necessary to create a platform device so that the appropriate driver probing is triggered. Since the platform device creation needs to happen after the CPU's have been started, and the MADT parsing needs to happen before, we save off the interrupt numbers discovered during the parsing. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> --- arch/arm64/kernel/smp.c | 5 +++++ drivers/perf/Kconfig | 4 ++++ drivers/perf/Makefile | 1 + drivers/perf/arm_pmu_acpi.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/perf/arm_pmu.h | 7 +++++++ 5 files changed, 53 insertions(+) create mode 100644 drivers/perf/arm_pmu_acpi.c diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index cb87234..789587d 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -37,6 +37,7 @@ #include <linux/completion.h> #include <linux/of.h> #include <linux/irq_work.h> +#include <linux/perf/arm_pmu.h> #include <asm/alternative.h> #include <asm/atomic.h> @@ -551,6 +552,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) } bootcpu_valid = true; early_map_cpu_to_node(0, acpi_numa_get_nid(0, hwid)); + arm_pmu_parse_acpi(0, processor); return; } @@ -571,6 +573,9 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) */ acpi_set_mailbox_entry(cpu_count, processor); + /* get PMU irq info */ + arm_pmu_parse_acpi(cpu_count, processor); + early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count, hwid)); cpu_count++; diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig index 4d5c5f9..697df05 100644 --- a/drivers/perf/Kconfig +++ b/drivers/perf/Kconfig @@ -19,4 +19,8 @@ config XGENE_PMU help Say y if you want to use APM X-Gene SoC performance monitors. +config ARM_PMU_ACPI + def_bool y + depends on ARM_PMU && ACPI + endmenu diff --git a/drivers/perf/Makefile b/drivers/perf/Makefile index b116e98..d1d7762 100644 --- a/drivers/perf/Makefile +++ b/drivers/perf/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_ARM_PMU) += arm_pmu.o obj-$(CONFIG_XGENE_PMU) += xgene_pmu.o +obj-$(CONFIG_ARM_PMU_ACPI) += arm_pmu_acpi.o diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c new file mode 100644 index 0000000..becc861 --- /dev/null +++ b/drivers/perf/arm_pmu_acpi.c @@ -0,0 +1,36 @@ +/* + * ARM ACPI PMU support + * + * Copyright (C) 2015 Red Hat Inc. + * Author: Mark Salter <msalter@redhat.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include <asm/cpu.h> +#include <linux/acpi.h> +#include <linux/irq.h> + +struct pmu_irq { + int gsi; + int trigger; + bool used; +}; + +static struct pmu_irq pmu_irqs[NR_CPUS]; + +/* + * Called from acpi_map_gic_cpu_interface()'s MADT parsing during boot. + * This routine saves off the GSI's and their trigger state for use when we are + * ready to build the PMU platform device. + */ +void __init arm_pmu_parse_acpi(int cpu, struct acpi_madt_generic_interrupt *gic) +{ + pmu_irqs[cpu].gsi = gic->performance_interrupt; + if (gic->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) + pmu_irqs[cpu].trigger = ACPI_EDGE_SENSITIVE; + else + pmu_irqs[cpu].trigger = ACPI_LEVEL_SENSITIVE; +} diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 8462da2..df1ba55 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -164,4 +164,11 @@ int arm_pmu_device_probe(struct platform_device *pdev, #endif /* CONFIG_ARM_PMU */ +#ifdef CONFIG_ARM_PMU_ACPI +struct acpi_madt_generic_interrupt; +void arm_pmu_parse_acpi(int cpu, struct acpi_madt_generic_interrupt *gic); +#else +#define arm_pmu_parse_acpi(a, b) do { } while (0) +#endif /* CONFIG_ARM_PMU_ACPI */ + #endif /* __ARM_PMU_H__ */ -- 2.7.4
next prev parent reply other threads:[~2017-01-23 22:33 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-23 22:32 [PATCH v14 0/6] Enable PMUs in ACPI systems Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-23 22:32 ` [PATCH v14 1/6] arm: arm64: Add routine to determine cpuid of other cpus Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton [this message] 2017-01-23 22:32 ` [PATCH v14 2/6] arm64: pmu: Cache PMU interrupt numbers from MADT parse Jeremy Linton 2017-01-23 22:32 ` [PATCH v14 3/6] arm: arm64: pmu: Assign platform PMU CPU affinity Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-23 22:32 ` [PATCH v14 4/6] arm64: pmu: Detect multiple generic PMUs and append counter Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-23 22:32 ` [PATCH v14 5/6] arm64: pmu: Detect and enable multiple PMUs in an ACPI system Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-23 22:32 ` [PATCH v14 6/6] arm: pmu: Add PMU definitions for cores not initially online Jeremy Linton 2017-01-23 22:32 ` Jeremy Linton 2017-01-24 6:46 ` [PATCH v14 0/6] Enable PMUs in ACPI systems Ganapatrao Kulkarni 2017-01-24 6:46 ` Ganapatrao Kulkarni 2017-01-24 19:56 ` Jeremy Linton 2017-01-24 19:56 ` Jeremy Linton 2017-01-24 7:49 ` Hanjun Guo 2017-01-24 7:49 ` Hanjun Guo 2017-02-10 6:06 ` Ganapatrao Kulkarni 2017-02-10 6:06 ` Ganapatrao Kulkarni
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1485210765-9422-3-git-send-email-jeremy.linton@arm.com \ --to=jeremy.linton@arm.com \ --cc=bamvor.zhangjian@linaro.org \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux@armlinux.org.uk \ --cc=lorenzo.pieralisi@arm.com \ --cc=mark.rutland@arm.com \ --cc=mlangsdorf@redhat.com \ --cc=msalter@redhat.com \ --cc=punit.agrawal@arm.com \ --cc=steve.capper@arm.com \ --cc=will.deacon@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.