From patchwork Fri Dec 15 22:06:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13495085 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 C7EF2C35274 for ; Fri, 15 Dec 2023 22:07:13 +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=aJqHicyy94RrqF6noBm6eNTq6Yfno3uFyJWESrF9BF8=; b=n59YGRWAzGFo4k fmJUl9bgadrhgZCCQhWXEST+Lasaqo2bGx5MMuHPAET0uWIEX4qUm8hMm2sXbkrAkWeUraIPhcxW1 +pl960TLL8COSBbbsMyDA386KKlPzaWiKAo9HODGG/4nWz75D78+za+zxxUcWSfuC51CALj4KFlgS bY9bAOrZ6PsS8if7BdcJx9laXN16+vCGRSqvA5g5x2wOL5oHNix1CVTOMXNwvstgyIhUn5FEG2Gxd qYksmhIAM2koTGkUuAsXNCMQu2oGOQwquzmV/bszN49lFXapiNsqDGtnu4EMaFZxExuhIEg60daxb FPiDI61yvb5v0ykagdsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKT-004hzq-1i; Fri, 15 Dec 2023 22:06:45 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.16]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKO-004hx8-0P for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 22:06:43 +0000 Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.203.211]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 7F14A10000D1C; Fri, 15 Dec 2023 22:06:35 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677993.924000 X-TM-MAIL-UUID: 699be982-236a-4761-80ca-85345b514ec2 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 E1DFA10000E34; Fri, 15 Dec 2023 22:06:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UuuUnYpMwXxSLVv/iN+7Al9bP4zmachHgn7QF4Eg8+qWs8VZkeZvTuyzeZlek6qxS97LONQLHGLQmgfUrj+bJysvFgjKLV2IHyz8Wxw/RAYe9pL0rqw0pv9t/bKJGcbA10/+TNFAS4loGW44KIy/DfxpNd0MDNIrUUyFvrReLhkXoZXsyqnJPcqUBWqVndwPWcAgjJkHkI+xPEPJoT0WlmedpYkhzOq+oJ9CAC6RPXZK8vGdYt1Ue+0k0uXKW2dlxhE/L1KMh2J30tiKilgQ2GsC3VHXAWFEuU3YXF/xabS/UIsXvC0+lDzXhkSFM9cFfGUWuMNzBRYJgaq16DUZTw== 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=n3VgXWgRtg/rFDFxEzHNoE8e1N/NnoOrbD/bAryhxmE=; b=U9SgLNh/uY/pPr9gZQLksMgKyoOFUymdqc8zQ2RgZCwponahJKL55++h7oYIb8B+/SgowbwULtGma2xFAuZmQlOFcFzpXtUcvIkJyv03zfhsyPjJiv/eZCMswGRt6vMNOsFyey3GFS9YWKCa3eANzrPSZxRWFnN3ry78xAAUPGhPhIqD8hI32ho1jCHQ9F20Py/gX8XaFqhijV3sbFG8nnnGjop/NGvABxcZ8P6HGpyucsL/+9tc6iU+9XUaSjKutA/uj8F/VDS4qmdlCch8uTUyvSrz5UpTRcUHCgRWABtotQP1LTYHrJ+Iy22cbSI8v/OgY3u/eil43kts7odYJw== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 1/7] timekeeping: Add clocksource ID to struct system_counterval_t Date: Fri, 15 Dec 2023 23:06:06 +0100 Message-Id: <20231215220612.173603-2-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6EUR05FT007:EE_|BEZP281MB2021:EE_ X-MS-Office365-Filtering-Correlation-Id: 63315aeb-092b-4706-5d21-08dbfdba1882 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 70l7VtiH1CgCPRQp3C+VSq7rz4BcaCggxj2L0HCM/ngsS4uAgfJMVr+b9FdSSRkwfAVVjloY+jrqi3vTGVeHeBSUweLkaJMxtlEEOS7kjp4RKKeY5R4p6R5VzvJkeDPI5OYErJb3mZEpmlIWi0+bpEzGXNKzDH91Jjca6qTpJtgTnOhIDHkMB0nCLdGNbpcOyf7NKjaytecDezIJE4Tk06xdoa6jRHEhjA2e+Bigfo8LrKa4Uw/jjwMvD8Z+mz9LqxP+7g58y7a20asDogOFFt+WRMT15Eqv2haqLh9ooE6ihlgoof34GjlL9OA9U7Acqdr7np/MrLx7ay8VTFxDliQRhCwx4aSb04JWZr/k2gWXdKoJE5JdukNvHTff42h53jTkgFmlUlQEIX5b/BuW0k44j0MNgMB1rEd53jbDCJ8LVoRhuR0H7wUtJDxQOcPzJnsAqYBwvNfgzzDC2R0x/YalpzoroasoEEtjJHKYHHpggfmTbtiyzB7My4HPYm3eVKbNh7tnQ4PpxiPCanJhqtrp4hNGMHyxLm39gL11uB50fn84qXptsST9n5S9jXwRVK42cQ0tztyXGM9y8AuOSHvXTNzbPjWGnhWVlHGiyGdElazrbj1/yqQC7VvuLEuXJj/WSEp8LOPLFNq/DxWLGKQunIdDaCPAes7CggJJ1347auyQ0lDNZbM5c/TbpXl4z/JL7F0vNt2Al7yxUQilvOFkdxPsjejCY1ejC7L2F5kotbl/zmp8lWo6L+s9P4MVKAVl5KWqITfWApgt0MWnfQ== 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)(346002)(136003)(39840400004)(376002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799012)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(966005)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:31.9216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63315aeb-092b-4706-5d21-08dbfdba1882 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: AM6EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BEZP281MB2021 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 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: e75e3261-40d8-4d1c-aac9-f728c685c5cd-0-0-200-0 X-TM-Deliver-Signature: 4B42FBC32BA0165278B8D7FEBEE10FBB X-TM-Addin-Auth: lofU8dU7CdFAhD8V9sagn575AEfwI3X3ytRWn+nIQZBRhSeZKXpgWtk8ubW QsBx7yYGxPJkY5F/LuMy6srgWd65Qo9+qbrJx0kkJwJbZ7I308Dkk+O54/YXj5rQOiQ8GX33POb tI+wMsWLHcGhZAb2HqQZ2d8iE9WKWeV0fo06u2vUq5+u9LpVu9Q0EXqKR7IBL9Pbpzy6TVoJHxO ZVKdGzMhvoYlpRbbpEAAF7n6HO5Zz/ESbRSFRAKocnepMuUrzQkaY9FFpK1+mNYwquPne2LevC8 XXE8/nOWtZqmvQM=.bPpDQlzcOcNoYt9A5H77a9CR386jDRBzQLsgklYU2XMC+ekPsNsfD1BP4A Jcb6vPqH/K8HQnLDHrWQFe4mpSdqnShAFqd3aOLNfdPEO08subNevpkOxsjEM6cgsECDXl3VXul ORxePK6hlb+HjiJdpifFwSMaiK8h6Up9Y2F3cMoK3utczzCmVZAJBN34jqyVWgruSlZ5Sasdk+t vZIJdF/oMam1o+kAAkKUrZS4lHhAy3jlxW0GqQ/B1RPFKHO+3x2EIAk2DQRfLe6551X6wH9YczS n2itYa2/OSiyu5Ng1EKUPUVwBELXWXr/49ibhsRpDc7fUnoMUDHJ+ClcjLQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677995; bh=O8MqEDHj5ZPOM57SiFoYrD63DRexH/0RpOMiWwTA4kQ=; l=1727; h=From:To:Date; b=UrFihNp8K98r1vYbUF27TVe5ZLFY893mdg+6qxxVieR3os+tsgkRTv3vd47WKCotM VO7if4ZlAgEs4+ifyEtmIYcB22F8y8jQdJT8vYcvF5zybfsQIpxQT+xrEiVIcb3xng kAL2FqO7bJlKS0P0gl1TbsxFQM1ZgWMR8/G9Hb/GonrRcu83orW6RAGcshIR0JQ/5o jg7tkio3dvaVTLF8pdrnvBRkh6RX4TJDP5eXRwKfqhqKbraoJRrN3wssNqJkbDYqmn OquQ5QckNTMao5/XvlIDEadWKIwwWJl9nrOp8OJaJGYGjFydGdZXrB294q6wuoBfBw ocH7CA6JWChBg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231215_140640_488134_0EF65375 X-CRM114-Status: GOOD ( 11.95 ) 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 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/20230818012014.212155-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 fe1e467ba046..74dc7c8b036f 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -272,10 +272,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 Fri Dec 15 22:06:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13495086 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 46B95C35274 for ; Fri, 15 Dec 2023 22:07:17 +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=Eo9tM0P4wuIstuXMkNyESz3hpB69QJrsl4N4uxdGJFM=; b=CbDgcTMSBSoYhc IgaCyEdNGuHTUF/5iPnnU4/dQsTcwjr7t4l3ukYsUVgByCvK/mWODXWz3Twoh9J0LnwHa+90WqxgN z/8KBLT2+8SCmxas7L+KjqSoPOLk9R97SKfVLLP8eoUqSrRIckTjPu/LXIN5iKZav/0fz3fv13wWW YfVP5U+58aY07xQwaY2lbBv/uGy30FboW7lpeaSt1vLfyfLezsXsugJB0TDuWuqhZRNz7A8bvwesj vGDXJLHLEPUahBncXnLiCMB454Cb8/4xNned09c/tV6SIK2ikMHYHKoR+Gj56ByfOqbwcLdyS9OXy GAKzlLbo7/pKvBTNJtgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKZ-004i1N-1q; Fri, 15 Dec 2023 22:06:51 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.119]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKO-004hxB-0L for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 22:06:44 +0000 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.199.136]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id BEAB210000081; Fri, 15 Dec 2023 22:06:35 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677995.018000 X-TM-MAIL-UUID: e195d0a4-074e-42bc-8b38-5418a9ed923e 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 048BC100012B2; Fri, 15 Dec 2023 22:06:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QsAIxYSW4RuBGDTyAvojo97WrVQNAdh8eReV1VjCgS3+/JmkK7mYBMCXxjuAocVdnKf56lLuImQgsnsmvY5U43qZs4Y3IbqhPE+HvdFyv9fv0vJXSNN7OP872EkSSKtxdDGaMA/7SWOdxge5+vrUSD0wElM4ZpySK4w+j7tQTmCCtZzXL3iakwDnTyTNwS42/FI92QaYlzv4I0bLw945ilEuRDfAbOXYyT0GTZ09WwnAtCHP5y/3MBOFquYPwq8U7EVAUMlG9RIRxZatz4MhCsYPhlBPeDQRlyH+Ru6VzXFOlTYKwbMaJKC/KK/vjbTl1VLXAxE6UPEoWj8hTw4IxQ== 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=5Sd5IEkoUPoeW7OZTn5GtmVq/OgfU7MvXexTI6z7ujI=; b=I1lY1+OVaSD9h9t188HZpYu8nvgNo1WzOaG/jOLrXv+rQ0iIb5Q+fFhP0XvzR1BSfmVwwSopBGHxXRI7TFeOBitY1skhLUwPBlBXqCAo/XMlAq5aQWpiTDkv9NvPviMreiJGZBkcSQZcRa2JGJbailKuzyP0pK+iNXjm/7o1b0b0ZPDt10bKv2s5HcujNOYut5sftbqO5DUFakzHyoZcG+Mkwtv+vVOX7YjZMmYSY4MMbj8tO64mGXGflg17n1/vSwfDfsMMBBgmqO1S+7EroQZm5c3SEaHKi1uazp4hbEdERpMoOcZgEwt9amsqxPTPwf3KldK+WYiRday5Bzn6vA== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 3/7] x86/kvm, ptp/kvm: Add clocksource ID, set system_counterval_t.cs_id Date: Fri, 15 Dec 2023 23:06:08 +0100 Message-Id: <20231215220612.173603-4-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6EUR05FT045:EE_|FR3P281MB3357:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be1649b-47ca-46d6-5f1e-08dbfdba1963 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dxBJ1YWW7MJZ+OYqQD1XhEXh22Ax1ZjwGMdmFpjYolHusm9t+mgKs2Kvf5mcvofB2PaC2KB97Jl84ylnJKv/K8Gd5y7tFP0ugKFlRID9FTe5AUdQzPebFJ3ki8Dz04xxZlRvpddolQLxGHJpRscSiFVFfewVv6B0mZt6iykh2Tn3PlnubtAHDYi1j3wsD7Rjmdit6Z0asmoLrdDCiqvHoYlMdx67nFBayamMfE0mlVX9RGfvFIqRXFohra+NojTMltICxGCrt2xgwHvVO+aYod5ACHdgaJSgkAxX02yIq0+dinP0pAQaiMxvl0xnIWiCf+dfk5X1hGImpNbt5lFxvqZ6EO1kubdMuHnRQHijbgvW9+Mm2tPWHuqxnaV02WGuBZ8LTa3hpvqEiZLunZXG9bpQuJ//adBb+4zblMAPI2CGM3+MSn9oElk8Dwm4zlQTR8NpzDkDsigSQaOviShJ0wzhxxt5kZ8hBfFtR6l/JSYgD4AnLYDXrE5De67T3Ga3ivyW04azx8C+HKt+xO5CD2GsgInuA63wTOjZzX68QekCO7GqcEE+2MgYJQiyXn/lMjvax2L1d6tgXWZlqFRpJDaWDu4hcNt5mt2pOH//ot73FB1qKeDO6a1vSwTBgxjex07Aktp2ELSFGXHxijhGZvKSapv18ZINwbERPxxq0q2Ha5yamc7zdo2bzgA0hBhrH3NOGumvL2n0RNa7Ptay39NbU91gTdZojKg1utdd1lPGAbfjUr/T4HoHKO3hpepKiPWsszoK6lftuLQBR1upFSHi5ecCjqRowGPexvfJFOA= 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)(376002)(346002)(396003)(136003)(39840400004)(230922051799003)(64100799003)(82310400011)(451199024)(1800799012)(186009)(36840700001)(46966006)(26005)(336012)(2616005)(1076003)(83380400001)(478600001)(44832011)(40480700001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(86362001)(47076005)(36860700001)(36756003)(2906002)(7416002)(81166007)(6916009)(70586007)(70206006)(54906003)(316002)(42186006)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:33.3963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1be1649b-47ca-46d6-5f1e-08dbfdba1963 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: AM6EUR05FT045.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR3P281MB3357 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--1.344000-4.000000 X-TMASE-MatchedRID: a3KJLn6RIiLJ+P2VFrJmrN/Z7q+hZQVeET56SaIP1M8cZzGOQm4bA4m5 ne5dZEv4w9jS+jgSrFWUIXVq5Qbu8VVPepzs4BLj+wgn0U2OrUhelLFkoMPMWMhGESF2QtYSi8+ IGr+Jb3Uyk/Hw4XN9jV1yiVrPdbQVm3S8hE6lHm2TlNTCzR+UCIUS0zu7U8m3qa5aeVMSQixPQF Fk0j5jBsA2iDfbpfy+AVpeDm8nJoLwnQHFZbUP3moEkqixPwVYOfEmq6feyfNuRXh7bFKB7pL2m I2fvuQKGSRm1o84EoGgf2pYMhSRCAw9lCLgQXXbvuvB6gAgryg= X-TMASE-XGENCLOUD: 39f7415f-b65b-4af8-98a4-8e0e810d2320-0-0-200-0 X-TM-Deliver-Signature: 9981ACC6710F36E7AE444A7FBB5B2F75 X-TM-Addin-Auth: e5O++ZGxWzX11OOFF/fMTxIjpFbFRb6LU0G74PTperWeB71cyvJjw1LumU3 vEFisFzhe7t8iSg1fIWdG0yJrgpj2AzNzKRPDnXBxYb7PXETFqS2+0DOtPXadwQ7fZHePPFREC5 L1w4HyXEcJaPmk51IjR/cSEWkjvOkHkRGb897sXQVwu5bwYQvE0gtgM0dZg1G26d7HqqS1OfJX0 bLekgQzekcl54v0CwdJhfbroUCVVWQ63+sPOhW87FRPOOBvKA6VpJBDPtoN43zGCS3CtuPiaNBV +ADe1XZP8k0UV6Q=.Zd/Vxvy+bWecvQV6pAZDouJtopdxZcPhom+RHNpRQGV7YAjHFTj8hKJj+p TonVdPm3dtaSfgmWxtiuPl2HP28taMN1VDhuGlnm0JbSVW9js+fv/ZZJgqTOUaBYSoR7qyXrs2I zbxLxBEODMqv1Nj2n5eMPExFb08MML9BKmqxUO9MCA+t/vYUIlIB42ioUwR+2djK9C5Bhk95OOW xER25/p90K2gPuWmcqOrcZAHMWfqt5YA67i2sEaleXoMHqLJvnZ7nZNU/URUPx3BqcNJEk1mxwq 5MCrzRXDrDcYsBYFdWZ3QT4Tsuu4f7fNMKsdBgkvRQzZSPB65KwVyrOZCQA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677995; bh=gkS2CFdT/6ybIKM4BHtmApR0TjJcIGt+eMfoV/Wrp7s=; l=2392; h=From:To:Date; b=csE/8rhPF/WBV6ofOsmdvZzR8aDbAAgYUoar3EGxQM8oeGi4rQsZ/VqufiuXZswAi VrquGJR/ZFZEcaaSdWVIJ6KPiqlNDXd0lquvBXNlzIstNRMLCVd3njIeT9Wc5mCMEi FczcCIpAt5ByCGGYZa6iwfh1lFQ+0ij0jdKXTC5QaJlvZC9gmNIvzAkfUB64gAjudi ixuB0cieQkG8bPmvPcWqEqLt8zbATHMyOGOlQEv3IGzPAGKR7WCU0n81MQXeOtUefF OEffS557QTgtQJU8Rz67/iG64+PhsS8zB+YDL82I6ZLN5OCxOBfJ94GYiIQOdbnYJ2 4h5j+K51VDj6A== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231215_140640_488571_0AACDCFD X-CRM114-Status: GOOD ( 13.63 ) 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, this will keep get_device_system_crosststamp() working, when it 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: v2: - Name clock id according to Thomas Gleixner's mockup. arch/x86/kernel/kvmclock.c | 2 ++ drivers/ptp/ptp_kvm_common.c | 2 ++ include/linux/clocksource_ids.h | 1 + 3 files changed, 5 insertions(+) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index fb8f52149be9..25d6bf743b03 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -160,6 +161,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 Fri Dec 15 22:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13495090 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 05E7FC35274 for ; Fri, 15 Dec 2023 22:07:24 +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=xGh5yyg77G6DzN rHgoD0WZJviQHAX6bLXi526fSIIG4He8jg4ZRaLuwsq+4lI+EJoKehu5/kufJw5lTN/v2btSuk1ev Osn0Q0O3VmLo+zgTBmHTo5bl4L6zj4/csASVxoz6WDbMJUD8Mxw8H1arR1hVPgt6kjh2mwNcDa5fX upvyhzRSXCpB17h5AHGH8YeoSrNxKtcmsc65TnDpEvzti16YhRvascfSlldOIYFtm1VVl/XZLZduN xeMqL3/tReYZ4ehZ4d3ubA0ANL1V2kWxX2hl3ZjPYLQBaXDM4VgpoLgFzCW4Hfp6BifHGvedtKQj+ OtoSRgYnmu2K9iENqVXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKb-004i3u-2H; Fri, 15 Dec 2023 22:06:53 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.113]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKP-004hxR-0T for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 22:06:46 +0000 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.190.17]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 0447D100017B7; Fri, 15 Dec 2023 22:06:37 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677996.575000 X-TM-MAIL-UUID: 3cf0ae40-e021-4181-887a-bfd49b216fe5 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 8CA2E100012B8; Fri, 15 Dec 2023 22:06:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D4Jn66wI/Lm3/qbC3LNinLdH+HuVJQl8PYcQyX0fEuUZW5Mxwou1utglcNvJ6iNI5yuz+gMqy5SWxkfgyFfU4TVixWXAa4VmOeJYoz+0no/JfoqyxFdJFqDKNy7y0+SEOhYyRJqKES3Uzbef4flhPI+kagwiHMtjEfB9MzLOy1+F7WZaYQF1vnBmjTAYsnCR8OeUMSLD4yivL8jd7Q8MOBVpBjCaiHG2gg9Xh3VcngX1leaI/sSCbWF+4D9zpS3jRBG7zSBQcgEJxYSs2XROtGmtz41g6Hx2itKLjFtXcuI7kJt4tV2PkBjaDlOyj8FWDosb2M4F07Qe1M6/EW/4xQ== 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=BqZ42nXmzQnDA2NctbcIaoKFj1BcCCfbSo6WxL/sVOojt+z2PGvR9EAeeDf4chduqoRXg2vzxrcxBDKYlMcNA0iL00YQkS0FPoCcUl6rVsuKg32cvi/RB17u3ShJBNIsv2AzwT1wxEJR2CQHX5w0igbvXaF26FkkWp11pQO1VZ/oKEbI/em0w65t+qeotsFteBrqhroqcIHnoDDyG+HdmYHPYZO8EV8kWRax8FjlORrfo/t5ntK6GVPu1yzRJjWdwrJuyZbLX47tA0gXX4wju/n9fOYl0JOzGM/6CSm9jj9CYj2sGViCCaGHbMR8LA5zximRyqttCa9r0hnkhRHECw== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 4/7] ptp/kvm, arm_arch_timer: Set system_counterval_t.cs_id to constant Date: Fri, 15 Dec 2023 23:06:09 +0100 Message-Id: <20231215220612.173603-5-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT012:EE_|BE1P281MB2932:EE_ X-MS-Office365-Filtering-Correlation-Id: 282d9463-953e-4fa8-2bba-08dbfdba19f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8yYfvD9Hm4D60NL5mPXiHSSAAb5rEjKzsa9XmiaCfSkMKKJuQxpGofiNBVS6ZYdu2nE4XO14juGnkprupnHbDc/Fmele74gNyBPPuaeSzbBmf3qLU9bRHTK8bUcIC3+iEgcmd1N1PyMq4VazlYphbYcD+n1sq0r8u8mrR8Fr8Y/nXBA6aGb1roOKCMl1Up4Q9ijDDB5BJ2cAHbYqdy4FCKg3Ak53W0gf8aX7l5L+03snHQTApw2gfEBLGflmgyhEeyFhuFAl5T7vwZHCCrtFYWxHpOugMRIAsLSGu+waSXCbaZufOV8DPaXTXbTHaJGvsAmkDJJUtlqh6GUi+bSk6+GCungCI6cm2tFc04u1AxGFFRONJ8TeHPumn79AmMhwPGcMyziU0XpjMIRrEbNglHDOaFviD+kX46zXXJkBiFMgIIo2Wy5UxXtioadnzXTrXO4OXEII2VwvvTM7MHD4vmsX+XucBmErFQ8IWMAUoogfOjcPJoiEOY3SiL/doUwl6xwJLAqXji+5skVPFxWyA9Xxkj+rML3vxvIBXE8fPShhL393KjUGzWTf7Zl3JhvFzs33RkUMpKhUiaqvLxJ/yYXqlQTSaS9HgW7EKQ+94byxDDyp42gNefDeYto7CxEHHG1T0YbuuVJ+KlLe32m3RDwc8bOI5t+WOkuKvJ3bLJVT2eoNr4T1zZExNw5cLaBMiTXr22/uADODxgM9s156IP7DeJZDFzR42xigK8snhTTrnKqNvX1UIajmEyR5WMOx9+va1HDyWQy2O4Q1oWwjJdB5MZHku6STqrAYPkXQpyA= 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)(396003)(376002)(136003)(346002)(230922051799003)(1800799012)(451199024)(186009)(82310400011)(64100799003)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:34.3467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 282d9463-953e-4fa8-2bba-08dbfdba19f9 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: DB8EUR05FT012.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BE1P281MB2932 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 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: adbce404-56d9-4abd-afa9-55a092636643-0-0-200-0 X-TM-Deliver-Signature: B819EC21C70D82E2308EA9DCB3485B89 X-TM-Addin-Auth: 7n2liQSfv/l2jQ8mhkvQOzxTvEU6xMkC2HSJXzl75MYIDgpCyS9+QL7naJ5 NEhnfryRmv8FATbKtHV4FRuhVJDXiCyNxiYywWP2h3r9YRYoeYuLVsxlbr63rVCCxr2+6pfhGjC 27BMqowTqxEL5T8TsqG6Ck5ljt2D4KPIdCznnDAVMo1gTsYpbhKFTf9kpipIsri4lRnBhxsQ0+v uCiGnN7i2FBv+QY3yd3tCJbQjaIK6J8NpkIUIAHpERPJOXvQzYCnLF00ks6Mh463yV25r7FjCo1 xWwkvxwPFZUqcYM=.Zr9HoGg1JNgvSbfKNJb4YLbipw0BMkejA1/LH1SN49l8x72K+pKj7jK0r8 wL/r5nz2dlOqDi5P8cIRX7oOgdTuhRb1DYt8aCtqJ2eL7s/mhLIdyXq5LgZT/1LPFqN1x6KWdqJ G+qBX7xjxY1uLwRky54K31QkW6FPxs7Etig2V91G7PuS3Nrn38oioOUcH/lXq5OpJVl+6AGq8Ml mTRymcCsR60/lEr54f82zHXYjIh88khj/LICY9sck1GRTiCokHtYymJfJwzkpRrmYA+s2EkhzZX iJ5J85zlr/KQ9d2bm8WqyPMQfB3A9qi8D4YjE86bGze3aDTjD+rDd9GsUXA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677996; bh=D57pOeABfamN98NGLpRroVr6iGToMt3H85oc0X/wUSE=; l=4724; h=From:To:Date; b=mviW8a/ILMUFUiUX4SXEVY7pQb2hpF9WfzofXo7M6w37PkAnjsyT7HaBMuXoILGdY ziLAtJlqdnpgmPhByLqAifsQUUPJoeaWut+ZwdVibtyNsW7W+QGKtic3qVrcvu/NWw fNJNyPeBKnkOkMIX9cUjZjgj0yJWIouJseUjPtvQ9mf6ydt0RWI8MFEZko6++j3YmH BqtSSmpVqM+nUY2P/ogvXsC6AfoEBY4UXuvNhOPAyo2fJtg6KSck8ETG8ykIuZ8r8z BZ34Ew49LojuW7RqxBXzmMuIaHDanS3CRoQ6nMP7+fs6zCKTjpYE+nw3cMQbrDJ450 c+f4IkhQ1tylA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231215_140641_461851_33B0A198 X-CRM114-Status: GOOD ( 17.77 ) 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 Fri Dec 15 22:06:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13495089 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 889B4C46CA2 for ; Fri, 15 Dec 2023 22:07:21 +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=QblKhkuD+55d0K3P5RKz9HiMb/ZMNjM2G6hcjzGcL6Q=; b=HC6fe6tvPX6ChN sHwbgmIH9Rw9B9XAn7snw1CDtgODCOgX4MFEncpW8KxCdkfq8eGQVOduoEMnNOk0Oq+C81hhiTjLC 08MJDEnqssVJXP7kmjOccxrGUbFYb3zLIrAwf+p5nkT7YCVk8bf3qGbC9N2+8JkgQumAbbnbppZ5O /0dzfkmTfWodtWFgS15wS4a6gbYy6NkolB+SP1q87Rp+3+8AYk26c9T1Au0oHEn6nLr4R96/o74fE QOvZ9Ndufc6N+jFe8aIBgTKt0V1PWyM7jXvtz/IxLfozwWrHglSzKQUw2rWMmodx9BlANfq46xvfu zZ+rEAmUx95Bbm9zW6dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKa-004i1x-0j; Fri, 15 Dec 2023 22:06:52 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.17]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKO-004hxH-2z for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 22:06:45 +0000 Received: from 104.47.7.168_.trendmicro.com (unknown [172.21.190.17]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id DD6FA1000006D; Fri, 15 Dec 2023 22:06:37 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677996.868000 X-TM-MAIL-UUID: b9911cce-9f2e-442c-be80-281553fba8e2 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 D4032100010AC; Fri, 15 Dec 2023 22:06:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8qwOH0LP0a+2dT6T3bmhN3gwhVzgk7+ijr/YNhHPNVJdrOyaiy9RXTzkf4SIOyafkfrZNBgkGckoWWBbqnK292j+TZj8c2tsRVn7JtaOMm1UmJ1Y1/+Yp37myNVr/H/NjfF58st7C9ZOOH8yjwpPH27b8SRTUZvvDzvz83mhrJkw9lMSBze4ueAU4+YiPvRV+558KX7KPOJtoIezgrnLx+uzTPDckCpryLEKxBcF7Z84IkvGxSzmJ8IsSvoECV2xE8NBhCYX7lix+h0AJGEFI9pC7GnrztssE0N6B9NPUMRC/2FXQ4mpwb3uOaMhEOf7jsEvNTDuHcM5m3E03LMAQ== 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=3xfDBu0dFrCJ0xgcFfSZVaKqG7Zde6VKWwu8n6eP+A0=; b=VhuAcRgFJ75vNoJvAKShPJcMGf4OUw5MhzHILcJNxST5RlaHilsg5tX25tI3kz7OdgdA/ey27WbTTajM39Q60gDzM+XKe4ysJEoSzMrzeacGPV5MapGhl2CqOqQcsN1tk9TWo866L9Fh11O1mvlra2Q4bG+lFqzxM3Ye2tWzQthLLnoakD51bzYVhM2HgC9h2uILF4n+KUkBxLtUtCSopTKZv66Rk+/cVWTeS6XdkWx08GYF/cNK24ddG3juH+NulDwACf81gQfaO/rDDvyeZEhz5xUnbHb8DwWJasUShRmG8zYYAHdc5TlcG8+KaezmEVWOFqOceRMDONTeFfrLbw== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 5/7] timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Date: Fri, 15 Dec 2023 23:06:10 +0100 Message-Id: <20231215220612.173603-6-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT060:EE_|FRYP281MB2304:EE_ X-MS-Office365-Filtering-Correlation-Id: a451a6e6-48ba-49e3-4948-08dbfdba1a79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2yeCm6q8s6Z7qAa8lz2S9IEc2ybGg3JzMs0IP/j8nkV8GkVhLIFhlp5+3WG5vkrEJkIQzKWh8VZD1sf/GomE6s6W92D+QIRPAiDXuLKziaLBEeZo7c0We+s8MkWqgb75gqBqhSomdvEbyweEKZq3mBzRD3CefmB8IGDz97eQ7xVXkqXXamnpXt2czIdpZbKXOIsL7VJeKPznVlNeOKVw0gvlHEz1XQqOwrqSsxa1dK0XrXEjJLyHzIozMFFUzhcGj8Wr8mhPZ0RWi0x0wH0IgbZcdGZsM7ihyNoazO2p6pLp3WloCCF7RLY9wgIDuki2WcIpfk6UZRjs3f0tCpGi4xi6qcZgl2pCa3dpWgleelPeHQdd0IROEZ5XkqeOzscxgajStmPtqy92qKwEiCeMjKVKhAXM4QCmKzGBszhymDVV1P5k8aZF+kAZk7upZRoONxawO/H6ISSPeWqpTS+KT1s6yUD5tq4jk/GgtOFEpijNkujz4NjAY6vUDIa4AclHfGbeXuvEXMGTB4JYDVDl6SRpRG7yvk+pA929bq0Ca6sFV00bRLpK+udFelW3gpg14YJiyF3IcqULioU4GohLBI8UCgMo+0Az5+VlJecNdP3y+qcl5eZvrgiHeFB9VdTvUyKmrFN04YZc85Otp1afjjF5qKbn6bl17dR6TWmNsFVtVGF90iIZjfhRfPlsHlJnL8e/lJvoeJMxLUIMPXL4XHkPHqy3DOzXNZ/VigK0gjN8+4nSPjGT5o0uc1NusY//JoxfO4AVkQin81zmmnIjuVhA4OY7z02h6GUAJrm98G4= 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)(346002)(136003)(39840400004)(376002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799012)(46966006)(36840700001)(47076005)(83380400001)(1076003)(2616005)(336012)(26005)(36860700001)(4326008)(8676002)(8936002)(5660300002)(44832011)(41300700001)(7416002)(2906002)(478600001)(966005)(42186006)(54906003)(70206006)(6916009)(316002)(70586007)(36756003)(81166007)(86362001)(40480700001)(142923001)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:35.1864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a451a6e6-48ba-49e3-4948-08dbfdba1a79 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: DB8EUR05FT060.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRYP281MB2304 X-TM-AS-ERS: 104.47.7.168-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10--4.043200-4.000000 X-TMASE-MatchedRID: xPvPRJicGCRt/9ulvM0QMd/Z7q+hZQVe6wJlKkXfZVkJ5yiKyAQmigHW HoYGrPh+C2QDPheido9iBl6ePEpdZVlsdSBrk49aju2XlcEx9HRelLFkoMPMWOI/qZVAgf06Vif 9o7rSV9vm9Tc/GgfFJwFtWueZlMH0t5KZ74QYwoxVSWOKG8Va/NVTzaAe7ACyygHdGJDPWm8TJ/ T+Ssc4ZVqoLahcwH4L6xA0Ava73nAPm15xyht8lXx2eIlQG1sMfC4IwOLvyucC4DhlAS07elo7G mCOJYd1ifGCYEa4FxdKYLa8+Kx/sN9Plhio5fnckALaj3suKW4400aIRT5JuQ== X-TMASE-XGENCLOUD: 433c05aa-ddf0-45d7-a0fb-c0f2b7ea777d-0-0-200-0 X-TM-Deliver-Signature: 9B5D122645748B5C3E68F7F255BE5457 X-TM-Addin-Auth: 2Smz6PIzA9aWRECSpKU3IMaFQ3QOtnjDu2p5JyMRuNABGs+ROowudK4OXIe mMg35X9gkMVwq7D+cdMcXWf17+Dc+qsWdb218EtH9aFnGw5XL4Q+NmLZUUpHvrYTyd52WOL3ct2 W/Iuz6pgKNwO+Zqbco/oI3/L0Ag+X9dkjG/x+TPr1ip+DNSygfhciGQh/LRQlsIoUYPzbmrtKBh bgmsSRT/cpzBnNS5IMNw1Lx2TTRaNvwVt5G+24zw+Gc0124B3ziP5gEPgbM5wsBU/9qoenl26zF A4iBRczYOJnppZ0=.c8JYJCjKerTdVa17JXNbgHeu7f94N8OFSitIG/uqQ0A4v1ichTrzYxvAx8 +XDyXVUYIvRF+HvTjmYpyQoePsMA4B+1S97F9ymPmlHHLygQtF47iYFNLHlc90CD9KRFHwFD4pR OIDca6uvXDf3mY19dajip1e4Jyn/8EZFAypG798RWxDcL7tWzE96KzFSOYyhy6ZAunUR9MDsvDp rrN/H8ywFWSzN1gzeaK/EV02GIpujAgIWiCb/VEsak9ipSoGJ3Gygul3nsWQYZJKlksc2pgxFNE WN8yDRQyBZsf/+gE7beefSLAeHzXfPsaNtytcPHH0zTBJzmJ2h3eqJwYtig== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677997; bh=NojOs1qfg8jfCnvQpu510s9G5wxEpdRCYhUuXgZyMgM=; l=3420; h=From:To:Date; b=VQhIjNaqWzDConf6m33bHny6T8JEUmz/xXKoo28/UItFI3emjHtLfee5RxKqbhpbR 9JNrSoxG6DUxm/pLxYfHUHgWCG7ib6HyY/yvK6slMXN+EdfTcVpPX8oMjv1j+DSMEV JLzD2OewqgJWBP+KswLFp4OQtI8a16PVZd/+d2L8tODvF826LEg6kgu7+VOyggTQ3I DS8zEvP11DlvzYYyM+C+5L7+9B+fqBF3J5o2Tv3a5zi1Lz45daA6bLavB8h6Zsfl/x 5AnO+q0H5V7D8yljYj1kQv7cDKfDU0tAum/EE1PN/rLOZQD92Cev/R2dbPIXdfoO9s ROQDNI6ceCzSg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231215_140641_263766_BA249509 X-CRM114-Status: GOOD ( 16.83 ) 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/20230818012014.212155-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 74dc7c8b036f..75e957171bd5 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -267,13 +267,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 Fri Dec 15 22:06:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 13495088 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 85B9BC35274 for ; Fri, 15 Dec 2023 22:07:19 +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=MJt88+8/DOMuKnsglT85xMBOJSv5TaDU+ZPeUNRhmvY=; b=b2shcZEQfBcILC pEompuUjj1nRhuR+W4tKsoOA0O4i2jt4AARakKIUCcSsoxP1wgiKdKv8y0KrLyMSgsH+uUXegZtOi mTEbgc09n+Tq1yZdH0zt7Ii8LS4z2gfRS1Vz7Oy+dEq4jhAgxNd6dB9SSktTnJT9ocUcdfh//fqoG rZk+WuqgO5Ii8Uw1QOIK/E0zs9599uhmlqF7K5499usmycTgHf0Ce6mKnOCt+yJ8LN9bKcK4FE/PE L4b/cJOdWQEsGO9n/ourGqb6NIsvhZV2sSTKvDzL0H1M9wBLJec3aGeoFy/kZbRyoBaxkHnvGEUVE qSpKA1L6yvo+zzUmwMpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKa-004i2a-34; Fri, 15 Dec 2023 22:06:52 +0000 Received: from repost01.tmes.trendmicro.eu ([18.185.115.14]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rEGKP-004hxU-04 for linux-arm-kernel@lists.infradead.org; Fri, 15 Dec 2023 22:06:46 +0000 Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.199.136]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 5AC5510001FCD; Fri, 15 Dec 2023 22:06:39 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1702677998.434000 X-TM-MAIL-UUID: 380a2162-0f97-44b7-bd2a-c04e49365528 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 6A2FD1000333E; Fri, 15 Dec 2023 22:06:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AAUNQT1zw7RsVAN+nof2ecsdmsI8RXb2jE1Gx234PtrcSPMr8SIsvG9DFbCdvaqibaVwzO0rMBnTvyWnWdEEIDTcw6pyHEnbJHp/4CGLPuNdX3VoQsd175qS7sQSZpeAoFHKr2PyJEWZfCZcrX6x9v8CltM1I+UJo5KBEEi9/3mstvmdQcitqsDMFx2qPZkiIRAGXxYgoxvdWpNcQEToOGd2fSA2iLKM2gWqmG0OoqixQ3xqnen3eBCaU6XRh5AqVTS5OWmslnIZcRpUYY+Lpl+DqZeBUCGGB2MASzFa6zt+qSHbM3U4J2tFwFn91TQUdGVA8aKduSGw2e5JjN6rOw== 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=jxIjbTGYUvyiFb0/gfdolPN9p2YMcYlaQ7cCg+6BRCM=; b=Vm1/4PrZXlRyj/hL/DUlxW/yYsRCZ8JyRplBzopBZMfYGnkQ6LH3wDQYG73m/knI+ydc8LXcxdpG11nLxPDHQ423NDGeg9mACQdR4LWSRYQ+1nIw/0RIOjOJZCuGzAKtoxTPJtEXVuLsu4QJD7y7YAauX3d7VUYljGz5sp2Jue8WCYVQ17r9hmxcgoyQSmj8jwkK/BCkD8A8aYFGOtT9kZI60qpIPzRFNm5puR1qI6O+b+K82Ui2jDhotLk5IWmn2KQfPP0WNGCjd6cb4u4PD5VJci7RywfguxJDV3u7lDNKAZG8vmwRr8MkmpEpnDMcu9zhpDdEhVkFJBT1gfKSyQ== 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, andriy.shevchenko@linux.intel.com, "Dong, Eddie" , "Hall, Christopher S" , 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: [RFC PATCH v2 6/7] treewide: Remove system_counterval_t.cs, which is never read Date: Fri, 15 Dec 2023 23:06:11 +0100 Message-Id: <20231215220612.173603-7-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231215220612.173603-1-peter.hilber@opensynergy.com> References: <20231215220612.173603-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8EUR05FT029:EE_|BEZP281MB2565:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f050ba9-8f21-4237-9841-08dbfdba1b07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KZg1rM4Xi3aH+KMY3YAypfhSkB0OqvflvVb+V2gL79jodI2XWMukEK4fipK/Xy9TuFbyp4VDHNP+2TNSTHCax3DS+BOZhsKibFlUuoaflChFWchs44ceTAFVFuqvRQSyLNp0fuldFwQORa6hl1liLH320aI7TwKS+t7uicRx8SBlUbM87gv8fVfTO1k+8z8c4c7/7zIW1UIxKs0DZiLS8hh+PaHzz5qYmcZoJCxxDjuQTGsSg1utsmGtrXNCCFWI1eFUYxfKyRBAQb2H2UE0yMoU4HoePSsBWB38+T2vXkYPdA7cbj+VTfpkegaONQ7BetNTNh/9GkLhyE7OEY41FNiDnjk8l4TaH6tNVbbFoV2pi3XDDA9wwM31F3sb4P9vnGNfhf8bEbUZ+zHt2GxjKi87xmO2EdQkaPaN6NAU5rYSnHNqtiheVfqknOapu0DfBPWR/N985PeCjVsYgvCqdlIRhxBRR/WKn2fuPwCAENZR1RrC/dhe7NkXj6OoOGV/l2dBrxC22biCJ51oVft938mvTjH7ta6IGE8IPG4G6dXfxYJ0Lvq16G+3K0SQmrbb5aG3islSUg/ZS5BqtJSAHZogKXqy3W0SfmxpAWhXDrepn7q8kiOb9+Ypo11MmHqNAPaHJeSO9GBuH5Q9CoOYHy/VR4kb2UoELjIm6DPkbcAYzHklDtPPYOUPE9ptL1A/Ps88Cm9NPLmjQ6wuaVThPKKij8TPIQRClFu/IzTnoRAZafVPlwNTwIsPN864wWk5tkJ8T6uLxA4TIvd/IM4WNS0uNC8RXHG5JRnLSmqP0UY= 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)(376002)(346002)(396003)(136003)(39840400004)(230922051799003)(64100799003)(82310400011)(451199024)(1800799012)(186009)(36840700001)(46966006)(26005)(336012)(2616005)(1076003)(83380400001)(478600001)(44832011)(40480700001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(86362001)(47076005)(36860700001)(36756003)(2906002)(7416002)(81166007)(6916009)(70586007)(70206006)(54906003)(316002)(42186006)(36900700001);DIR:OUT;SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2023 22:06:36.1346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f050ba9-8f21-4237-9841-08dbfdba1b07 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: BEZP281MB2565 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28060.002 X-TMASE-Result: 10-0.836900-4.000000 X-TMASE-MatchedRID: 2GwetqJOyZxrxBLbo6y0d4ruruLIWfnxgz5VmKZ8x85rIVA3IGfCC6DE DQa+uiKUfxo+wwDBGZpKfWS2EzGP5o/GIRjw2D78dArStA4IAF7scFLCzRtoVlQxWbscxchmnR4 nzBni1yUsCE8eCr9Fv/h6QguGwzP2odZPcBheFfPFPyeOO7dH/hqqRtM3sdE1t1CSfPp/+EVQx/ v29rIvkA26KZiyWHITa01Q0aXW7NFyiIBweSEVUnzV+KRRiDItcnxszfxH2Ckmx8kl1Wnd+q+eC SMeOiOkfZ9uentPYeaJcb4M4L3rfi1QF7giu85XOwBXM346/+yvkC0mxvBJfxrHZI5RLnIFAYOW D5xf/BeZ8t8OMKF/JZdgeE57XjFe X-TMASE-XGENCLOUD: 83b42042-85a5-9e61-a95c-102c20ead691-0-0-200-0 X-TM-Deliver-Signature: C38C6D983C320C4080E8007E1137FCAA X-TM-Addin-Auth: EEWhv+5llAm4/fbOKmJ61TMy2JOkDZQeoJhddwCqTDcZ0lL/XKMgAWTFJYw ieGO2TOmwFDveJjktUd+YFzcexEOysLp6b6uYh3vNXlPQOep4i4D/MIdzgQpu9IwuHynUAyQshq 5xU2QoxNWwXBBRys0cLiLTOPveC9HBJkL9Bbzl9wRlVqBbahHVtF74WNzwAJzmHpNfriVrPiXeg j5Vly4GyRrxw+b7OpyTCi/wdOL+6iTGpAz0bGw7TYeHDuLJG+ZJCygPlzo87OOv5bpWp0t4CptS ix9MXewHEtidU0w=.EpTjqq6jbicBovuIo5mU+mx/DOpcnWbkLDKy9lMFvEQ7lGGx0ygISGnBK8 qTSXgLfTicHPxmu4C17/JugbusZH2aV23OKlc7S8T0Xvn5U6USAP3jXYEo/SaXh8Riw5me7cTNz vwM0GtDuY9Z7BmgyXo3O/rbDwR0lCrH34NKFz2Jj6CFxpuDxEDeA22bcrLrRUOtG5Rtx+pc+/IN vt2LhvwACYRPPDoVXLf9nJf1RmBrfHcqsihAteH4UihFXIj6uNR4sLvD3350CXslfTPOAo7CLd2 zsWXZYAj2hDdNrr/v/yFT3g1XHSdq4WvCVvfgvF9yOF40HF6E+CAEsumbQQ== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1702677999; bh=BQ1ird3OIQSstOkL5D7Q4WuNIDqcJanL9DnLpx2+/qU=; l=7223; h=From:To:Date; b=EAEuIw9oOAURhR6HeGmUoB+cn7XiUKke8eOP0/T0Hfs1nyuDStqPxPyYz08F4pGb0 uHuK4KGEwaaQYvooRWN2UaEfKSWs4sbnddRD/FQO7TZIJ31HrfSkxdQJbk7f65e8d6 5vZjRTzWAZYrWBvfnVj55EH7wNwbB0ttJmP8zuJ/kQMQWajhEe1ww+ItX3VlP48qLe mA0lV55y1HfA5W+/wmLBbKIQY+xUcNaRovOkrAGJkoGUOeuaga+Zu+xMz6KxwjPhi0 JUJN1H8xkzni6Hl3BQyecff9NoW6V6fPZ+lmGim8R2whRP7PlceNTI5vZwj0XzkvND rcosdNEMMeseQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231215_140641_346140_872B2105 X-CRM114-Status: GOOD ( 18.00 ) 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 | 14 ++------------ 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(+), 27 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 9367174f7920..868f09966b0f 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -54,7 +54,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 { @@ -1314,7 +1313,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 }; @@ -1337,9 +1335,6 @@ EXPORT_SYMBOL(convert_art_to_tsc); * 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 comparability of two cycle - * values. * @cs_id: Clocksource ID corresponding to system counter value. * Used by timekeeping code to verify comparability of two * cycle values. @@ -1358,7 +1353,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 }; @@ -1467,10 +1461,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); @@ -1495,10 +1487,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 75e957171bd5..0f00f382bb5d 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -270,8 +270,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 @@ -279,7 +277,6 @@ struct system_device_crosststamp { */ struct system_counterval_t { u64 cycles; - struct clocksource *cs; enum clocksource_ids cs_id; };