linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC
       [not found] ` <20231122121235.827122-6-peterlin@andestech.com>
@ 2023-11-22 16:36   ` Geert Uytterhoeven
  0 siblings, 0 replies; 19+ messages in thread
From: Geert Uytterhoeven @ 2023-11-22 16:36 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, 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,
	inochiama

On Wed, Nov 22, 2023 at 1:16 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
> The Andes hart-level interrupt controller (Andes INTC) allows AX45MP
> cores to handle custom local interrupts, such as the performance
> counter overflow interrupt.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 11/13] riscv: dts: allwinner: Add T-Head PMU extension
       [not found] ` <20231122121235.827122-12-peterlin@andestech.com>
@ 2023-11-22 21:12   ` Guo Ren
  2023-11-23 14:58   ` Conor Dooley
  1 sibling, 0 replies; 19+ messages in thread
From: Guo Ren @ 2023-11-22 21:12 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, 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, inochiama

On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> xtheadpmu stands for T-Head Performance Monitor Unit extension.
> Based on the added T-Head PMU ISA string, the SBI PMU driver
> will make use of the non-standard irq source.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v2 -> v3:
>   - New patch
> Changes v3 -> v4:
>   - No change
> ---
>  arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> index 64c3c2e6cbe0..7dcba86cfdd0 100644
> --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
> @@ -27,7 +27,7 @@ cpu0: cpu@0 {
>                         riscv,isa = "rv64imafdc";
>                         riscv,isa-base = "rv64i";
>                         riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zicntr", "zicsr",
> -                                              "zifencei", "zihpm";
> +                                              "zifencei", "zihpm", "xtheadpmu";
Reviewed-by: Guo Ren <guoren@kernel.org>

>                         #cooling-cells = <2>;
>
>                         cpu0_intc: interrupt-controller {
> --
> 2.34.1
>


-- 
Best Regards
 Guo Ren

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found] ` <20231122121235.827122-10-peterlin@andestech.com>
@ 2023-11-22 21:14   ` Guo Ren
  2023-11-29  8:48     ` Yu-Chien Peter Lin
  2023-11-23 14:48   ` Conor Dooley
  1 sibling, 1 reply; 19+ messages in thread
From: Guo Ren @ 2023-11-22 21:14 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, 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, inochiama

On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> Document the ISA string for T-Head performance monitor extension
> which provides counter overflow interrupt mechanism.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v2 -> v3:
>   - New patch
> Changes v3 -> v4:
>   - No change
> ---
>  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> index c91ab0e46648..694efaea8fce 100644
> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> @@ -258,5 +258,11 @@ properties:
>              in commit 2e5236 ("Ztso is now ratified.") of the
>              riscv-isa-manual.
>
> +        - const: xtheadpmu
> +          description:
> +            The T-Head performance monitor extension for counter overflow. For more
> +            details, see the chapter 12 in the Xuantie C906 user manual.
> +            https://github.com/T-head-Semi/openc906/tree/main/doc
> +
>  additionalProperties: true
>  ...
> --
> 2.34.1
>
Reviewed-by: Guo Ren <guoren@kernel.org>

-- 
Best Regards
 Guo Ren

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 07/13] RISC-V: Move T-Head PMU to CPU feature alternative framework
       [not found] ` <20231122121235.827122-8-peterlin@andestech.com>
@ 2023-11-22 21:16   ` Guo Ren
  2023-11-23 14:45   ` Conor Dooley
  1 sibling, 0 replies; 19+ messages in thread
From: Guo Ren @ 2023-11-22 21:16 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, 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, inochiama

