Skip to contentSkip to conversation

cleanups for ARM64 ACPI

PATCH Superseded Hanjun Guo 3 participants 7 messages Aug 8, 2024 – Aug 9, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hanjun Guo

author maintainer
#0 lore raw

cover cleanups for ARM64 ACPI

Remove some leftover functions in asm/acpi.h, and ACPI NUMA code are not strictly arch specific, move them to drivers/acpi/arm64/.

Hanjun Guo (3):
ARM64: ACPI: Remove the leftover acpi_init_cpus()
ARM64: ACPI: Remove the leftover arm64_acpi_numa_init()
ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/

 arch/arm64/include/asm/acpi.h                        | 12 ------------
 arch/arm64/kernel/Makefile                           |  1 -
 drivers/acpi/arm64/Makefile                          |  1 +
 .../arm64/kernel => drivers/acpi/arm64}/acpi_numa.c  |  0
 include/linux/acpi.h                                 |  4 ++++
 5 files changed, 5 insertions(+), 13 deletions(-)
 rename {arch/arm64/kernel => drivers/acpi/arm64}/acpi_numa.c (100%)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/3 ARM64: ACPI: Remove the leftover acpi_init_cpus()

In commit 0f0783365cbb ("ARM64: kernel: unify ACPI and DT cpus initialization"), function acpi_init_cpus() was removed but the declaration was left in the asm/acpi.h, remove it.

---
 arch/arm64/include/asm/acpi.h | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/include/asm/acpi.h +0 -2
index a407f9cd549e..e872d28edb04 100644
@@ -132,10 +132,8 @@ static inline int get_cpu_for_acpi_id(u32 uid)
 }
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
-void __init acpi_init_cpus(void);
 int apei_claim_sea(struct pt_regs *regs);
 #else
-static inline void acpi_init_cpus(void) { }
 static inline int apei_claim_sea(struct pt_regs *regs) { return -ENOENT; }
 #endif /* CONFIG_ACPI */
 
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 2/3 ARM64: ACPI: Remove the leftover arm64_acpi_numa_init()

In reply to Hanjun Guo

In commit eb75541f8b45 ("arm64, numa: Change the numa init functions name to be generic"), arm64_acpi_numa_init() was renamed to arch_acpi_numa_init() and be static, so the leftover arm64_acpi_numa_init() in head file should be removed.

---
 arch/arm64/include/asm/acpi.h | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/include/asm/acpi.h +0 -2
index e872d28edb04..5e25110ad1b7 100644
@@ -175,11 +175,9 @@ static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
 #endif /* CONFIG_ACPI_APEI */
 
 #ifdef CONFIG_ACPI_NUMA
-int arm64_acpi_numa_init(void);
 int acpi_numa_get_nid(unsigned int cpu);
 void acpi_map_cpus_to_nodes(void);
 #else
-static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
 static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
 static inline void acpi_map_cpus_to_nodes(void) { }
 #endif /* CONFIG_ACPI_NUMA */
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH 3/3 ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/

In reply to Hanjun Guo

The ARM64 ACPI NUMA code can be moved out of arm64 arch code as it just related to ACPI NUMA table parsing, mappings for ACPI NUMA and cpu, move the ACPI NUMA code to drivers/acpi/arm64/.

Since arm64 selects ACPI_NUMA by default, so just move the function definitions under CONFIG_ARM64 in linux/acpi.h.

---
 arch/arm64/include/asm/acpi.h                         | 8 --------
 arch/arm64/kernel/Makefile                            | 1 -
 drivers/acpi/arm64/Makefile                           | 1 +
 {arch/arm64/kernel => drivers/acpi/arm64}/acpi_numa.c | 0
 include/linux/acpi.h                                  | 4 ++++
 5 files changed, 5 insertions(+), 9 deletions(-)
 rename {arch/arm64/kernel => drivers/acpi/arm64}/acpi_numa.c (100%)
arch/arm64/include/asm/acpi.h +0 -8
index 5e25110ad1b7..572355783971 100644
@@ -174,14 +174,6 @@ static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
 }
 #endif /* CONFIG_ACPI_APEI */
 
-#ifdef CONFIG_ACPI_NUMA
-int acpi_numa_get_nid(unsigned int cpu);
-void acpi_map_cpus_to_nodes(void);
-#else
-static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
-static inline void acpi_map_cpus_to_nodes(void) { }
-#endif /* CONFIG_ACPI_NUMA */
-
 #define ACPI_TABLE_UPGRADE_MAX_PHYS MEMBLOCK_ALLOC_ACCESSIBLE
 
 #endif /*_ASM_ACPI_H*/
arch/arm64/kernel/Makefile +0 -1
index 2b112f3b7510..c7d09c6348a4 100644
@@ -52,7 +52,6 @@ obj-$(CONFIG_EFI)			+= efi.o efi-rt-wrapper.o
 obj-$(CONFIG_PCI)			+= pci.o
 obj-$(CONFIG_ARMV8_DEPRECATED)		+= armv8_deprecated.o
 obj-$(CONFIG_ACPI)			+= acpi.o
-obj-$(CONFIG_ACPI_NUMA)			+= acpi_numa.o
 obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL)	+= acpi_parking_protocol.o
 obj-$(CONFIG_PARAVIRT)			+= paravirt.o
 obj-$(CONFIG_RANDOMIZE_BASE)		+= kaslr.o
drivers/acpi/arm64/Makefile +1 -0
index 05ecde9eaabe..9aeed2e4ebde 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_ACPI_APMT) 	+= apmt.o
 obj-$(CONFIG_ACPI_FFH)		+= ffh.o
 obj-$(CONFIG_ACPI_GTDT) 	+= gtdt.o
 obj-$(CONFIG_ACPI_IORT) 	+= iort.o
+obj-$(CONFIG_ACPI_NUMA)		+= acpi_numa.o
 obj-$(CONFIG_ACPI_PROCESSOR_IDLE) += cpuidle.o
 obj-$(CONFIG_ARM_AMBA)		+= amba.o
 obj-y				+= dma.o init.o
drivers/acpi/arm64/acpi_numa.c renamed from arch/arm64/kernel/acpi_numa.c +0 -0
similarity index 100%
rename from arch/arm64/kernel/acpi_numa.c
rename to drivers/acpi/arm64/acpi_numa.c
include/linux/acpi.h +4 -0
index 0687a442fec7..7de4e9dac0c7 100644
@@ -253,8 +253,12 @@ static inline void acpi_arch_dma_setup(struct device *dev) { }
 #endif
 
 #ifdef CONFIG_ARM64
+int acpi_numa_get_nid(unsigned int cpu);
+void acpi_map_cpus_to_nodes(void);
 void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
 #else
+static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
+static inline void acpi_map_cpus_to_nodes(void) { }
 static inline void
 acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
 #endif
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH 3/3] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/

kernel test robot noticed the following build errors:

Hi Hanjun,

kernel test robot noticed the following build errors:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on rafael-pm/linux-next rafael-pm/bleeding-edge linus/master v6.11-rc2 next-20240808] [cannot apply to arm-perf/for-next/perf]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hanjun-Guo/ARM64-ACPI-Remove-the-leftover-acpi_init_cpus/20240808-212154
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link:    https://lore.kernel.org/r/20240808131522.1032431-4-guohanjun%40huawei.com
patch subject: [PATCH 3/3] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20240809/[email protected]/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 4527fba9ad6bc682eceda603150bfaec65ec6916)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240809/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/nvme/host/pci.c:7:

>> include/linux/acpi.h:260:19: error: redefinition of 'acpi_numa_get_nid'
     260 | static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
         |                   ^
   arch/riscv/include/asm/acpi.h:68:19: note: previous definition is here
      68 | static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
         |                   ^
   In file included from drivers/nvme/host/pci.c:9:
   In file included from include/linux/blkdev.h:9:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/riscv/include/asm/cacheflush.h:9:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   drivers/nvme/host/pci.c:2982:41: warning: shift count >= width of type [-Wshift-count-overflow]
    2982 |                 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
         |                                                       ^~~~~~~~~~~~~~~~

include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
| ^ ~~~
2 warnings and 1 error generated.

vim +/acpi_numa_get_nid +260 include/linux/acpi.h

254
255 #ifdef CONFIG_ARM64
256 int acpi_numa_get_nid(unsigned int cpu);
257 void acpi_map_cpus_to_nodes(void);
258 void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
259 #else

 > 260	static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }

261 static inline void acpi_map_cpus_to_nodes(void) { }
262 static inline void
263 acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
264 #endif
265

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw

Re: [PATCH 3/3] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/

In reply to Hanjun Guo
Quoted 6 lines · Hanjun Guo

The ARM64 ACPI NUMA code can be moved out of arm64 arch code as it just related to ACPI NUMA table parsing, mappings for ACPI NUMA and cpu, move the ACPI NUMA code to drivers/acpi/arm64/.

Since arm64 selects ACPI_NUMA by default, so just move the function definitions under CONFIG_ARM64 in linux/acpi.h.

I was about to ask to take a look at riscv implementation to avoid any issues with this move, kbuild has already reported a build failure.

--
Regards,
Sudeep

author maintainer
#6 lore raw

Re: [PATCH 3/3] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/

Quoted 10 lines · Sudeep Holla
Quoted 6 lines · Hanjun Guo

The ARM64 ACPI NUMA code can be moved out of arm64 arch code as it just related to ACPI NUMA table parsing, mappings for ACPI NUMA and cpu, move the ACPI NUMA code to drivers/acpi/arm64/.

Since arm64 selects ACPI_NUMA by default, so just move the function definitions under CONFIG_ARM64 in linux/acpi.h.

I was about to ask to take a look at riscv implementation to avoid any issues with this move, kbuild has already reported a build failure.

sharp-sighted :)

Will take care of it next version.

Thanks
Hanjun