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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 DA562C432BE for ; Thu, 26 Aug 2021 08:51:22 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 55EC361076 for ; Thu, 26 Aug 2021 08:51:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 55EC361076 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DD9444B175; Thu, 26 Aug 2021 04:51:21 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eDr0ShwnDSzJ; Thu, 26 Aug 2021 04:51:16 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 74A234B169; Thu, 26 Aug 2021 04:51:16 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 64F904B13A for ; Thu, 26 Aug 2021 04:51:15 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E3fymWSFg7bV for ; Thu, 26 Aug 2021 04:51:10 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id AEEFA4B11B for ; Thu, 26 Aug 2021 04:51:10 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 282DD61076; Thu, 26 Aug 2021 08:51:08 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mJB6I-007JEw-1K; Thu, 26 Aug 2021 09:51:06 +0100 Date: Thu, 26 Aug 2021 09:51:05 +0100 Message-ID: <875yvspp1i.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Subject: Re: [PATCH v2] arm64: Do not trap PMSNEVFR_EL1 In-Reply-To: <20210824154523.906270-1-alexandru.elisei@arm.com> References: <20210824154523.906270-1-alexandru.elisei@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, broonie@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: catalin.marinas@arm.com, broonie@kernel.org, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Tue, 24 Aug 2021 16:45:23 +0100, Alexandru Elisei wrote: > > Commit 31c00d2aeaa2 ("arm64: Disable fine grained traps on boot") zeroed > the fine grained trap registers to prevent unwanted register traps from > occuring. However, for the PMSNEVFR_EL1 register, the corresponding > HDFG{R,W}TR_EL2.nPMSNEVFR_EL1 fields must be 1 to disable trapping. Set > both fields to 1 if FEAT_SPEv1p2 is detected to disable read and write > traps. > > Fixes: 31c00d2aeaa2 ("arm64: Disable fine grained traps on boot") > Signed-off-by: Alexandru Elisei > --- > Based on v5.14-rc7. Tested on the model, using boot-wrapper built from > commit 5cd6238ec4ef ("aarch32: fix .globl replacement"). Without this > patch, in NVHE mode, the model freezes when I try to access PMSNEVFR_EL1. > With this patch, the model doesn't hang anymore. > > Changes since v1: > > * Set the corresponding bit in HDFGWRTR_EL2 to also disable write traps. My > thanks to Mark for pointing it out. > > arch/arm64/include/asm/el2_setup.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h > index b83fb24954b7..3198acb2aad8 100644 > --- a/arch/arm64/include/asm/el2_setup.h > +++ b/arch/arm64/include/asm/el2_setup.h > @@ -149,8 +149,17 @@ > ubfx x1, x1, #ID_AA64MMFR0_FGT_SHIFT, #4 > cbz x1, .Lskip_fgt_\@ > > - msr_s SYS_HDFGRTR_EL2, xzr > - msr_s SYS_HDFGWTR_EL2, xzr > + mov x0, xzr > + mrs x1, id_aa64dfr0_el1 > + ubfx x1, x1, #ID_AA64DFR0_PMSVER_SHIFT, #4 > + cmp x1, #3 > + b.lt .Lset_fgt_\@ > + /* Disable PMSNEVFR_EL1 read and write traps */ > + orr x0, x0, #(1 << 62) > + > +.Lset_fgt_\@: > + msr_s SYS_HDFGRTR_EL2, x0 > + msr_s SYS_HDFGWTR_EL2, x0 > msr_s SYS_HFGRTR_EL2, xzr > msr_s SYS_HFGWTR_EL2, xzr > msr_s SYS_HFGITR_EL2, xzr The beauty of negative trap bits... Thankfully this seems to be the only one. Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm