2022-05-14 00:12:35

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] m68knommu: fix undefined reference to `mach_get_rtc_pll'

On Fri, May 13, 2022 at 2:25 PM Greg Ungerer <[email protected]> wrote:
> On 13/5/22 17:12, Geert Uytterhoeven wrote:
> > read_persistent_clock64() uses mach_hwclk(), which is provided by
> > both setup_mm.c and setup_no.c, so it's always available?> Albeit not populated by coldfire or nommu platform code, so I see
> > the point in depending on MMU (no nommu Amiga support yet ;-).
>
> Yes, exactly. And even worse is that on ColdFire platforms it
> is never set, so will be the startup value of NULL. It is called
> without checking for NULL in both of rtc_generic_get_time() and
> rtc_generic_set_time().

I think that's ok because rtc_generic_{get,set}_time is only called
from the rtc_generic driver, but that is not registered when mach_hwclk()
is NULL.

With your patch to add the CONFIG_MMU check, you can actually
remove the mach_hwclk() symbol from setup_no.c, and move the
remaining RTC related symbols from setup_mm.c into the #ifdef.

Arnd


2022-05-16 10:09:11

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH] m68knommu: fix undefined reference to `mach_get_rtc_pll'

Hi Arnd,

On 13/5/22 22:59, Arnd Bergmann wrote:
> On Fri, May 13, 2022 at 2:25 PM Greg Ungerer <[email protected]> wrote:
>> On 13/5/22 17:12, Geert Uytterhoeven wrote:
>>> read_persistent_clock64() uses mach_hwclk(), which is provided by
>>> both setup_mm.c and setup_no.c, so it's always available?> Albeit not populated by coldfire or nommu platform code, so I see
>>> the point in depending on MMU (no nommu Amiga support yet ;-).
>>
>> Yes, exactly. And even worse is that on ColdFire platforms it
>> is never set, so will be the startup value of NULL. It is called
>> without checking for NULL in both of rtc_generic_get_time() and
>> rtc_generic_set_time().
>
> I think that's ok because rtc_generic_{get,set}_time is only called
> from the rtc_generic driver, but that is not registered when mach_hwclk()
> is NULL.
>
> With your patch to add the CONFIG_MMU check, you can actually
> remove the mach_hwclk() symbol from setup_no.c, and move the
> remaining RTC related symbols from setup_mm.c into the #ifdef.

Yes, I think that would be a good idea.
Tidies thins up a little.

Regards
Greg


2022-05-16 14:08:31

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68knommu: fix undefined reference to `mach_get_rtc_pll'

On Mon, May 16, 2022 at 8:08 AM Greg Ungerer <[email protected]> wrote:
> On 13/5/22 22:59, Arnd Bergmann wrote:
> > On Fri, May 13, 2022 at 2:25 PM Greg Ungerer <[email protected]> wrote:
> >> On 13/5/22 17:12, Geert Uytterhoeven wrote:
> >>> read_persistent_clock64() uses mach_hwclk(), which is provided by
> >>> both setup_mm.c and setup_no.c, so it's always available?> Albeit not populated by coldfire or nommu platform code, so I see
> >>> the point in depending on MMU (no nommu Amiga support yet ;-).
> >>
> >> Yes, exactly. And even worse is that on ColdFire platforms it
> >> is never set, so will be the startup value of NULL. It is called
> >> without checking for NULL in both of rtc_generic_get_time() and
> >> rtc_generic_set_time().
> >
> > I think that's ok because rtc_generic_{get,set}_time is only called
> > from the rtc_generic driver, but that is not registered when mach_hwclk()
> > is NULL.
> >
> > With your patch to add the CONFIG_MMU check, you can actually
> > remove the mach_hwclk() symbol from setup_no.c, and move the
> > remaining RTC related symbols from setup_mm.c into the #ifdef.
>
> Yes, I think that would be a good idea.
> Tidies thins up a little.

Let's fix the build error first.

Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2022-05-17 18:26:03

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH] m68knommu: fix undefined reference to `mach_get_rtc_pll'

Hi Geert,

On 16/5/22 17:15, Geert Uytterhoeven wrote:
> On Mon, May 16, 2022 at 8:08 AM Greg Ungerer <[email protected]> wrote:
>> On 13/5/22 22:59, Arnd Bergmann wrote:
>>> On Fri, May 13, 2022 at 2:25 PM Greg Ungerer <[email protected]> wrote:
>>>> On 13/5/22 17:12, Geert Uytterhoeven wrote:
>>>>> read_persistent_clock64() uses mach_hwclk(), which is provided by
>>>>> both setup_mm.c and setup_no.c, so it's always available?> Albeit not populated by coldfire or nommu platform code, so I see
>>>>> the point in depending on MMU (no nommu Amiga support yet ;-).
>>>>
>>>> Yes, exactly. And even worse is that on ColdFire platforms it
>>>> is never set, so will be the startup value of NULL. It is called
>>>> without checking for NULL in both of rtc_generic_get_time() and
>>>> rtc_generic_set_time().
>>>
>>> I think that's ok because rtc_generic_{get,set}_time is only called
>>> from the rtc_generic driver, but that is not registered when mach_hwclk()
>>> is NULL.
>>>
>>> With your patch to add the CONFIG_MMU check, you can actually
>>> remove the mach_hwclk() symbol from setup_no.c, and move the
>>> remaining RTC related symbols from setup_mm.c into the #ifdef.
>>
>> Yes, I think that would be a good idea.
>> Tidies thins up a little.
>
> Let's fix the build error first.
>
> Reviewed-by: Geert Uytterhoeven <[email protected]>
> Acked-by: Geert Uytterhoeven <[email protected]>

I am re-thinking this fix at the moment. I think I missed the fact that
the 68328 has underlying mach_hwclk support, and so can use be used by
rtc_generic_{get,set}_time. So in other words classic m68k nommu config
should be able to use this code too. CONFIG_MMU blocking it is probably
not right here.

New patch coming.

Regards
Greg


> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds