Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2210787imm; Thu, 19 Jul 2018 15:30:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfrhrWgU6jXlYoJaCZqTFeiBjbtmSbKmDSDUaHsKTzAui06+W+BzojR2MkyFKhAsiTJY5w0 X-Received: by 2002:a63:ed56:: with SMTP id m22-v6mr11642035pgk.148.1532039429207; Thu, 19 Jul 2018 15:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532039429; cv=none; d=google.com; s=arc-20160816; b=k6V0q5MSHz3mvDuGw0E+ZXrxBDdSXJRFwnkoRXVztZs8QtjOPbnTKSGkEXMBS1fETX 93rg4Q0hw4xhx9j1d31/eCETXMxkT7UZkjClqHeuiy4jFlSHRvYEaPwbq5gpi69Pkwb7 KMkU+opN6CH0hpe0CCguBMsDKWFA5+pJCikHVJo44Sb6XJMBnLkS1vm6MF4ynXNjtq4m VX89BMXi72/ssyFXjnlm87BRGxrO7ojxFNbCrgTo2IMMoZqXQxb1Ry4afxw6KLtFfG2a e6SpVyc63ZG388Ygsy7My/1TzKz7bMxKFxZzwa9NMd1caTTtvMALBLeefX95PhJxY81A iVTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=ReKRDHEY099LDiexaN7BZAgVaSNuNMqvy3/qmI3Ev1g=; b=jRpjx3So+7LD/1pSGTn3z2zq6kNBafuhYm5aF7qTayIuGyJU4DIdsx0oOcNdrhJgRE ju6o0KOUceVoYZCwdkixzw1UNzTCWiubamv9oo4ikg9vRFXkOInTrnVDHeal7ahAWVDN ZMosxNPRL7kpSZMOPaYPSLomO7YqIipSt3bihxOG6f2ikif39Ns3RKPvK9U6nl6txH4K oKAIUfztgdMjFT218nGQTNCJJiIRXMevPPTm8a69qYOVTREqCqayYYtCtFXUCBIHuFLB OaxrPTv41x2LD6cWxhfyrdtSnRtAJPyzmsPog/7LaFB/y7nOD9Yh7TlmxiQTZYnyesgQ f0eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si290497plr.120.2018.07.19.15.30.14; Thu, 19 Jul 2018 15:30:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731282AbeGSXOG (ORCPT + 99 others); Thu, 19 Jul 2018 19:14:06 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48747 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbeGSXOG (ORCPT ); Thu, 19 Jul 2018 19:14:06 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JMSi4X2439211 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 15:28:44 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JMSioZ2439208; Thu, 19 Jul 2018 15:28:44 -0700 Date: Thu, 19 Jul 2018 15:28:44 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Pavel Tatashin Message-ID: Cc: schwidefsky@de.ibm.com, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, pasha.tatashin@oracle.com, tglx@linutronix.de Reply-To: mingo@kernel.org, tglx@linutronix.de, pasha.tatashin@oracle.com, linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com, hpa@zytor.com In-Reply-To: <20180719205545.16512-15-pasha.tatashin@oracle.com> References: <20180719205545.16512-15-pasha.tatashin@oracle.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/timers] s390/time: Add read_persistent_wall_and_boot_offset() Git-Commit-ID: be2e0e4257678408b0ab00ea9e743b9094e393e8 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: be2e0e4257678408b0ab00ea9e743b9094e393e8 Gitweb: https://git.kernel.org/tip/be2e0e4257678408b0ab00ea9e743b9094e393e8 Author: Pavel Tatashin AuthorDate: Thu, 19 Jul 2018 16:55:33 -0400 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 00:02:40 +0200 s390/time: Add read_persistent_wall_and_boot_offset() read_persistent_wall_and_boot_offset() will replace read_boot_clock64() because on some architectures it is more convenient to read both sources as one may depend on the other. For s390, implementation is the same as read_boot_clock64() but also calling and returning value of read_persistent_clock64() Signed-off-by: Pavel Tatashin Signed-off-by: Thomas Gleixner Reviewed-by: Martin Schwidefsky Cc: steven.sistare@oracle.com Cc: daniel.m.jordan@oracle.com Cc: linux@armlinux.org.uk Cc: heiko.carstens@de.ibm.com Cc: john.stultz@linaro.org Cc: sboyd@codeaurora.org Cc: hpa@zytor.com Cc: douly.fnst@cn.fujitsu.com Cc: peterz@infradead.org Cc: prarit@redhat.com Cc: feng.tang@intel.com Cc: pmladek@suse.com Cc: gnomes@lxorguk.ukuu.org.uk Cc: linux-s390@vger.kernel.org Cc: boris.ostrovsky@oracle.com Cc: jgross@suse.com Cc: pbonzini@redhat.com Link: https://lkml.kernel.org/r/20180719205545.16512-15-pasha.tatashin@oracle.com --- arch/s390/kernel/time.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index cf561160ea88..d1f5447d5687 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c @@ -221,6 +221,24 @@ void read_persistent_clock64(struct timespec64 *ts) ext_to_timespec64(clk, ts); } +void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time, + struct timespec64 *boot_offset) +{ + unsigned char clk[STORE_CLOCK_EXT_SIZE]; + struct timespec64 boot_time; + __u64 delta; + + delta = initial_leap_seconds + TOD_UNIX_EPOCH; + memcpy(clk, tod_clock_base, STORE_CLOCK_EXT_SIZE); + *(__u64 *)&clk[1] -= delta; + if (*(__u64 *)&clk[1] > delta) + clk[0]--; + ext_to_timespec64(clk, &boot_time); + + read_persistent_clock64(wall_time); + *boot_offset = timespec64_sub(*wall_time, boot_time); +} + void read_boot_clock64(struct timespec64 *ts) { unsigned char clk[STORE_CLOCK_EXT_SIZE];