2022-04-05 00:53:56

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH -next] cpuidle: riscv: support non-SMP config

Add <asm/smp.h> for cpuid_to_hartid_map etc.
This is needed for both SMP and non-SMP builds, but not having it
causes a build error for non-SMP:

drivers/cpuidle/cpuidle-riscv-sbi.c: In function 'sbi_cpuidle_init_cpu':
drivers/cpuidle/cpuidle-riscv-sbi.c:350:26: error: implicit declaration of function 'cpuid_to_hartid_map' [-Werror=implicit-function-declaration]

Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
Signed-off-by: Randy Dunlap <[email protected]>
Reported-by: kernel test robot <[email protected]>
Cc: Anup Patel <[email protected]>
Cc: Anup Patel <[email protected]>
Cc: Anup Patel <[email protected]>
Cc: Atish Patra <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Albert Ou <[email protected]>
---
drivers/cpuidle/cpuidle-riscv-sbi.c | 1 +
1 file changed, 1 insertion(+)

--- linux-next-20220401.orig/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ linux-next-20220401/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -22,6 +22,7 @@
#include <linux/pm_runtime.h>
#include <asm/cpuidle.h>
#include <asm/sbi.h>
+#include <asm/smp.h>
#include <asm/suspend.h>

#include "dt_idle_states.h"


2022-04-05 01:05:10

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH -next] cpuidle: riscv: support non-SMP config

On Mon, Apr 4, 2022 at 9:07 AM Randy Dunlap <[email protected]> wrote:
>
>
>
> On 4/3/22 20:05, Anup Patel wrote:
> > (Removed my WDC email because it does not exist anymore)
> >
> > On Sun, Apr 3, 2022 at 8:44 AM Randy Dunlap <[email protected]> wrote:
> >>
> >> Add <asm/smp.h> for cpuid_to_hartid_map etc.
> >> This is needed for both SMP and non-SMP builds, but not having it
> >> causes a build error for non-SMP:
> >>
> >> drivers/cpuidle/cpuidle-riscv-sbi.c: In function 'sbi_cpuidle_init_cpu':
> >> drivers/cpuidle/cpuidle-riscv-sbi.c:350:26: error: implicit declaration of function 'cpuid_to_hartid_map' [-Werror=implicit-function-declaration]
> >>
> >> Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
> >> Signed-off-by: Randy Dunlap <[email protected]>
> >> Reported-by: kernel test robot <[email protected]>
> >> Cc: Anup Patel <[email protected]>
> >> Cc: Anup Patel <[email protected]>
> >> Cc: Anup Patel <[email protected]>
> >> Cc: Atish Patra <[email protected]>
> >> Cc: Daniel Lezcano <[email protected]>
> >> Cc: "Rafael J. Wysocki" <[email protected]>
> >> Cc: [email protected]
> >> Cc: [email protected]
> >> Cc: Palmer Dabbelt <[email protected]>
> >> Cc: Paul Walmsley <[email protected]>
> >> Cc: Albert Ou <[email protected]>
> >> ---
> >> drivers/cpuidle/cpuidle-riscv-sbi.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> --- linux-next-20220401.orig/drivers/cpuidle/cpuidle-riscv-sbi.c
> >> +++ linux-next-20220401/drivers/cpuidle/cpuidle-riscv-sbi.c
> >> @@ -22,6 +22,7 @@
> >> #include <linux/pm_runtime.h>
> >> #include <asm/cpuidle.h>
> >> #include <asm/sbi.h>
> >> +#include <asm/smp.h>
> >
> > I suggest include linux/smp.h here instead of asm/smp.h
> >
> > Otherwise it looks good to me.
> >
> > Reviewed-by: Anup Patel <[email protected]>
> >
>
> Yeah, checkpatch also suggested that but it does not work.
> Yes, I tested it.
>
> linux/smp.h only #includes <asm/smp.h> if CONFIG_SMP is enabled,
> and this patch needs <asm/smp.h> for the non-SMP case.

Okay, sounds good to me.

No changes needed in this patch.

Regards,
Anup

>
> >
> >> #include <asm/suspend.h>
> >>
> >> #include "dt_idle_states.h"
>
> thanks.
> --
> ~Randy

2022-04-05 01:39:12

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH -next] cpuidle: riscv: support non-SMP config



On 4/3/22 20:05, Anup Patel wrote:
> (Removed my WDC email because it does not exist anymore)
>
> On Sun, Apr 3, 2022 at 8:44 AM Randy Dunlap <[email protected]> wrote:
>>
>> Add <asm/smp.h> for cpuid_to_hartid_map etc.
>> This is needed for both SMP and non-SMP builds, but not having it
>> causes a build error for non-SMP:
>>
>> drivers/cpuidle/cpuidle-riscv-sbi.c: In function 'sbi_cpuidle_init_cpu':
>> drivers/cpuidle/cpuidle-riscv-sbi.c:350:26: error: implicit declaration of function 'cpuid_to_hartid_map' [-Werror=implicit-function-declaration]
>>
>> Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
>> Signed-off-by: Randy Dunlap <[email protected]>
>> Reported-by: kernel test robot <[email protected]>
>> Cc: Anup Patel <[email protected]>
>> Cc: Anup Patel <[email protected]>
>> Cc: Anup Patel <[email protected]>
>> Cc: Atish Patra <[email protected]>
>> Cc: Daniel Lezcano <[email protected]>
>> Cc: "Rafael J. Wysocki" <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: Palmer Dabbelt <[email protected]>
>> Cc: Paul Walmsley <[email protected]>
>> Cc: Albert Ou <[email protected]>
>> ---
>> drivers/cpuidle/cpuidle-riscv-sbi.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> --- linux-next-20220401.orig/drivers/cpuidle/cpuidle-riscv-sbi.c
>> +++ linux-next-20220401/drivers/cpuidle/cpuidle-riscv-sbi.c
>> @@ -22,6 +22,7 @@
>> #include <linux/pm_runtime.h>
>> #include <asm/cpuidle.h>
>> #include <asm/sbi.h>
>> +#include <asm/smp.h>
>
> I suggest include linux/smp.h here instead of asm/smp.h
>
> Otherwise it looks good to me.
>
> Reviewed-by: Anup Patel <[email protected]>
>

Yeah, checkpatch also suggested that but it does not work.
Yes, I tested it.

linux/smp.h only #includes <asm/smp.h> if CONFIG_SMP is enabled,
and this patch needs <asm/smp.h> for the non-SMP case.

>
>> #include <asm/suspend.h>
>>
>> #include "dt_idle_states.h"

thanks.
--
~Randy

2022-04-05 01:50:00

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH -next] cpuidle: riscv: support non-SMP config

(Removed my WDC email because it does not exist anymore)

On Sun, Apr 3, 2022 at 8:44 AM Randy Dunlap <[email protected]> wrote:
>
> Add <asm/smp.h> for cpuid_to_hartid_map etc.
> This is needed for both SMP and non-SMP builds, but not having it
> causes a build error for non-SMP:
>
> drivers/cpuidle/cpuidle-riscv-sbi.c: In function 'sbi_cpuidle_init_cpu':
> drivers/cpuidle/cpuidle-riscv-sbi.c:350:26: error: implicit declaration of function 'cpuid_to_hartid_map' [-Werror=implicit-function-declaration]
>
> Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Atish Patra <[email protected]>
> Cc: Daniel Lezcano <[email protected]>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: Palmer Dabbelt <[email protected]>
> Cc: Paul Walmsley <[email protected]>
> Cc: Albert Ou <[email protected]>
> ---
> drivers/cpuidle/cpuidle-riscv-sbi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> --- linux-next-20220401.orig/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ linux-next-20220401/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -22,6 +22,7 @@
> #include <linux/pm_runtime.h>
> #include <asm/cpuidle.h>
> #include <asm/sbi.h>
> +#include <asm/smp.h>

I suggest include linux/smp.h here instead of asm/smp.h

Otherwise it looks good to me.

Reviewed-by: Anup Patel <[email protected]>

Regards,
Anup

> #include <asm/suspend.h>
>
> #include "dt_idle_states.h"

2022-04-20 17:38:34

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH -next] cpuidle: riscv: support non-SMP config

On Sat, 02 Apr 2022 20:13:55 PDT (-0700), [email protected] wrote:
> Add <asm/smp.h> for cpuid_to_hartid_map etc.
> This is needed for both SMP and non-SMP builds, but not having it
> causes a build error for non-SMP:
>
> drivers/cpuidle/cpuidle-riscv-sbi.c: In function 'sbi_cpuidle_init_cpu':
> drivers/cpuidle/cpuidle-riscv-sbi.c:350:26: error: implicit declaration of function 'cpuid_to_hartid_map' [-Werror=implicit-function-declaration]
>
> Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Anup Patel <[email protected]>
> Cc: Atish Patra <[email protected]>
> Cc: Daniel Lezcano <[email protected]>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: Palmer Dabbelt <[email protected]>
> Cc: Paul Walmsley <[email protected]>
> Cc: Albert Ou <[email protected]>
> ---
> drivers/cpuidle/cpuidle-riscv-sbi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> --- linux-next-20220401.orig/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ linux-next-20220401/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -22,6 +22,7 @@
> #include <linux/pm_runtime.h>
> #include <asm/cpuidle.h>
> #include <asm/sbi.h>
> +#include <asm/smp.h>
> #include <asm/suspend.h>
>
> #include "dt_idle_states.h"

Thanks, this is on fixes.