From patchwork Wed May 12 17:37:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 12254405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F585C2B9FB for ; Wed, 12 May 2021 17:41:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24FD861441 for ; Wed, 12 May 2021 17:41:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24FD861441 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=v5GafjJhcwVSkhO51Q1FMDGrHEcT/DBIQoX3z9mWmzE=; b=XyFw2z2kjVw2JJv9nn0OLXdEU onySVjZ/2okpIWKkv9HkIOogCzBORjh7KoXu7sipND+L7yIfUVq8cgZFvUZ8jWY4zj72YZw2qekz0 vB/M8gvXAYbqnKuUx0jpeMAlNlrZhlhD5rY7yPJsOyQYcZmy8XCaJTkVuQ7NIr8JT0Wh6a9yHkSwI 1K5fNNfPrPm1Kk1GNLRn2BpVkvYhvULhIWgsWV/jnqVd/fFbG+rNwz/lXAqUIWP/LaBO2W220xi2b rWgb8A4grUqV1OVmA/OwgiKZHr8ExBtQvQXQc12xTAx+CwF7oZ63k6yjUkqE7FKv1W1C21zEY3L9R 0ldfunlZA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgsp3-003SJG-9d; Wed, 12 May 2021 17:39:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgsoh-003SHT-Fc for linux-arm-kernel@desiato.infradead.org; Wed, 12 May 2021 17:38:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8eDbNMeS6zC5u6Jeu69d9rdLRidgmO42mzoRJ9nuRUM=; b=bGONa650TZKjhvbSXXasC1/UcY 86onkucZamQpg9TXaFX/70hlvZp9Q1OpcxVQMWEZhA1q5TgJsnWlAqnCXzJ1cy0Qs+BLvbSVPTTO6 WAqXtSK5JTojp/JiJs7cY8gHtPT59zwJwBgFPi/7+xYUH/pmlDIPtVmZYlx9a/2RvQ/m0sXoyFWwW U4SSLGHZECTDdq9Ja8ruEVPneEl2NXN3A8SxJKCTL+h4jWgB1ai8Wy7L7aA9oDNGtHDBI4SSW5PHG ULepMjQB9+gQQESAtWfXQChfBCgf5yqvnOzhnrBDPxgmX6g3oTYUu9OtSoukpenf+F0pEYAwhX7MS jyzwhrEA==; Received: from mail-dm6nam12on2117.outbound.protection.outlook.com ([40.107.243.117] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgsof-00AeX5-03 for linux-arm-kernel@lists.infradead.org; Wed, 12 May 2021 17:38:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFyErEOTNZ47TXSbuqe+ZQWXlaWppnJnBtOcOjoXazz334fdFso4TcYLVXF527FWoLOjOO+GQSmlThAuO4+1aDmfNwuO1JpktZiTBJG3RRajbXGcE+2v02mgCLZrwomn8OQRBMwdNMbvHqtVEcDWaal/TVNoJrVoAfDYYjKPGl0jrJBERmhhBz6Mfq09zOgk1dJdW8vuua6yKMiY1+r5SI4+0iQvilRWL63LmoXHLw+DIUyiR7wnWeOEgm86tzR7+yHdWi6+MBAgqWD7GGPZDXC0e3ixAgTUgd/9eD9CdO9uw+5itknngZCSFj+rjOvHnKS8+WqgFhcI+z8Lg8CxTg== 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=8eDbNMeS6zC5u6Jeu69d9rdLRidgmO42mzoRJ9nuRUM=; b=cSZXI6IeIqZ6fZnHDMnYWJMcl4IcO1PnwsNM2U+1pZx1LafwPGKZofZxO6w3FVGM1+6/eVqUvR6URTKSqoD+x4SUaws4+8ZAnKIOjfH88BEf0oGSZYRNtsVUISrx32eDk4TS9r9d/Zz9UEg4RNC/ktOv/3aousDXZ9+w2/e83u0Wbsu3sOgaP/NeskNXAdIxCpGtfdE/qSXe6jMBjUb3/K7HgRf34hWmoX+TYpRtbomlSM9NygDttOOD8ybAw938CNeO+1ZKvOCSW6D0L9m55vYuFyGjJ+BMSCg2eFwHpsxnn/qLTiknrYz58JC7tOMlCNAjxFkkgCfPTsEen9FZwQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8eDbNMeS6zC5u6Jeu69d9rdLRidgmO42mzoRJ9nuRUM=; b=GYTw+wg2kmeqrRYw8tVzU8wEc3PTk36GCMMmU44f7w+FPDzNLnplKmI4dHiMMrTUP/k7Kol9bDAVFX3B+tTwlO0dbuU0USBZ+1ikayf/c3irQ12WssdJkhagoLKigKQBCeuIF91k9qMPiHzFgTfyYIK9GvGS8N3dPDkBw8MMM6M= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by DM6PR21MB1483.namprd21.prod.outlook.com (2603:10b6:5:25c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.5; Wed, 12 May 2021 17:38:30 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::fdb1:c8ac:5a1f:8588%5]) with mapi id 15.20.4150.011; Wed, 12 May 2021 17:38:30 +0000 From: Michael Kelley To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-efi@vger.kernel.org, arnd@arndb.de, wei.liu@kernel.org, ardb@kernel.org, daniel.lezcano@linaro.org, kys@microsoft.com Cc: mikelley@microsoft.com Subject: [PATCH v10 3/7] arm64: hyperv: Add Hyper-V clocksource/clockevent support Date: Wed, 12 May 2021 10:37:43 -0700 Message-Id: <1620841067-46606-4-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> References: <1620841067-46606-1-git-send-email-mikelley@microsoft.com> X-Originating-IP: [131.107.1.144] X-ClientProxiedBy: CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mhkdev.corp.microsoft.com (131.107.1.144) by CO2PR04CA0102.namprd04.prod.outlook.com (2603:10b6:104:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 17:38:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e0c636c-b1f8-4b7f-b4ad-08d9156cc1c0 X-MS-TrafficTypeDiagnostic: DM6PR21MB1483: X-MS-Exchange-Transport-Forked: True X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ls1Uc0/jDxnBfopMtuk2271YjtZroAcJ1mlB4k4XSeOxysPyOBIcoOgD5MlDx/b8Zbm3YhSqefXr4xXB11u8OO3q1t8o7Z/jyBPwz5jc3bfMNBwxo88sZgP9GgroewTImqJ5Zc42SJM2KTdhuJf6xpdeAT2wLjgbp9MCjgQoR2iJol5/PR2JrSKGDLb7jqEBilJRZawjP90YYXwBukUUExJKlssQO5muvjlt33w1+OzD6Rakql4nn8xmaFPVM1KiP4hOY39f5o+QlAyMIEA2IQ6HyjFGcte2neex/vaOJQt23bqAihqik+1HoHYfl+Et6P0eRHbE7g7sQKUTqKhb76a0jalpS10Xm68miKBk5d6VofwUgPab79lK2MC+mKC/V63fokP8rK/5h8JQO8czqgGfPNWaj4q9dduK8D11YZM8U6ZCwSms3wDFJNwBUx9TGPBf8yC0hUQBR+JzqkrpcfonUCWU1pldah3j9thYz2GM1NM0cIzWTvgTtUTLUMc8LZChXkGHqbkJ1BYf/cmwj1QTR4HY3P0w9ClU8S9Sy8bb8J1FgeZ/Ji3tv5beEEhbSIwkn10MKaA7rHjwhHIuZOvS5to1c0I4tTAGI9TcjkLO6DyRTC+VzwhLA+6JVSlWiv/mTcg+y042N66SOfNDRNJ/8ZzKgOQHPR2RAL1Xx+4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(6636002)(316002)(478600001)(8676002)(86362001)(66556008)(921005)(16526019)(10290500003)(7696005)(52116002)(7416002)(2906002)(186003)(66476007)(4326008)(82960400001)(2616005)(82950400001)(956004)(66946007)(6486002)(6666004)(38100700002)(38350700002)(5660300002)(107886003)(36756003)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: m9BhlIQSejG6scey+/uo7d1VQ7glFSWOyxq1ha80VS/XbYQRSwBTv0FHJp+sKurcuUUYbmsqt4jno/eMKcqkL4vAu6dQyEX8EMNmtoVpUmRtV/R+hXZxc0zrwzhDF/j52s0WrGTvFARGGFRJNnP48i5YxAFvTBBnwzW5FevpnfSQYCmBA3DEVqiSJ52pXRvBOlWiQoIzVCF6Lc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c9NHspdVGxydBXkcYBIXl5S4dTqnvlyH8Myg8k2jphM+raVaAsgd9EGGMfeh9CbImkxxagbcO9lCA5PvqjN8nMsyvvM5 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e0c636c-b1f8-4b7f-b4ad-08d9156cc1c0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 17:38:30.1884 (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: zBmyLHu2KB0aYvHqVXt9mu41d7tOmRWkuXVib/m3A91hchu1nQUin8kJBF73G3bWmxwPPosaEftlNsdkQOZY/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1483 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210512_103837_065157_119C2C3B X-CRM114-Status: GOOD ( 14.54 ) 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 architecture specific definitions and functions needed by the architecture independent Hyper-V clocksource driver. Update the Hyper-V clocksource driver to be initialized on ARM64. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy --- arch/arm64/include/asm/mshyperv.h | 12 ++++++++++++ drivers/clocksource/hyperv_timer.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index c448704..b17299c 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -21,6 +21,7 @@ #include #include #include +#include /* * Declare calls to get and set Hyper-V VP register values on ARM64, which @@ -41,6 +42,17 @@ static inline u64 hv_get_register(unsigned int reg) return hv_get_vpreg(reg); } +/* Define the interrupt ID used by STIMER0 Direct Mode interrupts. This + * value can't come from ACPI tables because it is needed before the + * Linux ACPI subsystem is initialized. + */ +#define HYPERV_STIMER0_VECTOR 31 + +static inline u64 hv_get_raw_timer(void) +{ + return arch_timer_read_counter(); +} + /* SMCCC hypercall parameters */ #define HV_SMCCC_FUNC_NUMBER 1 #define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \ diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 977fd05..270ad9c 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -569,3 +569,17 @@ void __init hv_init_clocksource(void) hv_setup_sched_clock(read_hv_sched_clock_msr); } EXPORT_SYMBOL_GPL(hv_init_clocksource); + +/* Initialize everything on ARM64 */ +static int __init hyperv_timer_init(struct acpi_table_header *table) +{ + if (!hv_is_hyperv_initialized()) + return -EINVAL; + + hv_init_clocksource(); + if (hv_stimer_alloc(true)) + return -EINVAL; + + return 0; +} +TIMER_ACPI_DECLARE(hyperv, ACPI_SIG_GTDT, hyperv_timer_init);