mbox series

[0/5] LoongArch, MIPS: Unify Loongson IOCSR handling

Message ID 20240907-iocsr-v1-0-0c99b3334444@flygoat.com (mailing list archive)
Headers show
Series LoongArch, MIPS: Unify Loongson IOCSR handling | expand

Message

Jiaxun Yang Sept. 7, 2024, 10:17 a.m. UTC
Hi folks,

This series unfied LoongArch and MIPS's IOCSR functions and
macros so they will expose same interface to arch-indenpendent
drivers.

This can reduce code deuplication, and also help my unifed IPI driver
and MIPS extio driver effort.

This is touching many sub-systems in once so might be hard to merge.

Huacai, can you apply first three patch via loongarch-next tree.
For last two patch maybe better merge them via a second PR after
all subsystem PRs merged.

Please review.
Thanks

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Jiaxun Yang (5):
      LoongArch: Rename cpu_has_csr as cpu_has_iocsr
      LoongArch: Probe more CPU features from CPUCFG
      LoongArch: cpu-probe: Move IOCSR probing out of cpu_probe_common
      LoongArch: Extract IOCSR definitions to standalone header
      MIPS: Loongson64: Use shared IOCSR header

 MAINTAINERS                                        |   1 +
 arch/loongarch/include/asm/cpu-features.h          |   2 +-
 arch/loongarch/include/asm/cpu.h                   |   4 +-
 arch/loongarch/include/asm/loongarch.h             |  90 ----------------
 arch/loongarch/kernel/cpu-probe.c                  | 111 ++++++++++++--------
 arch/loongarch/kernel/relocate_kernel.S            |   5 +-
 arch/loongarch/kernel/smp.c                        |  23 +++--
 .../include/asm/mach-loongson64/loongson_regs.h    |  58 +++--------
 arch/mips/kvm/vz.c                                 |   2 +-
 arch/mips/loongson64/smp.c                         |  44 ++++----
 drivers/cpufreq/loongson3_cpufreq.c                |  10 +-
 drivers/irqchip/irq-loongarch-avec.c               |   5 +-
 drivers/irqchip/irq-loongson-eiointc.c             |   5 +-
 drivers/platform/mips/cpu_hwmon.c                  |   7 +-
 include/linux/loongson/iocsr.h                     | 113 +++++++++++++++++++++
 15 files changed, 256 insertions(+), 224 deletions(-)
---
base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
change-id: 20240906-iocsr-829075458511

Best regards,

Comments

Huacai Chen Sept. 7, 2024, 10:25 a.m. UTC | #1
Hi, Jiaxun,

On Sat, Sep 7, 2024 at 6:17 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> Hi folks,
>
> This series unfied LoongArch and MIPS's IOCSR functions and
> macros so they will expose same interface to arch-indenpendent
> drivers.
>
> This can reduce code deuplication, and also help my unifed IPI driver
> and MIPS extio driver effort.
>
> This is touching many sub-systems in once so might be hard to merge.
>
> Huacai, can you apply first three patch via loongarch-next tree.
> For last two patch maybe better merge them via a second PR after
> all subsystem PRs merged.
The problem is I'm not sure whether IOCSR registers are compatible in
all Loongson processors.

Huacai

