Messages in this thread | | | Subject | Re: [PATCH v3 2/4] LoongArch: Refactor get_acpi_id_for_cpu() related code | From | Tiezhu Yang <> | Date | Fri, 12 Apr 2024 17:28:52 +0800 |
| |
On 04/12/2024 12:17 PM, Huacai Chen wrote: > Hi, Tiezhu, > > On Thu, Apr 11, 2024 at 9:05 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: >> >> Currently, cpu_logical_map(cpu) is defined as __cpu_logical_map[cpu] >> in arch/loongarch/include/asm/smp.h and __cpu_logical_map[] is defined >> in arch/loongarch/kernel/smp.c, that is to say, cpu_logical_map(cpu) is >> vaild only under CONFIG_SMP, the implementation of get_acpi_id_for_cpu() >> which calls cpu_logical_map(cpu) is not suitable for the case of non-SMP, >> so refactor get_acpi_id_for_cpu() related code to make it work well for >> both SMP and non-SMP. > But you implement cpu_logical_map(cpu) for non-SMP in the 4th patch, right?
The initial aim is to make get_acpi_id_for_cpu() only related with acpi stuff and referenced the following riscv code, this patch can be dropped if you think it is better to only define cpu_logical_map(cpu) under !CONFIG_SMP, I am not sure whether it needs to keep the changes in acpi.c at least.
static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end) { struct acpi_madt_rintc *rintc = (struct acpi_madt_rintc *)header; int cpuid;
if (!(rintc->flags & ACPI_MADT_ENABLED)) return 0;
cpuid = riscv_hartid_to_cpuid(rintc->hart_id); /* * When CONFIG_SMP is disabled, mapping won't be created for * all cpus. * CPUs more than num_possible_cpus, will be ignored. */ if (cpuid >= 0 && cpuid < num_possible_cpus()) cpu_madt_rintc[cpuid] = *rintc;
return 0; }
struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) { return &cpu_madt_rintc[cpu]; }
u32 get_acpi_id_for_cpu(int cpu) { return acpi_cpu_get_madt_rintc(cpu)->uid; }
https://elixir.bootlin.com/linux/v6.9-rc3/source/arch/riscv/kernel/acpi.c#L194
Thanks, Tiezhu
| |