From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455649; cv=none; d=zohomail.com; s=zohoarc; b=ZGYQGuRjwAI5tY4Niy31lNiVGY8Iot3kr+cd+qisuF0CY77PMLzQeo5UpAJISfEKvUIh6la7px+UWhU0fs5Tcm5uYO34j5ao2zAihOUiEecFGui7PqHH48aBBC4Yhvefz5vhJiTVi1KqOKNw9ozJLqvvBr07UqOjcch3FZaToxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455649; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q/Cv6RQJVo/iWaXHksguT/ts6tGHqfaWX+aG4h8Fux4=; b=RpQ40JZOszSMyhmrgMynsrUYkCJ6IA3J0QJNfZcBCC2wrk2+VVm5THjcVpHbOR8ADHcAyny9FseWIAfgqnWTzNMxWZV3zp4BrxpfMBxLCmAwpajREOYlVaFKaPJrxCJTRPwMABElz4iNMWakrzVZ1Lml6Z3WbC0YjKDm2V0HD88= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455649119213.2361179469607; Sun, 15 Dec 2019 16:20:49 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige6t-0006hk-OO; Mon, 16 Dec 2019 00:19:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige6s-0006hd-IW for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:19:38 +0000 Received: from mail-qk1-x742.google.com (unknown [2607:f8b0:4864:20::742]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bc1b5f6a-1f99-11ea-88e7-bc764e2007e4; Mon, 16 Dec 2019 00:19:33 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id 21so1146447qky.4 for ; Sun, 15 Dec 2019 16:19:33 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id g16sm5431819qkk.61.2019.12.15.16.19.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:32 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 851932243F; Sun, 15 Dec 2019 19:19:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:31 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id DF9058005C; Sun, 15 Dec 2019 19:19:30 -0500 (EST) X-Inumbo-ID: bc1b5f6a-1f99-11ea-88e7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UVpf63Qd4TX5I9v6qZSm1vjU4JS6/z/tTXxQbaf4TBY=; b=D3mlEWftH/mVQoC67x99bNXce+yDo9uBMNOqzw1fGt6PhXd+LwHuVyfikJEw19svXT ahktUA0bg5LNwRtDfUXFXJtgYcVcz+WvgYNgKN52gtMp51f/HAJu//uMElnRofK2Dy+9 Ewadu7SGqcg12XJ5zZTRprJ3NaY1znutfpXRlG4jrG/SFwQGxLAzeNLLgox4fEnUWkQw +J5igAXDv+iyg+LeIsh1Zj443GBnRzKKPnfRFWGm4ewPAuxQE/ACSVBktckgGgyZgqCR 6LqvzSPpBJdipjqwU1V6qSP+X4WGwMPO3iyNej07cCFd7D54L3xTElk/AZTKjMtaVZW1 RD7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UVpf63Qd4TX5I9v6qZSm1vjU4JS6/z/tTXxQbaf4TBY=; b=NVZCvkM7spDq/asK7oniGmlVQhC0YXm3RK1YsOrvRDQrIUyB83hqHr1Hk/6h628jE+ J7Y3VYw83Z7Q5tjPZzUCH2Je7VO4/RCqETpEXXbBF6wF/JY+xmOFeMBngWJtG25yXuAA 1/N7ixd6QFNbatMMydvLY0QTwkHXsxolZJD7pX5qZnRbcHuC4hLLXwToD7Yz7ZrBvEzc TOoQQyGq1m00fiFLLPFwup+z4i61JQ+Lq3BuHUwirFH43BTHHKJOB530Zw4UMiyjXAff nt/qGJ+lmqJiPgFNdC2hMkCFpMZ6Kj8aBM6nfjrkoZOliBIzfbrHnVZ6Mb6FfwHO2QXl Yzkg== X-Gm-Message-State: APjAAAWsf+b4mS7EeutAXrir9zNGpFAKDT5skOr9KW4b5p/YSpZ/6cxT z4+eM13o431mpxIynYTsw1s= X-Google-Smtp-Source: APXvYqx3q9o5IJDrNl2qRBw2P9CxytUA2HNSYLBG2f5II++aBKtmeVfY050HNOiMvaqJ5iFUhF31NA== X-Received: by 2002:a37:4047:: with SMTP id n68mr24901320qka.258.1576455573256; Sun, 15 Dec 2019 16:19:33 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucfkphephedvrdduheehrdduuddurdejudenucfrrghr rghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrg hlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeep ghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:17 +0800 Message-Id: <20191216001922.23008-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 1/6] arm64: hyperv: Allow hv_get_raw_timer() definition to be overridden X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Vincenzo Frascino , Stephen Hemminger , Catalin Marinas , Haiyang Zhang , Michael Kelley , Stefano Stabellini , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In order to support vDSO, hv_read_tsc_page() should be able to be called from userspace if tsc page mapped. As a result, hv_get_raw_timer(), called by hv_read_tsc_page() requires to be called by both kernel and vDSO. Currently, it's defined as arch_timer_read_counter(), which is a function pointer initialized (using a kernel address) by the arch timer driver, therefore not usable in vDSO. Fix this by allowing a previous definition to override the default one, so that in vDSO code, we can define it as a function callable in userspace. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/include/asm/mshyperv.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/msh= yperv.h index a8468a611912..9cc4aeddf2d0 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -97,8 +97,15 @@ extern void hv_get_vpreg_128(u32 reg, struct hv_get_vp_r= egister_output *result); #define hv_disable_stimer0_percpu_irq(irq) disable_percpu_irq(irq) #endif =20 -/* ARM64 specific code to read the hardware clock */ +/* + * ARM64 specific code to read the hardware clock. + * + * This could be used in both kernel space and userspace (vDSO), so make it + * possible for a previous definition to override the default one. + */ +#ifndef hv_get_raw_timer #define hv_get_raw_timer() arch_timer_read_counter() +#endif =20 #include =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455639; cv=none; d=zohomail.com; s=zohoarc; b=Wa8jLz5jxggBUxkp2QhDhT7TYpn2hM+2sAE5kfY6aY6LTaVyEpOfUPPcES846W7WD4m3hTegwCRHfIIUtTWJofRZRva/JDt/h436QD4xBHIaRPsCT5vzniGyP0wvAUa2Of/jGhmbR6+iGkcVdWMR35MtAwlvF3G5dRKnVCIdytU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V2CaWSbtkkRDhSpQQ1oqI9F3gx3vzLwHo2e6ErARnJE=; b=iCG/M2T/F6wW+XHvndC5Un02emoRnj7CR/jLN748YjAyaxc4GomlC0uFaLHLMSBDiXoxXuIu9b4j4ACvXriKFFbH/mJ03xf9MHHAvYTxD9H8HfPhm8wUFsRLYQFPE6yWXCJurZwzTW7HpGF8C+s40JV3XAqxYVmzRYvNXb8E7PM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455639987865.99859889334; Sun, 15 Dec 2019 16:20:39 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige6z-0006i3-0Y; Mon, 16 Dec 2019 00:19:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige6x-0006hy-J1 for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:19:43 +0000 Received: from mail-qt1-x841.google.com (unknown [2607:f8b0:4864:20::841]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id be0b1a18-1f99-11ea-a1e1-bc764e2007e4; Mon, 16 Dec 2019 00:19:36 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id g17so3149341qtp.11 for ; Sun, 15 Dec 2019 16:19:36 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id v125sm5409912qka.47.2019.12.15.16.19.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:36 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 77F3122434; Sun, 15 Dec 2019 19:19:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:35 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id A59FA80059; Sun, 15 Dec 2019 19:19:34 -0500 (EST) X-Inumbo-ID: be0b1a18-1f99-11ea-a1e1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/LWpy3sT0NojI+6lHGq8dZmjGNhrVEiL5TtdHICIZc4=; b=YWwtUpgdB4C7Q4X0xMgmsDhu8K2YcKTpSy81xtryD588YUY101myAfwdgspbcp++85 6rUIKyZFgNjmsF4vh3aNwsJ/DIr5fJmGbJgJRAG4m5DMAcJVWbNmgUvu85ZRr82QbH7N SjPcnTI82np5u2GBasGGK7q0ufep07XQTVE2LKC4dmpRPeGgmVk+Vbvn5SP5P+2/c0d+ PW4xPb5dY7sVukOSE6AtRQFyG1c3wP0wyFooKOHxnXx9A2gSO+syfVPBz/XUSPLqmuEH O7l6gAeT6p4sbwV22GMICMLrj6hUwnTvwhKBHrhQNO6Z1EXh996On8A3IZd8QASa4dLh Jl6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/LWpy3sT0NojI+6lHGq8dZmjGNhrVEiL5TtdHICIZc4=; b=l3s7X3q51aJuE9+AB/SLAmjhYZRRKfU+HV2NChNqOx8YY3IqmOvZbNMNWbQFtmRIwQ 8y9d+SGVxaBXDdrcR8bMeyJv1DqOlAA092DI6H/kmoX98gGW7Ws2yxJ1qTJzDeDRRzA5 Vjck+iRTAIyIUNFFHk2B3yzurKX0mwYRKKbKtQhvihJt4rqN4v9M+CTWRKVb4aPTpKKJ xhG4s7UY7K/IOqsPkCm/KkqxtDAfQQqB3E3ZfKCGM7Op2yd/MibA/5yNageYrLsUuFOJ QpGP7HF5ZV7tA8kQvjuDfhswRq9j5nGx4tvGx8JZuBplqJRB0J2P+Z1bKggQEYg3pVxQ FIXw== X-Gm-Message-State: APjAAAWI8ImZEguV+eA+d73CEtCsDQXmyYxWKLRirHiCGZOgW/IQw3TT B5+KK1TWthnd6oR89AYExy4= X-Google-Smtp-Source: APXvYqyhIIjZfzlpUFVMB/tiV3ydzxJugA4tfdYzQ1/oDFfstC6D6w9VTmT3ruQGJ7EWghnBfRjF2Q== X-Received: by 2002:aed:2bc2:: with SMTP id e60mr22652718qtd.115.1576455576496; Sun, 15 Dec 2019 16:19:36 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucfkphephedvrdduheehrdduuddurdejudenucfrrghr rghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrg hlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeep ghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:18 +0800 Message-Id: <20191216001922.23008-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 2/6] arm64: vdso: Add support for multiple vDSO data pages X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Vincenzo Frascino , Stephen Hemminger , Catalin Marinas , Haiyang Zhang , Michael Kelley , Stefano Stabellini , Matteo Croce , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Split __vdso_abi::vdso_pages into nr_vdso_{data,code}_pages, so that __setup_additional_pages() could work with multiple vDSO data pages with the setup from __vdso_init(). Multiple vDSO data pages are required when running in a virtualized environment, where the cycles read from cntvct at userspace need to be adjusted with some data from a page maintained by the hypervisor. For example, the TSC page in Hyper-V. This is a prerequisite for vDSO support in ARM64 on Hyper-V. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/kernel/vdso.c | 43 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 354b11e27c07..b9b5ec7a3084 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -50,7 +50,8 @@ struct __vdso_abi { const char *name; const char *vdso_code_start; const char *vdso_code_end; - unsigned long vdso_pages; + unsigned long nr_vdso_data_pages; + unsigned long nr_vdso_code_pages; /* Data Mapping */ struct vm_special_mapping *dm; /* Code Mapping */ @@ -101,6 +102,8 @@ static int __vdso_init(enum arch_vdso_type arch_index) { int i; struct page **vdso_pagelist; + struct page **vdso_code_pagelist; + unsigned long nr_vdso_pages; unsigned long pfn; =20 if (memcmp(vdso_lookup[arch_index].vdso_code_start, "\177ELF", 4)) { @@ -108,14 +111,18 @@ static int __vdso_init(enum arch_vdso_type arch_index) return -EINVAL; } =20 - vdso_lookup[arch_index].vdso_pages =3D ( + vdso_lookup[arch_index].nr_vdso_data_pages =3D 1; + + vdso_lookup[arch_index].nr_vdso_code_pages =3D ( vdso_lookup[arch_index].vdso_code_end - vdso_lookup[arch_index].vdso_code_start) >> PAGE_SHIFT; =20 - /* Allocate the vDSO pagelist, plus a page for the data. */ - vdso_pagelist =3D kcalloc(vdso_lookup[arch_index].vdso_pages + 1, - sizeof(struct page *), + nr_vdso_pages =3D vdso_lookup[arch_index].nr_vdso_data_pages + + vdso_lookup[arch_index].nr_vdso_code_pages; + + /* Allocate the vDSO pagelist. */ + vdso_pagelist =3D kcalloc(nr_vdso_pages, sizeof(struct page *), GFP_KERNEL); if (vdso_pagelist =3D=3D NULL) return -ENOMEM; @@ -123,15 +130,17 @@ static int __vdso_init(enum arch_vdso_type arch_index) /* Grab the vDSO data page. */ vdso_pagelist[0] =3D phys_to_page(__pa_symbol(vdso_data)); =20 - /* Grab the vDSO code pages. */ pfn =3D sym_to_pfn(vdso_lookup[arch_index].vdso_code_start); =20 - for (i =3D 0; i < vdso_lookup[arch_index].vdso_pages; i++) - vdso_pagelist[i + 1] =3D pfn_to_page(pfn + i); + vdso_code_pagelist =3D vdso_pagelist + + vdso_lookup[arch_index].nr_vdso_data_pages; + + for (i =3D 0; i < vdso_lookup[arch_index].nr_vdso_code_pages; i++) + vdso_code_pagelist[i] =3D pfn_to_page(pfn + i); =20 - vdso_lookup[arch_index].dm->pages =3D &vdso_pagelist[0]; - vdso_lookup[arch_index].cm->pages =3D &vdso_pagelist[1]; + vdso_lookup[arch_index].dm->pages =3D vdso_pagelist; + vdso_lookup[arch_index].cm->pages =3D vdso_code_pagelist; =20 return 0; } @@ -141,26 +150,26 @@ static int __setup_additional_pages(enum arch_vdso_ty= pe arch_index, struct linux_binprm *bprm, int uses_interp) { - unsigned long vdso_base, vdso_text_len, vdso_mapping_len; + unsigned long vdso_base, vdso_text_len, vdso_data_len; void *ret; =20 - vdso_text_len =3D vdso_lookup[arch_index].vdso_pages << PAGE_SHIFT; - /* Be sure to map the data page */ - vdso_mapping_len =3D vdso_text_len + PAGE_SIZE; + vdso_data_len =3D vdso_lookup[arch_index].nr_vdso_data_pages << PAGE_SHIF= T; + vdso_text_len =3D vdso_lookup[arch_index].nr_vdso_code_pages << PAGE_SHIF= T; =20 - vdso_base =3D get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0); + vdso_base =3D get_unmapped_area(NULL, 0, + vdso_data_len + vdso_text_len, 0, 0); if (IS_ERR_VALUE(vdso_base)) { ret =3D ERR_PTR(vdso_base); goto up_fail; } =20 - ret =3D _install_special_mapping(mm, vdso_base, PAGE_SIZE, + ret =3D _install_special_mapping(mm, vdso_base, vdso_data_len, VM_READ|VM_MAYREAD, vdso_lookup[arch_index].dm); if (IS_ERR(ret)) goto up_fail; =20 - vdso_base +=3D PAGE_SIZE; + vdso_base +=3D vdso_data_len; mm->context.vdso =3D (void *)vdso_base; ret =3D _install_special_mapping(mm, vdso_base, vdso_text_len, VM_READ|VM_EXEC| --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455640; cv=none; d=zohomail.com; s=zohoarc; b=iZAJs2NBwgjuRSolCMfew5kji58r5YhlXuu7UI0g3skU7Gc0pddt7o1/aFmRK+tDwcu/KWXdZhf03wMkIhOhDR5AR9pjKM1tXLXX8lETIYX+f5ZEmV63CyvNpc4vg287oMGs1ZFrpoqD8Xt6W6LIK11wuE0L4/pnYyqhCSfc40s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455640; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OVECM2NucrXHM091BEgSi5OTFHYPhiXF2KyLpMx6ing=; b=bhrWYUE3hQDvUpczQ7Zjbh+x/2QGhkbqzVQ10GB7R0WXnne0wE1PrQe3lgVax3erVjGa4U+I8bf3qSw3SX+seibLv5Cag67Lpnsix+h6h8C/o10vGCq6UQDHvIZHSwN9KMPQFnapJKfa2I1/VtG/Y3JlG9nqdNmsu5BKrMl587k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455640248483.4841344705485; Sun, 15 Dec 2019 16:20:40 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige79-0006lE-Du; Mon, 16 Dec 2019 00:19:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige78-0006kl-Cv for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:19:54 +0000 Received: from mail-qv1-xf43.google.com (unknown [2607:f8b0:4864:20::f43]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c81ba91e-1f99-11ea-88e7-bc764e2007e4; Mon, 16 Dec 2019 00:19:53 +0000 (UTC) Received: by mail-qv1-xf43.google.com with SMTP id t9so2017579qvh.13 for ; Sun, 15 Dec 2019 16:19:53 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id l20sm3935350qtj.60.2019.12.15.16.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:52 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 1D85822430; Sun, 15 Dec 2019 19:19:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:52 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id B1E9530600FE; Sun, 15 Dec 2019 19:19:49 -0500 (EST) X-Inumbo-ID: c81ba91e-1f99-11ea-88e7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pqQp4+UbbRX/7xlzqwr46OCkSlvgFANLzi802cRaz4A=; b=GyH7/Io5fH/c/CUmowH+I8vPoZ8s483kMhc3an3/j9mKJEAGIdoesqC3IMwmIaJf03 ofn1CUUMWPYu6mLP1xPuGDobPBCRrctiJt71rFvn7BUCtLlI4zPp0N4uYuDweGoKXOCP onnsUA8IcLU1SG6wQREkSB57Jh1vP8OF5a9qw0sBK2sVIapT0w/2JQUScUrHqEMKVXCo ooyArdT1qkWIdNyhNVcqZbqJALcl1PuEzHCZd4RDv1JRQBkR9eTxP0/m9dGoWfhFWn64 6Li8U0KzRuQBfnhK4YnbQvWKuqIf+s+y01QrEgZcw3jGf/crhDv1JKa9Y3gPAa70XxBP xA9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pqQp4+UbbRX/7xlzqwr46OCkSlvgFANLzi802cRaz4A=; b=jQKA56S4KGloqvBQSi/4ajkRCRRaYsPQyMLBQtbkZhRC4pfsIWnOocflu3EAVAzxHr fpE3YyxVEj/iF9bJQcLk3+qKRLPETtnI8FXIq1vHU5VnL0xwSJok6JfcDuj306Jon1Wd FCKM82WY04jP9lWKtiGQSJc3i8qgB0qcQDi9prdPyxYxclOP9bgDbMX8x358QRCVWWbH y1pS/GxRIx+ctR9IG1T+5l81r78oCbI/2msdr0mYgQsPZ/1t0lFwJyZhXWDRbcgjIVfw Pa8ja+kdvndAfJUgPR4Gb18T6Wkl+1Mb0If5SoOHp/3Lhowi0kB1VXGxS0XCH7+zB2oj DPfA== X-Gm-Message-State: APjAAAV1FGxO3k1p0VO+ZK8LyptXhk4qtjJTL9iXR6Fr/9vLYOfXLuuU PeByZxN/xPoBIXGT7S2OTc0= X-Google-Smtp-Source: APXvYqxDQ+j2rURsMx2x0xRfHlMUbbM83uuSbHR32vFcElSOqCViHNeFWFNuwVwKh7NFCGLlq6vXXw== X-Received: by 2002:ad4:5614:: with SMTP id ca20mr95564qvb.43.1576455593249; Sun, 15 Dec 2019 16:19:53 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucfkphephedvrdduheehrdduuddurdejudenucfrrghr rghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrg hlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeep ghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgepvd X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:19 +0800 Message-Id: <20191216001922.23008-4-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 3/6] arm/arm64: clocksource: Introduce vclock_mode X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Mark Rutland , Vincenzo Frascino , Stephen Hemminger , Enrico Weigelt , Catalin Marinas , Haiyang Zhang , Daniel Lezcano , Russell King , Michael Kelley , Stefano Stabellini , Geert Uytterhoeven , Marc Zyngier , Huacai Chen , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng , Allison Randal Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Similar to x86, use a vclock_mode in arch_clocksource_data to differ clocksoures use different read function in vDSO. No functional changes, only preparation for support vDSO in ARM64 on Hyper-V. Note: the changes for arm are only because arm and arm64 share the same code in the arch timer driver and require arch_clocksource_data having the same field. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm/include/asm/clocksource.h | 6 +++++- arch/arm/kernel/vdso.c | 1 - arch/arm64/include/asm/clocksource.h | 6 +++++- arch/arm64/include/asm/mshyperv.h | 2 +- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 5 +++-- arch/arm64/include/asm/vdso/gettimeofday.h | 5 +++-- arch/arm64/include/asm/vdso/vsyscall.h | 4 +--- drivers/clocksource/arm_arch_timer.c | 8 ++++---- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/arch/arm/include/asm/clocksource.h b/arch/arm/include/asm/cloc= ksource.h index 0b350a7e26f3..017c5ab6e587 100644 --- a/arch/arm/include/asm/clocksource.h +++ b/arch/arm/include/asm/clocksource.h @@ -1,8 +1,12 @@ #ifndef _ASM_CLOCKSOURCE_H #define _ASM_CLOCKSOURCE_H =20 +#define VCLOCK_NONE 0 /* No vDSO clock available. */ +#define VCLOCK_CNTVCT 1 /* vDSO should use cntvcnt */ +#define VCLOCK_MAX 1 + struct arch_clocksource_data { - bool vdso_direct; /* Usable for direct VDSO access? */ + int vclock_mode; }; =20 #endif diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index c89ac1b9d28b..09e46ec420fe 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -263,4 +263,3 @@ void arm_install_vdso(struct mm_struct *mm, unsigned lo= ng addr) if (!IS_ERR(vma)) mm->context.vdso =3D addr; } - diff --git a/arch/arm64/include/asm/clocksource.h b/arch/arm64/include/asm/= clocksource.h index 0ece64a26c8c..fbe80057468c 100644 --- a/arch/arm64/include/asm/clocksource.h +++ b/arch/arm64/include/asm/clocksource.h @@ -2,8 +2,12 @@ #ifndef _ASM_CLOCKSOURCE_H #define _ASM_CLOCKSOURCE_H =20 +#define VCLOCK_NONE 0 /* No vDSO clock available. */ +#define VCLOCK_CNTVCT 1 /* vDSO should use cntvcnt */ +#define VCLOCK_MAX 1 + struct arch_clocksource_data { - bool vdso_direct; /* Usable for direct VDSO access? */ + int vclock_mode; }; =20 #endif diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/msh= yperv.h index 9cc4aeddf2d0..0afb00e3501d 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -90,7 +90,7 @@ extern void hv_get_vpreg_128(u32 reg, struct hv_get_vp_re= gister_output *result); #define hv_set_reference_tsc(val) \ hv_set_vpreg(HV_REGISTER_REFERENCE_TSC, val) #define hv_set_clocksource_vdso(val) \ - ((val).archdata.vdso_direct =3D false) + ((val).archdata.vclock_mode =3D VCLOCK_NONE) =20 #if IS_ENABLED(CONFIG_HYPERV) #define hv_enable_stimer0_percpu_irq(irq) enable_percpu_irq(irq, 0) diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64= /include/asm/vdso/compat_gettimeofday.h index c50ee1b7d5cd..630d04c3c92e 100644 --- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h +++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h @@ -8,6 +8,7 @@ #ifndef __ASSEMBLY__ =20 #include +#include #include =20 #include @@ -117,10 +118,10 @@ static __always_inline u64 __arch_get_hw_counter(s32 = clock_mode) u64 res; =20 /* - * clock_mode =3D=3D 0 implies that vDSO are enabled otherwise + * clock_mode =3D=3D VCLOCK_NONE implies that vDSO are disabled so * fallback on syscall. */ - if (clock_mode) + if (clock_mode =3D=3D VCLOCK_NONE) return __VDSO_USE_SYSCALL; =20 /* diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/includ= e/asm/vdso/gettimeofday.h index b08f476b72b4..e6e3fe0488c7 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -8,6 +8,7 @@ #ifndef __ASSEMBLY__ =20 #include +#include #include =20 #define __VDSO_USE_SYSCALL ULLONG_MAX @@ -71,10 +72,10 @@ static __always_inline u64 __arch_get_hw_counter(s32 cl= ock_mode) u64 res; =20 /* - * clock_mode =3D=3D 0 implies that vDSO are enabled otherwise + * clock_mode =3D=3D VCLOCK_NONE implies that vDSO are disabled so * fallback on syscall. */ - if (clock_mode) + if (clock_mode =3D=3D VCLOCK_NONE) return __VDSO_USE_SYSCALL; =20 /* diff --git a/arch/arm64/include/asm/vdso/vsyscall.h b/arch/arm64/include/as= m/vdso/vsyscall.h index 0c20a7c1bee5..07f78b0da498 100644 --- a/arch/arm64/include/asm/vdso/vsyscall.h +++ b/arch/arm64/include/asm/vdso/vsyscall.h @@ -24,9 +24,7 @@ struct vdso_data *__arm64_get_k_vdso_data(void) static __always_inline int __arm64_get_clock_mode(struct timekeeper *tk) { - u32 use_syscall =3D !tk->tkr_mono.clock->archdata.vdso_direct; - - return use_syscall; + return tk->tkr_mono.clock->archdata.vclock_mode; } #define __arch_get_clock_mode __arm64_get_clock_mode =20 diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm= _arch_timer.c index 9a5464c625b4..9b8d4d00b53b 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -69,7 +69,7 @@ static enum arch_timer_ppi_nr arch_timer_uses_ppi =3D ARC= H_TIMER_VIRT_PPI; static bool arch_timer_c3stop; static bool arch_timer_mem_use_virtual; static bool arch_counter_suspend_stop; -static bool vdso_default =3D true; +static int vdso_default =3D VCLOCK_CNTVCT; =20 static cpumask_t evtstrm_available =3D CPU_MASK_NONE; static bool evtstrm_enable =3D IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM); @@ -560,8 +560,8 @@ void arch_timer_enable_workaround(const struct arch_tim= er_erratum_workaround *wa * change both the default value and the vdso itself. */ if (wa->read_cntvct_el0) { - clocksource_counter.archdata.vdso_direct =3D false; - vdso_default =3D false; + clocksource_counter.archdata.vclock_mode =3D VCLOCK_NONE; + vdso_default =3D VCLOCK_NONE; } } =20 @@ -979,7 +979,7 @@ static void __init arch_counter_register(unsigned type) } =20 arch_timer_read_counter =3D rd; - clocksource_counter.archdata.vdso_direct =3D vdso_default; + clocksource_counter.archdata.vclock_mode =3D vdso_default; } else { arch_timer_read_counter =3D arch_counter_get_cntvct_mem; } --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455639; cv=none; d=zohomail.com; s=zohoarc; b=GyT5Hwh7zJYxjDymWxzkv1HvNB46cbY2MMLXXEnzxOcxYnMBGMwt+Zd9jzZRKoKjGnI6EE98IVbVFubZio4NDKblJVPn4GadytRo8koC5t3TMe78K7sa8I36HnHZZ/krAliNkdTEPBFfIHWFEa7OW6pZzlkz0wnWh/7nJyg5ZfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0LSJ5HZDSlSzhkMBmWY4jfyyCQqtSmEQ2dTLJMx5BFk=; b=YsS5L1QtEE8p7BxZt3VPQ6zWmGYHC35HOEpKlZ+aZNKfweryDfxwYeOWO+VfKR2UEoueMTNyOZUlX7Thxd1I71kp8Ie8lr0qJUaYGeFNjXdAZiTFCnt+kMz/nI1Gy1SAwuQ5rrdkhFCdgoG2vXqEK/ab+IXuYnR3K5wSPguaiPo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455639387571.7756305002235; Sun, 15 Dec 2019 16:20:39 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7C-0006mV-N0; Mon, 16 Dec 2019 00:19:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7B-0006m8-FQ for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:19:57 +0000 Received: from mail-qk1-x744.google.com (unknown [2607:f8b0:4864:20::744]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ca18ce18-1f99-11ea-88e7-bc764e2007e4; Mon, 16 Dec 2019 00:19:56 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id z76so889710qka.2 for ; Sun, 15 Dec 2019 16:19:56 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id i28sm6346240qtc.57.2019.12.15.16.19.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:56 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id AC2A822434; Sun, 15 Dec 2019 19:19:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:55 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id EB795306012F; Sun, 15 Dec 2019 19:19:54 -0500 (EST) X-Inumbo-ID: ca18ce18-1f99-11ea-88e7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qJHTf9gLZO0OmW0oKiFiaoMPD31UWwBIv/AQO8x022Q=; b=UCmY/B2PlCGXERTqtwgVAtc2JqLgwUuUJuM66myj3BI4trxbjf3g0TnSG6nt58tAr5 b6wmX04u6YUR9eii5m+YXMa0EHZfMbtFJz9VgI+Ygal0hewZUXXIVCeMfWObhUfyF884 ccoID02pgYC30wQuv/zvjzzmDqkBrJJHen+E411WY7HJgXTj6Wx6U3NKulvnMa5Govq9 DZ478mLox8WXtHb8Ijf7WIhQI4NskICyGfTV78MMNlQTmCghtj1RoL0rAINJT9xwhXHE TFSowtCHOCjZF2GfjW67JnBz9elQipCHK+6FWG2DnYry+jvTyvmUDGnSXckYfxC8F5D2 F7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qJHTf9gLZO0OmW0oKiFiaoMPD31UWwBIv/AQO8x022Q=; b=VOxIF20+WVull07q3Guy2LO74xKpbr/rxT49VQw8qyeK8fBZLG3+sYgCWN5xAh5Bg/ hBDGBiO7k0EfeM2+mO3NiuoIFw6756rtiaHTvx2Wz12qxiJOfi4GtdNkGljl4YS5Wnwc utEuLv6mtkNO1xYTPiWd/o92PxsBtE14yTUtHn6iZOBb9puFInfuG6X8Vc3ZHUc4Pd8D 1N0o3nGh4hiFAG6WJewzxcjRSdpfO2b8QskKTVG7TBt5n9JU8wPaGXP/H5HwXDj1/XFV VCEGTnJCo+z/O4GwLB/8fchlwcy53ts41mOwrZqz0yEbjDF407nNwQnNlLTQSnuAeHxp kVyg== X-Gm-Message-State: APjAAAXEBJdM3wUfREZiznVIxW4V3786Rzf4XYrhIekM7iJCjJNmVYlJ StLZltE4/QclcgpnrM2xrLU= X-Google-Smtp-Source: APXvYqziDt2MJepPF60CYkhXmMwNyU7utpHzVQ8iPImbF+lXkZE5ubq26nEL7jVGpgS+wAWhxEIl4A== X-Received: by 2002:a37:a70b:: with SMTP id q11mr24215846qke.393.1576455596683; Sun, 15 Dec 2019 16:19:56 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucffohhmrghinheplhgushdrshgsnecukfhppeehvddr udehhedrudduuddrjedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvg hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheeh hedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg enucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:20 +0800 Message-Id: <20191216001922.23008-5-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 4/6] arm64: vdso: hyperv: Map tsc page into vDSO if enabled X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Vincenzo Frascino , Stephen Hemminger , Greg Kroah-Hartman , Catalin Marinas , Haiyang Zhang , Michael Kelley , Alexios Zavras , Stefano Stabellini , Matteo Croce , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng , Allison Randal Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) On Hyper-V, a tsc page has the data for adjusting cntvct numbers to clocksource cycles, and that's how Hyper-V guest kernel reads the clocksource. In order to allow userspace to read the same clocksource directly, the tsc page has to been mapped into userspace via vDSO. Use the framework for vDSO set-up in __vdso_init() to do this. Note: if HYPERV_TIMER=3Dy but the kernel is using other clocksource or doesn't have the hyperv timer clocksource, tsc page will still be mapped into userspace. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/kernel/vdso.c | 12 ++++++++++++ arch/arm64/kernel/vdso/vdso.lds.S | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index b9b5ec7a3084..18a634987bdc 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -9,6 +9,7 @@ =20 #include #include +#include #include #include #include @@ -105,14 +106,22 @@ static int __vdso_init(enum arch_vdso_type arch_index) struct page **vdso_code_pagelist; unsigned long nr_vdso_pages; unsigned long pfn; + struct ms_hyperv_tsc_page *tsc_page; + int tsc_page_idx; =20 if (memcmp(vdso_lookup[arch_index].vdso_code_start, "\177ELF", 4)) { pr_err("vDSO is not a valid ELF object!\n"); return -EINVAL; } =20 + /* One vDSO data page */ vdso_lookup[arch_index].nr_vdso_data_pages =3D 1; =20 + /* Grab the Hyper-V tsc page, if enabled, add one more page */ + tsc_page =3D hv_get_tsc_page(); + if (tsc_page) + tsc_page_idx =3D vdso_lookup[arch_index].nr_vdso_data_pages++; + vdso_lookup[arch_index].nr_vdso_code_pages =3D ( vdso_lookup[arch_index].vdso_code_end - vdso_lookup[arch_index].vdso_code_start) >> @@ -130,6 +139,9 @@ static int __vdso_init(enum arch_vdso_type arch_index) /* Grab the vDSO data page. */ vdso_pagelist[0] =3D phys_to_page(__pa_symbol(vdso_data)); =20 + if (tsc_page) + vdso_pagelist[tsc_page_idx] =3D phys_to_page(__pa(tsc_page)); + /* Grab the vDSO code pages. */ pfn =3D sym_to_pfn(vdso_lookup[arch_index].vdso_code_start); =20 diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vds= o.lds.S index 7ad2d3a0cd48..e40a1f5a6d30 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -17,7 +17,17 @@ OUTPUT_ARCH(aarch64) =20 SECTIONS { - PROVIDE(_vdso_data =3D . - PAGE_SIZE); + /* + * vdso data pages: + * vdso data (1 page) + * hv tsc page (1 page if enabled) + */ + PROVIDE(_vdso_data =3D _hvclock_page - PAGE_SIZE); +#ifdef CONFIG_HYPERV_TIMER + PROVIDE(_hvclock_page =3D . - PAGE_SIZE); +#else + PROVIDE(_hvclock_page =3D .); +#endif . =3D VDSO_LBASE + SIZEOF_HEADERS; =20 .hash : { *(.hash) } :text --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455644; cv=none; d=zohomail.com; s=zohoarc; b=k6DZgC5tApKUoEBI9uz7KBNIdwk2AJGtxO+4H3IprbAsvpf20ntSq/Xj99QukFkkbfWTuq4fF96qrnyOmEQCFU6tO+Veg68bn7Sni0i+QZtO7w2wU1ZRztY2B+upU2Ev/F2wGCtQcI1CAjfJHrD7kx7z3iFulEsoUGsQbL7Rcr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455644; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+qk0i4Rs1pzUl5xDr+gaXIZPsA2tqXb70kYZEkewTRs=; b=oE9PU0CxeUZQHrkt2aiC7JXkiy7bYJm4pLMbx5COzPOKM4UIzifbvSFbSAnHvhTbrGaMxf31YKUuogWeG0pnQu+xtLc9tkQpTlhH9XJHf+tuek2ZLJf9Fvee4GJciLGAGev7E25dLkOL8zKPJMGOOLd47vUpxe0yvAMzZ7Z4Gro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455644901949.3515044445755; Sun, 15 Dec 2019 16:20:44 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7F-0006nh-0Q; Mon, 16 Dec 2019 00:20:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7D-0006n6-Ct for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:19:59 +0000 Received: from mail-qk1-x741.google.com (unknown [2607:f8b0:4864:20::741]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cb387a82-1f99-11ea-b6f1-bc764e2007e4; Mon, 16 Dec 2019 00:19:58 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id c17so3085676qkg.7 for ; Sun, 15 Dec 2019 16:19:58 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id c3sm5440772qkk.8.2019.12.15.16.19.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:58 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 9C34422430; Sun, 15 Dec 2019 19:19:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:57 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 1C0B1306012F; Sun, 15 Dec 2019 19:19:56 -0500 (EST) X-Inumbo-ID: cb387a82-1f99-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=usI7ZLlrtnzO1xtvE7qJdWgNGyWRiX0DoyyW1z56fjQ=; b=ZcL1vAcUgKjuyp97OeIAQ0epiqggmuG3QljxDovgnIuPeifT/+ziT7ngleb475gqEn 9Id1YfFkwJtqKMX0R1rk4968ygu0mENq1hVBHVVJjj7GS6YEfuggH3SpS/odI+aZbuZ+ wR1yKLxVoaENYO8aHVbpIBMGdc4fc6a0jRTmluYEgR7vyqYJmsDxWaczEy3PKU2+pxMW 4r5P1g4JLkfLLzURF05vGcUJxbw7J3nbdZaBY2LNdkHfzssQ0qogl+PdzqVn4BSuUfn+ nbAbEfWsiinDCitUgRfKhjdzIctPFTcitdQwBDqSgMyKeBA1RokL0sW+os4Hxyvm/m+6 lbXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=usI7ZLlrtnzO1xtvE7qJdWgNGyWRiX0DoyyW1z56fjQ=; b=bEzhwG+NmIvmCRVTMU/wJ7jw8YOzhtLuVZqAUMEgGXt5y1Lk5mmPLjVEZE4pqCXjeq yQkIt7Me+cX4TnkdBsBXqFSM3sGjUf6Uo5lkQV+N2K2yXIatuBNwkOSfo/1vSxYsw75f PIZZXXIWNCkRB6nFpisej8vtbECn9VstTxxRjKIh2+hpTNOtlGViJd9g4dR8AAbKuu7W LQfX1595O/EjloWCCN/T+XMuNAM/5+fXIQAjwLgGeZ4YN38Hqiv4anGytHQpsDKOflqx sjhJzLj3+/QKxmP5XQTyX3jwjaKs3c88VcV9o7ZJtdUf3hfM/amE7NA5u1JPNBsHoE8J 2tsA== X-Gm-Message-State: APjAAAXcjA6tcdbkm3wWM70YrYugpK4XupItro5ZvRtnK8Tb+VetRWaq 5B8axcdrHNWPtyCa08KEYPU= X-Google-Smtp-Source: APXvYqyuGzwONPf0HzeujWXJY0HQfLDKVVu2G/wH3GBxfrZbbw4VCaxRxyLj5AO/cD1ig93OBJk46w== X-Received: by 2002:a05:620a:12d5:: with SMTP id e21mr24635272qkl.44.1576455598605; Sun, 15 Dec 2019 16:19:58 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucfkphephedvrdduheehrdduuddurdejudenucfrrghr rghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrg hlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeep ghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgepfe X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:21 +0800 Message-Id: <20191216001922.23008-6-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 5/6] arm64: hyperv: Enable userspace to read cntvct X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Vincenzo Frascino , Stephen Hemminger , Catalin Marinas , Haiyang Zhang , Michael Kelley , Stefano Stabellini , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Since reading hyperv-timer clocksource requires reading cntvct, userspace should be allowed to read it, otherwise reading cntvct will result in traps, which makes vsyscall's cost similar compared to syscall's. So enable it on every cpu when a Hyper-V guest booting up. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/hyperv/hv_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/hyperv/hv_init.c b/arch/arm64/hyperv/hv_init.c index 86e4621d5885..1ea97ecfb143 100644 --- a/arch/arm64/hyperv/hv_init.c +++ b/arch/arm64/hyperv/hv_init.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,7 @@ EXPORT_SYMBOL_GPL(hv_max_vp_index); static int hv_cpu_init(unsigned int cpu) { u64 msr_vp_index; + u32 cntkctl; =20 hv_get_vp_index(msr_vp_index); =20 @@ -53,6 +55,11 @@ static int hv_cpu_init(unsigned int cpu) if (msr_vp_index > hv_max_vp_index) hv_max_vp_index =3D msr_vp_index; =20 + /* Enable EL0 to access cntvct */ + cntkctl =3D arch_timer_get_cntkctl(); + cntkctl |=3D ARCH_TIMER_USR_VCT_ACCESS_EN; + arch_timer_set_cntkctl(cntkctl); + return 0; } =20 --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat Apr 27 21:05:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576455650; cv=none; d=zohomail.com; s=zohoarc; b=LNH7ly4CAtzd6m0z7/084exxmIvjR3Ufdysfuphe+MjNLdTOnVgU1Sdz07BTNkRikXlxBH+stdqSoxQwK5QjLH5UcU2KitzCBY+8frq6wkj9NmkeZBCKqOfD1kWSYryEEpRUGjFnGfrWju0URSwbkvUHEJaWLilq0U9jZ9bJrO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576455650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9oPLsX/PKlQa97rV2WQ4GN1RMJTs/vdsKAuniSXRPIM=; b=MKOtS34m/mdx/mKGrblgKenjqjmWV/XjWZ+I0xQXDfWbb3M63Q/pLfrD2hABqe5YJMJ95u97pezP9ZW8fHK0LXs5AEUBxD3uLeXEsawEX+5lVBl0U3FVDTlbyNcv6Ee72V9bXRDXxFjgvF3vjphgu8+qXcvIQl84NVC+ojAphSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576455650764717.1605063385074; Sun, 15 Dec 2019 16:20:50 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7N-0007Sl-AP; Mon, 16 Dec 2019 00:20:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ige7M-0007Ow-09 for xen-devel@lists.xenproject.org; Mon, 16 Dec 2019 00:20:08 +0000 Received: from mail-qk1-x744.google.com (unknown [2607:f8b0:4864:20::744]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cfc2af5a-1f99-11ea-88e7-bc764e2007e4; Mon, 16 Dec 2019 00:20:07 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id j9so2938094qkk.1 for ; Sun, 15 Dec 2019 16:20:06 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id h1sm5312169qkc.38.2019.12.15.16.20.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:20:05 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 18F2B22442; Sun, 15 Dec 2019 19:20:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:20:04 -0500 Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 69CB980063; Sun, 15 Dec 2019 19:20:03 -0500 (EST) X-Inumbo-ID: cfc2af5a-1f99-11ea-88e7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7S615KofXaQ1yUG/3GM94cEkec6rvE87OWT0R1mkHVE=; b=nqPgX5mFOvAOvhSP8TsLpj5UaQakaOAGyTfIYXnrJ98dEtbMpEP8y70bY2krwxvBGv 3sK8HR/8589X7H4aSpRQYDfPVFxXCiHAWknqhsEK4Dqnmtom1eCmt/84ndxMicvGc0tX SK1DtIiUK/u/cmwstnoeopb3cfXxGD4PGhoanmWF1wQx39CgqDz+4kssxSIdbFWyWPOB y63NGEJciBnX0t8sIT3OXdy/PBOf6jMsRpwBBJWBXrJ9vblwvEfFYeeNeGZ2SeNxLe1f oSONG29STbtZuutO4OQ8C6uyMnSUAFvzBbOaI53Zjw4vhBWJIWjfAI2QyCTMnpNHF0F/ 6NtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7S615KofXaQ1yUG/3GM94cEkec6rvE87OWT0R1mkHVE=; b=o0hQY65NiZVtQaQFmBuSVBIhwVdam8R/IsP4wML81kSe0WBmdNQ6d4YpwTVaym/s3+ /pbTxC09n0ZA8F5nH0oLB3c3WYAORSr6Hq9pGQ8f+vSn+8HuaTuzKFpgPnA7S0skyVUz XWL8heCp55QMAISFOsXecyl/e1PQXBZOEtDe8+Gf0HAj3tH/cYTi/WlAYk25cSssMTAD LpilLAbdd6BfnYvFqlcKa8pGJpmOWpTzG4FY/LIdZKmffSa3MCEs4DVjhW3OKg9h7Sx5 Gl+nAHTmfjUaKIUQ2vGCdhHbJ8WNVBbb+2YdK3m1O7erqzpfvVCmS+uBbLFS7p/DpzL9 9svQ== X-Gm-Message-State: APjAAAXr722Tf+QA3tSlPM3rINPiWdW2foPhXkgCShPMXxkJgd4bGzq4 NXSGxxyVwPKRqWXxut5Z+uk= X-Google-Smtp-Source: APXvYqw+Sd5f8LCDwfYgXxyt3Pq91Kobn432DMObcmpR4URJPQMO29VkBjNnlDH47LvcwB6Snoz7LA== X-Received: by 2002:a37:684a:: with SMTP id d71mr22545035qkc.201.1576455606206; Sun, 15 Dec 2019 16:20:06 -0800 (PST) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucfkphephedvrdduheehrdduuddurdejudenucfrrghr rghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrg hlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeep ghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgepge X-ME-Proxy: From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 16 Dec 2019 08:19:22 +0800 Message-Id: <20191216001922.23008-7-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191216001922.23008-1-boqun.feng@gmail.com> References: <20191216001922.23008-1-boqun.feng@gmail.com> MIME-Version: 1.0 Subject: [Xen-devel] [RFC 6/6] arm64: hyperv: Enable vDSO X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Vincenzo Frascino , Stephen Hemminger , Catalin Marinas , Haiyang Zhang , Michael Kelley , Stefano Stabellini , xen-devel@lists.xenproject.org, Thomas Gleixner , "K. Y. Srinivasan" , Will Deacon , Boqun Feng Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Similar to x86, add a new vclock_mode VCLOCK_HVCLOCK, and reuse the hv_read_tsc_page() for userspace to read tsc page clocksource. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/include/asm/clocksource.h | 3 ++- arch/arm64/include/asm/mshyperv.h | 2 +- arch/arm64/include/asm/vdso/gettimeofday.h | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/clocksource.h b/arch/arm64/include/asm/= clocksource.h index fbe80057468c..c6acd45fe748 100644 --- a/arch/arm64/include/asm/clocksource.h +++ b/arch/arm64/include/asm/clocksource.h @@ -4,7 +4,8 @@ =20 #define VCLOCK_NONE 0 /* No vDSO clock available. */ #define VCLOCK_CNTVCT 1 /* vDSO should use cntvcnt */ -#define VCLOCK_MAX 1 +#define VCLOCK_HVCLOCK 2 /* vDSO should use vread_hvclock() */ +#define VCLOCK_MAX 2 =20 struct arch_clocksource_data { int vclock_mode; diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/msh= yperv.h index 0afb00e3501d..7c85dd816dca 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -90,7 +90,7 @@ extern void hv_get_vpreg_128(u32 reg, struct hv_get_vp_re= gister_output *result); #define hv_set_reference_tsc(val) \ hv_set_vpreg(HV_REGISTER_REFERENCE_TSC, val) #define hv_set_clocksource_vdso(val) \ - ((val).archdata.vclock_mode =3D VCLOCK_NONE) + ((val).archdata.vclock_mode =3D VCLOCK_HVCLOCK) =20 #if IS_ENABLED(CONFIG_HYPERV) #define hv_enable_stimer0_percpu_irq(irq) enable_percpu_irq(irq, 0) diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/includ= e/asm/vdso/gettimeofday.h index e6e3fe0488c7..7e689b903f4d 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -67,6 +67,20 @@ int clock_getres_fallback(clockid_t _clkid, struct __ker= nel_timespec *_ts) return ret; } =20 +#ifdef CONFIG_HYPERV_TIMER +/* This will override the default hv_get_raw_timer() */ +#define hv_get_raw_timer() __arch_counter_get_cntvct() +#include + +extern struct ms_hyperv_tsc_page +_hvclock_page __attribute__((visibility("hidden"))); + +static u64 vread_hvclock(void) +{ + return hv_read_tsc_page(&_hvclock_page); +} +#endif + static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) { u64 res; @@ -78,6 +92,11 @@ static __always_inline u64 __arch_get_hw_counter(s32 clo= ck_mode) if (clock_mode =3D=3D VCLOCK_NONE) return __VDSO_USE_SYSCALL; =20 +#ifdef CONFIG_HYPERV_TIMER + if (likely(clock_mode =3D=3D VCLOCK_HVCLOCK)) + return vread_hvclock(); +#endif + /* * This isb() is required to prevent that the counter value * is speculated. --=20 2.24.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel