* loongarch wakeup build error
@ 2023-03-29 22:55 Randy Dunlap
2023-03-30 3:33 ` Tiezhu Yang
0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2023-03-29 22:55 UTC (permalink / raw)
To: linux-kernel, Huacai Chen, WANG Xuerui; +Cc: loongarch
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]
Hi,
I don't know if this has been reported previously, so here goes.
When CONFIG_SUSPEND is not set:
loongarch64-linux-ld: drivers/acpi/sleep.o: in function `acpi_pm_prepare':
sleep.c:(.text+0x278): undefined reference to `loongarch_wakeup_start'
loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
A complete randconfig file is attached.
--
~Randy
[-- Attachment #2: lg-wakeup-not-suspend.config --]
[-- Type: application/x-config, Size: 137866 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: loongarch wakeup build error
2023-03-29 22:55 loongarch wakeup build error Randy Dunlap
@ 2023-03-30 3:33 ` Tiezhu Yang
2023-03-30 5:37 ` Randy Dunlap
2023-03-31 2:17 ` Huacai Chen
0 siblings, 2 replies; 4+ messages in thread
From: Tiezhu Yang @ 2023-03-30 3:33 UTC (permalink / raw)
To: Randy Dunlap, linux-kernel, Huacai Chen, WANG Xuerui; +Cc: loongarch
On 03/30/2023 06:55 AM, Randy Dunlap wrote:
> Hi,
>
> I don't know if this has been reported previously, so here goes.
>
> When CONFIG_SUSPEND is not set:
>
> loongarch64-linux-ld: drivers/acpi/sleep.o: in function `acpi_pm_prepare':
> sleep.c:(.text+0x278): undefined reference to `loongarch_wakeup_start'
> loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
> loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
>
> A complete randconfig file is attached.
>
I can reproduce this build error on LoongArch.
Here is the call trace:
acpi_pm_prepare()
__acpi_pm_prepare()
acpi_sleep_prepare()
acpi_get_wakeup_address()
loongarch_wakeup_start()
loongarch_wakeup_start() is defined in arch/loongarch/power/suspend_asm.S
which is built under CONFIG_SUSPEND. In order to fix the build error, just
define a empty loongarch_wakeup_start() if CONFIG_SUSPEND is not set.
diff --git a/arch/loongarch/include/asm/acpi.h
b/arch/loongarch/include/asm/acpi.h
index 4198753aa1d0..7b812a836a5a 100644
--- a/arch/loongarch/include/asm/acpi.h
+++ b/arch/loongarch/include/asm/acpi.h
@@ -39,9 +39,14 @@ extern int loongarch_acpi_suspend(void);
extern int (*acpi_suspend_lowlevel)(void);
extern void loongarch_suspend_enter(void);
+#ifdef CONFIG_SUSPEND
+extern void loongarch_wakeup_start(void);
+#else
+static inline void loongarch_wakeup_start(void) {}
+#endif
+
static inline unsigned long acpi_get_wakeup_address(void)
{
- extern void loongarch_wakeup_start(void);
return (unsigned long)loongarch_wakeup_start;
}
If the above change makes sense, I will send a formal patch later.
Thanks,
Tiezhu
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: loongarch wakeup build error
2023-03-30 3:33 ` Tiezhu Yang
@ 2023-03-30 5:37 ` Randy Dunlap
2023-03-31 2:17 ` Huacai Chen
1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2023-03-30 5:37 UTC (permalink / raw)
To: Tiezhu Yang, linux-kernel, Huacai Chen, WANG Xuerui; +Cc: loongarch
Hi,
On 3/29/23 20:33, Tiezhu Yang wrote:
>
>
> On 03/30/2023 06:55 AM, Randy Dunlap wrote:
>> Hi,
>>
>> I don't know if this has been reported previously, so here goes.
>>
>> When CONFIG_SUSPEND is not set:
>>
>> loongarch64-linux-ld: drivers/acpi/sleep.o: in function `acpi_pm_prepare':
>> sleep.c:(.text+0x278): undefined reference to `loongarch_wakeup_start'
>> loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
>> loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
>>
>> A complete randconfig file is attached.
>>
>
> I can reproduce this build error on LoongArch.
>
> Here is the call trace:
>
> acpi_pm_prepare()
> __acpi_pm_prepare()
> acpi_sleep_prepare()
> acpi_get_wakeup_address()
> loongarch_wakeup_start()
>
>
> loongarch_wakeup_start() is defined in arch/loongarch/power/suspend_asm.S
> which is built under CONFIG_SUSPEND. In order to fix the build error, just
> define a empty loongarch_wakeup_start() if CONFIG_SUSPEND is not set.
>
> diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h
> index 4198753aa1d0..7b812a836a5a 100644
> --- a/arch/loongarch/include/asm/acpi.h
> +++ b/arch/loongarch/include/asm/acpi.h
> @@ -39,9 +39,14 @@ extern int loongarch_acpi_suspend(void);
> extern int (*acpi_suspend_lowlevel)(void);
> extern void loongarch_suspend_enter(void);
>
> +#ifdef CONFIG_SUSPEND
> +extern void loongarch_wakeup_start(void);
> +#else
> +static inline void loongarch_wakeup_start(void) {}
> +#endif
> +
> static inline unsigned long acpi_get_wakeup_address(void)
> {
> - extern void loongarch_wakeup_start(void);
> return (unsigned long)loongarch_wakeup_start;
> }
>
> If the above change makes sense, I will send a formal patch later.
LGTM and builds cleanly.
Thanks.
--
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: loongarch wakeup build error
2023-03-30 3:33 ` Tiezhu Yang
2023-03-30 5:37 ` Randy Dunlap
@ 2023-03-31 2:17 ` Huacai Chen
1 sibling, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2023-03-31 2:17 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: Randy Dunlap, linux-kernel, WANG Xuerui, loongarch
Hi, Tiezhu,
On Thu, Mar 30, 2023 at 11:33 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
>
>
> On 03/30/2023 06:55 AM, Randy Dunlap wrote:
> > Hi,
> >
> > I don't know if this has been reported previously, so here goes.
> >
> > When CONFIG_SUSPEND is not set:
> >
> > loongarch64-linux-ld: drivers/acpi/sleep.o: in function `acpi_pm_prepare':
> > sleep.c:(.text+0x278): undefined reference to `loongarch_wakeup_start'
> > loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
> > loongarch64-linux-ld: sleep.c:(.text+0x27c): undefined reference to `loongarch_wakeup_start'
> >
> > A complete randconfig file is attached.
> >
>
> I can reproduce this build error on LoongArch.
>
> Here is the call trace:
>
> acpi_pm_prepare()
> __acpi_pm_prepare()
> acpi_sleep_prepare()
> acpi_get_wakeup_address()
> loongarch_wakeup_start()
>
>
> loongarch_wakeup_start() is defined in arch/loongarch/power/suspend_asm.S
> which is built under CONFIG_SUSPEND. In order to fix the build error, just
> define a empty loongarch_wakeup_start() if CONFIG_SUSPEND is not set.
>
> diff --git a/arch/loongarch/include/asm/acpi.h
> b/arch/loongarch/include/asm/acpi.h
> index 4198753aa1d0..7b812a836a5a 100644
> --- a/arch/loongarch/include/asm/acpi.h
> +++ b/arch/loongarch/include/asm/acpi.h
> @@ -39,9 +39,14 @@ extern int loongarch_acpi_suspend(void);
> extern int (*acpi_suspend_lowlevel)(void);
> extern void loongarch_suspend_enter(void);
>
> +#ifdef CONFIG_SUSPEND
> +extern void loongarch_wakeup_start(void);
> +#else
> +static inline void loongarch_wakeup_start(void) {}
> +#endif
> +
> static inline unsigned long acpi_get_wakeup_address(void)
> {
> - extern void loongarch_wakeup_start(void);
> return (unsigned long)loongarch_wakeup_start;
> }
>
> If the above change makes sense, I will send a formal patch later.
No, we should make sure acpi_get_wakeup_address() return 0, not a
random address [1]. But my version reuse your commit messages, thank
you all the same.
[1] https://github.com/loongson/linux/commit/49d888dce72e2dc094c9ac39702bbe058b89ed79
Huacai
>
> Thanks,
> Tiezhu
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-31 2:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 22:55 loongarch wakeup build error Randy Dunlap
2023-03-30 3:33 ` Tiezhu Yang
2023-03-30 5:37 ` Randy Dunlap
2023-03-31 2:17 ` Huacai Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).