From patchwork Thu Feb 1 01:04:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540544 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 767DDC47DB3 for ; Thu, 1 Feb 2024 01:06:48 +0000 (UTC) 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=WPZ2yZlb2n4B7bCeG4yDzUC7DcBtDirNF2V4ZC4+NkM=; b=Hd23jdlCbs7fOa BDzTyCy7wztGUoHL6P8FQ87KauQhxTZLlSN/QUC1u1ZfAyStH9n4SrkwETts7LoGjxeplkoBLbDRy 3S/dFs17fQZ1VqbaDE0gBdPfqOY3zpCkx3TycJePrGpPIPW9GEW4rti0j1mCR4+UhEVXH/9h79BvX pgRv8WmpJflryYSwytEcuT6u8K8VCO6kLFGzBVSN405XzZMx4jGLSw0qMBFFOH0VEeyCEnf+9cg8t DADtbKDtysAHcCHGrcfkfvitdDESMccXYeQ3K2kzOH3fsUvBpIWHCu/73SFoLxEJlA8qxtzu8Asyz lEEN9w72xawKrVDI2meg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLXF-0000000696v-3tSV; Thu, 01 Feb 2024 01:06:33 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.121]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLX7-0000000693z-20V2 for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 01:06:27 +0000 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.165.80]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id B3A7C1000007B; Thu, 1 Feb 2024 01:06:23 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749546.249000 X-TM-MAIL-UUID: 83e2df86-fe60-4be2-bc0a-13be3f96a655 Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.168]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 3D02010004D81; Thu, 1 Feb 2024 01:05:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMez3rGaMDRxG9JWPC/MtVIt4NdDRUvVdAec/6GUE8vsV+g868BfoKNYc30VJEsmvAUtSdgiiz1YYo0QCv1wGderMKe5JgfySakd1X1wL/B3zIIwC30LQZ5DPSZiQM2OMLCw/nmXKnladAA3Myuk7IpiCtKl0bGiOd4+y0B7dx2hU80jblPF5hb2GWa07+wyALhIgLLpneLT903PFfyOIVkEUy2aE/QHQ8s3U6JBZOA18tHqGvcoVYhdydrvHvanJ9T9kT2oDYEXKztZY87ZFe56OloktevPJWaES9nO+OnsyRRmaVxB4khQuzblgfvh/wCP2ajGpKykXijazE6YcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P80BaWCtwU961ML0qd6PJqYYAAwoo7QXKC2rGxLdToo=; b=VNcdtBwsaDa7BrEExG/HoZe0b0cqrbo3TsfnWa2SdW2COkkD52oMFB72SH7wvTxFxHb/YJ5EjcdwIICoI3ASo6vtmF5v0VV3u3prM6aN2QUAxpZm5eFD93my0L9JQDrX/2L3k0ZoyXmEYmhxg/uNP+IMBujP7/7EEVi/rBTbNms7cJS+ayRdGvs+wkxoKlS0ZdqEhCWgzY53Xd3v7UOiHoqjJJSS47ZeHUEuU924kQLeOcuvQtE5JWrXAOnY3S5PoBBI9/4uPTTjRzgNeLq9n3r5NKge9oWBZotrLx8Wlak/td2W5dOaMn+0Qwnh4eRtXvArFJ1CRNTEIjNDcj2DjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 2/8] timekeeping: Add clocksource ID to struct system_counterval_t Date: Thu, 1 Feb 2024 02:04:47 +0100 Message-Id: <20240201010453.2212371-3-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT021:EE_|FRYP281MB0032:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cfb6228-dfca-482c-2d12-08dc22c1ea60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UJ+33MOJqXy1BUIqjzZao42U6FTXpc6uM6q0Y5jYgacj1BxAR1Ku6fejhtVn89fRbMecP/IR8UWyIq55mQTb7ypblIhJjtbY1udN3Pa4qz38SJMJL3tJhMlOewyPwE5Q/hwAWzU9TF1Rvmx2OCj0CTadCjvdb0jWMdcJTzXkBkAOkL3FsjuAElPL6fFXp2G3eLQa2Gsf/bSVUrLzte03VBsdD+IMarOxtptrdHdhDYTPHA0RNgO3tdD6O1ntverq7fMQ7pQSq9xcIkfduXbwWXutg5YG5+S0hDhF6B60E3LQmpLxuX/ZxUpNJC6bUzST+FYA9JTS/3RP5ZYa3a65ve5f7kC/Y4tpvGenZkiTgvpMDkgi9kDNkMxqkNFIUnxWsv6UUK016EzRQElFOcUvLWAv+ICBogmlepUMIJnKUvZNsUTqAz9zM5EmEEJKyfJuByyaJ7wDdkXOC3xdYd2SyWBMpR1w741Q/h3JclXcX/O/SRuS8JAy+eOUDEgClYNJGU8WVruo43kNn4vJVujycQKoCjYugzcYjHi7zaghhkjxFmpkP7zKXZsTxcSP+PtFwBC4FIFvRa754kIj0IWLQWXIBH1dYvbyZrhYP0PEX7EcxUU/XbdOtSYZkI9x4nizoU7/TDi+RsO1c1nFuOL0EyFZEs/HbwThIJpUYy4SYK1zX5peJlwuUHJbBv8qLWJtCjsH6TXXViuyPbilXm2vIux2ZKnMGgHg76vT9b2GsjM= X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(396003)(39840400004)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(82310400011)(46966006)(36840700001)(41300700001)(54906003)(36756003)(47076005)(36860700001)(316002)(1076003)(2616005)(70586007)(70206006)(6916009)(42186006)(966005)(5660300002)(478600001)(7416002)(86362001)(2906002)(8676002)(83380400001)(26005)(8936002)(336012)(4326008)(44832011)(40480700001)(81166007)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:43.4878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1cfb6228-dfca-482c-2d12-08dc22c1ea60 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT021.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB0032 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--1.225700-4.000000 X-TMASE-MatchedRID: I6rpFm0lrcMEZ1mm50iAbgs6eGQ6Ral9EkUS8Erng9pzi8z2Fvgo+kp9 UxJnBl3FHDf9l7U5F7SnyNbHJWoNRbkeKW6KfnZEiu6u4shZ+fHcHWFKCmADc2shUDcgZ8ILoMQ NBr66IpTrLAe8bL+cp6EWqZPwachiifyRQLERY0pCPQBD3xA/3aODSWu0oxbK6gfKtA7Yhlrtmy EvxwC5ZF4L45p2p0pV3+6k97GsyDgqZdHEYvGr9R+AJsLlsQNEJEWB6QUw47pwgry9e+z6K02xv NT0DEAe X-TMASE-XGENCLOUD: 5b6ea32b-704b-42a3-a7c3-7ea9119431c2-0-0-200-0 X-TM-Deliver-Signature: 31549B26C2C12E238FE761D6A9ABD8F8 X-TM-Addin-Auth: ySrecwAZ6T0lqY5ygKpJic7UH9JZ0ONTg5B4LEUWxWxmxrX+NxzTqbuy9T/ B1YOtZV39v3RabXTypwHnahUBDDHv+VX35DBWxkf24fZB6OyGUUSw/PxMvOEAvy8Lv9e8M+ZKDO jBpsIskkODLgPyD+kxnxbAkpqXZGRK8cXaKG7PBFJJcgwgVNTNO1gHkIwShrHK4jNuGCJL5CVgx pRIPNLW4gp6wYLaovr+TFdELhcEfa3rIL/MdnxOnxdAHgtWR47GQgwhOwc0/J8Kdfmh6vsNuVWu qBmXceFOihjAAs2U/tqCUdSL6mv/9Vc/MReA.KDDjpmL4E1kvs5qcC+MdSieM0sfsL3FwnH/oBD tVaCHFlDpgX0PSjZUwqIx6XdLnB60NJRAbT/YOa0CS2Fuooel4jWkh32+eVuvsbQl7YYGMwNneh +7pVeUj28tCQm0KwxQm2KQQQvu3yfLAEthSRVBI5RvkzECC7XqT9EOeZj1iR0u2xGo/rRq9rMUc A9Jg0LkFCAbHtLzmUsfeKO6kgvDhUFS7QCz+TzH5pAe6Xpj8ER8e0tqQYj18N+ahwTvF6bU3KQb 8DopGyCYin6DICZfAOATZzqaP1PX/ZRdRy/fAB/r7TMs/EkydQ9r2tz7YhiHqdUwZh7IS309KcH bjyQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749583; bh=VEEICBI9hb85ucOIjDdO+txOgLqKBI+xAIKrGkmsBbI=; l=1732; h=From:To:Date; b=yVBUe2SqPjElDv94s/Rg71vp8wnuw5LF6WDKlMqqCdt+hab6nWGOcT57byD6WKNP1 cWzGJ9G+2IndCT+lUuxAIEtch5gOfm/lZ/uXCQ6sfBgwlq/jCcqHGGQa1nQtTd5eEx o6T3AJd0ryAMy3rwx1y9bDx5he3rtYypPkZtd1hIUwIMvy2Piomov1896bcbD0Fl13 WZ66wqj1nAubKgueqMkq+BG84pt0XDA6DXd+cIlk7B9wHnyv39APn/RJFYOPe0StJI 8PWq2IlR8E1qDKxn9Wt3YJkpQX4B0C3OdlQ8DppPzYVAfhQ5XI9Ih53GedqlTNA+8U S0b+mMa053b5w== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_170625_898956_45A4E7CF X-CRM114-Status: GOOD ( 12.36 ) 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 Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the Arm Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Add a clocksource ID member to struct system_counterval_t, which in the future shall identify the clocksource, and which shall replace the struct clocksource * member. By this, get_device_system_crosststamp() callers (such as virtio_rtc and ptp_kvm) will be able to supply easily accessible clocksource ids instead of clocksource pointers. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber --- Notes: v2: - Refer to clocksource IDs as such in comments (Thomas Gleixner). include/linux/timekeeping.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 7c43e98cf211..ca234fa4cc04 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -273,10 +273,15 @@ struct system_device_crosststamp { * @cycles: System counter value * @cs: Clocksource corresponding to system counter value. Used by * timekeeping code to verify comparibility of two cycle values + * @cs_id: Clocksource ID corresponding to system counter value. To be + * used instead of cs in the future. + * The default ID, CSID_GENERIC, does not identify a specific + * clocksource. */ struct system_counterval_t { u64 cycles; struct clocksource *cs; + enum clocksource_ids cs_id; }; /* From patchwork Thu Feb 1 01:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540543 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8CD17C4828E for ; Thu, 1 Feb 2024 01:06:48 +0000 (UTC) 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=uY0b4tJtNmDJ5c1yVoxphgLUUB98GdwB8azaP4nbm6c=; b=lh/Djk6TrqATWz 0AFlgZaFWnsAXHkFXK3lDQnokoPCSC+f9THIFqoPlD+Cw1f8khs+wzs6zaFSKxOaNPgacH2L4Ok9k FC1mSGCV1bi+lqcY8FkYjzOYfb9gSxMPwsKQquHcSOFg3zY0FatHvNWBvoANUbbsx/GkA3LztNmuu NfPjcqUZPJsUHqUXwkpDcEfTBsUF71b/xV8dYJ2ZzcGf3YajE3obXEQAp/0pG3npYrmYM16XMQXaH sOCID6Gm33y2Exk5nzkw1Dq3TaQRz92xVhNAARJN8Zy+QFU4DoHHCv2eIlBccJpXM926iWKFJJFqv YJF41c0mqcUMtqCJwhig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLXG-0000000697F-2Efn; Thu, 01 Feb 2024 01:06:34 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.111]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLX8-00000006947-0Ip9 for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 01:06:27 +0000 Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id CD5F2100004E7; Thu, 1 Feb 2024 01:06:23 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749547.193000 X-TM-MAIL-UUID: b05bbf6d-8b4b-42d1-8a10-3a4eb6c9942b Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 2F5651000030C; Thu, 1 Feb 2024 01:05:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DxAE+zjcXonRvxWcg2KKBiAorb5Ekhpw7TzXJC0ymiBcNT6oQXKU0rKS666Y2qE/h0X6ZKNKQYsNvxkvyvQSkzlXIhaampPoDUgGflZfc2WUacX8g9HhWq7qzE4KFsyX+ApRT2ChQmWntBRdtOSDe4wTturGKlVy2uAlNeeCYmKZ3ECzGB8w/mDViikiY+C5TLxabhG6Fy7Om1crN4KYtq4F+ZgqfxvGVmKqWUnqUHe7/oHWR9tk0m2paXVmXlEnb4UWNlMjWBuM2AggHyY7aa2Ter7Ih0wXYGA1AZxv/6d8Jkcsl0iUp0nLROn1t2O69cJxaG3A+efFcYECdpYhIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5KYjWDpJ4m6ElafzQDPfs1wFjYeCwnJ/3eTVK+O6LPg=; b=FitptyKP4tdsDRVInPq3X4mqJSjchbb8jbZ1d8Sz5ovqFlM1EZElcrruVMHReiFu7l4SFxW1D+aYMR4rgjjbjc8/qISV9Qzy2Wgkl1GbGSqI4LLXZyA/e5XWP4M+2U2UsOd5MXm/I+B+hyWeS72MgJkVznDtj0Nsn0RMdWY6LeRbGKGxF21A7XTaNuVCJJO5SAjutMz8y38VGyzMbRbLCprT0pYUiaBIt+st9tiIz5DFZynaaJgedf1zIUBQ77JF59QTmlHfsouBAKXLj461aJ9db15BGKvejpUN5oxsdF12tyKaDduxbcQbENKvaXVPkSt0uechKCpwdlOwCk8TSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 4/8] x86/kvm, ptp/kvm: Add clocksource ID, set system_counterval_t.cs_id Date: Thu, 1 Feb 2024 02:04:49 +0100 Message-Id: <20240201010453.2212371-5-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR05FT057:EE_|FR6P281MB3654:EE_ X-MS-Office365-Filtering-Correlation-Id: 06b4cafd-189f-4843-05c1-08dc22c1eb45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CGH93QONNpnotSd5ir1KXFLAKLHO0g6xDMneH3QMhTOtvmUM9U8+75fe0QclloegLnh36K2b0+9GkMh218dHEPwTOlqej7nK1FHgLgkgMydmNpwGzhrvNxLdQLZ1Nn6Z5vwSc5WVowHQ0KT5fQj6QpRmqypHPVrZjyJiwpGh29tSmpwM6KIVX7gwALP8L8iOtfO75362Xa2csMgNu/2/cui8toeX7TFQMrPOuqpgiYYXUBgPIUqxxL+oeXzwXgt6aArK+AG9fCGHG/qXLJ6BH3L/F+cnXcjcvhw0lYyD31/hiH0daSN5nyuMie5eQ1aPKOQYHZc82Owf/+FzddyOW90O3lQ6KfgsY8sjYyBpAvtD8WxZogHSUWHUWzKkaldW1w/Tyj43nHS22QGEmSOAfssVZVUpS0ZcY7lq7dn3JNQ8ONkqwRgnrMNV7ja5U5h2zcx4hPoH+PhWNPNRFTrJkcuB4an+n5ZQ0wk+/irFNrC/pA3RJYOIOj3cZy5CqBJMVADTx6O7upVM1wE5JBoJiBkshVjGqu78Ldmb9dloJBIOCWfy3p8UdvErYIDOPghTHMxU0MELt/N8LOD9ZZ0N5j0aFFrekL1wYeVXkMAAjGf5/RaPByeAklp1dHC/zRBFxTFneYrimBqIwJ5I4HvgBL1ICrkAl/HzQjbXEChmI+cCmr4rpyCiJISprnrYy/jGRyhbOkK3tNIRni2jzsb4QKPHnjiKs26B7aBlmdn+J04cMLIExMRVJ7hiW9XACKL1 X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(396003)(136003)(346002)(39840400004)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(82310400011)(186009)(36840700001)(46966006)(336012)(5660300002)(86362001)(41300700001)(36756003)(36860700001)(47076005)(81166007)(316002)(42186006)(8676002)(54906003)(4326008)(70206006)(83380400001)(44832011)(26005)(1076003)(70586007)(8936002)(2616005)(6916009)(478600001)(2906002)(7416002)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:45.0032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06b4cafd-189f-4843-05c1-08dc22c1eb45 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT057.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR6P281MB3654 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--1.472000-4.000000 X-TMASE-MatchedRID: SzbEz7SZt2vJ+P2VFrJmrN/Z7q+hZQVeET56SaIP1M+3UJJ8+n/4RSVv z26lmBXMFRlFiUGUwEmxjL2S8+j0lhfJ8eNjkTqdiu6u4shZ+fGDPlWYpnzHzmshUDcgZ8ILoMQ NBr66IpR/Gj7DAMEZmgMX/QeBIae0ez0KPZoFPyh4ZqfDdG89LitlpTPi5tO8MHiMmW0ZUNss3n AY9fdM9dh5c4TN8zbZ7PVkFWMnCn8N5Rk4kJccyL/a0nd+hIFCI/NGWt0UYPCKAhAjcFxLY7vRD AstQV9xnkz5OiQq1jJyAc4P1/IUE6iCvOFGVAUC X-TMASE-XGENCLOUD: 3bef6c72-1ea3-4c1e-8ab3-531d12416ba7-0-0-200-0 X-TM-Deliver-Signature: 5ABE237ED0DAA6C42DFD5D7901FB2AE6 X-TM-Addin-Auth: huWxA5dvdJK+KqvepDjR7IiEWLwW4lQK9IP9AgwcLnrCsaiYx4kbtEyM7wy i8lvS2sosGbZTMJc8ieC8Uy8FPJq16GO82Rq3GAqNqxQZ0I68KFqRe2OQBp1V6xVWBwukPEM3AV Ef3S5GqZ8EZI17/Wu4yNE2dmvCVLAfLL2OygIrHMcf+rWTKav4AJd12GtX7xM0AM2LQNQ13LVSA ldeqaFiVOhP8fvcRwKtYZDYqP8nji9/RyCu8CfaN2zgZXMPEvNflR+KvybAXGfCzybHLUl5joEr VsOv8qJG/cAFm9CgJLJQF6HzgK14h9fLzh5D.nUEaiXUYV3LXvv8D13L4zaL2ak37HWTRFbaP5H Xon0z/ZVS+oIlGFsTpOAlLXImfzg+mJ10khzOHr8wmR0ro5+1qEtgx5BNTZQ1zLlqRQjX5wu103 bajCMyp2q1oIonqd0T3pvLMDnGmaxHIqyck6MrCePjlTZeOntY4xpSDsu9djzuiA2mOUi5yP45J LawTUxWfPvODDOhlhYxZPwoDwyyDWp3qs+vgsg9kvV988PUkMZLIa7ZXqi42KtIkc1zY2F+yhtt pwu6ItBTzByfSeascdwKcSMrFDexJY2YLiY2ulPlRyzc+3Qp+8CM38xX58P/Pvh7po+zyLSnghF LHXA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749583; bh=5YtK4a4nifkYy7D9GImx5YWZNY7r7bQKqO6G1y6uwu4=; l=2271; h=From:To:Date; b=V9n3kxsbJbVA2nqHpwcOsdkmRaoBWe18noGWcY36Li4sjYA1hWj2vt4imy7oy2Z3m Zxbufu3tJC5nFbhRtCyVJEkuOb+lFQf1cDY/R1iQXD8PLfcF2FivwJMdtWx5Sx+Snm 7MNLDGhImuhCH24fXpyyFeyBoXtKXG9toTDQgiiMTzQGOxxskgyt2p/j+pZY1t9YHA l/xFvynl8ylj2XIMWMp1SZGlP/Gf64IHJVnOi9x4XL2LT3pgKJ1t+YzmeSqjWEPJJ9 CHAUuY+zv6PpgDpTPC1lTg8LobLpXanwxYC0ADwVTWgU7RT2U1KX70R161d2qiRMTV GRaMfusW7cvcg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_170626_483341_702EDB8D X-CRM114-Status: GOOD ( 14.10 ) 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 Add a clocksource ID for the x86 kvmclock. Also, for ptp_kvm, set the recently added struct system_counterval_t member cs_id to the clocksource ID (x86 kvmclock or Arm Generic Timer). In the future, get_device_system_crosststamp() will compare the clocksource ID in struct system_counterval_t, rather than the clocksource. For now, to avoid touching too many subsystems at once, extract the clocksource ID from the clocksource. The clocksource dereference will be removed in the following. Signed-off-by: Peter Hilber --- Notes: v3: - Omit redundant clocksource_ids.h include (Andy Shevchenko). v2: - Name clock id according to Thomas Gleixner's mockup. arch/x86/kernel/kvmclock.c | 1 + drivers/ptp/ptp_kvm_common.c | 2 ++ include/linux/clocksource_ids.h | 1 + 3 files changed, 4 insertions(+) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5bb395551c44..2f1bbf730f45 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -160,6 +160,7 @@ struct clocksource kvm_clock = { .rating = 400, .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS, + .id = CSID_X86_KVM_CLK, .enable = kvm_cs_enable, }; EXPORT_SYMBOL_GPL(kvm_clock); diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index 2418977989be..b0b36f135347 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -4,6 +4,7 @@ * * Copyright (C) 2017 Red Hat Inc. */ +#include #include #include #include @@ -47,6 +48,7 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, system_counter->cycles = cycle; system_counter->cs = cs; + system_counter->cs_id = cs->id; *device_time = timespec64_to_ktime(tspec); diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h index f8467946e9ee..a4fa3436940c 100644 --- a/include/linux/clocksource_ids.h +++ b/include/linux/clocksource_ids.h @@ -8,6 +8,7 @@ enum clocksource_ids { CSID_ARM_ARCH_COUNTER, CSID_X86_TSC_EARLY, CSID_X86_TSC, + CSID_X86_KVM_CLK, CSID_MAX, }; From patchwork Thu Feb 1 01:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540541 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BBD29C47258 for ; Thu, 1 Feb 2024 01:06:46 +0000 (UTC) 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=m18ngyKrgMaStq+ZAart1eAnT1T7IKbqESUZ0hnmORc=; b=bdHlP+fdTrFceb 9blygv/A5Pih6GrqTcUsYVO/s2RglgyeGqqfqX+TWkCUCn9CV/DeYbJnjcG4grtphJKR/InBpSbyG cWT8JqsqbeXtZGPxuiT827Rb3iQER/M90cYhI7b/Uqy/MH1/zRYEST2HWmIQoelw5Oh0EYA9XhKxu j34S+j1veTwMBhI5jLGpk+Diae2+qlEpEHOJKT3C1ooky9aUPBSB/Tg/T4F66unmp5k1Hb59fZQXz iqJjKgqeMXdjroV+AjaQvAk9Su/rY2yq8DLsVN3XI3/cx6357dSraRSV6NqW7RlGYfvWxcBYoNO1G Iy3N6rnswT0WbuFRivCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLXI-00000006984-2NOP; Thu, 01 Feb 2024 01:06:36 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.112]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLXD-0000000695z-0tu9 for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 01:06:32 +0000 Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id AE869100004D3; Thu, 1 Feb 2024 01:06:29 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749547.736000 X-TM-MAIL-UUID: 5c9397da-eb9e-42f7-9e74-f7ce1151010d Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id B3E8F10006A5E; Thu, 1 Feb 2024 01:05:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBQb9aXSmWIXZ5e3sAVvBwCaEuWpTiBSxy5zKGOn/TXCGahXbUijIOvoJ6FLkApl4W6WxN4PglFmo5hpdG6cKbAPa1Bs+NgDnP6Gg07GJ3t7o6PMEhLlwYMGVb3FMBQpZqE9zvnOqC1BDPB3F/kNGXCcyhEs4Uy/krRqZbtvMaQDuBiLEXYhL6ZlRk8RYXA3m+a/PSfxt9d2l1jEEhngf7nQc3DSF3hOF1O0ILvfP/lIGo8IOj8EX73a+WqFc8E9TiqclCt1e/9ZNejAaVULIQvme+upk7VxSu5csHljZaklgfpQj48rEX34b2ky6hEQNqt7U+zT35uHF0XVEok34w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JhgN1hN5nDXN/Fou+ALZ0OcVA9vQ13ILRQYwQOvZUNw=; b=HB7O83FYqcEKRkcKv520CrrzYKjD5vPAZx4SyZe+RlWTafIhsfjhSkqidNHzfU6kd0bCYV5e3NigoNzfiQDXTMBglrJe9DaR5F1NKB1j0hQ7OH8yNK73hGxmYSBMMxy1W0fTLNEmM+uwW8O1m2Kq73QttWm5DzugYqdv4v82SfaiiW2sOgB09LAZRRpaXLm9p4BUrbzosZe4yfWT+7f2DFF5zIVV/eeBtc+rhdcctEaekJKzXjsUNA3oYTDomQqg0E4An3h/zXCvM6+6lXDun1vmj3V7W8cthW293jkO8h7NJg/WiNTsrzpBQch4XKJnh2CLQem2JTLIlU5ZMkVMZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 5/8] ptp/kvm, arm_arch_timer: Set system_counterval_t.cs_id to constant Date: Thu, 1 Feb 2024 02:04:50 +0100 Message-Id: <20240201010453.2212371-6-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT029:EE_|FR2P281MB0107:EE_ X-MS-Office365-Filtering-Correlation-Id: dd7e9af6-3249-4a0e-c64b-08dc22c1ebd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j//xz2/FI7LgQ7uhT1Y84nILqDRR6bYPSjAlv+0eWOzFVSi8tDilxUVImkG4ngHcgS/s+DJ7TJzTy8506LUOJWM1btQVxp6UTzSPEUL4U0UUVKiA8jhCBzNwlwqLa0cCJ+3S+yCwdKIRJ3NdOeI2A+Nd+K+loO0tup5dm5NpzRzEtXgf98N3hVPmDDvIZEJkyb4H6qwsdMWb/d5fcVtiBjK4RhIOjV2OW5XkDHZ5+GgdgrBP+lGxu+BQp0klpIDJV+T4xQJwyvwvA5M7bJ20omQY9zKZM7kwIuljfuKhcJOr/HjNjlEcbnV2Yq+kEQGUTrrT68dZexreikRhM7bc9dDl5sLphWvxGcmSRfKEdL7NodVOkzAscDmx53Glje0S4zCnwKnpaDZJTJIErsyj9cxiRSXsPXK08AhvpOvNf054HUQdNxM2ENKvOQqO+fL195s0noEexBmqA3GrLCDbCFX1mUti2RaxXvHA38h5edCDIex7VBbdLWubTNArj3BdTLSq9ODOm+0dAISChUxjmjeWZ30gBu2v/TngOH0LwWKKP1ZDKMSK3wqWWnVCCX8YJRMAaIHQoIu616GP1b48Zt/bgigVqKoHXvUY00WOMBWdbXjnx7p9RFQMIYcX13RJDE94eUJGHdfaKfZhXk7sWi+yy4w4sfhsipXNrOuneVhUOqUClyyyHZk1AreNIP+TptFlfMRWxKfXN9wRkk20M0+HJwyHliRs6mFdTUHPDBC5xd502r1Cg1/LHvRwL+0F X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(39840400004)(346002)(230922051799003)(1800799012)(64100799003)(82310400011)(186009)(451199024)(46966006)(36840700001)(40480700001)(83380400001)(41300700001)(86362001)(36756003)(81166007)(36860700001)(47076005)(336012)(2616005)(26005)(1076003)(2906002)(478600001)(6916009)(70586007)(70206006)(316002)(54906003)(42186006)(44832011)(5660300002)(7416002)(8676002)(8936002)(4326008)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:45.9427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd7e9af6-3249-4a0e-c64b-08dc22c1ebd6 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT029.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR2P281MB0107 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10-1.458100-4.000000 X-TMASE-MatchedRID: bjwz5Y9VyUDCCiFlDvprp7r2u0KWqQKNSDS3MUO7D/TIRhEhdkLWEovP iBq/iW91MpPx8OFzfY0wNyuTxfRm8ShARHtTtMpxhi2C7dlNKWrn0oaU6WM++5zYnFsPfA8XUMf 79vayL5ANuimYslhyE2tNUNGl1uzREfinJ3N6jMzFTQGAKRxj5No+48giqZwnEgg3cwDHl/0S3W M79W3o4ma3xca03R6M/utaD2GffWo0zI7+eiZZ8F5CD/hq6siqFEqAM28vQO1Q6z0JFJrmFnhEE wH9X4REQE1Xqh2tz4E= X-TMASE-XGENCLOUD: 94638120-ac67-4978-93c3-0cd2902ecd73-0-0-200-0 X-TM-Deliver-Signature: B373ADE2DED4ADB7679BF271BCAA9316 X-TM-Addin-Auth: 8XTTJSTfCuDKwe9AtHmgxezWSnJkKdKsUymwIVnx6WSdfhq4RiAhPIVgF7B HjuXLGJUfaidfVcwF0dz9meo/dg7OzUGLqfndiWAP6lunKNHVjmPkSVhkyvj8iE44qJOVGHMuZG ruTUQm5PM/dJLRv06dV3tnoEODN+V98FUDIC447mOOkIL3ofFGuh9qCO2i6BYK7Yhfu6oBRRVIM Sm2f3jt5i+nZQnH8OrQZiaj+sv5h8WaiLuV1iWvsNZ1yQBuD0sq/dASCpdLZ96dJoHUbovZjGOY DDHzqHVo+/pemfGlvsM46A5Id6L4t/WIozEu.pxOrUYIredW6WK5u3i8RWDdo9ZxGzitekXngfs 5S4rjzOn6m5a/K3VJXYh/5f7gK8kD6Aq5WBbexVChp6M4SjVKyXdH/WpB7upkSSFgY1MydhpzZf GhNqrptC1Z6/5FarD4U1AP6QqP0Ou0vg1loJPZihrFsJYgd5XfkE8rv4bc0ayXWly5vix5c/83h t4spgTpvm8QC/g8jWpS1g51T7x70ROQOLg9qXyG/tWcaInkZb0z8+j+ABbAdbui0lh/QT2h3DFr 0Bk9NplUry5QbI3/nunLmy0R+knYJwwh3s4/l1RPe0uFX04zaubvyfWmKX/b3w1fhYPD6QcHMyP xQ6w== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749589; bh=D57pOeABfamN98NGLpRroVr6iGToMt3H85oc0X/wUSE=; l=4724; h=From:To:Date; b=AkFHexsJyiiioD/6hJQl8fT+d4yVX/CIpU2UIXVNhWItDjjxfsIG/HITheyeh8U+8 psOofcEjsvIC9UnnhLYWuY1ARPzvlhT3wShy3GWUYLbTTUjWaBUOiZtObIPosDv1Xc EJda/tp4lkxTTLdjSD1OEF353i9ZQ71V+RjnIKiqtiz4logvUH1p5WbFBINeTRXl/h ucoFLm6nYrDgQbOcZX9KY/TnW3BOPTepIIFhEmMhfeVPTKVK680zBnVvlwc8cGqZZN Fgjral0NWJHmp29GjNconaUokkSB5f9m38sheEpzvB6mWhKm8B6k4wtC+xazH/yKrL Rxf+80P5uBEpw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_170631_571125_0F4C5F72 X-CRM114-Status: GOOD ( 18.50 ) 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 Identify the clocksources used by ptp_kvm by setting clocksource ID enum constants. This avoids dereferencing struct clocksource. Once the system_counterval_t.cs member will be removed, this will also avoid the need to obtain clocksource pointers from kvm_arch_ptp_get_crosststamp(). The clocksource IDs are associated to timestamps requested from the KVM hypervisor, so the proper clocksource ID is known at the ptp_kvm request site. While at it, also rectify the ptp_kvm_get_time_fn() ret type. Signed-off-by: Peter Hilber --- Notes: v2: Added in v2. drivers/clocksource/arm_arch_timer.c | 5 ++++- drivers/ptp/ptp_kvm_arm.c | 2 +- drivers/ptp/ptp_kvm_common.c | 10 +++++----- drivers/ptp/ptp_kvm_x86.c | 4 +++- include/linux/ptp_kvm.h | 4 +++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index e054de92de91..45a02872669e 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1807,7 +1807,8 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init); #endif int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, - struct clocksource **cs) + struct clocksource **cs, + enum clocksource_ids *cs_id) { struct arm_smccc_res hvc_res; u32 ptp_counter; @@ -1833,6 +1834,8 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, *cycle = (u64)hvc_res.a2 << 32 | hvc_res.a3; if (cs) *cs = &clocksource_counter; + if (cs_id) + *cs_id = CSID_ARM_ARCH_COUNTER; return 0; } diff --git a/drivers/ptp/ptp_kvm_arm.c b/drivers/ptp/ptp_kvm_arm.c index e68e6943167b..017bb5f03b14 100644 --- a/drivers/ptp/ptp_kvm_arm.c +++ b/drivers/ptp/ptp_kvm_arm.c @@ -28,5 +28,5 @@ void kvm_arch_ptp_exit(void) int kvm_arch_ptp_get_clock(struct timespec64 *ts) { - return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL); + return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL, NULL); } diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index b0b36f135347..f6683ba0ab3c 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -4,7 +4,6 @@ * * Copyright (C) 2017 Red Hat Inc. */ -#include #include #include #include @@ -29,15 +28,16 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, struct system_counterval_t *system_counter, void *ctx) { - long ret; - u64 cycle; + enum clocksource_ids cs_id; struct timespec64 tspec; struct clocksource *cs; + u64 cycle; + int ret; spin_lock(&kvm_ptp_lock); preempt_disable_notrace(); - ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs); + ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs, &cs_id); if (ret) { spin_unlock(&kvm_ptp_lock); preempt_enable_notrace(); @@ -48,7 +48,7 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, system_counter->cycles = cycle; system_counter->cs = cs; - system_counter->cs_id = cs->id; + system_counter->cs_id = cs_id; *device_time = timespec64_to_ktime(tspec); diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c index 902844cc1a17..2782442922cb 100644 --- a/drivers/ptp/ptp_kvm_x86.c +++ b/drivers/ptp/ptp_kvm_x86.c @@ -93,7 +93,8 @@ int kvm_arch_ptp_get_clock(struct timespec64 *ts) } int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, - struct clocksource **cs) + struct clocksource **cs, + enum clocksource_ids *cs_id) { struct pvclock_vcpu_time_info *src; unsigned int version; @@ -124,6 +125,7 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, } while (pvclock_read_retry(src, version)); *cs = &kvm_clock; + *cs_id = CSID_X86_KVM_CLK; return 0; } diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h index 746fd67c3480..95b3d4d0d7dd 100644 --- a/include/linux/ptp_kvm.h +++ b/include/linux/ptp_kvm.h @@ -8,6 +8,7 @@ #ifndef _PTP_KVM_H_ #define _PTP_KVM_H_ +#include #include struct timespec64; @@ -17,6 +18,7 @@ int kvm_arch_ptp_init(void); void kvm_arch_ptp_exit(void); int kvm_arch_ptp_get_clock(struct timespec64 *ts); int kvm_arch_ptp_get_crosststamp(u64 *cycle, - struct timespec64 *tspec, struct clocksource **cs); + struct timespec64 *tspec, struct clocksource **cs, + enum clocksource_ids *cs_id); #endif /* _PTP_KVM_H_ */ From patchwork Thu Feb 1 01:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540542 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0B543C4828C for ; Thu, 1 Feb 2024 01:06:48 +0000 (UTC) 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=pahqMDrWLglLP4cgcT2AZYv+LhD7Xatoe0Q2Vnpt6Z4=; b=A7UgOy1/cvXmI1 5PMYTnsO4r8eKAZMb0LwaIXmtBhWyLIuyEQxJcXELR/Tr+zNnfCwiui6B/zotfYYKWd0fQy+VOKUb hZAAAZ67Z31QXEbxCDoF6TPhAoqMgYNWysFy0ac8twYDJrFZa/NQydB5NViYg5XqQEDQSYNPwk/4N VBWFRbkJEhfdLvq7C+A2gn56/Soi5lVxx2GMu9QeY+smxQWjIkoYUygCQ1cj0HzcfUyXYasxxbFBg jIZsWbvkQ+Be5sUoabuyv5lzS/nAs3a/WLTS2KmdnRZUZD44N4kfEAqLDgNHUWi0tEKb/ajn6nTR9 2WDGSsDgGUaOKMy4IqZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLX7-00000006948-3CCh; Thu, 01 Feb 2024 01:06:25 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.26]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLX3-00000006934-06iP for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 01:06:24 +0000 Received: from 104.47.7.169_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 9666E10000E36; Thu, 1 Feb 2024 01:06:17 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749549.127000 X-TM-MAIL-UUID: 709e3cc4-757f-4404-9af5-e56d9b0a6509 Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 1F23C10000E27; Thu, 1 Feb 2024 01:05:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zknp6agk+5MT2WVkC1kU8vBXclZZnhsjEAdXme5JAuPR+tkvaWwisgw8R1Iv3liuFMbCTaNqtqAz5HTs+S9/XC0oMgzzBHIJVpkP1G12UR2E395ArK4lIm5RKb9Ws7MjLUy7eT8IdfcA99t1SubH8sLpd46X8vrUvaJBmY+oA6SdWym+9UeH4ak3L4agMVTD6kcORjA3Jox+E9o2g53SJ9HTFWr7JRy+Cy/9R1HBsiWprVoAndEynM9P5DrcKiK6kvNpGPIPaoiNQ8ITwuIh+KN7hesKr+eqm166rNdBLOQRI/kQpBocq/lp7J3gOYUefkFxligxX8JNoofDdX70Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=19V5f5v4K31vf5r1k2uGbWqScSaz2MU+qssn/Nacn4w=; b=b9yZ6yK75RQUi/YqMqz9i4Aee9bK5CqkjYQq5kylpZGU+Fo9Sk7sqEiglON3vlN0Nu1s4nMC0ynQO1+Tqy2hORkgVlthzdexTWNLXZI5t4A/Fgk/hFgyca/VbWY2mEnbICFPKJ+ZEmUppl0FYp+UORJ94F6LkPeQeDL7hlbo2P7L1h6exfoM8nd2scqEVU5FQd8KkaiEz/VKYxat6WiikbEp36nNxkyp55zIRrCLSa21sxSyNVxfrEaUUv7HiMJIhU9DtkOE/gpZkgdMgwiNMtia+nv0ym8IjvcqdJys1vvVttdrjx7aH/2rLpNy6wBAsnMqd1PDBP40VRfXjgr7Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 6/8] timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Date: Thu, 1 Feb 2024 02:04:51 +0100 Message-Id: <20240201010453.2212371-7-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT053:EE_|BEVP281MB3522:EE_ X-MS-Office365-Filtering-Correlation-Id: 68e8df3a-ccf8-4dc0-f8de-08dc22c1ec77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SMPn4YTEVAuru0q6PEGjScR9cb4/cXYPn25yAmfn1n2RnNTtLvMDwXPiToRJ82YnOhnlYYm1DlLzCMZuXSsOBzxh1i0zrW3CvHARxfYejvUkMZ56alcVtS8Aj1Iuj+zpXG7uHRYi/u9cnRIndVovAO1KWo2yu53PAAJ024q6dZAwyt1rXdi35nkx+A9lyIHeAlU7WZmAdZXTBacP1PbcXG/1Zm8yUuwc00KsDSE/aiWzZHHNq86Oy2Kewph4zn3taHLDx+Ws00PDXEvPWMMwnCKqY3oz8VEmXgpy9rnbMVyEO6lvDcXYo5cLus+RhYTH3fce2aIUeK98aqhsWe/D0UvsBt1toW7zFgb4EjFicwwXtJDeiw9B5MTuOYajxbMDg09N+IxZGP0hYll4GzBuHHPmpEv3MEI15nBds1b8BOSRyryo29kHm2Kjyy4TSZemQilz+04L75tdjyR2gWpNB6X55BTsd/4zSBGAy2TA9wo9pKeti25RV81KF5WNWLMTGcCzzph5/UUnbrqAcAsVLJIS7UhoD0Q8qJ2OBN+8FB0juwuF/IgOE/Ix2Me7Il1uSmxlu4yzk7y+eApzyDpFXRTBuyz5piMgCc6/xbgZee7Gg8N9YpoQDT4wxswW/11iDf00pjqHaevZ97B1q+MUIxuq2uH2UixjTnS5lN7q8Z/41yBzLvRveplJgs4GB4rWQAFg6v0u6kDXC8pHCtKhuea5bxW8oXAqtwnKrHsMtVHDxZAcYJ+DKw58gtRw4Xgj X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(136003)(39840400004)(346002)(376002)(396003)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(36840700001)(46966006)(41300700001)(83380400001)(47076005)(1076003)(2616005)(336012)(26005)(81166007)(36860700001)(4326008)(44832011)(8676002)(8936002)(5660300002)(7416002)(2906002)(478600001)(966005)(42186006)(54906003)(70586007)(70206006)(6916009)(316002)(86362001)(36756003)(40480700001)(142923001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:46.9992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68e8df3a-ccf8-4dc0-f8de-08dc22c1ec77 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT053.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BEVP281MB3522 X-TM-AS-ERS: 104.47.7.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10--4.043200-4.000000 X-TMASE-MatchedRID: xPvPRJicGCRt/9ulvM0QMd/Z7q+hZQVe6wJlKkXfZVkJ5yiKyAQmigHW HoYGrPh+C2QDPheido9iBl6ePEpdZVlsdSBrk49aju2XlcEx9HRelLFkoMPMWOI/qZVAgf06Vif 9o7rSV9vm9Tc/GgfFJwFtWueZlMH0t5KZ74QYwoxVSWOKG8Va/NVTzaAe7ACyygHdGJDPWm8TJ/ T+Ssc4ZVqoLahcwH4L6xA0Ava73nAPm15xyht8lXx2eIlQG1sMfC4IwOLvyucC4DhlAS07elo7G mCOJYd1+Tf0tcxKuLqp1o3scZXZMKi/idDT83QQLnekw6JLry5x/K7fMpYywQ== X-TMASE-XGENCLOUD: bd19414a-342d-4838-91df-7f66a485cb9a-0-0-200-0 X-TM-Deliver-Signature: 2BA278FB04BECBAC442E7F811F5E5EF9 X-TM-Addin-Auth: KNGNGy7t/AMGYYoPNJK33ihSH7nZOlcO1ENE9vIJullXy940AcoaOTWa2EH CaJ6tWJPN/O3nktQf4U8z82TJnXEPnNin+3JoCVAHtJJS52G5DRKQm5kOdWRlMM5E+RLfJXjcMs PSSGY8C6UENKzGxp/+F69UGZoV1GwNw3+rxSV9eQ5WwxvJLauAlgDfZYcRwtUivqlPJf3SLVzQ9 GnFCoAa692daYx/wOu86WSacyFs8K5UWgW07fnOgzh9mt8wMHLfWeVzUkBLPZuHZoR22RZps4xR T2JwLeXP3oHXap5LIrWC5xK3X/e4m8oenkz4.dzBdD0ueEzIDCZ2p1juT/CU3dycpZ3O8MSXgnj e/cu5MlnrLULYa7fhzKgDw2NBlrFuvRXSE7OPgyhF6XTPbcNlYa+H30FOzK0YJBymT9ZuQ7LVaw rOMdn/QKgcJgIjXx1AjjZGjsalneCBHi7+U73LyV2AE/ouKwcMBBhJeCmPE4z17kxgOKmr4DBWZ GL0HmtJXfBLWR304+8BqiXl/BMdGsmFx167jGXMXOJl6le/59k6hnjC5xMiI7JeK8vlTi+4y64L MlwAIzSmOh3HxyBr2mWFIQ8XT48PUxwz0S3CQzZ4zzQQ/GDfkN6LQ9qSD3PChPWr9rVU2Dd4qb4 3yWg== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749577; bh=GD3Um5Fk9KYt8CWRDZT+Iu5Qq0xNhOzbOrimElkMX08=; l=3419; h=From:To:Date; b=Rd+6oYlw0e5i5m/oaOaELqxRPwIeG1mlIQovq3Yvw72ixqAZDaxVS9qRblcqx1kdv XkCyQ5QbF3iMch+YLL2ARfcEB9RTh4IXINOZDGOKAxRIsBP94wTNfGKZt7f9X2x3tq JXH/pICCc7AfoXB/vAaG1V9gf5r64hmQ5oGwNLtRgeosCAXiBRb4BbqggKzBtPzB8e wBw37E42Uce7SUy+17En+9gBVtHgogYStStsLKosCVDryexFvyqfrjgM20s/f2S8Rr ZiTTg7HKGDtAI1PoIuLKbGVJLZ/e/bNkh9PZaRW1AHX8/JxtcFsDFUJ4wWuyOGLbQ9 +3BagxUPjpgCA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_170621_395147_8EECF486 X-CRM114-Status: GOOD ( 17.29 ) 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 Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the Arm Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Address this by evaluating the clocksource ID, rather than the clocksource pointer, of struct system_counterval_t. By this, setting the clocksource pointer becomes unneeded, and it will be dropped from struct system_counterval_t in the future. By this, get_device_system_crosststamp() callers (such as virtio_rtc and ptp_kvm) will no longer need to supply clocksource pointers. This change should not alter any behavior, as the struct system_counterval_t clocksource ID is already being set wherever the clocksource pointer is set. get_device_system_crosststamp() will now fail if the clocksource has ID CSID_GENERIC, but all currently relevant clocksources have a custom clocksource ID. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber --- Notes: v2: - Refer to clocksource IDs as such in comments (Thomas Gleixner). - Update comments which were still referring to clocksource pointers. include/linux/timekeeping.h | 10 +++++----- kernel/time/timekeeping.c | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index ca234fa4cc04..3538c5bdf9ee 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -268,13 +268,13 @@ struct system_device_crosststamp { }; /** - * struct system_counterval_t - system counter value with the pointer to the + * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource * @cycles: System counter value - * @cs: Clocksource corresponding to system counter value. Used by - * timekeeping code to verify comparibility of two cycle values - * @cs_id: Clocksource ID corresponding to system counter value. To be - * used instead of cs in the future. + * @cs: Clocksource corresponding to system counter value. Timekeeping + * code now evaluates cs_id instead. + * @cs_id: Clocksource ID corresponding to system counter value. Used by + * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific * clocksource. */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d02809dbb..0ff065c5d25b 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1232,11 +1232,12 @@ int get_device_system_crosststamp(int (*get_time_fn) return ret; /* - * Verify that the clocksource associated with the captured - * system counter value is the same as the currently installed - * timekeeper clocksource + * Verify that the clocksource ID associated with the captured + * system counter value is the same as for the currently + * installed timekeeper clocksource */ - if (tk->tkr_mono.clock != system_counterval.cs) + if (system_counterval.cs_id == CSID_GENERIC || + tk->tkr_mono.clock->id != system_counterval.cs_id) return -ENODEV; cycles = system_counterval.cycles; From patchwork Thu Feb 1 01:04:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13540545 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EDA79C47258 for ; Thu, 1 Feb 2024 01:06:50 +0000 (UTC) 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=uqoTatM6sB/uF5oG9nH8o99LoEslgZKZLBISZCOqkN8=; b=X1Ox6EOjaWjJ/E TE/9cEMeATTapNRLKMPDJlWy962dvpM8FdwCedqQYZXKMWEbAIgzqUE3wVRFNNI+RhT3IPtATLQ4U Lx/lj1MXS/0IzkJ+ywF0HD0Q3ws4bOZR6a9oEZ3KUNiWr9O57BzGDWCyTj2eDnwibkqlzEeiWHqAM QaTiYj9Ku14du+j2+/C7NN44BV2TtqGOfedcSdqOGOocrYJFcktdRW8J0RvfS6C94F4COnwyDseCq MU9Mme2BnUku6+KfFe0mRS1WFOV0dzyeHUhFcNOSqyA28+HqJQ5MvWrFap2KhjF4hIhH2eq5s7OPh 1oHdU0VpMOi5heNk6GLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLXH-0000000697i-3k65; Thu, 01 Feb 2024 01:06:35 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.113]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVLX9-0000000694e-2BWZ for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 01:06:29 +0000 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.176.220]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 8AFDB100004D0; Thu, 1 Feb 2024 01:06:25 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1706749549.349000 X-TM-MAIL-UUID: 57a7349a-401c-46dd-a091-502461c475aa Received: from DEU01-BE0-obe.outbound.protection.outlook.com (unknown [104.47.7.168]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 5580710006A5E; Thu, 1 Feb 2024 01:05:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GKhyu1JIeZwB9nOdO9yB4NN5zgsl1eKp2kxic9vkp1DOl3zR2PLwPFLOeLTDfdN24qjaorlw0uvUj+lJhmGrm8C9Wpj1jp9qgOIBH0X+QiOIvImLOgvZgry00ly7RS389iUSXp4o5//uY1LW8xRogIyUgQCGR5vaXsS6q6lBz3SPgQhjfwf/ojUa+VWVGK7VS/i0OrcJ4sFFh2qd90DN7K5gl/77hRVkmv4BA/CEVAIAQng2r+2WAqPFj3VJIn8ak7MxLb1ASixnIeA4aNY9zJCcctZ8BvOCsMR6lt+/VdyuBoR6YzWQTWKfNn36PQfFGGECY6qtZLVO3n1SXIZPfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LsyIsJZULVmOyBWJOur/9/jVP+yb1X6rnbgwdmk3TFE=; b=KRGUgomn33oerqrVwRfUHTGUzle56lVaaDZfDYUTwY2sgPMzqXO6/KA/Njz7GFyrgOSA1yvC5B/rGA2Fhaa6n7kxpvZCC0FFVqvvotQFE0rLLmAYIw7Uo9ZtTSSLM6G8gLR+l3NcXcRWfXVircIF/tERHyjdzAjqPTh51nnqxmZnEqqCycGEqK66+iiXRRVOQ7Hxr5/wBRny8glvjlyZUE/sOateCWr5HsTBXn2xkucUom7Wi4iqTu+NaygyGz2+4MdvZxJOHYZQdgoPv3SCrgqEw3XZFxb5pT5WK8VWwWxcJQvOphJEXe8nLDqqBCl8NuNxCKVcH6I+/4L/MmCZzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=alien8.de smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Peter Hilber To: linux-kernel@vger.kernel.org Cc: Peter Hilber , "D, Lakshmi Sowjanya" , Thomas Gleixner , jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, "Dong, Eddie" , "Hall, Christopher S" , Simon Horman , Andy Shevchenko , Marc Zyngier , linux-arm-kernel@lists.infradead.org, Sean Christopherson , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Wanpeng Li , Vitaly Kuznetsov , Mark Rutland , Daniel Lezcano , Richard Cochran , kvm@vger.kernel.org, netdev@vger.kernel.org, Stephen Boyd Subject: [PATCH v3 7/8] treewide: Remove system_counterval_t.cs, which is never read Date: Thu, 1 Feb 2024 02:04:52 +0100 Message-Id: <20240201010453.2212371-8-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240201010453.2212371-1-peter.hilber@opensynergy.com> References: <20240201010453.2212371-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR05FT008:EE_|FRYP281MB0272:EE_ X-MS-Office365-Filtering-Correlation-Id: 81d7bb6c-a1ec-4d74-9208-08dc22c1ecfe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s5p/bEfW1RcHnaUVG/vPSD45EAcSRtlIOej782H1Qr4bexPXN78iDHu2/3sLAOKBHi119bqIVep+/rMO5VyE8j2xgSiuVZBPhiHrLO+ahZ6FV47rCbjbi0hMdnXX4e80HKVeeMspKZ5zgByY9ll03N2BshqGdXtoDXfc7N/hAprTJAMacD3NluZJfLFl/FuujB6B/HXNcpsWMSajjDsQ1+tcC4V2yFTqandyCqeVJ2cyKlUvmRSPKdk9EhUswVRVtpJR+stEiAaRbrFnjrf2mVT5tFIEk+hH4Az6zG1T7SNK/2zBIldYuZTvfqoniTt4uKmhS+1Xi7f0uLgzKK2znsUgbpgE+wZ+yMFhjuvnXUPwucyF8L1UInGpTYeAyeBYlUD6fMD2z+wJd23N6auQyJ2zyjM44R9VJVa0Bt6n8mEpjEztB545+vZVqJ+Y2iLJr5a85PGyxmWmOd5InNlMJ/h/Ayfp6dPHaLwb5ICeWepqgo3kAESx08OQKPB5CeUlSvGpNCK1YeAWgNOLbVn9Fp111sFCrR4UpwuYTfWvcU36exn9QG2j96UhZjP9w8UV3VLb+dalqliYE0dif9uv/RZ0MA2XX20IyhqTfs0FieJUuUc0RnnwKqJ7+8Oq2pEMZKxkYybBxTrL1los1W/z3MoWLeTyeXlR9D/a9hccfZvsP/lJYYhwPwdJeCwW6xV97upuTGDxwYxyNKWRP7c7KVyUYrnxXQ+WbmhXX8CE7jhTLzYLIqzZTsJyALjjUtr2 X-Forefront-Antispam-Report: CIP:217.66.60.4;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SR-MAIL-03.open-synergy.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(39840400004)(346002)(376002)(136003)(396003)(230922051799003)(1800799012)(82310400011)(186009)(451199024)(64100799003)(36840700001)(46966006)(316002)(47076005)(70206006)(70586007)(42186006)(6916009)(54906003)(36756003)(7416002)(36860700001)(8936002)(4326008)(44832011)(8676002)(86362001)(5660300002)(41300700001)(81166007)(2616005)(40480700001)(336012)(1076003)(478600001)(26005)(2906002)(83380400001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 01:05:47.8969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d7bb6c-a1ec-4d74-9208-08dc22c1ecfe X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64;Ip=[217.66.60.4];Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT008.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB0272 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28152.007 X-TMASE-Result: 10-0.836900-4.000000 X-TMASE-MatchedRID: 2GwetqJOyZxrxBLbo6y0d4ruruLIWfnxgz5VmKZ8x85rIVA3IGfCC6DE DQa+uiKUfxo+wwDBGZpKfWS2EzGP5o/GIRjw2D78dArStA4IAF4SRRLwSueD2tEOKD7Vsunkj6Q WX061FFJ3hNro2zkthd9gyvNyzxXy0bKbAkjZTQt4lyF1lyvUrTUfXwpl5znYB/H9q/pEjfECt0 I5Tjuo2dlhzrOwI51bKRbMLPl3awjb3dppi+rLrXzV+KRRiDItcnxszfxH2Ckmx8kl1Wnd+q+eC SMeOiOkfZ9uentPYeaJcb4M4L3rfi1QF7giu85XOwBXM346/+wUiV4IE4MuxRTbXVdulhu/g7hE xeK2mZMPR11w2j/xz8m6mrJkmFv1 X-TMASE-XGENCLOUD: 5c2e2e76-2709-4d52-874d-66c1ac854c9f-0-0-200-0 X-TM-Deliver-Signature: AA2270AE4D693477B76D0B655674B1B2 X-TM-Addin-Auth: 0Q/emdNT/sNhsg4VmkEqA2bu2nwRc6yHrwfyDG7IMJ+dbBHMyMPaixZ8R0s 1wC8mhCCB/0wymKGMmNx4IT3OCTtdT7hnm6lTJv7lcK9G9hJ5spUPD3r10QrlYYdgFEYN6EvIjx Lr+Tsxz4GRDIGFCvs9woZNEVmzBWfZc5RBSd8ThjUYM/W8iFS6enWL0K62k+3l5GYHkccduG6/d //yHM5obD7hm34tudjbXV8RTxcodJRXRE2Bb13sHMl4Z7nWvgH01QT3Kt9/IOGJQyB8pxeCgepL ljKkzZfq83uwBuCFyA5Imyvj1VmqfVYh3n02.JPyoV/T2r1tAEv1U2pH2m/h5Kz2zbcSCHDbYHT XxvHJK7bu8RSaskkqGRoRWblNYdOGwapk478mbCBWwHFs+qRIkG9JO5xEPCTG+lqkIlB9BuOMd9 X1mVvf/iDTJASysGBQbHn9jd+SwCdNSgg+nuGvDBrTAlH9n7vrpbDalc/HMxm3sJUcfFVXnCShI 0MITdgDSFqtUdrGpefVMRv+b97DTpRxpITAw6fFbR+knLuvFp1s12x5aSjlhs9ORt80AyrJck+b G4gs2L4Yt7Tqc3szU3dC4/sLGqJCZvwJGLvihk52vxB2MnyhBxZ109ISF5BLO4N0UyQOzHa6Ln8 BS6w== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1706749585; bh=j3ZK0LDs+hrr9tdazQ5dmRy2Y1/jm40trOZjBU8ltrU=; l=6724; h=From:To:Date; b=XWj5mJP31O4E221jcObYKFA0r/yq0fZlOLcoTqw2C0JCSLwZJy7RN+GMHteSyjY86 skqvyIe0/+D1muE+/Z0lOqRrxzWOM3xPs2/PZEmLoYqE06uO+lyP0VIayPFJq28/2M zxpXlUOjkjJYCa0V/d3NBBfgTIOGbdURsQTaBMCfRlX2bx9J/7FNrsQOTM2TD4TvLM OOKPZk6Ofi5cm6Ny3tTVofh3bB//FGmLuYKQ+ZRFL8Qafbw1xEBh2L9MvCjpfabOuo EBrovfjDD9vNPsg3xG8/VCGGji6LIuM0JnuzE99bRNJHfUfbfTdG0WJRBhahR8ADxp CHnoSMuKwURTw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_170627_885653_89E5FD2F X-CRM114-Status: GOOD ( 18.28 ) 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 The clocksource pointer in struct system_counterval_t is not evaluated any more. Remove the code setting the member, and the member itself. Signed-off-by: Peter Hilber --- arch/x86/kernel/tsc.c | 11 ++--------- drivers/clocksource/arm_arch_timer.c | 3 --- drivers/ptp/ptp_kvm_arm.c | 2 +- drivers/ptp/ptp_kvm_common.c | 4 +--- drivers/ptp/ptp_kvm_x86.c | 2 -- include/linux/ptp_kvm.h | 4 +--- include/linux/timekeeping.h | 3 --- 7 files changed, 5 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 9f164aad5e94..693148adca22 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -53,7 +53,6 @@ static int __read_mostly tsc_force_recalibrate; static u32 art_to_tsc_numerator; static u32 art_to_tsc_denominator; static u64 art_to_tsc_offset; -static struct clocksource *art_related_clocksource; static bool have_art; struct cyc2ns { @@ -1313,7 +1312,6 @@ struct system_counterval_t convert_art_to_tsc(u64 art) res += tmp + art_to_tsc_offset; return (struct system_counterval_t) { - .cs = art_related_clocksource, .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, .cycles = res }; @@ -1350,7 +1348,6 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) res += tmp; return (struct system_counterval_t) { - .cs = art_related_clocksource, .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, .cycles = res }; @@ -1459,10 +1456,8 @@ static void tsc_refine_calibration_work(struct work_struct *work) if (tsc_unstable) goto unreg; - if (boot_cpu_has(X86_FEATURE_ART)) { - art_related_clocksource = &clocksource_tsc; + if (boot_cpu_has(X86_FEATURE_ART)) have_art = true; - } clocksource_register_khz(&clocksource_tsc, tsc_khz); unreg: clocksource_unregister(&clocksource_tsc_early); @@ -1487,10 +1482,8 @@ static int __init init_tsc_clocksource(void) * the refined calibration and directly register it as a clocksource. */ if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) { - if (boot_cpu_has(X86_FEATURE_ART)) { - art_related_clocksource = &clocksource_tsc; + if (boot_cpu_has(X86_FEATURE_ART)) have_art = true; - } clocksource_register_khz(&clocksource_tsc, tsc_khz); clocksource_unregister(&clocksource_tsc_early); diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 45a02872669e..8d4a52056684 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1807,7 +1807,6 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init); #endif int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, - struct clocksource **cs, enum clocksource_ids *cs_id) { struct arm_smccc_res hvc_res; @@ -1832,8 +1831,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, *ts = ktime_to_timespec64(ktime); if (cycle) *cycle = (u64)hvc_res.a2 << 32 | hvc_res.a3; - if (cs) - *cs = &clocksource_counter; if (cs_id) *cs_id = CSID_ARM_ARCH_COUNTER; diff --git a/drivers/ptp/ptp_kvm_arm.c b/drivers/ptp/ptp_kvm_arm.c index 017bb5f03b14..e68e6943167b 100644 --- a/drivers/ptp/ptp_kvm_arm.c +++ b/drivers/ptp/ptp_kvm_arm.c @@ -28,5 +28,5 @@ void kvm_arch_ptp_exit(void) int kvm_arch_ptp_get_clock(struct timespec64 *ts) { - return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL, NULL); + return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL); } diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c index f6683ba0ab3c..15ccb7dd2ed0 100644 --- a/drivers/ptp/ptp_kvm_common.c +++ b/drivers/ptp/ptp_kvm_common.c @@ -30,14 +30,13 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, { enum clocksource_ids cs_id; struct timespec64 tspec; - struct clocksource *cs; u64 cycle; int ret; spin_lock(&kvm_ptp_lock); preempt_disable_notrace(); - ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs, &cs_id); + ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs_id); if (ret) { spin_unlock(&kvm_ptp_lock); preempt_enable_notrace(); @@ -47,7 +46,6 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time, preempt_enable_notrace(); system_counter->cycles = cycle; - system_counter->cs = cs; system_counter->cs_id = cs_id; *device_time = timespec64_to_ktime(tspec); diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c index 2782442922cb..617c8d6706d3 100644 --- a/drivers/ptp/ptp_kvm_x86.c +++ b/drivers/ptp/ptp_kvm_x86.c @@ -93,7 +93,6 @@ int kvm_arch_ptp_get_clock(struct timespec64 *ts) } int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, - struct clocksource **cs, enum clocksource_ids *cs_id) { struct pvclock_vcpu_time_info *src; @@ -124,7 +123,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec, *cycle = __pvclock_read_cycles(src, clock_pair->tsc); } while (pvclock_read_retry(src, version)); - *cs = &kvm_clock; *cs_id = CSID_X86_KVM_CLK; return 0; diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h index 95b3d4d0d7dd..e8c74fa3f455 100644 --- a/include/linux/ptp_kvm.h +++ b/include/linux/ptp_kvm.h @@ -12,13 +12,11 @@ #include struct timespec64; -struct clocksource; int kvm_arch_ptp_init(void); void kvm_arch_ptp_exit(void); int kvm_arch_ptp_get_clock(struct timespec64 *ts); int kvm_arch_ptp_get_crosststamp(u64 *cycle, - struct timespec64 *tspec, struct clocksource **cs, - enum clocksource_ids *cs_id); + struct timespec64 *tspec, enum clocksource_ids *cs_id); #endif /* _PTP_KVM_H_ */ diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3538c5bdf9ee..7e50cbd97f86 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -271,8 +271,6 @@ struct system_device_crosststamp { * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource * @cycles: System counter value - * @cs: Clocksource corresponding to system counter value. Timekeeping - * code now evaluates cs_id instead. * @cs_id: Clocksource ID corresponding to system counter value. Used by * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific @@ -280,7 +278,6 @@ struct system_device_crosststamp { */ struct system_counterval_t { u64 cycles; - struct clocksource *cs; enum clocksource_ids cs_id; };