On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
<peterlin@andestech.com> wrote:
>
> The custom PMU extension aims to support perf event sampling prior
> to the ratification of Sscofpmf. Instead of diverting the bits and
> register reserved for future standard, a set of custom registers is
> added.  Hence, we may consider it as a CPU feature rather than an
> erratum.
>
> T-Head cores need to append "xtheadpmu" to the riscv,isa-extensions
> for each cpu node in device tree, and enable CONFIG_THEAD_CUSTOM_PMU
> for proper functioning as of this commit.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Hi All,
>
> This is in preparation for introducing other PMU alternative.
> We follow Conor's suggestion [1][2] to use cpu feature alternative
> framework rather than errata, I'm happy to drop the patch if someone
> is willing to take care of this for T-Head's platforms (or sticking
> with CPU errata alternative?)
>
> [1] https://patchwork.kernel.org/project/linux-riscv/patch/20230907021635.1002738-4-peterlin@andestech.com/#25503860
> [2] https://patchwork.kernel.org/project/linux-riscv/patch/20231023004100.2663486-8-peterlin@andestech.com/#25565650
>
> Changes v1 -> v2:
>   - New patch
> Changes v2 -> v3:
>   - Removed m{vendor/arch/imp}id checks in pmu_sbi_setup_irqs()
> Changes v3 -> v4:
>   - No change
> ---
>  arch/riscv/Kconfig.errata            | 13 -------------
>  arch/riscv/errata/thead/errata.c     | 19 -------------------
>  arch/riscv/include/asm/errata_list.h | 15 +--------------
>  arch/riscv/include/asm/hwcap.h       |  1 +
>  arch/riscv/kernel/cpufeature.c       |  1 +
>  drivers/perf/Kconfig                 | 13 +++++++++++++
>  drivers/perf/riscv_pmu_sbi.c         | 19 ++++++++++++++-----
>  7 files changed, 30 insertions(+), 51 deletions(-)
>
> diff --git a/arch/riscv/Kconfig.errata b/arch/riscv/Kconfig.errata
> index e2c731cfed8c..0d19f47d1018 100644
> --- a/arch/riscv/Kconfig.errata
> +++ b/arch/riscv/Kconfig.errata
> @@ -86,17 +86,4 @@ config ERRATA_THEAD_CMO
>
>           If you don't know what to do here, say "Y".
>
> -config ERRATA_THEAD_PMU
> -       bool "Apply T-Head PMU errata"
> -       depends on ERRATA_THEAD && RISCV_PMU_SBI
> -       default y
> -       help
> -         The T-Head C9xx cores implement a PMU overflow extension very
> -         similar to the core SSCOFPMF extension.
> -
> -         This will apply the overflow errata to handle the non-standard
> -         behaviour via the regular SBI PMU driver and interface.
> -
> -         If you don't know what to do here, say "Y".
> -
>  endmenu # "CPU errata selection"
> diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c
> index 0554ed4bf087..5de5f7209132 100644
> --- a/arch/riscv/errata/thead/errata.c
> +++ b/arch/riscv/errata/thead/errata.c
> @@ -53,22 +53,6 @@ static bool errata_probe_cmo(unsigned int stage,
>         return true;
>  }
>
> -static bool errata_probe_pmu(unsigned int stage,
> -                            unsigned long arch_id, unsigned long impid)
> -{
> -       if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PMU))
> -               return false;
> -
> -       /* target-c9xx cores report arch_id and impid as 0 */
> -       if (arch_id != 0 || impid != 0)
> -               return false;
> -
> -       if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
> -               return false;
> -
> -       return true;
> -}
> -
>  static u32 thead_errata_probe(unsigned int stage,
>                               unsigned long archid, unsigned long impid)
>  {
> @@ -80,9 +64,6 @@ static u32 thead_errata_probe(unsigned int stage,
>         if (errata_probe_cmo(stage, archid, impid))
>                 cpu_req_errata |= BIT(ERRATA_THEAD_CMO);
>
> -       if (errata_probe_pmu(stage, archid, impid))
> -               cpu_req_errata |= BIT(ERRATA_THEAD_PMU);
> -
>         return cpu_req_errata;
>  }
>
> diff --git a/arch/riscv/include/asm/errata_list.h b/arch/riscv/include/asm/errata_list.h
> index 4ed21a62158c..9bccc2ba0eb5 100644
> --- a/arch/riscv/include/asm/errata_list.h
> +++ b/arch/riscv/include/asm/errata_list.h
> @@ -25,8 +25,7 @@
>  #ifdef CONFIG_ERRATA_THEAD
>  #define        ERRATA_THEAD_PBMT 0
>  #define        ERRATA_THEAD_CMO 1
> -#define        ERRATA_THEAD_PMU 2
> -#define        ERRATA_THEAD_NUMBER 3
> +#define        ERRATA_THEAD_NUMBER 2
>  #endif
>
>  #ifdef __ASSEMBLY__
> @@ -147,18 +146,6 @@ asm volatile(ALTERNATIVE_2(                                                \
>             "r"((unsigned long)(_start) + (_size))                      \
>         : "a0")
>
> -#define THEAD_C9XX_RV_IRQ_PMU                  17
> -#define THEAD_C9XX_CSR_SCOUNTEROF              0x5c5
> -
> -#define ALT_SBI_PMU_OVERFLOW(__ovl)                                    \
> -asm volatile(ALTERNATIVE(                                              \
> -       "csrr %0, " __stringify(CSR_SSCOUNTOVF),                        \
> -       "csrr %0, " __stringify(THEAD_C9XX_CSR_SCOUNTEROF),             \
> -               THEAD_VENDOR_ID, ERRATA_THEAD_PMU,                      \
> -               CONFIG_ERRATA_THEAD_PMU)                                \
> -       : "=r" (__ovl) :                                                \
> -       : "memory")
> -
>  #endif /* __ASSEMBLY__ */
>
>  #endif
> diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
> index 06d30526ef3b..c85ee34c78d9 100644
> --- a/arch/riscv/include/asm/hwcap.h
> +++ b/arch/riscv/include/asm/hwcap.h
> @@ -57,6 +57,7 @@
>  #define RISCV_ISA_EXT_ZIHPM            42
>  #define RISCV_ISA_EXT_SMSTATEEN                43
>  #define RISCV_ISA_EXT_ZICOND           44
> +#define RISCV_ISA_EXT_XTHEADPMU                45
>
>  #define RISCV_ISA_EXT_MAX              64
>
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index b3785ffc1570..e606f588d366 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -185,6 +185,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {
>         __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL),
>         __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT),
>         __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT),
> +       __RISCV_ISA_EXT_DATA(xtheadpmu, RISCV_ISA_EXT_XTHEADPMU),
>  };
>
>  const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext);
> diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig
> index 273d67ecf6d2..c71b6f16bdfa 100644
> --- a/drivers/perf/Kconfig
> +++ b/drivers/perf/Kconfig
> @@ -86,6 +86,19 @@ config RISCV_PMU_SBI
>           full perf feature support i.e. counter overflow, privilege mode
>           filtering, counter configuration.
>
> +config THEAD_CUSTOM_PMU
> +       bool "T-Head custom PMU support"
> +       depends on RISCV_ALTERNATIVE && RISCV_PMU_SBI
> +       default y
> +       help
> +         The T-Head C9xx cores implement a PMU overflow extension very
> +         similar to the core SSCOFPMF extension.
> +
> +         This will patch the overflow CSR and handle the non-standard
> +         behaviour via the regular SBI PMU driver and interface.
> +
> +         If you don't know what to do here, say "Y".
> +
>  config ARM_PMU_ACPI
>         depends on ARM_PMU && ACPI
>         def_bool y
> diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> index 2edbc37abadf..31ca79846399 100644
> --- a/drivers/perf/riscv_pmu_sbi.c
> +++ b/drivers/perf/riscv_pmu_sbi.c
> @@ -20,10 +20,21 @@
>  #include <linux/cpu_pm.h>
>  #include <linux/sched/clock.h>
>
> -#include <asm/errata_list.h>
>  #include <asm/sbi.h>
>  #include <asm/cpufeature.h>
>
> +#define THEAD_C9XX_RV_IRQ_PMU          17
> +#define THEAD_C9XX_CSR_SCOUNTEROF      0x5c5
> +
> +#define ALT_SBI_PMU_OVERFLOW(__ovl)                                    \
> +asm volatile(ALTERNATIVE(                                              \
> +       "csrr %0, " __stringify(CSR_SSCOUNTOVF),                        \
> +       "csrr %0, " __stringify(THEAD_C9XX_CSR_SCOUNTEROF),             \
> +               0, RISCV_ISA_EXT_XTHEADPMU,                             \
> +               CONFIG_THEAD_CUSTOM_PMU)                                \
> +       : "=r" (__ovl) :                                                \
> +       : "memory")
> +
>  #define SYSCTL_NO_USER_ACCESS  0
>  #define SYSCTL_USER_ACCESS     1
>  #define SYSCTL_LEGACY          2
> @@ -808,10 +819,8 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
>         if (riscv_isa_extension_available(NULL, SSCOFPMF)) {
>                 riscv_pmu_irq_num = RV_IRQ_PMU;
>                 riscv_pmu_use_irq = true;
> -       } else if (IS_ENABLED(CONFIG_ERRATA_THEAD_PMU) &&
> -                  riscv_cached_mvendorid(0) == THEAD_VENDOR_ID &&
> -                  riscv_cached_marchid(0) == 0 &&
> -                  riscv_cached_mimpid(0) == 0) {
> +       } else if (riscv_isa_extension_available(NULL, XTHEADPMU) &&
> +                  IS_ENABLED(CONFIG_THEAD_CUSTOM_PMU)) {
>                 riscv_pmu_irq_num = THEAD_C9XX_RV_IRQ_PMU;
>                 riscv_pmu_use_irq = true;
>         }
> --
> 2.34.1
>
Reviewed-by: Guo Ren <guoren@kernel.org>

-- 
Best Regards
 Guo Ren

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string
       [not found] ` <20231122121235.827122-5-peterlin@andestech.com>
@ 2023-11-23 14:38   ` Conor Dooley
       [not found]   ` <CA+V-a8t+vgrwDe9OxqMNHdcVX+qq76DuskF0ETCri4VeP-FAbg@mail.gmail.com>
  1 sibling, 0 replies; 19+ messages in thread
From: Conor Dooley @ 2023-11-23 14:38 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama


[-- Attachment #1.1: Type: text/plain, Size: 1681 bytes --]

On Wed, Nov 22, 2023 at 08:12:26PM +0800, Yu Chien Peter Lin wrote:
> Add "andestech,cpu-intc" compatible string to indicate 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>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.

> ---
> Changes v1 -> v2:
>   - New patch
> Changes v2 -> v3:
>   - Updated commit message
>   - Fixed possible compatibles for Andes INTC
> Changes v3 -> v4:
>   - Add const entry instead of enum (Suggested by Conor)
> ---
>  Documentation/devicetree/bindings/riscv/cpus.yaml | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
> index f392e367d673..50307554478f 100644
> --- a/Documentation/devicetree/bindings/riscv/cpus.yaml
> +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
> @@ -100,7 +100,11 @@ properties:
>          const: 1
>  
>        compatible:
> -        const: riscv,cpu-intc
> +        oneOf:
> +          - items:
> +              - const: andestech,cpu-intc
> +              - const: riscv,cpu-intc
> +          - const: riscv,cpu-intc
>  
>        interrupt-controller: true
>  
> -- 
> 2.34.1
> 

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 07/13] RISC-V: Move T-Head PMU to CPU feature alternative framework
       [not found] ` <20231122121235.827122-8-peterlin@andestech.com>
  2023-11-22 21:16   ` [PATCH v4 07/13] RISC-V: Move T-Head PMU to CPU feature alternative framework Guo Ren
@ 2023-11-23 14:45   ` Conor Dooley
  1 sibling, 0 replies; 19+ messages in thread
From: Conor Dooley @ 2023-11-23 14:45 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama


[-- Attachment #1.1: Type: text/plain, Size: 646 bytes --]


>  drivers/perf/riscv_pmu_sbi.c         | 19 ++++++++++++++-----

> +config THEAD_CUSTOM_PMU
> +	bool "T-Head custom PMU support"
> +	depends on RISCV_ALTERNATIVE && RISCV_PMU_SBI
> +	default y
> +	help
> +	  The T-Head C9xx cores implement a PMU overflow extension very
> +	  similar to the core SSCOFPMF extension.
> +
> +	  This will patch the overflow CSR and handle the non-standard
> +	  behaviour via the regular SBI PMU driver and interface.
> +
> +	  If you don't know what to do here, say "Y".

This is a < 20 line diff to the pmu driver, is it really worth adding
having config options for these two non standard PMU implementations?

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found] ` <20231122121235.827122-10-peterlin@andestech.com>
  2023-11-22 21:14   ` [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description Guo Ren
@ 2023-11-23 14:48   ` Conor Dooley
  2023-11-29  8:47     ` Yu-Chien Peter Lin
  1 sibling, 1 reply; 19+ messages in thread
From: Conor Dooley @ 2023-11-23 14:48 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama


[-- Attachment #1.1: Type: text/plain, Size: 1332 bytes --]

On Wed, Nov 22, 2023 at 08:12:31PM +0800, Yu Chien Peter Lin wrote:
> Document the ISA string for T-Head performance monitor extension
> which provides counter overflow interrupt mechanism.
> 
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> Changes v2 -> v3:
>   - New patch
> Changes v3 -> v4:
>   - No change
> ---
>  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> index c91ab0e46648..694efaea8fce 100644
> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> @@ -258,5 +258,11 @@ properties:
>              in commit 2e5236 ("Ztso is now ratified.") of the
>              riscv-isa-manual.
>  
> +        - const: xtheadpmu
> +          description:
> +            The T-Head performance monitor extension for counter overflow. For more
> +            details, see the chapter 12 in the Xuantie C906 user manual.
> +            https://github.com/T-head-Semi/openc906/tree/main/doc

I'm pretty sure that I asked on the previous revision for you to
identify a specific revision of this document.

Cheers,
Conor.

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 11/13] riscv: dts: allwinner: Add T-Head PMU extension
       [not found] ` <20231122121235.827122-12-peterlin@andestech.com>
  2023-11-22 21:12   ` [PATCH v4 11/13] riscv: dts: allwinner: Add T-Head PMU extension Guo Ren
@ 2023-11-23 14:58   ` Conor Dooley
  2023-11-29  9:34     ` Yu-Chien Peter Lin
  1 sibling, 1 reply; 19+ messages in thread
From: Conor Dooley @ 2023-11-23 14:58 UTC (permalink / raw)
  To: Yu Chien Peter Lin
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama


[-- Attachment #1.1: Type: text/plain, Size: 660 bytes --]

On Wed, Nov 22, 2023 at 08:12:33PM +0800, Yu Chien Peter Lin wrote:
> xtheadpmu stands for T-Head Performance Monitor Unit extension.
> Based on the added T-Head PMU ISA string, the SBI PMU driver
> will make use of the non-standard irq source.

Allwinner aren't the only ones using T-Head CPUs that the previous
m*id pmu detection code would have matched on. I think the first three
files below will also need to be updated:

rg -l "thead,c[0-9]*\b[^-]" arch/riscv/boot/dts/
arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
arch/riscv/boot/dts/sophgo/cv1800b.dtsi
arch/riscv/boot/dts/thead/th1520.dtsi
arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi

Cheers,
Conor.

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string
       [not found]   ` <CA+V-a8t+vgrwDe9OxqMNHdcVX+qq76DuskF0ETCri4VeP-FAbg@mail.gmail.com>
@ 2023-11-29  6:43     ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-11-29  6:43 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: 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,
	peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt, samuel,
	sunilvl, tglx, tim609, uwu, wens, will, ycliang

Hi Prabhakar,

On Fri, Nov 24, 2023 at 03:03:51PM +0000, Lad, Prabhakar wrote:
> On Wed, Nov 22, 2023 at 12:18 PM Yu Chien Peter Lin
> <peterlin@andestech.com> wrote:
> >
> > Add "andestech,cpu-intc" compatible string to indicate 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
> > Changes v3 -> v4:
> >   - Add const entry instead of enum (Suggested by Conor)
> > ---
> >  Documentation/devicetree/bindings/riscv/cpus.yaml | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
> > index f392e367d673..50307554478f 100644
> > --- a/Documentation/devicetree/bindings/riscv/cpus.yaml
> > +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
> > @@ -100,7 +100,11 @@ properties:
> >          const: 1
> >
> >        compatible:
> > -        const: riscv,cpu-intc
> > +        oneOf:
> > +          - items:
> > +              - const: andestech,cpu-intc
> given that the first patch renames andestech -> andes, do you want to
> follow the same here?

Thanks for pointing this out.
We would like to use "andestech" for compatible string.

Documentation/devicetree/bindings/vendor-prefixes.yaml
118:  "^andestech,.*":
119-    description: Andes Technology Corporation

> > +              - const: riscv,cpu-intc
> > +          - const: riscv,cpu-intc
> >
> >        interrupt-controller: true
> >
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks for the review!

Best regards,
Peter Lin

> Cheers,
> Prabhakar
> 
> > --
> > 2.34.1
> >
> >

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
  2023-11-23 14:48   ` Conor Dooley
@ 2023-11-29  8:47     ` Yu-Chien Peter Lin
  2023-11-29 12:33       ` Conor Dooley
  0 siblings, 1 reply; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-11-29  8:47 UTC (permalink / raw)
  To: Conor Dooley
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama

Hi Conor,

On Thu, Nov 23, 2023 at 02:48:20PM +0000, Conor Dooley wrote:
> On Wed, Nov 22, 2023 at 08:12:31PM +0800, Yu Chien Peter Lin wrote:
> > Document the ISA string for T-Head performance monitor extension
> > which provides counter overflow interrupt mechanism.
> > 
> > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> > ---
> > Changes v2 -> v3:
> >   - New patch
> > Changes v3 -> v4:
> >   - No change
> > ---
> >  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > index c91ab0e46648..694efaea8fce 100644
> > --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> > +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > @@ -258,5 +258,11 @@ properties:
> >              in commit 2e5236 ("Ztso is now ratified.") of the
> >              riscv-isa-manual.
> >  
> > +        - const: xtheadpmu
> > +          description:
> > +            The T-Head performance monitor extension for counter overflow. For more
> > +            details, see the chapter 12 in the Xuantie C906 user manual.
> > +            https://github.com/T-head-Semi/openc906/tree/main/doc
> 
> I'm pretty sure that I asked on the previous revision for you to
> identify a specific revision of this document.

Sorry, I'm still searching for it.

Regards,
Peter Lin

> Cheers,
> Conor.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
  2023-11-22 21:14   ` [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description Guo Ren
@ 2023-11-29  8:48     ` Yu-Chien Peter Lin
       [not found]       ` <IA1PR20MB49537364BDF1ADE185CA8FE4BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
  0 siblings, 1 reply; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-11-29  8:48 UTC (permalink / raw)
  To: Guo Ren
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, conor.dooley, conor, devicetree,
	dminus, evan, geert+renesas, 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, inochiama

Hi Guo Ren,

On Thu, Nov 23, 2023 at 05:14:30AM +0800, Guo Ren wrote:
> On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
> <peterlin@andestech.com> wrote:
> >
> > Document the ISA string for T-Head performance monitor extension
> > which provides counter overflow interrupt mechanism.
> >
> > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> > ---
> > Changes v2 -> v3:
> >   - New patch
> > Changes v3 -> v4:
> >   - No change
> > ---
> >  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > index c91ab0e46648..694efaea8fce 100644
> > --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> > +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > @@ -258,5 +258,11 @@ properties:
> >              in commit 2e5236 ("Ztso is now ratified.") of the
> >              riscv-isa-manual.
> >
> > +        - const: xtheadpmu
> > +          description:
> > +            The T-Head performance monitor extension for counter overflow. For more
> > +            details, see the chapter 12 in the Xuantie C906 user manual.
> > +            https://github.com/T-head-Semi/openc906/tree/main/doc
> > +
> >  additionalProperties: true
> >  ...
> > --
> > 2.34.1
> >
> Reviewed-by: Guo Ren <guoren@kernel.org>

Thanks for the review.
Would you share document about T-Head PMU?

Best regards,
Peter Lin

> -- 
> Best Regards
>  Guo Ren

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 11/13] riscv: dts: allwinner: Add T-Head PMU extension
  2023-11-23 14:58   ` Conor Dooley
@ 2023-11-29  9:34     ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-11-29  9:34 UTC (permalink / raw)
  To: Conor Dooley
  Cc: acme, adrian.hunter, ajones, alexander.shishkin, andre.przywara,
	anup, aou, atishp, conor+dt, 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, peterz, prabhakar.mahadev-lad.rj, rdunlap,
	robh+dt, samuel, sunilvl, tglx, tim609, uwu, wens, will, ycliang,
	inochiama

Hi Conor,

On Thu, Nov 23, 2023 at 02:58:55PM +0000, Conor Dooley wrote:
> On Wed, Nov 22, 2023 at 08:12:33PM +0800, Yu Chien Peter Lin wrote:
> > xtheadpmu stands for T-Head Performance Monitor Unit extension.
> > Based on the added T-Head PMU ISA string, the SBI PMU driver
> > will make use of the non-standard irq source.
> 
> Allwinner aren't the only ones using T-Head CPUs that the previous
> m*id pmu detection code would have matched on. I think the first three
> files below will also need to be updated:
> 
> rg -l "thead,c[0-9]*\b[^-]" arch/riscv/boot/dts/
> arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> arch/riscv/boot/dts/thead/th1520.dtsi
> arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi

That's really helpful, I'll add these .dtsi files in the patchset v5.

Thanks,
Peter Lin

> Cheers,
> Conor.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
  2023-11-29  8:47     ` Yu-Chien Peter Lin
@ 2023-11-29 12:33       ` Conor Dooley
  0 siblings, 0 replies; 19+ messages in thread
From: Conor Dooley @ 2023-11-29 12:33 UTC (permalink / raw)
  To: Yu-Chien Peter Lin
  Cc: Conor Dooley, acme, adrian.hunter, ajones, alexander.shishkin,
	andre.przywara, anup, aou, atishp, conor+dt, 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, inochiama


[-- Attachment #1.1: Type: text/plain, Size: 1787 bytes --]

On Wed, Nov 29, 2023 at 04:47:38PM +0800, Yu-Chien Peter Lin wrote:
> Hi Conor,
> 
> On Thu, Nov 23, 2023 at 02:48:20PM +0000, Conor Dooley wrote:
> > On Wed, Nov 22, 2023 at 08:12:31PM +0800, Yu Chien Peter Lin wrote:
> > > Document the ISA string for T-Head performance monitor extension
> > > which provides counter overflow interrupt mechanism.
> > > 
> > > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> > > ---
> > > Changes v2 -> v3:
> > >   - New patch
> > > Changes v3 -> v4:
> > >   - No change
> > > ---
> > >  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > > index c91ab0e46648..694efaea8fce 100644
> > > --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> > > +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> > > @@ -258,5 +258,11 @@ properties:
> > >              in commit 2e5236 ("Ztso is now ratified.") of the
> > >              riscv-isa-manual.
> > >  
> > > +        - const: xtheadpmu
> > > +          description:
> > > +            The T-Head performance monitor extension for counter overflow. For more
> > > +            details, see the chapter 12 in the Xuantie C906 user manual.
> > > +            https://github.com/T-head-Semi/openc906/tree/main/doc
> > 
> > I'm pretty sure that I asked on the previous revision for you to
> > identify a specific revision of this document.
> 
> Sorry, I'm still searching for it.

Identifying a specific commit from that repo as the revision would be
okay. Follow the format used elsewhere for the standard extensions.

Cheers,
Conor.

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found]       ` <IA1PR20MB49537364BDF1ADE185CA8FE4BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
@ 2023-11-30  9:21         ` Yu-Chien Peter Lin
       [not found]           ` <IA1PR20MB4953A05B9162AA2659DE78A5BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
       [not found]           ` <IA1PR20MB4953460FE5BF431DD32CD860BB81A@IA1PR20MB4953.namprd20.prod.outlook.com>
  0 siblings, 2 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-11-30  9:21 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Guo Ren, acme, adrian.hunter, ajones, alexander.shishkin,
	andre.przywara, anup, aou, atishp, conor+dt, conor.dooley, conor,
	devicetree, dminus, evan, geert+renesas, 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

Hi Inochi,

On Thu, Nov 30, 2023 at 04:29:22PM +0800, Inochi Amaoto wrote:
> >
> >Hi Guo Ren,
> >
> >On Thu, Nov 23, 2023 at 05:14:30AM +0800, Guo Ren wrote:
> >> On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
> >> <peterlin@andestech.com> wrote:
> >>>
> >>> Document the ISA string for T-Head performance monitor extension
> >>> which provides counter overflow interrupt mechanism.
> >>>
> >>> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> >>> ---
> >>> Changes v2 -> v3:
> >>>   - New patch
> >>> Changes v3 -> v4:
> >>>   - No change
> >>> ---
> >>>  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> >>>  1 file changed, 6 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>> index c91ab0e46648..694efaea8fce 100644
> >>> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>> @@ -258,5 +258,11 @@ properties:
> >>>              in commit 2e5236 ("Ztso is now ratified.") of the
> >>>              riscv-isa-manual.
> >>>
> >>> +        - const: xtheadpmu
> >>> +          description:
> >>> +            The T-Head performance monitor extension for counter overflow. For more
> >>> +            details, see the chapter 12 in the Xuantie C906 user manual.
> >>> +            https://github.com/T-head-Semi/openc906/tree/main/doc
> >>> +
> >>>  additionalProperties: true
> >>>  ...
> >>> --
> >>> 2.34.1
> >>>
> >> Reviewed-by: Guo Ren <guoren@kernel.org>
> >
> >Thanks for the review.
> >Would you share document about T-Head PMU?
> >
> 
> Hi, Peter Lin:
> 
> You can use the following two document to get all events:
> https://github.com/T-head-Semi/openc906/tree/main/doc
> https://github.com/T-head-Semi/openc910/tree/main/doc
> 
> There are also some RTL code can describe these events:
> https://github.com/T-head-Semi/openc910/blob/e0c4ad8ec7f8c70f649d826ebd6c949086453272/C910_RTL_FACTORY/gen_rtl/pmu/rtl/ct_hpcp_top.v#L1123
> https://github.com/T-head-Semi/openc906/blob/af5614d72de7e5a4b8609c427d2e20af1deb21c4/C906_RTL_FACTORY/gen_rtl/pmu/rtl/aq_hpcp_top.v#L543
> 
> The perf events json can also be used as document, this is already
> applied (with more detailed explanation):
> https://lore.kernel.org/all/IA1PR20MB495325FCF603BAA841E29281BBBAA@IA1PR20MB4953.namprd20.prod.outlook.com/

Thanks for reaching out!
The updated description will be:

- const: xtheadpmu
  description:
    The T-Head performance monitor extension for counter overflow, as ratified
    in commit bd9206 ("Initial commit") of Xuantie C906 user manual.
    https://github.com/T-head-Semi/openc906/tree/main/doc

Is it OK with you?

Best regards,
Peter Lin

> Best regards,
> Inochi

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found]           ` <IA1PR20MB4953A05B9162AA2659DE78A5BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
@ 2023-11-30 12:58             ` Conor Dooley
       [not found]               ` <IA1PR20MB495378652B09B37E92D8BB04BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
  0 siblings, 1 reply; 19+ messages in thread
From: Conor Dooley @ 2023-11-30 12:58 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Yu-Chien Peter Lin, Guo Ren, acme, adrian.hunter, ajones,
	alexander.shishkin, andre.przywara, anup, aou, atishp, conor+dt,
	conor.dooley, devicetree, dminus, evan, geert+renesas, 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.1: Type: text/plain, Size: 3294 bytes --]

On Thu, Nov 30, 2023 at 08:16:38PM +0800, Inochi Amaoto wrote:
> >
> >Hi Inochi,
> >
> >On Thu, Nov 30, 2023 at 04:29:22PM +0800, Inochi Amaoto wrote:
> >>>
> >>> Hi Guo Ren,
> >>>
> >>> On Thu, Nov 23, 2023 at 05:14:30AM +0800, Guo Ren wrote:
> >>>> On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
> >>>> <peterlin@andestech.com> wrote:
> >>>>>
> >>>>> Document the ISA string for T-Head performance monitor extension
> >>>>> which provides counter overflow interrupt mechanism.
> >>>>>
> >>>>> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> >>>>> ---
> >>>>> Changes v2 -> v3:
> >>>>>   - New patch
> >>>>> Changes v3 -> v4:
> >>>>>   - No change
> >>>>> ---
> >>>>>  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> >>>>>  1 file changed, 6 insertions(+)
> >>>>>
> >>>>> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>> index c91ab0e46648..694efaea8fce 100644
> >>>>> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>> @@ -258,5 +258,11 @@ properties:
> >>>>>              in commit 2e5236 ("Ztso is now ratified.") of the
> >>>>>              riscv-isa-manual.
> >>>>>
> >>>>> +        - const: xtheadpmu
> >>>>> +          description:
> >>>>> +            The T-Head performance monitor extension for counter overflow. For more
> >>>>> +            details, see the chapter 12 in the Xuantie C906 user manual.
> >>>>> +            https://github.com/T-head-Semi/openc906/tree/main/doc
> >>>>> +
> >>>>>  additionalProperties: true
> >>>>>  ...
> >>>>> --
> >>>>> 2.34.1
> >>>>>
> >>>> Reviewed-by: Guo Ren <guoren@kernel.org>
> >>>
> >>> Thanks for the review.
> >>> Would you share document about T-Head PMU?
> >>>
> >>
> >> Hi, Peter Lin:
> >>
> >> You can use the following two document to get all events:
> >> https://github.com/T-head-Semi/openc906/tree/main/doc
> >> https://github.com/T-head-Semi/openc910/tree/main/doc
> >>
> >> There are also some RTL code can describe these events:
> >> https://github.com/T-head-Semi/openc910/blob/e0c4ad8ec7f8c70f649d826ebd6c949086453272/C910_RTL_FACTORY/gen_rtl/pmu/rtl/ct_hpcp_top.v#L1123
> >> https://github.com/T-head-Semi/openc906/blob/af5614d72de7e5a4b8609c427d2e20af1deb21c4/C906_RTL_FACTORY/gen_rtl/pmu/rtl/aq_hpcp_top.v#L543
> >>
> >> The perf events json can also be used as document, this is already
> >> applied (with more detailed explanation):
> >> https://lore.kernel.org/all/IA1PR20MB495325FCF603BAA841E29281BBBAA@IA1PR20MB4953.namprd20.prod.outlook.com/
> >
> >Thanks for reaching out!
> >The updated description will be:
> >
> >- const: xtheadpmu
> >  description:
> >    The T-Head performance monitor extension for counter overflow, as ratified
> >    in commit bd9206 ("Initial commit") of Xuantie C906 user manual.
> >    https://github.com/T-head-Semi/openc906/tree/main/doc
> >
> >Is it OK with you?
> >
> 
> I suggest using perf event json as event description. The jsons provide
> more detailed explanation for these events than the user manual.

Does the "perf event json" describe the registers and interrupt behaviour?

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found]               ` <IA1PR20MB495378652B09B37E92D8BB04BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
@ 2023-12-01  0:40                 ` Conor Dooley
  0 siblings, 0 replies; 19+ messages in thread
From: Conor Dooley @ 2023-12-01  0:40 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Yu-Chien Peter Lin, Guo Ren, acme, adrian.hunter, ajones,
	alexander.shishkin, andre.przywara, anup, aou, atishp, conor+dt,
	conor.dooley, devicetree, dminus, evan, geert+renesas, 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.1: Type: text/plain, Size: 4086 bytes --]

On Fri, Dec 01, 2023 at 07:11:31AM +0800, Inochi Amaoto wrote:
> >
> >On Thu, Nov 30, 2023 at 08:16:38PM +0800, Inochi Amaoto wrote:
> >>>
> >>> Hi Inochi,
> >>>
> >>> On Thu, Nov 30, 2023 at 04:29:22PM +0800, Inochi Amaoto wrote:
> >>>>>
> >>>>> Hi Guo Ren,
> >>>>>
> >>>>> On Thu, Nov 23, 2023 at 05:14:30AM +0800, Guo Ren wrote:
> >>>>>> On Wed, Nov 22, 2023 at 8:17 PM Yu Chien Peter Lin
> >>>>>> <peterlin@andestech.com> wrote:
> >>>>>>>
> >>>>>>> Document the ISA string for T-Head performance monitor extension
> >>>>>>> which provides counter overflow interrupt mechanism.
> >>>>>>>
> >>>>>>> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> >>>>>>> ---
> >>>>>>> Changes v2 -> v3:
> >>>>>>>   - New patch
> >>>>>>> Changes v3 -> v4:
> >>>>>>>   - No change
> >>>>>>> ---
> >>>>>>>  Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++
> >>>>>>>  1 file changed, 6 insertions(+)
> >>>>>>>
> >>>>>>> diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>>>> index c91ab0e46648..694efaea8fce 100644
> >>>>>>> --- a/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>>>> +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml
> >>>>>>> @@ -258,5 +258,11 @@ properties:
> >>>>>>>              in commit 2e5236 ("Ztso is now ratified.") of the
> >>>>>>>              riscv-isa-manual.
> >>>>>>>
> >>>>>>> +        - const: xtheadpmu
> >>>>>>> +          description:
> >>>>>>> +            The T-Head performance monitor extension for counter overflow. For more
> >>>>>>> +            details, see the chapter 12 in the Xuantie C906 user manual.
> >>>>>>> +            https://github.com/T-head-Semi/openc906/tree/main/doc
> >>>>>>> +
> >>>>>>>  additionalProperties: true
> >>>>>>>  ...
> >>>>>>> --
> >>>>>>> 2.34.1
> >>>>>>>
> >>>>>> Reviewed-by: Guo Ren <guoren@kernel.org>
> >>>>>
> >>>>> Thanks for the review.
> >>>>> Would you share document about T-Head PMU?
> >>>>>
> >>>>
> >>>> Hi, Peter Lin:
> >>>>
> >>>> You can use the following two document to get all events:
> >>>> https://github.com/T-head-Semi/openc906/tree/main/doc
> >>>> https://github.com/T-head-Semi/openc910/tree/main/doc
> >>>>
> >>>> There are also some RTL code can describe these events:
> >>>> https://github.com/T-head-Semi/openc910/blob/e0c4ad8ec7f8c70f649d826ebd6c949086453272/C910_RTL_FACTORY/gen_rtl/pmu/rtl/ct_hpcp_top.v#L1123
> >>>> https://github.com/T-head-Semi/openc906/blob/af5614d72de7e5a4b8609c427d2e20af1deb21c4/C906_RTL_FACTORY/gen_rtl/pmu/rtl/aq_hpcp_top.v#L543
> >>>>
> >>>> The perf events json can also be used as document, this is already
> >>>> applied (with more detailed explanation):
> >>>> https://lore.kernel.org/all/IA1PR20MB495325FCF603BAA841E29281BBBAA@IA1PR20MB4953.namprd20.prod.outlook.com/
> >>>
> >>> Thanks for reaching out!
> >>> The updated description will be:
> >>>
> >>> - const: xtheadpmu
> >>>  description:
> >>>    The T-Head performance monitor extension for counter overflow, as ratified
> >>>    in commit bd9206 ("Initial commit") of Xuantie C906 user manual.
> >>>    https://github.com/T-head-Semi/openc906/tree/main/doc
> >>>
> >>> Is it OK with you?
> >>>
> >>
> >> I suggest using perf event json as event description. The jsons provide
> >> more detailed explanation for these events than the user manual.
> >
> >Does the "perf event json" describe the registers and interrupt behaviour?
> >
> 
> It does not. IIRC, the linux just uses SBI as perf driver backend. So
> the registers and interrupt behaviour is primarily for SBI developer.

Interrupts and registers are the reason that this patch (and the rest of
the patchset) exists :)

> For registers and interrup detail, just reference the openc910 doc url
> (https://github.com/T-head-Semi/openc910/tree/main/doc) and the T-HEAD
> PMU driver in OpenSBI.

The former, sure. But I will not accept driver implementations as the
reference in this context.

Thanks,
Conor.

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description
       [not found]           ` <IA1PR20MB4953460FE5BF431DD32CD860BB81A@IA1PR20MB4953.namprd20.prod.outlook.com>
@ 2023-12-06  3:14             ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-12-06  3:14 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Guo Ren, acme, adrian.hunter, ajones, alexander.shishkin,
	andre.przywara, anup, aou, atishp, conor+dt, conor.dooley, conor,
	devicetree, dminus, evan, geert+renesas, 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 Fri, Dec 01, 2023 at 09:14:00AM +0800, Inochi Amaoto wrote:
<...>
> >>
> >> Hi, Peter Lin:
> >>
> >> You can use the following two document to get all events:
> >> https://github.com/T-head-Semi/openc906/tree/main/doc
> >> https://github.com/T-head-Semi/openc910/tree/main/doc
> >>
> >> There are also some RTL code can describe these events:
> >> https://github.com/T-head-Semi/openc910/blob/e0c4ad8ec7f8c70f649d826ebd6c949086453272/C910_RTL_FACTORY/gen_rtl/pmu/rtl/ct_hpcp_top.v#L1123
> >> https://github.com/T-head-Semi/openc906/blob/af5614d72de7e5a4b8609c427d2e20af1deb21c4/C906_RTL_FACTORY/gen_rtl/pmu/rtl/aq_hpcp_top.v#L543
> >>
> >> The perf events json can also be used as document, this is already
> >> applied (with more detailed explanation):
> >> https://lore.kernel.org/all/IA1PR20MB495325FCF603BAA841E29281BBBAA@IA1PR20MB4953.namprd20.prod.outlook.com/
> >
> >Thanks for reaching out!
> >The updated description will be:
> >
> >- const: xtheadpmu
> >  description:
> >    The T-Head performance monitor extension for counter overflow, as ratified
> >    in commit bd9206 ("Initial commit") of Xuantie C906 user manual.
> >    https://github.com/T-head-Semi/openc906/tree/main/doc
> >
> >Is it OK with you?
> >
> 
> Please indicate chapter 12 and chapter 13.5 of the manual related to
> the PMU. And changed openc906 manual to openc910 manual because it is
> more updated.
> 
> If modified:
> 
> Reviewed-by: Inochi Amaoto <inochiama@outlook.com>

Got it! Thanks for the information.

Regards,
Peter Lin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 02/13] irqchip/riscv-intc: Allow large non-standard interrupt number
       [not found]   ` <871qbwsn9h.ffs@tglx>
@ 2023-12-12 10:17     ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-12-12 10:17 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: 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,
	peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt, samuel,
	sunilvl, tim609, uwu, wens, will, ycliang, inochiama

Hi Thomas,

On Fri, Dec 08, 2023 at 04:54:34PM +0100, Thomas Gleixner wrote:
> On Wed, Nov 22 2023 at 20:12, Yu Chien Peter Lin wrote:
> > Currently, the implementation of the RISC-V INTC driver uses the
> > interrupt cause as hwirq and has a limitation of supporting a
> 
> s/hwirq/hardware interrupt/
> 
> Please spell things out. We are not on Xitter here.
> 
> > 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
> 
> This limitation prevents to fully utilize the ... 

Okay, will fix.

Thanks,
Peter Lin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 03/13] irqchip/riscv-intc: Introduce Andes hart-level interrupt controller
       [not found]   ` <87y1e4r8db.ffs@tglx>
