mbox series

[v4,0/4] Add ACPI NUMA support for RISC-V

Message ID cover.1718268003.git.haibo1.xu@intel.com (mailing list archive)
Headers show
Series Add ACPI NUMA support for RISC-V | expand

Message

Xu, Haibo1 June 13, 2024, 8:54 a.m. UTC
This patch series enable RISC-V ACPI NUMA support which was based on
the recently approved ACPI ECR[1].

Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
from SRAT and SLIT ACPI tables.
Patch 2/4 add the common SRAT RINTC affinity structure handler.
Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
by default on all supported platform.
Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
potential boot noise on ACPI platforms that are not NUMA.

Based-on: https://github.com/linux-riscv/linux-riscv/tree/for-next

[1] https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view?usp=sharing

Testing:
Since the ACPI AIA/PLIC support patch set is still under upstream review,
hence it is tested using the poll based HVC SBI console and RAM disk.
1) Build latest Qemu with the following patch backported
   https://github.com/vlsunil/qemu/commit/42bd4eeefd5d4410a68f02d54fee406d8a1269b0

2) Build latest EDK-II
   https://github.com/tianocore/edk2/blob/master/OvmfPkg/RiscVVirt/README.md

3) Build Linux with the following configs enabled
   CONFIG_RISCV_SBI_V01=y
   CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
   CONFIG_NONPORTABLE=y
   CONFIG_HVC_RISCV_SBI=y
   CONFIG_NUMA=y
   CONFIG_ACPI_NUMA=y

4) Build buildroot rootfs.cpio

5) Launch the Qemu machine
   qemu-system-riscv64 -nographic \
   -machine virt,pflash0=pflash0,pflash1=pflash1 -smp 4 -m 8G \
   -blockdev node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \
   -blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \
   -object memory-backend-ram,size=4G,id=m0 \
   -object memory-backend-ram,size=4G,id=m1 \
   -numa node,memdev=m0,cpus=0-1,nodeid=0 \
   -numa node,memdev=m1,cpus=2-3,nodeid=1 \
   -numa dist,src=0,dst=1,val=30 \
   -kernel linux/arch/riscv/boot/Image \
   -initrd buildroot/output/images/rootfs.cpio \
   -append "root=/dev/ram ro console=hvc0 earlycon=sbi"

