lkml.org 
[lkml]   [2021]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] openrisc: use device tree to determine present cpus
On Sat, Jan 30, 2021 at 12:00:10PM +0100, Jan Henrik Weinstock wrote:
> Hi Stafford, Geert,
>
> thanks for your feedback. I have made the following changes to the patch:

Hi, Thanks for the updates.

> 1. use for_each_of_cpu_node
> 2. possible_cpus is now what is in the devicetree, up to NR_CPUS
> 3. present_cpus is now all possible cpus, up to max_cpus

This looks good, one small comment below. Can you send the next patch as a v2?

Using 'git format-patch -v2 ...'

> Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de>
> ---
You can include the 'Changes since v1' in the space here after '---'.

> arch/openrisc/kernel/smp.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c
> index 29c82ef2e..83cbf43d4 100644
> --- a/arch/openrisc/kernel/smp.c
> +++ b/arch/openrisc/kernel/smp.c
> @@ -16,6 +16,7 @@
> #include <linux/sched.h>
> #include <linux/sched/mm.h>
> #include <linux/irq.h>
> +#include <linux/of.h>
> #include <asm/cpuinfo.h>
> #include <asm/mmu_context.h>
> #include <asm/tlbflush.h>
> @@ -60,22 +61,32 @@ void __init smp_prepare_boot_cpu(void)
>
> void __init smp_init_cpus(void)
> {
> - int i;
> + struct device_node* cpu;
> + u32 cpu_id;
>
> - for (i = 0; i < NR_CPUS; i++)
> - set_cpu_possible(i, true);
> + for_each_of_cpu_node(cpu) {
> + if (of_property_read_u32(cpu, "reg", &cpu_id)) {
> + pr_warn("%s missing reg property", cpu->full_name);
> + continue;
> + }
> +
> + if (cpu_id < NR_CPUS)

Should we warn on the else case?

> + set_cpu_possible(cpu_id, true);
> + }
> }

-Stafford

\
 
 \ /
  Last update: 2021-01-31 00:05    [W:0.057 / U:6.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site