@ 2023-12-12 10:28     ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 19+ messages in thread
From: Yu-Chien Peter Lin @ 2023-12-12 10:28 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: 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,
	peterz, prabhakar.mahadev-lad.rj, rdunlap, robh+dt, samuel,
	sunilvl, tim609, uwu, wens, will, ycliang, inochiama

Hi Thomas,

On Fri, Dec 08, 2023 at 05:01:36PM +0100, Thomas Gleixner wrote:
> On Wed, Nov 22 2023 at 20:12, Yu Chien Peter Lin wrote:
> > To share the riscv_intc_domain_map() with the generic RISC-V INTC and
> > ACPI, we add a chip parameter to riscv_intc_init_common(), so it can be
> 
> s/we//
> 
> See: Documentation/process/
> 
> > passed to the irq_domain_set_info() as private data.
> > diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
> > index 2fdd40f2a791..30f0036c8978 100644
> > --- a/drivers/irqchip/irq-riscv-intc.c
> > +++ b/drivers/irqchip/irq-riscv-intc.c
> > @@ -17,6 +17,7 @@
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> >  #include <linux/smp.h>
> > +#include <linux/soc/andes/irq.h>
> >  
> >  static struct irq_domain *intc_domain;
> >  
> > @@ -46,6 +47,31 @@ 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)
> > +{
> > +	/*
> > +	 * Andes specific S-mode local interrupt causes (hwirq)
> > +	 * are defined as (256 + n) and controlled by n-th bit
> > +	 * of SLIE.
> > +	 */
> > +	unsigned int mask = BIT(d->hwirq % BITS_PER_LONG);
> 
> How is this supposed to be correct with BITS_PER_LONG == 64?

Yes, I should subtract ANDES_SLI_CAUSE_BASE directly here.

> > +
> > +	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);
> 
> Ditto.
> 
> > +	if (d->hwirq < ANDES_SLI_CAUSE_BASE)
> > +		csr_set(CSR_IE, mask);
> > +	else
> > +		csr_set(ANDES_CSR_SLIE, mask);
> > +}
> 
> >  static int riscv_intc_domain_map(struct irq_domain *d, unsigned int irq,
> >  				 irq_hw_number_t hwirq)
> >  {
> > +	struct irq_chip *chip = d->host_data;
> > +
> >  	irq_set_percpu_devid(irq);
> > -	irq_domain_set_info(d, irq, hwirq, &riscv_intc_chip, d->host_data,
> > +	irq_domain_set_info(d, irq, hwirq, chip, d->host_data,
> 
> So this sets 'chip_data' to the chip itself. What's the point? Just set
> it to NULL as the chip obviously does not need chip_data at all.

Will fix. Thanks.

Best regards,
Peter Lin

> >  			    handle_percpu_devid_irq, NULL, NULL);
> >  
> >  	return 0;
> > @@ -112,11 +147,12 @@ static struct fwnode_handle *riscv_intc_hwnode(void)
> >  	return intc_domain->fwnode;
> >  }
> >  
> > -static int __init riscv_intc_init_common(struct fwnode_handle *fn)
> > +static int __init riscv_intc_init_common(struct fwnode_handle *fn,
> > +					 struct irq_chip *chip)
> >  {
> >  	int rc;
> >  
> > -	intc_domain = irq_domain_create_tree(fn, &riscv_intc_domain_ops, NULL);
> > +	intc_domain = irq_domain_create_tree(fn, &riscv_intc_domain_ops, chip);
> >  	if (!intc_domain) {
> >  		pr_err("unable to add IRQ domain\n");
> >  		return -ENXIO;
> > @@ -138,6 +174,7 @@ static int __init riscv_intc_init(struct device_node *node,
> >  {
> >  	int rc;
> >  	unsigned long hartid;
> > +	struct irq_chip *chip = &riscv_intc_chip;
> 
> https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations
> 
> Thanks
> 
>         tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-12-12 10:30 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231122121235.827122-1-peterlin@andestech.com>
     [not found] ` <20231122121235.827122-6-peterlin@andestech.com>
2023-11-22 16:36   ` [PATCH v4 05/13] riscv: dts: renesas: r9a07g043f: Update compatible string to use Andes INTC Geert Uytterhoeven
     [not found] ` <20231122121235.827122-12-peterlin@andestech.com>
2023-11-22 21:12   ` [PATCH v4 11/13] riscv: dts: allwinner: Add T-Head PMU extension Guo Ren
2023-11-23 14:58   ` Conor Dooley
2023-11-29  9:34     ` Yu-Chien Peter Lin
     [not found] ` <20231122121235.827122-8-peterlin@andestech.com>
2023-11-22 21:16   ` [PATCH v4 07/13] RISC-V: Move T-Head PMU to CPU feature alternative framework Guo Ren
2023-11-23 14:45   ` Conor Dooley
     [not found] ` <20231122121235.827122-5-peterlin@andestech.com>
2023-11-23 14:38   ` [PATCH v4 04/13] dt-bindings: riscv: Add Andes interrupt controller compatible string Conor Dooley
     [not found]   ` <CA+V-a8t+vgrwDe9OxqMNHdcVX+qq76DuskF0ETCri4VeP-FAbg@mail.gmail.com>
2023-11-29  6:43     ` Yu-Chien Peter Lin
     [not found] ` <20231122121235.827122-10-peterlin@andestech.com>
2023-11-22 21:14   ` [PATCH v4 09/13] dt-bindings: riscv: Add T-Head PMU extension description Guo Ren
2023-11-29  8:48     ` Yu-Chien Peter Lin
     [not found]       ` <IA1PR20MB49537364BDF1ADE185CA8FE4BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
2023-11-30  9:21         ` Yu-Chien Peter Lin
     [not found]           ` <IA1PR20MB4953A05B9162AA2659DE78A5BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
2023-11-30 12:58             ` Conor Dooley
     [not found]               ` <IA1PR20MB495378652B09B37E92D8BB04BB82A@IA1PR20MB4953.namprd20.prod.outlook.com>
2023-12-01  0:40                 ` Conor Dooley
     [not found]           ` <IA1PR20MB4953460FE5BF431DD32CD860BB81A@IA1PR20MB4953.namprd20.prod.outlook.com>
2023-12-06  3:14             ` Yu-Chien Peter Lin
2023-11-23 14:48   ` Conor Dooley
2023-11-29  8:47     ` Yu-Chien Peter Lin
2023-11-29 12:33       ` Conor Dooley
     [not found] ` <20231122121235.827122-3-peterlin@andestech.com>
     [not found]   ` <871qbwsn9h.ffs@tglx>
2023-12-12 10:17     ` [PATCH v4 02/13] irqchip/riscv-intc: Allow large non-standard interrupt number Yu-Chien Peter Lin
     [not found] ` <20231122121235.827122-4-peterlin@andestech.com>
     [not found]   ` <87y1e4r8db.ffs@tglx>
2023-12-12 10:28     ` [PATCH v4 03/13] irqchip/riscv-intc: Introduce Andes hart-level interrupt controller 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).