>
> Please review.
> Thanks
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Jiaxun Yang (5):
>       LoongArch: Rename cpu_has_csr as cpu_has_iocsr
>       LoongArch: Probe more CPU features from CPUCFG
>       LoongArch: cpu-probe: Move IOCSR probing out of cpu_probe_common
>       LoongArch: Extract IOCSR definitions to standalone header
>       MIPS: Loongson64: Use shared IOCSR header
>
>  MAINTAINERS                                        |   1 +
>  arch/loongarch/include/asm/cpu-features.h          |   2 +-
>  arch/loongarch/include/asm/cpu.h                   |   4 +-
>  arch/loongarch/include/asm/loongarch.h             |  90 ----------------
>  arch/loongarch/kernel/cpu-probe.c                  | 111 ++++++++++++--------
>  arch/loongarch/kernel/relocate_kernel.S            |   5 +-
>  arch/loongarch/kernel/smp.c                        |  23 +++--
>  .../include/asm/mach-loongson64/loongson_regs.h    |  58 +++--------
>  arch/mips/kvm/vz.c                                 |   2 +-
>  arch/mips/loongson64/smp.c                         |  44 ++++----
>  drivers/cpufreq/loongson3_cpufreq.c                |  10 +-
>  drivers/irqchip/irq-loongarch-avec.c               |   5 +-
>  drivers/irqchip/irq-loongson-eiointc.c             |   5 +-
>  drivers/platform/mips/cpu_hwmon.c                  |   7 +-
>  include/linux/loongson/iocsr.h                     | 113 +++++++++++++++++++++
>  15 files changed, 256 insertions(+), 224 deletions(-)
> ---
> base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
> change-id: 20240906-iocsr-829075458511
>
> Best regards,
> --
> Jiaxun Yang <jiaxun.yang@flygoat.com>
>
Jiaxun Yang Sept. 7, 2024, 10:30 a.m. UTC | #2
在2024年9月7日九月 上午11:25,Huacai Chen写道:
> Hi, Jiaxun,
>
> On Sat, Sep 7, 2024 at 6:17 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>>
>> Hi folks,
>>
>> This series unfied LoongArch and MIPS's IOCSR functions and
>> macros so they will expose same interface to arch-indenpendent
>> drivers.
>>
>> This can reduce code deuplication, and also help my unifed IPI driver
>> and MIPS extio driver effort.
>>
>> This is touching many sub-systems in once so might be hard to merge.
>>
>> Huacai, can you apply first three patch via loongarch-next tree.
>> For last two patch maybe better merge them via a second PR after
>> all subsystem PRs merged.
> The problem is I'm not sure whether IOCSR registers are compatible in
> all Loongson processors.

Maybe we can introduce something like IOCSR flavour later, however my take
would be force all IOCSR devices to be probed by OF/ACPI.

In this case, it's still better to share IOCSR macro and functions between
MIPS/LoongArch Loongson-3 processors, as they are guaranteed to be compatible.

Future incompatible definitions will benefit from better resilience provided
by this series as well.

Thanks
- Jiaxun

>
> Huacai
>
>>
>> Please review.
>> Thanks
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>> Jiaxun Yang (5):
>>       LoongArch: Rename cpu_has_csr as cpu_has_iocsr
>>       LoongArch: Probe more CPU features from CPUCFG
>>       LoongArch: cpu-probe: Move IOCSR probing out of cpu_probe_common
>>       LoongArch: Extract IOCSR definitions to standalone header
>>       MIPS: Loongson64: Use shared IOCSR header
>>
>>  MAINTAINERS                                        |   1 +
>>  arch/loongarch/include/asm/cpu-features.h          |   2 +-
>>  arch/loongarch/include/asm/cpu.h                   |   4 +-
>>  arch/loongarch/include/asm/loongarch.h             |  90 ----------------
>>  arch/loongarch/kernel/cpu-probe.c                  | 111 ++++++++++++--------
>>  arch/loongarch/kernel/relocate_kernel.S            |   5 +-
>>  arch/loongarch/kernel/smp.c                        |  23 +++--
>>  .../include/asm/mach-loongson64/loongson_regs.h    |  58 +++--------
>>  arch/mips/kvm/vz.c                                 |   2 +-
>>  arch/mips/loongson64/smp.c                         |  44 ++++----
>>  drivers/cpufreq/loongson3_cpufreq.c                |  10 +-
>>  drivers/irqchip/irq-loongarch-avec.c               |   5 +-
>>  drivers/irqchip/irq-loongson-eiointc.c             |   5 +-
>>  drivers/platform/mips/cpu_hwmon.c                  |   7 +-
>>  include/linux/loongson/iocsr.h                     | 113 +++++++++++++++++++++
>>  15 files changed, 256 insertions(+), 224 deletions(-)
>> ---
>> base-commit: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
>> change-id: 20240906-iocsr-829075458511
>>
>> Best regards,
>> --
>> Jiaxun Yang <jiaxun.yang@flygoat.com>
>>