From patchwork Wed Oct 20 12:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hikaru Nishida X-Patchwork-Id: 12572217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0CCCC433EF for ; Wed, 20 Oct 2021 12:07:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEB6160EE2 for ; Wed, 20 Oct 2021 12:07:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BEB6160EE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7/rINw5YnBkPILCEiS1zjYuceo/gF+Fe/DPGB5I9t0g=; b=2ULpBfG16OjXYE mjWnqwRTu6J3jJc3HgITEh87ywQ4GjgAzA1YncUn0x+uOhv7pjeZeUnnTCAfFnN7QDrUwLHU/ALEc js+JJK6FPUkCeySuOyHm2Yn4CLD8bUqonl4DvuxBuuZTGlonp5IPrXOGGTTcav7WqJBtIv4IjCPwq YMf8i309uhYOYtOrDZ2MXx9hl6ruyZxzj13xJmWpT3ZzxTMvM6xAnexmox9EsUInyL5b319KGOPgN yWH19AEEpTu9TV8sLT1pQkipkvGpWZJvYJegkscYF8qsUxBrZhKwg5eBNuvUdm9Y86Ch4LmmEdK8+ xeQDRPItrPC80z9DrdXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdALr-004PyU-9e; Wed, 20 Oct 2021 12:05:47 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdAL3-004PcZ-QG for linux-arm-kernel@lists.infradead.org; Wed, 20 Oct 2021 12:04:59 +0000 Received: by mail-pf1-x42b.google.com with SMTP id k26so2783479pfi.5 for ; Wed, 20 Oct 2021 05:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pU7j7Xk9+/byWORMoTjuh+PtfIleRNtFNR9pisRaOIs=; b=V++5qWbqy5428E4+L8MN0z76u0WFToo1W/QPmRiz3Y2mC128yoEwYEbB+FWVhgenuB n+q6iWsUMxoBq63k7TZlDaAFsLpNQMhhMZKNtAvJHVTqVAJ9VUojVmNE8vYiYx8R+ufz cVJPMZ5WhVbo7SnHuHoClSMPP6oZyFSv/o/vg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pU7j7Xk9+/byWORMoTjuh+PtfIleRNtFNR9pisRaOIs=; b=JxxqVjl3Q0OA4gwlFpsKUkHnSQHhhHaApTchAWhiFyFzXInX4eR27x4+l/0zXYIbW3 40kVC4fclwFEliXGlstbOW9iaSO+sSD4ZtFsdAH5ExoDTtkQsYZN8TZxtsr31l2Erz7u rvPOxNlZ6PQFe0fQnn72FD3XCTGD6SVe+TN2CHj7v7OD1lCujEVdknn5Wo32yJW1nOuZ J+Qzj72HJGxluxPjaeFUytnOW2oAQYPE4t/gPyWstMcBSkbQGkWep/jvZjRvns1P8u17 VK7D1YOdPOJerrRqaoWmVZiiIJu1KUCBEtvFAul4fI5Akqox+ndGCCCBkuAYG3n8p54j FrfQ== X-Gm-Message-State: AOAM533w9qvLOm52bUyuiKreRus4pVC0bYdeiKPgQBpsMgcDFeco3iPn eL7azeHjoHg8tFr5S/McufsAYg== X-Google-Smtp-Source: ABdhPJxaf4wQew/0fxehgf4we7eoDadSQ+ziLebkvEYdeY0bf6NB9PnUwEUIMDvlNw3FihCdjsAaDA== X-Received: by 2002:a63:710d:: with SMTP id m13mr33036191pgc.467.1634731496586; Wed, 20 Oct 2021 05:04:56 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:e516:d575:e6f:a526]) by smtp.gmail.com with UTF8SMTPSA id i12sm2108246pgd.56.2021.10.20.05.04.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Oct 2021 05:04:56 -0700 (PDT) From: Hikaru Nishida To: linux-kernel@vger.kernel.org, dme@dme.org, tglx@linutronix.de, mlevitsk@redhat.com, linux@roeck-us.net, pbonzini@redhat.com, vkuznets@redhat.com, maz@kernel.org, will@kernel.org Cc: suleiman@google.com, senozhatsky@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Hikaru Nishida , Arnd Bergmann , Geert Uytterhoeven , Ingo Molnar , John Stultz , Linus Walleij , Stephen Boyd Subject: [RFC PATCH v3 1/5] timekeeping: Expose tk->offs_boot via ktime_get_offs_boot_ns Date: Wed, 20 Oct 2021 21:04:26 +0900 Message-Id: <20211020210348.RFC.v3.1.Ic2211981441d0504581923b8770809f0750a4d0d@changeid> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211020120431.776494-1-hikalium@chromium.org> References: <20211020120431.776494-1-hikalium@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_050457_911241_4BE3B8DF X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Expose tk->offs_boot to be used in kvm virtual suspend injection. Signed-off-by: Hikaru Nishida --- Changes in v3: - Added this patch. include/linux/timekeeping.h | 2 ++ kernel/time/timekeeping.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 78a98bdff76d..f7be69c81dab 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -179,6 +179,8 @@ extern u64 ktime_get_raw_fast_ns(void); extern u64 ktime_get_boot_fast_ns(void); extern u64 ktime_get_real_fast_ns(void); +extern u64 ktime_get_offs_boot_ns(void); + /* * timespec64/time64_t interfaces utilizing the ktime based ones * for API completeness, these could be implemented more efficiently diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b348749a9fc6..e77580d9f8c1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -565,6 +565,16 @@ u64 ktime_get_real_fast_ns(void) } EXPORT_SYMBOL_GPL(ktime_get_real_fast_ns); +/** + * ktime_get_offs_boot_ns - boottime offset to monotonic. + * Return: boottime offset in nanoseconds. + */ +u64 ktime_get_offs_boot_ns(void) +{ + return ktime_to_ns(tk_core.timekeeper.offs_boot); +} +EXPORT_SYMBOL_GPL(ktime_get_offs_boot_ns); + /** * ktime_get_fast_timestamps: - NMI safe timestamps * @snapshot: Pointer to timestamp storage