linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/13] Support Andes PMU extension
@ 2023-10-22 15:18 Yu Chien Peter Lin
  2023-10-22 15:18 ` [PATCH v3 01/13] riscv: errata: Rename defines for Andes Yu Chien Peter Lin
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

Hi All,

This patch series introduces the Andes PMU extension, which serves
the same purpose as Sscofpmf. In this version we use FDT-based
probing and the CONFIG_ANDES_CUSTOM_PMU to enable perf sampling
and filtering support.

Its non-standard local interrupt is assigned to bit 18 in the
custom S-mode local interrupt enable/pending registers (slie/slip),
while the interrupt cause is (256 + 18).

The feature needs the PMU device registered in OpenSBI.
The OpenSBI and Linux patches can be found on Andes Technology GitHub
- https://github.com/andestech/opensbi/commits/andes-pmu-support-v2
- https://github.com/andestech/linux/commits/andes-pmu-support-v3

The PMU device tree node used on AX45MP:
- https://github.com/andestech/opensbi/blob/andes-pmu-support-v2/docs/pmu_support.md#example-3

Tested hardware:
- ASUS  Tinker-V (RZ/Five, AX45MP single core)
- Andes AE350    (AX45MP quad core)

Locus Wei-Han Chen (1):
  riscv: andes: Support symbolic FW and HW raw events

Yu Chien Peter Lin (12):
  riscv: errata: Rename defines for Andes
  irqchip/riscv-intc: Allow large non-standard hwirq number
  irqchip/riscv-intc: Introduce Andes IRQ chip
  dt-bindings: riscv: Add Andes interrupt controller compatible string
  riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes
    INTC
  perf: RISC-V: Eliminate redundant IRQ enable/disable operations
  RISC-V: Move T-Head PMU to CPU feature alternative framework
  perf: RISC-V: Introduce Andes PMU for perf event sampling
  dt-bindings: riscv: Add T-Head PMU extension description
  dt-bindings: riscv: Add Andes PMU extension description
  riscv: dts: allwinner: Add T-Head PMU extension
  riscv: dts: renesas: Add Andes PMU extension

 .../devicetree/bindings/riscv/cpus.yaml       |   7 +-
 .../devicetree/bindings/riscv/extensions.yaml |  13 ++
 arch/riscv/Kconfig.errata                     |  13 --
 arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi |   2 +-
 arch/riscv/boot/dts/renesas/r9a07g043f.dtsi   |   4 +-
 arch/riscv/errata/andes/errata.c              |  10 +-
 arch/riscv/errata/thead/errata.c              |  19 ---
 arch/riscv/include/asm/errata_list.h          |  19 +--
 arch/riscv/include/asm/hwcap.h                |   2 +
 arch/riscv/include/asm/vendorid_list.h        |   2 +-
 arch/riscv/kernel/alternative.c               |   2 +-
 arch/riscv/kernel/cpufeature.c                |   2 +
 drivers/irqchip/irq-riscv-intc.c              |  63 +++++++--
 drivers/perf/Kconfig                          |  27 ++++
 drivers/perf/riscv_pmu_sbi.c                  |  51 +++++--
 include/linux/irqchip/irq-riscv-intc.h        |  12 ++
 .../arch/riscv/andes/ax45/firmware.json       |  68 ++++++++++
 .../arch/riscv/andes/ax45/instructions.json   | 127 ++++++++++++++++++
 .../arch/riscv/andes/ax45/memory.json         |  57 ++++++++
 .../arch/riscv/andes/ax45/microarch.json      |  77 +++++++++++
 tools/perf/pmu-events/arch/riscv/mapfile.csv  |   1 +
 21 files changed, 499 insertions(+), 79 deletions(-)
 create mode 100644 include/linux/irqchip/irq-riscv-intc.h
 create mode 100644 tools/perf/pmu-events/arch/riscv/andes/ax45/firmware.json
 create mode 100644 tools/perf/pmu-events/arch/riscv/andes/ax45/instructions.json
 create mode 100644 tools/perf/pmu-events/arch/riscv/andes/ax45/memory.json
 create mode 100644 tools/perf/pmu-events/arch/riscv/andes/ax45/microarch.json

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 01/13] riscv: errata: Rename defines for Andes
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
@ 2023-10-22 15:18 ` Yu Chien Peter Lin
  2023-10-22 15:18 ` [RFC PATCH v3 02/13] irqchip/riscv-intc: Allow large non-standard hwirq number Yu Chien Peter Lin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

Using "ANDES" rather than "ANDESTECH" to unify the naming
convention with directory, file names, Kconfig options
and other definitions.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---
Changes v1 -> v2:
  - No change
Changes v2 -> v3:
  - Rewrote commit message (suggested by Conor)
---
 arch/riscv/errata/andes/errata.c       | 10 +++++-----
 arch/riscv/include/asm/errata_list.h   |  4 ++--
 arch/riscv/include/asm/vendorid_list.h |  2 +-
 arch/riscv/kernel/alternative.c        |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/riscv/errata/andes/errata.c b/arch/riscv/errata/andes/errata.c
index 197db68cc8da..d2e1abcac967 100644
--- a/arch/riscv/errata/andes/errata.c
+++ b/arch/riscv/errata/andes/errata.c
@@ -18,9 +18,9 @@
 #include <asm/sbi.h>
 #include <asm/vendorid_list.h>
 
-#define ANDESTECH_AX45MP_MARCHID	0x8000000000008a45UL
-#define ANDESTECH_AX45MP_MIMPID		0x500UL
-#define ANDESTECH_SBI_EXT_ANDES		0x0900031E
+#define ANDES_AX45MP_MARCHID		0x8000000000008a45UL
+#define ANDES_AX45MP_MIMPID		0x500UL
+#define ANDES_SBI_EXT_ANDES		0x0900031E
 
 #define ANDES_SBI_EXT_IOCP_SW_WORKAROUND	1
 
@@ -32,7 +32,7 @@ static long ax45mp_iocp_sw_workaround(void)
 	 * ANDES_SBI_EXT_IOCP_SW_WORKAROUND SBI EXT checks if the IOCP is missing and
 	 * cache is controllable only then CMO will be applied to the platform.
 	 */
-	ret = sbi_ecall(ANDESTECH_SBI_EXT_ANDES, ANDES_SBI_EXT_IOCP_SW_WORKAROUND,
+	ret = sbi_ecall(ANDES_SBI_EXT_ANDES, ANDES_SBI_EXT_IOCP_SW_WORKAROUND,
 			0, 0, 0, 0, 0, 0);
 
 	return ret.error ? 0 : ret.value;
@@ -43,7 +43,7 @@ static bool errata_probe_iocp(unsigned int stage, unsigned long arch_id, unsigne
 	if (!IS_ENABLED(CONFIG_ERRATA_ANDES_CMO))
 		return false;
 
-	if (arch_id != ANDESTECH_AX45MP_MARCHID || impid != ANDESTECH_AX45MP_MIMPID)
+	if (arch_id != ANDES_AX45MP_MARCHID || impid != ANDES_AX45MP_MIMPID)
 		return false;
 
 	if (!ax45mp_iocp_sw_workaround())
diff --git a/arch/riscv/include/asm/errata_list.h b/arch/riscv/include/asm/errata_list.h
index b55b434f0059..c190393aa9db 100644
--- a/arch/riscv/include/asm/errata_list.h
+++ b/arch/riscv/include/asm/errata_list.h
@@ -12,8 +12,8 @@
 #include <asm/vendorid_list.h>
 
 #ifdef CONFIG_ERRATA_ANDES
-#define ERRATA_ANDESTECH_NO_IOCP	0
-#define ERRATA_ANDESTECH_NUMBER		1
+#define ERRATA_ANDES_NO_IOCP 0
+#define ERRATA_ANDES_NUMBER 1
 #endif
 
 #ifdef CONFIG_ERRATA_SIFIVE
diff --git a/arch/riscv/include/asm/vendorid_list.h b/arch/riscv/include/asm/vendorid_list.h
index e55407ace0c3..2f2bb0c84f9a 100644
--- a/arch/riscv/include/asm/vendorid_list.h
+++ b/arch/riscv/include/asm/vendorid_list.h
@@ -5,7 +5,7 @@
 #ifndef ASM_VENDOR_LIST_H
 #define ASM_VENDOR_LIST_H
 
-#define ANDESTECH_VENDOR_ID	0x31e
+#define ANDES_VENDOR_ID		0x31e
 #define SIFIVE_VENDOR_ID	0x489
 #define THEAD_VENDOR_ID		0x5b7
 
diff --git a/arch/riscv/kernel/alternative.c b/arch/riscv/kernel/alternative.c
index 319a1da0358b..0128b161bfda 100644
--- a/arch/riscv/kernel/alternative.c
+++ b/arch/riscv/kernel/alternative.c
@@ -43,7 +43,7 @@ static void riscv_fill_cpu_mfr_info(struct cpu_manufacturer_info_t *cpu_mfr_info
 
 	switch (cpu_mfr_info->vendor_id) {
 #ifdef CONFIG_ERRATA_ANDES
-	case ANDESTECH_VENDOR_ID:
+	case ANDES_VENDOR_ID:
 		cpu_mfr_info->patch_func = andes_errata_patch_func;
 		break;
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFC PATCH v3 02/13] irqchip/riscv-intc: Allow large non-standard hwirq number
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
  2023-10-22 15:18 ` [PATCH v3 01/13] riscv: errata: Rename defines for Andes Yu Chien Peter Lin
