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: <CAAhV-H7_a4hUoDV+FLjf9PXuHjxRa8BokjCFAGFfirgAPfGuqw@mail.gmail.com>
Date:   Sat, 14 May 2022 22:12:37 +0800
From:   Huacai Chen <chenhuacai@...il.com>
To:     Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     Huacai Chen <chenhuacai@...ngson.cn>,
        Arnd Bergmann <arnd@...db.de>,
        Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Airlie <airlied@...ux.ie>,
        Jonathan Corbet <corbet@....net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Yanteng Si <siyanteng@...ngson.cn>,
        Guo Ren <guoren@...nel.org>, Xuerui Wang <kernel@...0n.name>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH V10 16/22] LoongArch: Add misc common routines

Hi, Alexandre,

On Sat, May 14, 2022 at 8:56 PM Alexandre Belloni
<alexandre.belloni@...tlin.com> wrote:
>
> Hi,
>
> On 14/05/2022 16:03:56+0800, Huacai Chen wrote:
> > diff --git a/arch/loongarch/kernel/rtc.c b/arch/loongarch/kernel/rtc.c
> > new file mode 100644
> > index 000000000000..d7568385219f
> > --- /dev/null
> > +++ b/arch/loongarch/kernel/rtc.c
> > @@ -0,0 +1,36 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
> > + */
> > +
> > +#include <linux/init.h>
> > +#include <linux/kernel.h>
> > +#include <linux/platform_device.h>
> > +#include <asm/loongson.h>
> > +
> > +#define RTC_TOYREAD0    0x2C
> > +#define RTC_YEAR        0x30
> > +
> > +unsigned long loongson_get_rtc_time(void)
> > +{
> > +     unsigned int year, mon, day, hour, min, sec;
> > +     unsigned int value;
> > +
> > +     value = ls7a_readl(LS7A_RTC_REG_BASE + RTC_TOYREAD0);
> > +     sec = (value >> 4) & 0x3f;
> > +     min = (value >> 10) & 0x3f;
> > +     hour = (value >> 16) & 0x1f;
> > +     day = (value >> 21) & 0x1f;
> > +     mon = (value >> 26) & 0x3f;
> > +     year = ls7a_readl(LS7A_RTC_REG_BASE + RTC_YEAR);
> > +
> > +     year = 1900 + year;
> > +
> > +     return mktime64(year, mon, day, hour, min, sec);
> > +}
> > +
> > +void read_persistent_clock64(struct timespec64 *ts)
> > +{
>
> This should rather be implemented in a proper rtc driver and then have
> userspace set the system time or use hctosys.
I found that some archs don't implement read_persistent_clock64(), so
I can safely remove the whole file if there is available rtc drivers?

Huacai
>
> > +     ts->tv_sec = loongson_get_rtc_time();
> > +     ts->tv_nsec = 0;
> > +}
> > --
> > 2.27.0
> >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