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: <20200420201312.7afe1bb7@flygoat-x1e>
Date:   Mon, 20 Apr 2020 20:13:12 +0800
From:   Jiaxun Yang <jiaxun.yang@...goat.com>
To:     maobibo <maobibo@...ngson.cn>
Cc:     linux-mips@...r.kernel.org,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Rob Herring <robh+dt@...nel.org>,
        Huacai Chen <chenhc@...ote.com>, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND 1/5] MIPS: Loongson64: Remove dead RTC code

On Mon, 20 Apr 2020 20:06:02 +0800
maobibo <maobibo@...ngson.cn> wrote:

> On 04/20/2020 03:33 PM, Jiaxun Yang wrote:
> > RTC is now enabled by devicetree. So platform code is
> > no longer needed.
> > 
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> > ---
> >  .../include/asm/mach-loongson64/mc146818rtc.h | 36
> > ----------------- arch/mips/loongson64/Kconfig                  |
> > 4 -- arch/mips/loongson64/Makefile                 |  1 -
> >  arch/mips/loongson64/rtc.c                    | 39
> > ------------------- arch/mips/loongson64/time.c                   |
> >  8 +--- 5 files changed, 1 insertion(+), 87 deletions(-)
> >  delete mode 100644
> > arch/mips/include/asm/mach-loongson64/mc146818rtc.h delete mode
> > 100644 arch/mips/loongson64/rtc.c
> > 
> > diff --git a/arch/mips/include/asm/mach-loongson64/mc146818rtc.h
> > b/arch/mips/include/asm/mach-loongson64/mc146818rtc.h deleted file
> > mode 100644 index ebdccfee50be..000000000000
> > --- a/arch/mips/include/asm/mach-loongson64/mc146818rtc.h
> > +++ /dev/null
> > @@ -1,36 +0,0 @@
> > -/*
> > - * This file is subject to the terms and conditions of the GNU
> > General Public
> > - * License.  See the file "COPYING" in the main directory of this
> > archive
> > - * for more details.
> > - *
> > - * Copyright (C) 1998, 2001, 03, 07 by Ralf Baechle
> > (ralf@...ux-mips.org)
> > - *
> > - * RTC routines for PC style attached Dallas chip.
> > - */
> > -#ifndef __ASM_MACH_LOONGSON64_MC146818RTC_H
> > -#define __ASM_MACH_LOONGSON64_MC146818RTC_H
> > -
> > -#include <linux/io.h>
> > -
> > -#define RTC_PORT(x)	(0x70 + (x))
> > -#define RTC_IRQ		8
> > -
> > -static inline unsigned char CMOS_READ(unsigned long addr)
> > -{
> > -	outb_p(addr, RTC_PORT(0));
> > -	return inb_p(RTC_PORT(1));
> > -}
> > -
> > -static inline void CMOS_WRITE(unsigned char data, unsigned long
> > addr) -{
> > -	outb_p(addr, RTC_PORT(0));
> > -	outb_p(data, RTC_PORT(1));
> > -}
> > -
> > -#define RTC_ALWAYS_BCD	0
> > -
> > -#ifndef mc146818_decode_year
> > -#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 :
> > (year) + 1970) -#endif
> > -
> > -#endif /* __ASM_MACH_LOONGSON64_MC146818RTC_H */
> > diff --git a/arch/mips/loongson64/Kconfig
> > b/arch/mips/loongson64/Kconfig index 48b29c198acf..c386b8a3c753
> > 100644 --- a/arch/mips/loongson64/Kconfig
> > +++ b/arch/mips/loongson64/Kconfig
> > @@ -14,8 +14,4 @@ config RS780_HPET
> >  	  If unsure, say Yes.
> >  
> >  
> > -config LOONGSON_MC146818
> > -	bool
> > -	default n
> > -
> >  endif # MACH_LOONGSON64
> > diff --git a/arch/mips/loongson64/Makefile
> > b/arch/mips/loongson64/Makefile index f04461839540..102a19aa92aa
> > 100644 --- a/arch/mips/loongson64/Makefile
> > +++ b/arch/mips/loongson64/Makefile
> > @@ -8,6 +8,5 @@ obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o
> > platform.o acpi_init.o dma.o \ obj-$(CONFIG_SMP)	+= smp.o
> >  obj-$(CONFIG_NUMA)	+= numa.o
> >  obj-$(CONFIG_RS780_HPET) += hpet.o
> > -obj-$(CONFIG_LOONGSON_MC146818) += rtc.o
> >  obj-$(CONFIG_SUSPEND) += pm.o
> >  obj-$(CONFIG_PCI_QUIRKS) += vbios_quirk.o
> > diff --git a/arch/mips/loongson64/rtc.c b/arch/mips/loongson64/rtc.c
> > deleted file mode 100644
> > index 8d7628c0f513..000000000000
> > --- a/arch/mips/loongson64/rtc.c
> > +++ /dev/null
> > @@ -1,39 +0,0 @@
> > -// SPDX-License-Identifier: GPL-2.0-or-later
> > -/*
> > - *  Lemote Fuloong platform support
> > - *
> > - *  Copyright(c) 2010 Arnaud Patard <apatard@...driva.com>
> > - */
> > -
> > -#include <linux/init.h>
> > -#include <linux/kernel.h>
> > -#include <linux/platform_device.h>
> > -#include <linux/mc146818rtc.h>
> > -
> > -static struct resource loongson_rtc_resources[] = {
> > -	{
> > -		.start	= RTC_PORT(0),
> > -		.end	= RTC_PORT(1),
> > -		.flags	= IORESOURCE_IO,
> > -	}, {
> > -		.start	= RTC_IRQ,
> > -		.end	= RTC_IRQ,
> > -		.flags	= IORESOURCE_IRQ,
> > -	}
> > -};
> > -
> > -static struct platform_device loongson_rtc_device = {
> > -	.name		= "rtc_cmos",
> > -	.id		= -1,
> > -	.resource	= loongson_rtc_resources,
> > -	.num_resources	= ARRAY_SIZE(loongson_rtc_resources),
> > -};
> > -
> > -
> > -static int __init loongson_rtc_platform_init(void)
> > -{
> > -	platform_device_register(&loongson_rtc_device);
> > -	return 0;
> > -}
> > -
> > -device_initcall(loongson_rtc_platform_init);
> > diff --git a/arch/mips/loongson64/time.c
> > b/arch/mips/loongson64/time.c index 1245f22cec84..91e842b58365
> > 100644 --- a/arch/mips/loongson64/time.c
> > +++ b/arch/mips/loongson64/time.c
> > @@ -6,7 +6,7 @@
> >   * Copyright (C) 2009 Lemote Inc.
> >   * Author: Wu Zhangjin, wuzhangjin@...il.com
> >   */
> > -#include <asm/mc146818-time.h>
> > +
> >  #include <asm/time.h>
> >  #include <asm/hpet.h>
> >  
> > @@ -21,9 +21,3 @@ void __init plat_time_init(void)
> >  	setup_hpet_timer();
> >  #endif
> >  }
> > -
> > -void read_persistent_clock64(struct timespec64 *ts)
> > -{
> > -	ts->tv_sec = mc146818_get_cmos_time();
> > -	ts->tv_nsec = 0;
> > -}
> >   
> Hi Jiaxun,
> 
> Are you sure to remove function read_persistent_clock64 ? which is
> called in kernel/time/timekeeping.c

Hi Bibi,

Thanks for your review.

Pretty sure. It is mc146818 specified, it can never work on LS7A/LS2K
which have another RTC implementation.

I have performed boot test with this patch.
Kernel have safety fallback on platforms without this callback. 

> 
> regards
> bibo,mao
> 

Thanks
--
Jiaxun Yang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