Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3571442pxk; Mon, 28 Sep 2020 23:50:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmixptkYO8yIMVC3EQ+AHJI8r1D5h0zv1//ZNBh/9+BBCPNn2omrpHoggoJxgZU+VQex+p X-Received: by 2002:a50:cdd1:: with SMTP id h17mr1704731edj.94.1601362238399; Mon, 28 Sep 2020 23:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601362238; cv=none; d=google.com; s=arc-20160816; b=ubgQky8QsFP0yS54IK5gIy3xu/eoNmJv39ZiOYpcunSMib/pLSN53ejPmC/diA+Um5 ojrndJRmXhx7ht3bscuL5YWi6HFejsQ7J3R54iEKj3nZMyhkDjn1cxA566Igwzp3KBW3 UWsyPhno9s+x+JB+lWbAqRnkstP9LRBDk4vFk7MydjeyFaWgS9bMJgwNQ83cutrVoVeF PnMEAeuJ00dBQ9O+oaNp5cfEIEFzPEu59vfUyZnlN2+7Sq9XO7RRMpvGpA6EGXt9F5EJ 6v4mb67I5RgnoAf1fmbd9H6eSexR9NZ7N15I6ibBLa739Dq/D/Ro+hnPjUu7k9z3MHob N9ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=/bZCfJjSxxc8rq0f5a0xlSxUeZ6KJoaM01wWmlZnQLw=; b=T00RPvWbBW6iHDvRPkO3kIq7t9Bu3JOxNFVYuwiY2Bk07O165hRTRDn7o8H201FyjT KzQtI2ObYctaOBinhji7gI7hLw6IWkiookgTxktu4h6bFZp1HQafDJzuDG/wjC4v/JMY JtPEEjCgDkc25qNsoEb/0JahshvS4PbmoyU8NRfP+JaPlRDCYtqSxdbeXemD1xjb5LFR BCSRuY1hYrJfHlul/mEh5nIvP+iprZ6OhSMzXhDnmP3Lx42eLejYVN6CgqTWKbfCmCET n2fB2RjHbd/7ffBhA9Pd8XrYwAv4vnk7AZ9hbXov84GLQMwdl1dmyOl1I/Zoh5cdwQmP q6Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si2118048eja.409.2020.09.28.23.50.15; Mon, 28 Sep 2020 23:50:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727645AbgI2Gsu (ORCPT + 99 others); Tue, 29 Sep 2020 02:48:50 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:55328 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbgI2Gsm (ORCPT ); Tue, 29 Sep 2020 02:48:42 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4C0qjK5L86z9v2cP; Tue, 29 Sep 2020 08:48:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id HxjWnqY8l-RF; Tue, 29 Sep 2020 08:48:37 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4C0qjK4dlTz9v2c7; Tue, 29 Sep 2020 08:48:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9295A8B79F; Tue, 29 Sep 2020 08:48:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Ra4jW0KpaPAB; Tue, 29 Sep 2020 08:48:38 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5072B8B76C; Tue, 29 Sep 2020 08:48:38 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 30B1865E8A; Tue, 29 Sep 2020 06:48:38 +0000 (UTC) Message-Id: <4757e1ed21fe1968c761ae081d1f3d790a9673f8.1601362098.git.christophe.leroy@csgroup.eu> In-Reply-To: <27951fa6c9a8f80724d1bc81a6117ac32343a55d.1601362098.git.christophe.leroy@csgroup.eu> References: <27951fa6c9a8f80724d1bc81a6117ac32343a55d.1601362098.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v3 7/8] powerpc: Remove __USE_RTC() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 29 Sep 2020 06:48:38 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that PowerPC 601 is gone, __USE_RTC() is never true. Remove it. That also leads to removing get_rtc() and get_rtcl() Signed-off-by: Christophe Leroy --- v2: Also remove get_rtc() and get_rtcl() --- arch/powerpc/include/asm/time.h | 28 +----------------- arch/powerpc/kernel/time.c | 52 +++++---------------------------- 2 files changed, 9 insertions(+), 71 deletions(-) diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index ce065589192a..caf68a4bc19e 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -38,9 +38,6 @@ struct div_result { u64 result_low; }; -/* Accessor functions for the timebase (RTC on 601) registers. */ -#define __USE_RTC() (0) - #ifdef CONFIG_PPC64 /* For compatibility, get_tbl() is defined as get_tb() on ppc64 */ @@ -59,25 +56,6 @@ static inline unsigned int get_tbu(void) } #endif /* !CONFIG_PPC64 */ -static inline unsigned int get_rtcl(void) -{ - unsigned int rtcl; - - asm volatile("mfrtcl %0" : "=r" (rtcl)); - return rtcl; -} - -static inline u64 get_rtc(void) -{ - unsigned int hi, lo, hi2; - - do { - asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" - : "=r" (hi), "=r" (lo), "=r" (hi2)); - } while (hi2 != hi); - return (u64)hi * 1000000000 + lo; -} - static inline u64 get_vtb(void) { #ifdef CONFIG_PPC_BOOK3S_64 @@ -109,7 +87,7 @@ static inline u64 get_tb(void) static inline u64 get_tb_or_rtc(void) { - return __USE_RTC() ? get_rtc() : get_tb(); + return get_tb(); } static inline void set_tb(unsigned int upper, unsigned int lower) @@ -153,10 +131,6 @@ static inline void set_dec(u64 val) static inline unsigned long tb_ticks_since(unsigned long tstamp) { - if (__USE_RTC()) { - int delta = get_rtcl() - (unsigned int) tstamp; - return delta < 0 ? delta + 1000000000 : delta; - } return get_tbl() - tstamp; } diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index f85539ebb513..13c820c15d37 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -75,15 +75,6 @@ #include #include -static u64 rtc_read(struct clocksource *); -static struct clocksource clocksource_rtc = { - .name = "rtc", - .rating = 400, - .flags = CLOCK_SOURCE_IS_CONTINUOUS, - .mask = CLOCKSOURCE_MASK(64), - .read = rtc_read, -}; - static u64 timebase_read(struct clocksource *); static struct clocksource clocksource_timebase = { .name = "timebase", @@ -447,19 +438,9 @@ void vtime_flush(struct task_struct *tsk) void __delay(unsigned long loops) { unsigned long start; - int diff; spin_begin(); - if (__USE_RTC()) { - start = get_rtcl(); - do { - /* the RTCL register wraps at 1000000000 */ - diff = get_rtcl() - start; - if (diff < 0) - diff += 1000000000; - spin_cpu_relax(); - } while (diff < loops); - } else if (tb_invalid) { + if (tb_invalid) { /* * TB is in error state and isn't ticking anymore. * HMI handler was unable to recover from TB error. @@ -696,8 +677,6 @@ EXPORT_SYMBOL_GPL(tb_to_ns); */ notrace unsigned long long sched_clock(void) { - if (__USE_RTC()) - return get_rtc(); return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; } @@ -847,11 +826,6 @@ void read_persistent_clock64(struct timespec64 *ts) } /* clocksource code */ -static notrace u64 rtc_read(struct clocksource *cs) -{ - return (u64)get_rtc(); -} - static notrace u64 timebase_read(struct clocksource *cs) { return (u64)get_tb(); @@ -948,12 +922,7 @@ void update_vsyscall_tz(void) static void __init clocksource_init(void) { - struct clocksource *clock; - - if (__USE_RTC()) - clock = &clocksource_rtc; - else - clock = &clocksource_timebase; + struct clocksource *clock = &clocksource_timebase; if (clocksource_register_hz(clock, tb_ticks_per_sec)) { printk(KERN_ERR "clocksource: %s is already registered\n", @@ -1071,17 +1040,12 @@ void __init time_init(void) u64 scale; unsigned shift; - if (__USE_RTC()) { - /* 601 processor: dec counts down by 128 every 128ns */ - ppc_tb_freq = 1000000000; - } else { - /* Normal PowerPC with timebase register */ - ppc_md.calibrate_decr(); - printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n", - ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); - printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n", - ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); - } + /* Normal PowerPC with timebase register */ + ppc_md.calibrate_decr(); + printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n", + ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); + printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n", + ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); tb_ticks_per_jiffy = ppc_tb_freq / HZ; tb_ticks_per_sec = ppc_tb_freq; -- 2.25.0