From patchwork Fri Jun 28 18:33:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 11023125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5818138D for ; Fri, 28 Jun 2019 18:33:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DC7D28683 for ; Fri, 28 Jun 2019 18:33:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C46A28696; Fri, 28 Jun 2019 18:33:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6F6728683 for ; Fri, 28 Jun 2019 18:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbfF1Sdy (ORCPT ); Fri, 28 Jun 2019 14:33:54 -0400 Received: from mail-eopbgr770129.outbound.protection.outlook.com ([40.107.77.129]:44558 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725783AbfF1Sdy (ORCPT ); Fri, 28 Jun 2019 14:33:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hwuSEc1a21ae+NZhQzAVbDuY8laT/xOpjo63M2q9Iyt9TropxbJpTJv23DAjwCKH62OhC8ivyo/jYR9bQAZi6dO7E/3wuadl81zjBKSRliZ99G324Zrj1U+G6wAExVFoZZ4fMBmmHofLEKMkV8yZwwNXn/nHGJOwAVWRYnKmqAg9s+g3u/uti1/9nLfJJtcsn/5+0b4BOtGm396ozOdhVnjgi8gocGH7uk9TVX7LD1AxEPCaXVE0+s1hwqV3naNQ7TGLu7PGUwsqfyHfkx9rWYW47XGZVwAV5gxwSBD2hW//GVy+Re7LY/a/YTyBagjGb3z3kr6M5EVzJKPvIuy2zQ== 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-SenderADCheck; bh=34yH1k0ByhdX0SL4JskX1hR+6/uCYYhisYC1pTFuUq4=; b=Xve4PS/X1XNXJAfopXKb0kCcSw598S6J6rH0Fe3XPrlAd6e8bYkycCSEfpu+zywk8eAbP9jYG2DhjkdR7YoUzyG6SWwltDe2UrRzah2J0otJmN0ZCW8HKMExv2emm4eVN33YIP9g7lyoC8cRMGvjjCp46wZR7JxB2CUcO8Nf1NFvDqXlGEuekxd1lM8jpSccgnGMMBFXF7yWj+Nea8bdTI9t+WQo+V5qqKWx6q3e4vBshDdwuTmAq1s2ftuMb0swgNjfYsjo+PRV6mi6qfzumbw6zMKipOi8tSrA/70cJuI0B/7sZVrChwd8eZKEeODLkRAnCmFVepvJazBoz9+ZtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=microsoft.com;dmarc=pass action=none header.from=microsoft.com;dkim=pass header.d=microsoft.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=34yH1k0ByhdX0SL4JskX1hR+6/uCYYhisYC1pTFuUq4=; b=T98Rkstw7eRVwCT/Ul/P3J1HWJqL/uvaH7BSd3tAi4eaS4iJQO4dpcq0FzcXgDVFMbs6RtRb0LttZnjE3o3mN9AYj9RnKXfJfFSNU0WNhAoaG21cySxTnZXCBfjl1LZ1uRvl7XeP5jHFh2tkY6trZdmCiWAhFGHnCxvCURjxGu8= Received: from DM6PR21MB1340.namprd21.prod.outlook.com (20.179.53.83) by DM6PR21MB1145.namprd21.prod.outlook.com (20.179.50.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.4; Fri, 28 Jun 2019 18:33:50 +0000 Received: from DM6PR21MB1340.namprd21.prod.outlook.com ([fe80::c817:8ed1:5d04:5a95]) by DM6PR21MB1340.namprd21.prod.outlook.com ([fe80::c817:8ed1:5d04:5a95%6]) with mapi id 15.20.2052.005; Fri, 28 Jun 2019 18:33:50 +0000 From: Michael Kelley To: "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "x86@kernel.org" CC: Michael Kelley , "will.deacon@arm.com" , "catalin.marinas@arm.com" , "mark.rutland@arm.com" , "linux-arm-kernel@lists.infradead.org" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "olaf@aepfle.de" , "apw@canonical.com" , vkuznets , "jasowang@redhat.com" , "marcelo.cerri@canonical.com" , Sunil Muthuswamy , KY Srinivasan , "sashal@kernel.org" , "vincenzo.frascino@arm.com" , "linux-arch@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "arnd@arndb.de" , "linux@armlinux.org.uk" , "ralf@linux-mips.org" , "paul.burton@mips.com" , "daniel.lezcano@linaro.org" , "salyzyn@android.com" , "pcc@google.com" , "shuah@kernel.org" , "0x7f454c46@gmail.com" <0x7f454c46@gmail.com>, "linux@rasmusvillemoes.dk" , "huw@codeweavers.com" , "sfr@canb.auug.org.au" , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "kvm@vger.kernel.org" Subject: [PATCH v4 0/2] Drivers: hv: Move Hyper-V clock/timer code to separate clocksource driver Thread-Topic: [PATCH v4 0/2] Drivers: hv: Move Hyper-V clock/timer code to separate clocksource driver Thread-Index: AQHVLeAHtKnubHleu0muzknyz7e1vg== Date: Fri, 28 Jun 2019 18:33:50 +0000 Message-ID: <1561746758-23216-1-git-send-email-mikelley@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CY4PR06CA0043.namprd06.prod.outlook.com (2603:10b6:903:77::29) To DM6PR21MB1340.namprd21.prod.outlook.com (2603:10b6:5:175::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=mikelley@microsoft.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.8.3.1 x-originating-ip: [131.107.174.8] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a7da63b7-23c8-47ad-6e38-08d6fbf72a27 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DM6PR21MB1145; x-ms-traffictypediagnostic: DM6PR21MB1145: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-forefront-prvs: 00826B6158 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(136003)(396003)(376002)(366004)(39860400002)(346002)(199004)(189003)(386003)(86362001)(2616005)(54906003)(256004)(110136005)(478600001)(316002)(7416002)(7406005)(6486002)(486006)(14454004)(50226002)(2201001)(52116002)(476003)(6512007)(99286004)(4720700003)(6436002)(10290500003)(53936002)(4326008)(22452003)(25786009)(305945005)(6116002)(102836004)(5660300002)(71200400001)(71190400001)(14444005)(26005)(73956011)(66556008)(64756008)(66446008)(66476007)(186003)(36756003)(3846002)(66946007)(6506007)(7736002)(8676002)(81156014)(81166006)(66066001)(2906002)(68736007)(2501003)(10090500001)(8936002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM6PR21MB1145;H:DM6PR21MB1340.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: nwrSxzjT2z1O2DIkxuKdKVv1HHBcJz9ThYMHCx4x4zfDtBTqUU8S/LldNWxPAvecfduTgccH4S+9ckY0Bv7Oxvwk4NbZr6KhYb1sxus0/uERws1AIgrDBmeod439Uh4X+l5gKlDDbTVLSXN2Tbn/OpTkdCkZ8kqqXwp/ddL+C0G9cw8xIG1IxiTOugQVY2baqwGXJS3LXwnhVDB6jYOaGotpCjE984aBL1iUkyd7wm65Y9RHTwu7QZgk4bsD4Qq2gFCCFGq1hQeQ79Tq2Z0hng8ykXn1Mk4Wovu2Ix+YORhTU30ZB9+wsFBofkoBuV6SOuvuLt/GGH7uLwGNDWnU4WZ8Rk9ODP6YYnN0ZpWTT1rIARZQ2iAULIccOdyhFIpSeZObnb98caUD2qt7tKtRsMWpRNWmFaCD+ASt+bbTfH4= MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7da63b7-23c8-47ad-6e38-08d6fbf72a27 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2019 18:33:50.3409 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lkmlmhk@microsoft.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1145 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch series moves Hyper-V clock/timer code to a separate Hyper-V clocksource driver. Previously, Hyper-V clock/timer code and data structures were mixed in with other Hyper-V code in the ISA independent drivers/hv code as well as in ISA dependent code. The new Hyper-V clocksource driver is ISA independent, with a just few dependencies on ISA specific functions. The patch series does not change any behavior or functionality -- it only reorganizes the existing code and fixes up the linkages. A few places outside of Hyper-V code are fixed up to use the new #include file structure. This restructuring is in response to Marc Zyngier's review comments on supporting Hyper-V running on ARM64, and is a good idea in general. It increases the amount of code shared between the x86 and ARM64 architectures, and reduces the size of the new code for supporting Hyper-V on ARM64. A new version of the Hyper-V on ARM64 patches will follow once this clocksource restructuring is accepted. The code is diff'ed against the upstream tip tree: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso Changes in v4: * Revised commit messages * Rebased to upstream tip tree Changes in v3: * Removed boolean argument to hv_init_clocksource(). Always call sched_clock_register, which is needed on ARM64 but a no-op on x86. * Removed separate cpuhp setup in hv_stimer_alloc() and instead directly call hv_stimer_init() and hv_stimer_cleanup() from corresponding VMbus functions. This more closely matches original code and avoids clocksource stop/restart problems on ARM64 when VMbus code denies CPU offlining request. Changes in v2: * Revised commit short descriptions so the distinction between the first and second patches is clearer [GregKH] * Renamed new clocksource driver files and functions to use existing "timer" and "stimer" names instead of introducing "syntimer". [Vitaly Kuznetsov] * Introduced CONFIG_HYPER_TIMER to fix build problem when CONFIG_HYPERV=m [Vitaly Kuznetsov] * Added "Suggested-by: Marc Zyngier" Michael Kelley (2): Drivers: hv: Create Hyper-V clocksource driver from existing clockevents code Drivers: hv: Move Hyper-V clocksource code to new clocksource driver MAINTAINERS | 2 + arch/x86/entry/vdso/vma.c | 2 +- arch/x86/hyperv/hv_init.c | 91 +-------- arch/x86/include/asm/hyperv-tlfs.h | 6 + arch/x86/include/asm/mshyperv.h | 81 ++------ arch/x86/include/asm/vdso/gettimeofday.h | 2 +- arch/x86/kernel/cpu/mshyperv.c | 2 + arch/x86/kvm/x86.c | 1 + drivers/clocksource/Makefile | 1 + drivers/clocksource/hyperv_timer.c | 321 +++++++++++++++++++++++++++++++ drivers/hv/Kconfig | 3 + drivers/hv/hv.c | 156 +-------------- drivers/hv/hyperv_vmbus.h | 3 - drivers/hv/vmbus_drv.c | 42 ++-- include/clocksource/hyperv_timer.h | 105 ++++++++++ 15 files changed, 483 insertions(+), 335 deletions(-) create mode 100644 drivers/clocksource/hyperv_timer.c create mode 100644 include/clocksource/hyperv_timer.h