lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2QzMiga0FFVmTuefnq1OzsgyopiJN2he8043K0TRF1ng@mail.gmail.com>
Date:   Fri, 14 Jan 2022 11:46:38 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Laurent Vivier <laurent@...ier.eu>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        linux-m68k <linux-m68k@...ts.linux-m68k.org>,
        John Stultz <john.stultz@...aro.org>,
        linux-rtc@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>
Subject: Re: [PATCH v6 3/4] clocksource/drivers: Add a goldfish-timer clocksource

On Thu, Jan 13, 2022 at 9:19 PM Laurent Vivier <laurent@...ier.eu> wrote:
>
> Add a clocksource based on the goldfish-rtc device.
>
> Signed-off-by: Laurent Vivier <laurent@...ier.eu>
> ---
>  drivers/clocksource/Kconfig          |   7 ++
>  drivers/clocksource/Makefile         |   1 +
>  drivers/clocksource/timer-goldfish.c | 130 +++++++++++++++++++++++++++
>  include/clocksource/timer-goldfish.h |  12 +++
>  4 files changed, 150 insertions(+)
>  create mode 100644 drivers/clocksource/timer-goldfish.c
>  create mode 100644 include/clocksource/timer-goldfish.h
>
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index f65e31bab9ae..6ca9bb78407d 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -711,4 +711,11 @@ config MICROCHIP_PIT64B
>           modes and high resolution. It is used as a clocksource
>           and a clockevent.
>
> +config GOLDFISH_TIMER
> +       bool "Clocksource using goldfish-rtc"
> +       select RTC_CLASS
> +       select RTC_DRV_GOLDFISH

This should probably be

          depends on M68K || COMPILE_TEST
          depends on RTC_DRV_GOLDFISH

A driver should never 'select' another user-selectable subsystem

> +static int goldfish_timer_set_oneshot(struct clock_event_device *evt)
> +{
> +       struct goldfish_timer *timerdrv = ced_to_gf(evt);
> +       void __iomem *base = timerdrv->base;
> +
> +       __raw_writel(0, base + TIMER_ALARM_HIGH);
> +       __raw_writel(0, base + TIMER_ALARM_LOW);
> +       __raw_writel(1, base + TIMER_IRQ_ENABLED);

As mentioned elsewhere, the __raw_* accessors are not portable, please
use readl()/writel() here, or possibly ioread32_be()/iowrite32_be() for
the big-endian variant.

> +EXPORT_SYMBOL_GPL(goldfish_timer_init);

No need to export this if the only callers are in the kernel.

         Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