* [PATCH v2 1/4] ARM64: ACPI: Remove the leftover acpi_init_cpus()
2024-08-11 4:22 [PATCH v2 0/4] Cleanups for ARM64 ACPI Hanjun Guo
@ 2024-08-11 4:23 ` Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 2/4] ARM64: ACPI: Remove the leftover arm64_acpi_numa_init() Hanjun Guo
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Hanjun Guo @ 2024-08-11 4:23 UTC (permalink / raw)
To: Sudeep Holla, Lorenzo Pieralisi, Rafael J . Wysocki
Cc: Will Deacon, Catalin Marinas, linux-acpi, linux-arm-kernel,
Hanjun Guo
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.
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
arch/arm64/include/asm/acpi.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index a407f9cd549e..e872d28edb04 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -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 */
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/4] ARM64: ACPI: Remove the leftover arm64_acpi_numa_init()
2024-08-11 4:22 [PATCH v2 0/4] Cleanups for ARM64 ACPI Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 1/4] ARM64: ACPI: Remove the leftover acpi_init_cpus() Hanjun Guo
@ 2024-08-11 4:23 ` Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 3/4] ARM64: ACPI: Make acpi_numa_get_nid() invisible to kernel/smp.c Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/ Hanjun Guo
3 siblings, 0 replies; 7+ messages in thread
From: Hanjun Guo @ 2024-08-11 4:23 UTC (permalink / raw)
To: Sudeep Holla, Lorenzo Pieralisi, Rafael J . Wysocki
Cc: Will Deacon, Catalin Marinas, linux-acpi, linux-arm-kernel,
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.
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
arch/arm64/include/asm/acpi.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index e872d28edb04..5e25110ad1b7 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -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 */
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 3/4] ARM64: ACPI: Make acpi_numa_get_nid() invisible to kernel/smp.c
2024-08-11 4:22 [PATCH v2 0/4] Cleanups for ARM64 ACPI Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 1/4] ARM64: ACPI: Remove the leftover acpi_init_cpus() Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 2/4] ARM64: ACPI: Remove the leftover arm64_acpi_numa_init() Hanjun Guo
@ 2024-08-11 4:23 ` Hanjun Guo
2024-08-11 4:23 ` [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/ Hanjun Guo
3 siblings, 0 replies; 7+ messages in thread
From: Hanjun Guo @ 2024-08-11 4:23 UTC (permalink / raw)
To: Sudeep Holla, Lorenzo Pieralisi, Rafael J . Wysocki
Cc: Will Deacon, Catalin Marinas, linux-acpi, linux-arm-kernel,
Hanjun Guo
To do the preparation of moving acpi_numa.c to drivers/acpi/arm64,
Make acpi_numa_get_nid() invisible to kernel/smp.c, with less
export functions.
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
arch/arm64/include/asm/acpi.h | 2 --
arch/arm64/kernel/acpi_numa.c | 8 +++++++-
arch/arm64/kernel/smp.c | 5 -----
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 5e25110ad1b7..40a501e1f26b 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -175,10 +175,8 @@ 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 */
diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c
index 0c036a9a3c33..2e55ff02bf07 100644
--- a/arch/arm64/kernel/acpi_numa.c
+++ b/arch/arm64/kernel/acpi_numa.c
@@ -29,7 +29,7 @@
static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE };
-int __init acpi_numa_get_nid(unsigned int cpu)
+static int __init acpi_numa_get_nid(unsigned int cpu)
{
return acpi_early_node_map[cpu];
}
@@ -72,9 +72,15 @@ static int __init acpi_parse_gicc_pxm(union acpi_subtable_headers *header,
void __init acpi_map_cpus_to_nodes(void)
{
+ int i;
+
acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat),
ACPI_SRAT_TYPE_GICC_AFFINITY,
acpi_parse_gicc_pxm, 0);
+
+ for (i = 0; i < nr_cpu_ids; i++)
+ early_map_cpu_to_node(i, acpi_numa_get_nid(i));
+
}
/* Callback for Proximity Domain -> ACPI processor UID mapping */
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 5e18fbcee9a2..b717b77ed4d6 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -650,8 +650,6 @@ acpi_parse_gic_cpu_interface(union acpi_subtable_headers *header,
static void __init acpi_parse_and_init_cpus(void)
{
- int i;
-
/*
* do a walk of MADT to determine how many CPUs
* we have including disabled CPUs, and get information
@@ -669,9 +667,6 @@ static void __init acpi_parse_and_init_cpus(void)
* as separate steps.
*/
acpi_map_cpus_to_nodes();
-
- for (i = 0; i < nr_cpu_ids; i++)
- early_map_cpu_to_node(i, acpi_numa_get_nid(i));
}
#else
#define acpi_parse_and_init_cpus(...) do { } while (0)
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
2024-08-11 4:22 [PATCH v2 0/4] Cleanups for ARM64 ACPI Hanjun Guo
` (2 preceding siblings ...)
2024-08-11 4:23 ` [PATCH v2 3/4] ARM64: ACPI: Make acpi_numa_get_nid() invisible to kernel/smp.c Hanjun Guo
@ 2024-08-11 4:23 ` Hanjun Guo
2024-08-12 3:02 ` kernel test robot
3 siblings, 1 reply; 7+ messages in thread
From: Hanjun Guo @ 2024-08-11 4:23 UTC (permalink / raw)
To: Sudeep Holla, Lorenzo Pieralisi, Rafael J . Wysocki
Cc: Will Deacon, Catalin Marinas, linux-acpi, linux-arm-kernel,
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 node and cpu, so move the ACPI NUMA code to
drivers/acpi/arm64/.
Since arm64 selects ACPI_NUMA by default if ACPI=y, just move the
function definitions under CONFIG_ARM64 in linux/acpi.h, as the
caller of acpi_map_cpus_to_nodes() is only with ACPI selected, so
no inline function is needed, this will solve the conflict with
riscv implementation as well.
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
arch/arm64/include/asm/acpi.h | 6 ------
arch/arm64/kernel/Makefile | 1 -
drivers/acpi/arm64/Makefile | 1 +
{arch/arm64/kernel => drivers/acpi/arm64}/acpi_numa.c | 0
include/linux/acpi.h | 1 +
5 files changed, 2 insertions(+), 7 deletions(-)
rename {arch/arm64/kernel => drivers/acpi/arm64}/acpi_numa.c (100%)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 40a501e1f26b..572355783971 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -174,12 +174,6 @@ static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
}
#endif /* CONFIG_ACPI_APEI */
-#ifdef CONFIG_ACPI_NUMA
-void acpi_map_cpus_to_nodes(void);
-#else
-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*/
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 2b112f3b7510..c7d09c6348a4 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -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
diff --git a/drivers/acpi/arm64/Makefile b/drivers/acpi/arm64/Makefile
index 05ecde9eaabe..9aeed2e4ebde 100644
--- a/drivers/acpi/arm64/Makefile
+++ b/drivers/acpi/arm64/Makefile
@@ -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
diff --git a/arch/arm64/kernel/acpi_numa.c b/drivers/acpi/arm64/acpi_numa.c
similarity index 100%
rename from arch/arm64/kernel/acpi_numa.c
rename to drivers/acpi/arm64/acpi_numa.c
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 0687a442fec7..09e0c2ad8c43 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -253,6 +253,7 @@ static inline void acpi_arch_dma_setup(struct device *dev) { }
#endif
#ifdef CONFIG_ARM64
+void acpi_map_cpus_to_nodes(void);
void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
#else
static inline void
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
2024-08-11 4:23 ` [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/ Hanjun Guo
@ 2024-08-12 3:02 ` kernel test robot
2024-08-12 3:46 ` Hanjun Guo
0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2024-08-12 3:02 UTC (permalink / raw)
To: Hanjun Guo, Sudeep Holla, Lorenzo Pieralisi, Rafael J . Wysocki
Cc: oe-kbuild-all, Will Deacon, Catalin Marinas, linux-acpi,
linux-arm-kernel, Hanjun Guo
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-rc3 next-20240809]
[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/20240811-122442
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link: https://lore.kernel.org/r/20240811042303.3498761-5-guohanjun%40huawei.com
patch subject: [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
config: arm64-randconfig-001-20240812 (https://download.01.org/0day-ci/archive/20240812/202408121026.c3mDLUsP-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240812/202408121026.c3mDLUsP-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408121026.c3mDLUsP-lkp@intel.com/
All errors (new ones prefixed by >>):
aarch64-linux-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-ld: arch/arm64/kernel/smp.o: in function `smp_init_cpus':
>> arch/arm64/kernel/smp.c:669:(.init.text+0x424): undefined reference to `acpi_map_cpus_to_nodes'
vim +669 arch/arm64/kernel/smp.c
e189624916961c Lorenzo Pieralisi 2018-06-25 650
e189624916961c Lorenzo Pieralisi 2018-06-25 651 static void __init acpi_parse_and_init_cpus(void)
e189624916961c Lorenzo Pieralisi 2018-06-25 652 {
e189624916961c Lorenzo Pieralisi 2018-06-25 653 /*
e189624916961c Lorenzo Pieralisi 2018-06-25 654 * do a walk of MADT to determine how many CPUs
e189624916961c Lorenzo Pieralisi 2018-06-25 655 * we have including disabled CPUs, and get information
e189624916961c Lorenzo Pieralisi 2018-06-25 656 * we need for SMP init.
e189624916961c Lorenzo Pieralisi 2018-06-25 657 */
e189624916961c Lorenzo Pieralisi 2018-06-25 658 acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
e189624916961c Lorenzo Pieralisi 2018-06-25 659 acpi_parse_gic_cpu_interface, 0);
e189624916961c Lorenzo Pieralisi 2018-06-25 660
e189624916961c Lorenzo Pieralisi 2018-06-25 661 /*
e189624916961c Lorenzo Pieralisi 2018-06-25 662 * In ACPI, SMP and CPU NUMA information is provided in separate
e189624916961c Lorenzo Pieralisi 2018-06-25 663 * static tables, namely the MADT and the SRAT.
e189624916961c Lorenzo Pieralisi 2018-06-25 664 *
e189624916961c Lorenzo Pieralisi 2018-06-25 665 * Thus, it is simpler to first create the cpu logical map through
e189624916961c Lorenzo Pieralisi 2018-06-25 666 * an MADT walk and then map the logical cpus to their node ids
e189624916961c Lorenzo Pieralisi 2018-06-25 667 * as separate steps.
e189624916961c Lorenzo Pieralisi 2018-06-25 668 */
e189624916961c Lorenzo Pieralisi 2018-06-25 @669 acpi_map_cpus_to_nodes();
e189624916961c Lorenzo Pieralisi 2018-06-25 670 }
0f0783365cbb7e Lorenzo Pieralisi 2015-05-13 671 #else
e189624916961c Lorenzo Pieralisi 2018-06-25 672 #define acpi_parse_and_init_cpus(...) do { } while (0)
0f0783365cbb7e Lorenzo Pieralisi 2015-05-13 673 #endif
0f0783365cbb7e Lorenzo Pieralisi 2015-05-13 674
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
2024-08-12 3:02 ` kernel test robot
@ 2024-08-12 3:46 ` Hanjun Guo
0 siblings, 0 replies; 7+ messages in thread
From: Hanjun Guo @ 2024-08-12 3:46 UTC (permalink / raw)
To: kernel test robot, Sudeep Holla, Lorenzo Pieralisi,
Rafael J . Wysocki
Cc: oe-kbuild-all, Will Deacon, Catalin Marinas, linux-acpi,
linux-arm-kernel
On 2024/8/12 11:02, kernel test robot wrote:
> 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-rc3 next-20240809]
> [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/20240811-122442
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
> patch link: https://lore.kernel.org/r/20240811042303.3498761-5-guohanjun%40huawei.com
> patch subject: [PATCH v2 4/4] ARM64: ACPI: Move the NUMA code to drivers/acpi/arm64/
> config: arm64-randconfig-001-20240812 (https://download.01.org/0day-ci/archive/20240812/202408121026.c3mDLUsP-lkp@intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 14.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240812/202408121026.c3mDLUsP-lkp@intel.com/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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202408121026.c3mDLUsP-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> aarch64-linux-ld: Unexpected GOT/PLT entries detected!
> aarch64-linux-ld: Unexpected run-time procedure linkages detected!
> aarch64-linux-ld: arch/arm64/kernel/smp.o: in function `smp_init_cpus':
>>> arch/arm64/kernel/smp.c:669:(.init.text+0x424): undefined reference to `acpi_map_cpus_to_nodes'
Good catch, I missed the random config which CONFIG_NUMA is not set.
Thanks
Hanjun
^ permalink raw reply [flat|nested] 7+ messages in thread