Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp89338imm; Thu, 21 Jun 2018 14:28:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfT2o5YMUSb833oWaWDHC6Tetb2l13qRTqLHKEbLC+ytQ3lu4dRcWFf6xcSBkoH5GGBXlK X-Received: by 2002:a17:902:bd42:: with SMTP id b2-v6mr30090419plx.23.1529616538658; Thu, 21 Jun 2018 14:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616538; cv=none; d=google.com; s=arc-20160816; b=BK7NZsihbku05WdVT76nJcZoEi1XdDoa6AY/rEzcEouYPyQYEtPNUgGHWbrNy/0eRY Oc1ZF/kl7hmFJoi2Xov9Dq7UvZNht3wd1pEVOa36FSAY7sYqQPa8e4k5JSnfAGp3qhSr 5e8dsHn6sw55DO1rEg2IoRf4mKOTfXzCaySCvDYwQpmsZWKmC7e8m82FbEJWXXXyNNrq FhOHgG0nIy22UaAK7P+MDMBczzzbOgPbMpzhA5JBExClz+0HRkBcsrF/hRxPsNdxlBtj uyCcYxKclWLHwVepMjwM8QQguVJG8fTN0xhA2sRcWcqn1Evr+7iq9zEW52P91KCnSFyI +1vA== 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=hYJF+qrAoWZJa6Vd/MNqpypPSuOig7XhmwbnSWDkyiU=; b=puOpgmj+UBAAQ/G86hi8K494758g4XezAzTCXYnWuGvfzZNgEcP5TDTi8X1zdf4nQ9 ObiGrxloRbtP1nket896U4l/fFule8a8safIyVk0t6oWuPMBoCyzAq9LJCrHMIIwVbn7 b6Ma9G+gLO7Kj0K5gHcZQ+iKhM1FRQq05x6SVgT4gtOyrYJKtLSpym22z0dRXNN1YicO 0zCaT2FzJOq/ioGJAOb3DNC4Q4lqzG/W+bSiCduAcGhPhC5Zm3T+D0XIqCF6T5wlEGZU xBD98LHiyPayn96Sq24o/Y1vCvACi2CyA+woNkiW6piV+appJ/W3wQWORCYKhySjtC3g iipA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=LaRzzmH8; 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 c2-v6si5701254pfb.139.2018.06.21.14.28.44; Thu, 21 Jun 2018 14:28:58 -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-2017-10-26 header.b=LaRzzmH8; 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 S933745AbeFUV0g (ORCPT + 99 others); Thu, 21 Jun 2018 17:26:36 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:46340 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933658AbeFUV0a (ORCPT ); Thu, 21 Jun 2018 17:26:30 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5LLNsbX012186; Thu, 21 Jun 2018 21:25:35 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-2017-10-26; bh=hYJF+qrAoWZJa6Vd/MNqpypPSuOig7XhmwbnSWDkyiU=; b=LaRzzmH8CnXK1J4rIBk+PXwKvdvhCp2aQZpH8PevVVnL8QJKrIsd1yIpFfvXfVDVAHK2 Z2xrr+y0eampvj6k2ydq79NYENncPuQzfYIl/CPKhrPPWGKO6vNlYqg5MpAmJs2jL8bO ZnDgWrMOunErLQ/eiBSAXyEU4+2YdK+YsCf7GPB4xO7Zppt2AYoQ2yn78JfABN8ZktQZ RMHyjb8rYtwmZY3Q7dDwe/Yp+t54yCu/F/4bFYzEbjv6g5cM3LVhV3GI4zSJnOgLDOI1 t2bZzmh28+TVcOPiIzL///BdmqWJgK6JLnrtxCoJd0/zUsLBT6YrnhCyRVal9Azj4LMN AQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2jmr2muvfh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jun 2018 21:25:35 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5LLPYN2030826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jun 2018 21:25:34 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5LLPXZM015153; Thu, 21 Jun 2018 21:25:33 GMT Received: from xakep.us.oracle.com (/10.39.228.116) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Jun 2018 14:25:33 -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 Subject: [PATCH v12 05/11] s390/time: add read_persistent_wall_and_boot_offset() Date: Thu, 21 Jun 2018 17:25:12 -0400 Message-Id: <20180621212518.19914-6-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180621212518.19914-1-pasha.tatashin@oracle.com> References: <20180621212518.19914-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8931 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=849 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806210230 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 --- 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.17.1