Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2137975imm; Thu, 19 Jul 2018 13:58:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfeO63/RbQEUexU+iNLdkzQq4K3rAuwLpdj7cZ/wtIE8SZGrdWq0616rolG04ivtupYm9X2 X-Received: by 2002:a17:902:262:: with SMTP id 89-v6mr11495992plc.221.1532033912067; Thu, 19 Jul 2018 13:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532033912; cv=none; d=google.com; s=arc-20160816; b=Omu95flgF18+wuAlauDvI7ZUQXjsHB9x7b/CvxZfJ4EVte+s0mLJ+fJxVbhZeKg5tx 6DUoydstQ4xo2cQeTd+rMuZ/btDQOP7Jpx1R1r2X0w8t8t/ZlgUEwTr+KP8d8iVl05X0 ihu8go9zc9ntrKcFi/OwxRV8ksszvIR63T8SkDXFTe832LkQHAJtJGGMzRXA0oY3/5y/ to1Db9rS0erVqFlz9ADrINS3S2EnGOOBKnMpuATS6i1yPXOUuXlneXP/F/4o59jwYRxO yQgFuFDUMxF7YRYQXYFrGmhTPMyZ9z1c35uMa4PY3XYG7kcDzRUA257QgQYGliqV6eIz oeIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=u9xkzVrGLcSIP1S5upihsE8ORFj1GIa4knBRLdaeXvE=; b=uVhTTnAeWntG2IqSN3RtUssrA+klLEhZd8eAezCy3n8QlWhP3M2TQO3parQGfFKOz0 8Dzbrp+MyWmuv5QSWWc/l+znINEx+DE/QDQbrntnqIU9pUlum8J90E9bcT25X5iUhKz7 +6Pp5FI7ZE2UQSJF3HO/RI3dvbmxzr2QDCxSVMUVTB8OwyI50kTDglz+VpP9syieLDX2 kKegtutoOup8NVOf1FPe7hVHCzBzAOuJlktPVxrqyOpSH3296OkzgseoV8E7zYKmPVNg Y6ASJxFez3EnCJ5BaDW7thdqu5T9ce0gi+ZuTh3a5H2CvTxBc+PA3RRxjGTgUdDo0tHF 05nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=gkwusNut; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si129325pgc.445.2018.07.19.13.58.17; Thu, 19 Jul 2018 13:58:32 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=gkwusNut; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731442AbeGSVmT (ORCPT + 99 others); Thu, 19 Jul 2018 17:42:19 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:45292 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730628AbeGSVmS (ORCPT ); Thu, 19 Jul 2018 17:42:18 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6JKso7e192061; Thu, 19 Jul 2018 20:56:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=u9xkzVrGLcSIP1S5upihsE8ORFj1GIa4knBRLdaeXvE=; b=gkwusNutBPmrNf7EVmAwDwgaCEx9eBN2OUGCFU9NzhlOgbx3OqnJ2ZgxD4Hk/BvfntHN foWVn8NpCfHeb4N0lZU+d91qusja+8NdQXdfy9vapHn4iYx24VEm08VwZNPNNG+r5bdM kSdsqrNioUA9xXwNBVghhq9coL65bOgLV+BOuncDY70/75flrwd7tbNq/FQ1wXhxtI1Q 6m8J7/Wep1gccEJfI+ywZ8ffVi/h9H3kiyMXIQpAVe0L+O5e9/gtntrphexoKhVNkRtc giMx6n9coAQIHRUDHemSBDmHlizsGzSk/7XQ4qhm6SOM3ZDYsXnNnxM4NuRrgbv5j2Yq /Q== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2k9yjgrufp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:39 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKucAd001514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:38 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKuc7w003735; Thu, 19 Jul 2018 20:56:38 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Jul 2018 20:56:37 +0000 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, pasha.tatashin@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, pbonzini@redhat.com Subject: [PATCH v15 14/26] s390/time: add read_persistent_wall_and_boot_offset() Date: Thu, 19 Jul 2018 16:55:33 -0400 Message-Id: <20180719205545.16512-15-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180719205545.16512-1-pasha.tatashin@oracle.com> References: <20180719205545.16512-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8959 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=986 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807190218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Martin Schwidefsky --- 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]; -- 2.18.0