@ 2023-10-22 15:18 ` Yu Chien Peter Lin
  2023-10-22 15:18 ` [RFC PATCH v3 03/13] irqchip/riscv-intc: Introduce Andes IRQ chip Yu Chien Peter Lin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

Currently, the implementation of the RISC-V INTC driver uses the
interrupt cause as hwirq and has a limitation of supporting a
maximum of 64 hwirqs. However, according to the privileged spec,
interrupt causes >= 16 are defined for platform use.

This limitation prevents us from fully utilizing the available
local interrupt sources. Additionally, the hwirqs used on RISC-V
are sparse, with only interrupt numbers 1, 5 and 9 (plus Sscofpmf
or T-Head's PMU irq) being currently used for supervisor mode.

The patch switches to using irq_domain_create_tree() which
creates the radix tree map, allowing us to handle a larger
number of hwirqs.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---
Changes v1 -> v2:
  - Fixed irq mapping failure checking (suggested by Clément and Anup)
Changes v2 -> v3:
  - No change
---
 drivers/irqchip/irq-riscv-intc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
index e8d01b14ccdd..79d049105384 100644
--- a/drivers/irqchip/irq-riscv-intc.c
+++ b/drivers/irqchip/irq-riscv-intc.c
@@ -24,10 +24,8 @@ static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
 {
 	unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG;
 
-	if (unlikely(cause >= BITS_PER_LONG))
-		panic("unexpected interrupt cause");
-
-	generic_handle_domain_irq(intc_domain, cause);
+	if (generic_handle_domain_irq(intc_domain, cause))
+		pr_warn("Failed to handle interrupt (cause: %ld)\n", cause);
 }
 
 /*
@@ -117,8 +115,8 @@ static int __init riscv_intc_init_common(struct fwnode_handle *fn)
 {
 	int rc;
 
-	intc_domain = irq_domain_create_linear(fn, BITS_PER_LONG,
-					       &riscv_intc_domain_ops, NULL);
+	intc_domain = irq_domain_create_tree(fn, &riscv_intc_domain_ops,
+					     NULL);
 	if (!intc_domain) {
 		pr_err("unable to add IRQ domain\n");
 		return -ENXIO;
@@ -132,8 +130,6 @@ static int __init riscv_intc_init_common(struct fwnode_handle *fn)
 
 	riscv_set_intc_hwnode_fn(riscv_intc_hwnode);
 
-	pr_info("%d local interrupts mapped\n", BITS_PER_LONG);
-
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [RFC PATCH v3 03/13] irqchip/riscv-intc: Introduce Andes IRQ chip
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
  2023-10-22 15:18 ` [PATCH v3 01/13] riscv: errata: Rename defines for Andes Yu Chien Peter Lin
  2023-10-22 15:18 ` [RFC PATCH v3 02/13] irqchip/riscv-intc: Allow large non-standard hwirq number Yu Chien Peter Lin
@ 2023-10-22 15:18 ` Yu Chien Peter Lin
  2023-10-22 15:18 ` [PATCH v3 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string Yu Chien Peter Lin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

This commit adds support for the Andes IRQ chip, which provides
IRQ mask/unmask functions to access the custom CSR (SLIE)
where the non-standard S-mode local interrupt enable bits are
located.

The Andes INTC requires the "andestech,cpu-intc" compatible string
to be present in interrupt-controller of cpu node. e.g.,

  cpu0: cpu@0 {
      compatible = "andestech,ax45mp", "riscv";
      ...
      cpu0-intc: interrupt-controller {
          #interrupt-cells = <0x01>;
          compatible = "andestech,cpu-intc", "riscv,cpu-intc";
          interrupt-controller;
      };
  };

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Charles Ci-Jyun Wu <dminus@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---
Changes v1 -> v2:
  - New patch
Changes v2 -> v3:
  - Return -ENXIO if no valid compatible INTC found
  - Allow falling back to generic RISC-V INTC
---
 drivers/irqchip/irq-riscv-intc.c       | 51 +++++++++++++++++++++++++-
 include/linux/irqchip/irq-riscv-intc.h | 12 ++++++
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/irqchip/irq-riscv-intc.h

diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
index 79d049105384..a0efd645a142 100644
--- a/drivers/irqchip/irq-riscv-intc.c
+++ b/drivers/irqchip/irq-riscv-intc.c
@@ -13,6 +13,7 @@
 #include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/irqdomain.h>
+#include <linux/irqchip/irq-riscv-intc.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -45,6 +46,26 @@ static void riscv_intc_irq_unmask(struct irq_data *d)
 	csr_set(CSR_IE, BIT(d->hwirq));
 }
 
+static void andes_intc_irq_mask(struct irq_data *d)
+{
+	unsigned int mask = BIT(d->hwirq % BITS_PER_LONG);
+
+	if (d->hwirq < ANDES_SLI_CAUSE_BASE)
+		csr_clear(CSR_IE, mask);
+	else
+		csr_clear(ANDES_CSR_SLIE, mask);
+}
+
+static void andes_intc_irq_unmask(struct irq_data *d)
+{
+	unsigned int mask = BIT(d->hwirq % BITS_PER_LONG);
+
+	if (d->hwirq < ANDES_SLI_CAUSE_BASE)
+		csr_set(CSR_IE, mask);
+	else
+		csr_set(ANDES_CSR_SLIE, mask);
+}
+
 static void riscv_intc_irq_eoi(struct irq_data *d)
 {
 	/*
@@ -68,12 +89,37 @@ static struct irq_chip riscv_intc_chip = {
 	.irq_eoi = riscv_intc_irq_eoi,
 };
 
+static struct irq_chip andes_intc_chip = {
+	.name = "RISC-V INTC",
+	.irq_mask = andes_intc_irq_mask,
+	.irq_unmask = andes_intc_irq_unmask,
+	.irq_eoi = riscv_intc_irq_eoi,
+};
+
 static int riscv_intc_domain_map(struct irq_domain *d, unsigned int irq,
 				 irq_hw_number_t hwirq)
 {
+	struct fwnode_handle *fn = riscv_get_intc_hwnode();
+	struct irq_chip *chip;
+	const char *cp;
+	int rc;
+
 	irq_set_percpu_devid(irq);
-	irq_domain_set_info(d, irq, hwirq, &riscv_intc_chip, d->host_data,
-			    handle_percpu_devid_irq, NULL, NULL);
+
+	rc = fwnode_property_read_string(fn, "compatible", &cp);
+	if (rc)
+		return rc;
+
+	if (strcmp(cp, "riscv,cpu-intc") == 0)
+		chip = &riscv_intc_chip;
+	else if (strcmp(cp, "andestech,cpu-intc") == 0)
+		chip = &andes_intc_chip;
+	else
+		return -ENXIO;
+
+	irq_domain_set_info(d, irq, hwirq, chip,
+			    d->host_data, handle_percpu_devid_irq, NULL,
+			    NULL);
 
 	return 0;
 }
@@ -166,6 +212,7 @@ static int __init riscv_intc_init(struct device_node *node,
 }
 
 IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init);
+IRQCHIP_DECLARE(andes, "andestech,cpu-intc", riscv_intc_init);
 
 #ifdef CONFIG_ACPI
 
diff --git a/include/linux/irqchip/irq-riscv-intc.h b/include/linux/irqchip/irq-riscv-intc.h
new file mode 100644
index 000000000000..87c105b5b545
--- /dev/null
+++ b/include/linux/irqchip/irq-riscv-intc.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2023 Andes Technology Corporation
+ */
+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_RISCV_INTC_H
+#define __INCLUDE_LINUX_IRQCHIP_IRQ_RISCV_INTC_H
+
+#define ANDES_SLI_CAUSE_BASE	256
+#define ANDES_CSR_SLIE		0x9c4
+#define ANDES_CSR_SLIP		0x9c5
+
+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_RISCV_INTC_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
                   ` (2 preceding siblings ...)
  2023-10-22 15:18 ` [RFC PATCH v3 03/13] irqchip/riscv-intc: Introduce Andes IRQ chip Yu Chien Peter Lin
@ 2023-10-22 15:18 ` Yu Chien Peter Lin
  2023-10-22 15:18 ` [PATCH v3 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC Yu Chien Peter Lin
  2023-10-22 18:00 ` [PATCH v3 00/13] Support Andes PMU extension Conor Dooley
  5 siblings, 0 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

Add "andestech,cpu-intc" compatible string which indicates that
Andes specific local interrupt is supported on the core,
e.g. AX45MP cores have 3 types of non-standard local interrupt
can be handled in supervisor mode:

- Slave port ECC error interrupt
- Bus write transaction error interrupt
- Performance monitor overflow interrupt

These interrupts are enabled/disabled via a custom register
SLIE instead of the standard interrupt enable register SIE.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
Changes v1 -> v2:
  - New patch
Changes v2 -> v3:
  - Updated commit message
  - Fixed possible compatibles for Andes INTC
---
 Documentation/devicetree/bindings/riscv/cpus.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
index 97e8441eda1c..4c1bbcf07406 100644
--- a/Documentation/devicetree/bindings/riscv/cpus.yaml
+++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
@@ -99,7 +99,12 @@ properties:
         const: 1
 
       compatible:
-        const: riscv,cpu-intc
+        oneOf:
+          - items:
+              - enum:
+                  - andestech,cpu-intc
+              - const: riscv,cpu-intc
+          - const: riscv,cpu-intc
 
       interrupt-controller: true
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
                   ` (3 preceding siblings ...)
  2023-10-22 15:18 ` [PATCH v3 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string Yu Chien Peter Lin
@ 2023-10-22 15:18 ` Yu Chien Peter Lin
  2023-10-22 18:00 ` [PATCH v3 00/13] Support Andes PMU extension Conor Dooley
  5 siblings, 0 replies; 8+ messages in thread
From: Yu Chien Peter Lin @ 2023-10-22 15:18 UTC (permalink / raw)
  To: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, guoren, heiko, irogers,
	jernej.skrabec, jolsa, jszhang, krzysztof.kozlowski+dt,
	linux-arm-kernel, linux-kernel, linux-perf-users,
	linux-renesas-soc, linux-riscv, linux-sunxi, locus84, magnus.damm,
	mark.rutland, mingo, n.shubin, namhyung, palmer, paul.walmsley,
	peterlin, peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt,
	samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang

The Andes INTC allows AX45MP cores to handle custom local
interrupts, such as the performance monitor overflow interrupt.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
Changes v1 -> v2:
  - New patch
Changes v2 -> v3:
  - Fixed possible compatibles for Andes INTC
---
 arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/renesas/r9a07g043f.dtsi b/arch/riscv/boot/dts/renesas/r9a07g043f.dtsi
index 8a726407fb76..dfe27550af11 100644
--- a/arch/riscv/boot/dts/renesas/r9a07g043f.dtsi
+++ b/arch/riscv/boot/dts/renesas/r9a07g043f.dtsi
@@ -37,7 +37,7 @@ cpu0: cpu@0 {
 
 			cpu0_intc: interrupt-controller {
 				#interrupt-cells = <1>;
-				compatible = "riscv,cpu-intc";
+				compatible = "andestech,cpu-intc", "riscv,cpu-intc";
 				interrupt-controller;
 			};
 		};
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 00/13] Support Andes PMU extension
  2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
                   ` (4 preceding siblings ...)
  2023-10-22 15:18 ` [PATCH v3 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC Yu Chien Peter Lin
@ 2023-10-22 18:00 ` Conor Dooley
  2023-10-23  0:13   ` Yu-Chien Peter Lin
  5 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2023-10-22 18:00 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, devicetree, dminus,
	evan, geert+renesas, guoren, heiko, irogers, jernej.skrabec,
	jolsa, jszhang, krzysztof.kozlowski+dt, linux-arm-kernel,
	linux-kernel, linux-perf-users, linux-renesas-soc, linux-riscv,
	linux-sunxi, locus84, magnus.damm, mark.rutland, mingo, n.shubin,
	namhyung, palmer, paul.walmsley, peterz, prabhakar.mahadev-lad.rj,
	rdunlap, robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will,
	ycliang

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

Hey,

On Sun, Oct 22, 2023 at 11:18:45PM +0800, Yu Chien Peter Lin wrote:
> Hi All,
> 
> This patch series introduces the Andes PMU extension, which serves
> the same purpose as Sscofpmf. In this version we use FDT-based
> probing and the CONFIG_ANDES_CUSTOM_PMU to enable perf sampling
> and filtering support.
> 
> Its non-standard local interrupt is assigned to bit 18 in the
> custom S-mode local interrupt enable/pending registers (slie/slip),
> while the interrupt cause is (256 + 18).
> 
> The feature needs the PMU device registered in OpenSBI.
> The OpenSBI and Linux patches can be found on Andes Technology GitHub
> - https://github.com/andestech/opensbi/commits/andes-pmu-support-v2
> - https://github.com/andestech/linux/commits/andes-pmu-support-v3
> 
> The PMU device tree node used on AX45MP:
> - https://github.com/andestech/opensbi/blob/andes-pmu-support-v2/docs/pmu_support.md#example-3
> 
> Tested hardware:
> - ASUS  Tinker-V (RZ/Five, AX45MP single core)
> - Andes AE350    (AX45MP quad core)
> 
> Locus Wei-Han Chen (1):
>   riscv: andes: Support symbolic FW and HW raw events
> 
> Yu Chien Peter Lin (12):
>   riscv: errata: Rename defines for Andes
>   irqchip/riscv-intc: Allow large non-standard hwirq number
>   irqchip/riscv-intc: Introduce Andes IRQ chip
>   dt-bindings: riscv: Add Andes interrupt controller compatible string
>   riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes
>     INTC
>   perf: RISC-V: Eliminate redundant IRQ enable/disable operations
>   RISC-V: Move T-Head PMU to CPU feature alternative framework
>   perf: RISC-V: Introduce Andes PMU for perf event sampling
>   dt-bindings: riscv: Add T-Head PMU extension description
>   dt-bindings: riscv: Add Andes PMU extension description
>   riscv: dts: allwinner: Add T-Head PMU extension
>   riscv: dts: renesas: Add Andes PMU extension

You only sent 5 of these patches FYI.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 00/13] Support Andes PMU extension
  2023-10-22 18:00 ` [PATCH v3 00/13] Support Andes PMU extension Conor Dooley
@ 2023-10-23  0:13   ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Yu-Chien Peter Lin @ 2023-10-23  0:13 UTC (permalink / raw)
  To: Conor Dooley
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, devicetree, dminus,
	evan, geert+renesas, guoren, heiko, irogers, jernej.skrabec,
	jolsa, jszhang, krzysztof.kozlowski+dt, linux-arm-kernel,
	linux-kernel, linux-perf-users, linux-renesas-soc, linux-riscv,
	linux-sunxi, locus84, magnus.damm, mark.rutland, mingo, n.shubin,
	namhyung, palmer, paul.walmsley, peterz, prabhakar.mahadev-lad.rj,
	rdunlap, robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will,
	ycliang

On Sun, Oct 22, 2023 at 07:00:28PM +0100, Conor Dooley wrote:
> Hey,
> 
> On Sun, Oct 22, 2023 at 11:18:45PM +0800, Yu Chien Peter Lin wrote:
> > Hi All,
> > 
> > This patch series introduces the Andes PMU extension, which serves
> > the same purpose as Sscofpmf. In this version we use FDT-based
> > probing and the CONFIG_ANDES_CUSTOM_PMU to enable perf sampling
> > and filtering support.
> > 
> > Its non-standard local interrupt is assigned to bit 18 in the
> > custom S-mode local interrupt enable/pending registers (slie/slip),
> > while the interrupt cause is (256 + 18).
> > 
> > The feature needs the PMU device registered in OpenSBI.
> > The OpenSBI and Linux patches can be found on Andes Technology GitHub
> > - https://github.com/andestech/opensbi/commits/andes-pmu-support-v2
> > - https://github.com/andestech/linux/commits/andes-pmu-support-v3
> > 
> > The PMU device tree node used on AX45MP:
> > - https://github.com/andestech/opensbi/blob/andes-pmu-support-v2/docs/pmu_support.md#example-3
> > 
> > Tested hardware:
> > - ASUS  Tinker-V (RZ/Five, AX45MP single core)
> > - Andes AE350    (AX45MP quad core)
> > 
> > Locus Wei-Han Chen (1):
> >   riscv: andes: Support symbolic FW and HW raw events
> > 
> > Yu Chien Peter Lin (12):
> >   riscv: errata: Rename defines for Andes
> >   irqchip/riscv-intc: Allow large non-standard hwirq number
> >   irqchip/riscv-intc: Introduce Andes IRQ chip
> >   dt-bindings: riscv: Add Andes interrupt controller compatible string
> >   riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes
> >     INTC
> >   perf: RISC-V: Eliminate redundant IRQ enable/disable operations
> >   RISC-V: Move T-Head PMU to CPU feature alternative framework
> >   perf: RISC-V: Introduce Andes PMU for perf event sampling
> >   dt-bindings: riscv: Add T-Head PMU extension description
> >   dt-bindings: riscv: Add Andes PMU extension description
> >   riscv: dts: allwinner: Add T-Head PMU extension
> >   riscv: dts: renesas: Add Andes PMU extension
> 
> You only sent 5 of these patches FYI.

Hi Conor,

Yeah... I know. The following emails were intercepted automatically
due to our data traffic policy. I will resend the whole series soon.

Best regards,
Peter Lin


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-23  0:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-22 15:18 [PATCH v3 00/13] Support Andes PMU extension Yu Chien Peter Lin
2023-10-22 15:18 ` [PATCH v3 01/13] riscv: errata: Rename defines for Andes Yu Chien Peter Lin
2023-10-22 15:18 ` [RFC PATCH v3 02/13] irqchip/riscv-intc: Allow large non-standard hwirq number Yu Chien Peter Lin
2023-10-22 15:18 ` [RFC PATCH v3 03/13] irqchip/riscv-intc: Introduce Andes IRQ chip Yu Chien Peter Lin
2023-10-22 15:18 ` [PATCH v3 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string Yu Chien Peter Lin
2023-10-22 15:18 ` [PATCH v3 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC Yu Chien Peter Lin
2023-10-22 18:00 ` [PATCH v3 00/13] Support Andes PMU extension Conor Dooley
2023-10-23  0:13   ` Yu-Chien Peter Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).