From mboxrd@z Thu Jan 1 00:00:00 1970 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 B7E0CC433FE for ; Thu, 20 Oct 2022 09:08:49 +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=cpAUih8Qsjju+45DBydcaodlJwXfHS6SF8IbOJJawyU=; b=VTS55ko2ZC907k NeRtTDNrCl/7lg5CiXfhb02BkAww9oqeguOiQALH04NaOcPp7YvF/srXYAS9BbPLA7CmtaSF0BLyS N7CwR3MitBsuYkRMqMZYktsTuPrbiyFmlkSO9zoZMvCbfL8WWf5ic+rDN3m4mdzJeRE5zPgsquT6N 1St2qR3SO0Da/67NjqNQEuaKhpJFHCLgZJy7iBMwYNtBNsmiOT16197UXfACa6YU0pLBjOvZxYREU hKLkuWkihd8ci4D/By+9cpGV6Jap5bWwlroFY0H0rFCHJX1yS3+IjLhmxO7/F2g248NPtVPWATOCv LRc4LGGLdrF8IXfgUMmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRWq-00CiPB-R7; Thu, 20 Oct 2022 09:07:52 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olRWd-00CiGF-FP for linux-arm-kernel@lists.infradead.org; Thu, 20 Oct 2022 09:07:40 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C25C61A77; Thu, 20 Oct 2022 09:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DF67C43144; Thu, 20 Oct 2022 09:07:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666256858; bh=xyiyg9il/ViIF4bM3FJ9Dsfm9mqVqIoR7isfo23/NMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAbIEMlGW44lpBy4A+Jy0Xv5KOgwSHnfozq6Kwr/9VVOntb+tOyDQV03qTIrlIJ8Y l/MnIdIr5P7PEIHhwY4K2D30+Mbq713bwK/QtmVGXp3mi2kWkvMS0ySnStahPxnDDf R/OwUTMIojl0j9DQbhGulf05qRL9qmRLyeJmPNAY9C9d0TrRTpZl6SFR2uk/wvCbQ0 L0H+u77VaYd3aj0d1ut1KtLpl9kP/JoARYZICVBPipLG3db0R4Hrn8kk9VeF3cO7qb oUZ3w/db57sG/5hO7PxtP2f5fyk9HyLa2tLw1CErlGWQAdyhmhHChiweSqB3SSPPv0 uah1VH+mkq/sw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1olRWZ-000Buf-T2; Thu, 20 Oct 2022 10:07:35 +0100 From: Marc Zyngier To: , , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Quentin Perret , Will Deacon , Fuad Tabba Subject: [PATCH 05/17] arm64: Allow EL1 physical timer access when running VHE Date: Thu, 20 Oct 2022 10:07:15 +0100 Message-Id: <20221020090727.3669908-6-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221020090727.3669908-1-maz@kernel.org> References: <20221020090727.3669908-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, oliver.upton@linux.dev, qperret@google.com, will@kernel.org, tabba@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221020_020739_567861_3F325C34 X-CRM114-Status: GOOD ( 12.46 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To initialise the timer access from EL2 when HCR_EL2.E2H is set, we must make use the CNTHCTL_EL2 formap used is appropriate. This amounts to shifting the timer/counter enable bits by 10 to the left. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/el2_setup.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index 668569adf4d3..fa1045f709bb 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -34,6 +34,11 @@ */ .macro __init_el2_timers mov x0, #3 // Enable EL1 physical timers + mrs x1, hcr_el2 + and x1, x1, #HCR_E2H + cbz x1, .LnVHE_\@ + lsl x0, x0, #10 +.LnVHE_\@: msr cnthctl_el2, x0 msr cntvoff_el2, xzr // Clear virtual offset .endm -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel