Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp8456imm; Tue, 17 Jul 2018 19:25:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpehy8B52cLdrPPzE/mlDvC3d++qy40tX9ZHfKg+eM0AIknlZ4EncCIiZgE0wGkyzyfRYlyp X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr3962945pln.8.1531880723385; Tue, 17 Jul 2018 19:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531880723; cv=none; d=google.com; s=arc-20160816; b=jELOIUAUDBWxqZe1N5SxlvyGWPQVCbWHMZq0hJTBPvsaeSkhmSD62NYGB/+Mngo+M9 QIwnNv8JpL2VtHyQYuMwM5smS+ysN2aqxhato4sALMYw4Ne6jXwVEB8ItZnY02vCaI5F Qaxj7f2uTgTHKtB1sXW9BNGMmTIDX2fRAis8ZkIT8q4DVLBFL+DYUtEJmsg/Q+35C04P fmd6OP+zytDh1fDg52e0FWRSefp4d79Nww9QfFj3JHtuWUN/XWbzXoLvdY06EmCf2i44 NhAEDSEUyx81/qWEjlyDrwAMKjbiOheUvKZlgDoYplilVfObrYQCmvHx9edwap+ykGYH x9gg== 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=xdyByBqkL5XzhaFWa1QSz/lrkWsISYhe6jURZJos0Wt00GbkR/Jc9ikM33KqrTwWZo W/n2HT0ms/gTc15J0vBkQRSlCra67b8sU9SneKbGaNSvN3v+lSP93//HDlYCAv9JlYXh FtAVRtES+0l7kt8TTEoZM8kyCIhR3fb7IzfNHIXnQB5H8YOo2UoH6dMfvcdshOIuTKx8 3kYqo8kkLwvvhXimJlDXutErnu1p5MNq+vSTGvKXkUZnKxd+hULxv4Fe1Vc+9l4Yv4rS VEGbLV8QHKl/iV2ZyaXjC56yrUauKQKz8xc+nOfqT+AZpR1VcGllkR1fpOSn48Mdbkdu My2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="v9q/1vP5"; 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 p185-v6si2182767pga.476.2018.07.17.19.25.08; Tue, 17 Jul 2018 19:25:23 -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="v9q/1vP5"; 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 S1731980AbeGRC7p (ORCPT + 99 others); Tue, 17 Jul 2018 22:59:45 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:58320 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731891AbeGRC7n (ORCPT ); Tue, 17 Jul 2018 22:59:43 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6I2KuL8166461; Wed, 18 Jul 2018 02:22:58 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=v9q/1vP5s6n0hLoFm4R6MNB/ynExv8VymvqLQFUr7UCazA8zwMITUVrOBz2vg5iyDpBQ YUltnY3lXxyZb7rgbODCNtaE2oyeV9/NxthYQIfNgOYstEVrwYu5hvG9WvsOH3KYD4XQ XrWR0JiWgihTPm94O6+2cOLHlUOszQUZlYDLx0nca71FeYwbllzUSaEX8zSXw1w2YVJy NlG60fsgiwO3Hh34E273HQCG2SrQcTmYZizXRM7sttboMup+5ocv8G6sNjpXXc89Y5i4 j+B6lXIDwOrljHu6RfxuEzpj7SR5VyzX4RWdmxWpC1ZcES8CSfDd8gp6QSAVbi0MgkQO OA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2k7a3ju3c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:58 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6I2Mvqm028043 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:58 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6I2MvoG020693; Wed, 18 Jul 2018 02:22:57 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Jul 2018 19:22:56 -0700 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 v14 15/25] s390/time: add read_persistent_wall_and_boot_offset() Date: Tue, 17 Jul 2018 22:22:01 -0400 Message-Id: <20180718022211.6259-16-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718022211.6259-1-pasha.tatashin@oracle.com> References: <20180718022211.6259-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8957 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=931 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807180026 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