[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x80000000-0x17fffffff]
[    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x180000000-0x27fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x17fe3bc40-0x17fe3cfff]
[    0.000000] NUMA: NODE_DATA [mem 0x27fff4c40-0x27fff5fff]
...
[    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x0 -> Node 0
[    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x1 -> Node 0
[    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x2 -> Node 1
[    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x3 -> Node 1

---
Changes since v3
  - Rebase to linux-riscv/for-next(Linux 6.10-rc1)
  - Remove original patch 1/6 since it had been merged through
    ACPICA pull(commit fe1c408d50604f)
  - Remove original patch 4/6 since the related changes was
    introduced in commit 3a785e19f43267

Haibo Xu (4):
  ACPI: RISCV: Add NUMA support based on SRAT and SLIT
  ACPI: NUMA: Add handler for SRAT RINTC affinity structure
  ACPI: NUMA: change the ACPI_NUMA to a hidden option
  ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init

 arch/arm64/Kconfig            |   1 -
 arch/loongarch/Kconfig        |   1 -
 arch/riscv/include/asm/acpi.h |  15 +++-
 arch/riscv/kernel/Makefile    |   1 +
 arch/riscv/kernel/acpi.c      |   5 --
 arch/riscv/kernel/acpi_numa.c | 131 ++++++++++++++++++++++++++++++++++
 arch/riscv/kernel/setup.c     |   4 +-
 arch/riscv/kernel/smpboot.c   |   2 -
 drivers/acpi/numa/Kconfig     |   5 +-
 drivers/acpi/numa/srat.c      |  32 ++++++++-
 drivers/base/arch_numa.c      |   2 +-
 include/linux/acpi.h          |   6 ++
 12 files changed, 187 insertions(+), 18 deletions(-)
 create mode 100644 arch/riscv/kernel/acpi_numa.c

Comments

Hanjun Guo June 24, 2024, 2:26 a.m. UTC | #1
On 2024/6/13 16:54, Haibo Xu wrote:
> This patch series enable RISC-V ACPI NUMA support which was based on
> the recently approved ACPI ECR[1].
> 
> Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
> from SRAT and SLIT ACPI tables.
> Patch 2/4 add the common SRAT RINTC affinity structure handler.
> Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
> by default on all supported platform.
> Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
> potential boot noise on ACPI platforms that are not NUMA.

Looks good to me,

Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Sunil V L July 1, 2024, 5:52 a.m. UTC | #2
On Thu, Jun 13, 2024 at 04:54:32PM +0800, Haibo Xu wrote:
> This patch series enable RISC-V ACPI NUMA support which was based on
> the recently approved ACPI ECR[1].
> 
> Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
> from SRAT and SLIT ACPI tables.
> Patch 2/4 add the common SRAT RINTC affinity structure handler.
> Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
> by default on all supported platform.
> Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
> potential boot noise on ACPI platforms that are not NUMA.
> 
> Based-on: https://github.com/linux-riscv/linux-riscv/tree/for-next
> 
> [1] https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view?usp=sharing

Hi Palmer,

Can this series be taken for -next?

Thanks,
Sunil
patchwork-bot+linux-riscv@kernel.org July 23, 2024, 12:58 p.m. UTC | #3
Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 13 Jun 2024 16:54:32 +0800 you wrote:
> This patch series enable RISC-V ACPI NUMA support which was based on
> the recently approved ACPI ECR[1].
> 
> Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
> from SRAT and SLIT ACPI tables.
> Patch 2/4 add the common SRAT RINTC affinity structure handler.
> Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
> by default on all supported platform.
> Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
> potential boot noise on ACPI platforms that are not NUMA.
> 
> [...]

Here is the summary with links:
  - [v4,1/4] ACPI: RISCV: Add NUMA support based on SRAT and SLIT
    https://git.kernel.org/riscv/c/eabd9db64ea8
  - [v4,2/4] ACPI: NUMA: Add handler for SRAT RINTC affinity structure
    https://git.kernel.org/riscv/c/39494aec8a04
  - [v4,3/4] ACPI: NUMA: change the ACPI_NUMA to a hidden option
    https://git.kernel.org/riscv/c/adc3e82d2537
  - [v4,4/4] ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init
    https://git.kernel.org/riscv/c/5f76d4211ee4

You are awesome, thank you!
Palmer Dabbelt July 24, 2024, 2:50 p.m. UTC | #4
On Thu, 13 Jun 2024 01:54:32 PDT (-0700), haibo1.xu@intel.com wrote:
> This patch series enable RISC-V ACPI NUMA support which was based on
> the recently approved ACPI ECR[1].
>
> Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
> from SRAT and SLIT ACPI tables.
> Patch 2/4 add the common SRAT RINTC affinity structure handler.
> Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
> by default on all supported platform.
> Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
> potential boot noise on ACPI platforms that are not NUMA.
>
> Based-on: https://github.com/linux-riscv/linux-riscv/tree/for-next

No big deal, but that's not actually my repo.  Looks like it's just 
mirroring something, I use the kernel.org git stuff these days.  I 
dropped it from the cover letter for the merge, it's not super useful 
anyway because it's a branch so nobody will know what it means later.

Aside from that things look good, I've got this queued up for the 
tester.

>
> [1] https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view?usp=sharing
>
> Testing:
> Since the ACPI AIA/PLIC support patch set is still under upstream review,
> hence it is tested using the poll based HVC SBI console and RAM disk.
> 1) Build latest Qemu with the following patch backported
>    https://github.com/vlsunil/qemu/commit/42bd4eeefd5d4410a68f02d54fee406d8a1269b0
>
> 2) Build latest EDK-II
>    https://github.com/tianocore/edk2/blob/master/OvmfPkg/RiscVVirt/README.md
>
> 3) Build Linux with the following configs enabled
>    CONFIG_RISCV_SBI_V01=y
>    CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
>    CONFIG_NONPORTABLE=y
>    CONFIG_HVC_RISCV_SBI=y
>    CONFIG_NUMA=y
>    CONFIG_ACPI_NUMA=y
>
> 4) Build buildroot rootfs.cpio
>
> 5) Launch the Qemu machine
>    qemu-system-riscv64 -nographic \
>    -machine virt,pflash0=pflash0,pflash1=pflash1 -smp 4 -m 8G \
>    -blockdev node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \
>    -blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \
>    -object memory-backend-ram,size=4G,id=m0 \
>    -object memory-backend-ram,size=4G,id=m1 \
>    -numa node,memdev=m0,cpus=0-1,nodeid=0 \
>    -numa node,memdev=m1,cpus=2-3,nodeid=1 \
>    -numa dist,src=0,dst=1,val=30 \
>    -kernel linux/arch/riscv/boot/Image \
>    -initrd buildroot/output/images/rootfs.cpio \
>    -append "root=/dev/ram ro console=hvc0 earlycon=sbi"
>
> [    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x80000000-0x17fffffff]
> [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x180000000-0x27fffffff]
> [    0.000000] NUMA: NODE_DATA [mem 0x17fe3bc40-0x17fe3cfff]
> [    0.000000] NUMA: NODE_DATA [mem 0x27fff4c40-0x27fff5fff]
> ...
> [    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x0 -> Node 0
> [    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x1 -> Node 0
> [    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x2 -> Node 1
> [    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x3 -> Node 1
>
> ---
> Changes since v3
>   - Rebase to linux-riscv/for-next(Linux 6.10-rc1)
>   - Remove original patch 1/6 since it had been merged through
>     ACPICA pull(commit fe1c408d50604f)
>   - Remove original patch 4/6 since the related changes was
>     introduced in commit 3a785e19f43267
>
> Haibo Xu (4):
>   ACPI: RISCV: Add NUMA support based on SRAT and SLIT
>   ACPI: NUMA: Add handler for SRAT RINTC affinity structure
>   ACPI: NUMA: change the ACPI_NUMA to a hidden option
>   ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init
>
>  arch/arm64/Kconfig            |   1 -
>  arch/loongarch/Kconfig        |   1 -
>  arch/riscv/include/asm/acpi.h |  15 +++-
>  arch/riscv/kernel/Makefile    |   1 +
>  arch/riscv/kernel/acpi.c      |   5 --
>  arch/riscv/kernel/acpi_numa.c | 131 ++++++++++++++++++++++++++++++++++
>  arch/riscv/kernel/setup.c     |   4 +-
>  arch/riscv/kernel/smpboot.c   |   2 -
>  drivers/acpi/numa/Kconfig     |   5 +-
>  drivers/acpi/numa/srat.c      |  32 ++++++++-
>  drivers/base/arch_numa.c      |   2 +-
>  include/linux/acpi.h          |   6 ++
>  12 files changed, 187 insertions(+), 18 deletions(-)
>  create mode 100644 arch/riscv/kernel/acpi_numa.c
Haibo Xu July 24, 2024, 2:56 p.m. UTC | #5
On Wed, Jul 24, 2024 at 10:50 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Thu, 13 Jun 2024 01:54:32 PDT (-0700), haibo1.xu@intel.com wrote:
> > This patch series enable RISC-V ACPI NUMA support which was based on
> > the recently approved ACPI ECR[1].
> >
> > Patch 1/4 add RISC-V specific acpi_numa.c file to parse NUMA information
> > from SRAT and SLIT ACPI tables.
> > Patch 2/4 add the common SRAT RINTC affinity structure handler.
> > Patch 3/4 change the ACPI_NUMA to a hidden option since it would be selected
> > by default on all supported platform.
> > Patch 4/4 replace pr_info with pr_debug in arch_acpi_numa_init() to avoid
> > potential boot noise on ACPI platforms that are not NUMA.
> >
> > Based-on: https://github.com/linux-riscv/linux-riscv/tree/for-next
>
> No big deal, but that's not actually my repo.  Looks like it's just
> mirroring something, I use the kernel.org git stuff these days.  I
> dropped it from the cover letter for the merge, it's not super useful
> anyway because it's a branch so nobody will know what it means later.
>
> Aside from that things look good, I've got this queued up for the
> tester.
>

Thanks!

> >
> > [1] https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view?usp=sharing
> >
> > Testing:
> > Since the ACPI AIA/PLIC support patch set is still under upstream review,
> > hence it is tested using the poll based HVC SBI console and RAM disk.
> > 1) Build latest Qemu with the following patch backported
> >    https://github.com/vlsunil/qemu/commit/42bd4eeefd5d4410a68f02d54fee406d8a1269b0
> >
> > 2) Build latest EDK-II
> >    https://github.com/tianocore/edk2/blob/master/OvmfPkg/RiscVVirt/README.md
> >
> > 3) Build Linux with the following configs enabled
> >    CONFIG_RISCV_SBI_V01=y
> >    CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
> >    CONFIG_NONPORTABLE=y
> >    CONFIG_HVC_RISCV_SBI=y
> >    CONFIG_NUMA=y
> >    CONFIG_ACPI_NUMA=y
> >
> > 4) Build buildroot rootfs.cpio
> >
> > 5) Launch the Qemu machine
> >    qemu-system-riscv64 -nographic \
> >    -machine virt,pflash0=pflash0,pflash1=pflash1 -smp 4 -m 8G \
> >    -blockdev node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \
> >    -blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \
> >    -object memory-backend-ram,size=4G,id=m0 \
> >    -object memory-backend-ram,size=4G,id=m1 \
> >    -numa node,memdev=m0,cpus=0-1,nodeid=0 \
> >    -numa node,memdev=m1,cpus=2-3,nodeid=1 \
> >    -numa dist,src=0,dst=1,val=30 \
> >    -kernel linux/arch/riscv/boot/Image \
> >    -initrd buildroot/output/images/rootfs.cpio \
> >    -append "root=/dev/ram ro console=hvc0 earlycon=sbi"
> >
> > [    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x80000000-0x17fffffff]
> > [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x180000000-0x27fffffff]
> > [    0.000000] NUMA: NODE_DATA [mem 0x17fe3bc40-0x17fe3cfff]
> > [    0.000000] NUMA: NODE_DATA [mem 0x27fff4c40-0x27fff5fff]
> > ...
> > [    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x0 -> Node 0
> > [    0.000000] ACPI: NUMA: SRAT: PXM 0 -> HARTID 0x1 -> Node 0
> > [    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x2 -> Node 1
> > [    0.000000] ACPI: NUMA: SRAT: PXM 1 -> HARTID 0x3 -> Node 1
> >
> > ---
> > Changes since v3
> >   - Rebase to linux-riscv/for-next(Linux 6.10-rc1)
> >   - Remove original patch 1/6 since it had been merged through
> >     ACPICA pull(commit fe1c408d50604f)
> >   - Remove original patch 4/6 since the related changes was
> >     introduced in commit 3a785e19f43267
> >
> > Haibo Xu (4):
> >   ACPI: RISCV: Add NUMA support based on SRAT and SLIT
> >   ACPI: NUMA: Add handler for SRAT RINTC affinity structure
> >   ACPI: NUMA: change the ACPI_NUMA to a hidden option
> >   ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init
> >
> >  arch/arm64/Kconfig            |   1 -
> >  arch/loongarch/Kconfig        |   1 -
> >  arch/riscv/include/asm/acpi.h |  15 +++-
> >  arch/riscv/kernel/Makefile    |   1 +
> >  arch/riscv/kernel/acpi.c      |   5 --
> >  arch/riscv/kernel/acpi_numa.c | 131 ++++++++++++++++++++++++++++++++++
> >  arch/riscv/kernel/setup.c     |   4 +-
> >  arch/riscv/kernel/smpboot.c   |   2 -
> >  drivers/acpi/numa/Kconfig     |   5 +-
> >  drivers/acpi/numa/srat.c      |  32 ++++++++-
> >  drivers/base/arch_numa.c      |   2 +-
> >  include/linux/acpi.h          |   6 ++
> >  12 files changed, 187 insertions(+), 18 deletions(-)
> >  create mode 100644 arch/riscv/kernel/acpi_numa.c