Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3765412rdg; Wed, 18 Oct 2023 05:41:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcBssSLoe+38cmy+zTtEegd2ANBFE3pUKUFHwCG9g6y26J7wzMA7qYBW4MwbBbGyGmmn88 X-Received: by 2002:a05:6a20:9193:b0:136:ea0e:d23 with SMTP id v19-20020a056a20919300b00136ea0e0d23mr5130066pzd.11.1697632885772; Wed, 18 Oct 2023 05:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697632885; cv=none; d=google.com; s=arc-20160816; b=loqJLugHD55oKgSir7mMyHgfazMeYQ/IGELmxrUsikvlzuMiat+PLh05VnKRWFcMpU fr056iTmGxrewfgN9Ok/Lc5re8a3VAQH0OuH3xkuCsMbOFIjus7qFKMN2inWQbGWIDKY idFLu3bLloiQlfk4p6S7DfA6cUEjWoL4QRJDn5xTuVvdflgwa70fDKR84F1Dqr33fLOO VmnnmXc/PxZm6B8LRSwkXbnWkVkBGAGy1l7OK8sKvyEeMeOOxRi5enBqAQlcfpvgZNf0 rqACAhXRmiYN5Lh8O6wMgeMx4GkEfb1hgqMtb5d9I3EAIv4vpfHjdP5yClxOTf5yJPi4 Nfkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=rlavmIobyWmvAhoakpFc1yT5G0b3gv9rn/MewFRj6mc=; fh=H5M+SUWapC/3S02a2TqU9z8XKoVdwzR1WfxqBeup3U8=; b=nmiq4+2sJ+oV6Ow4a1IsFq4FERFf3F8xpW1fwODGyW+OiuFuHwgnsnR/09wemUu+Ys 5bbdOCXd1EjgEb0THluZza3QWLB/ya18Mk8ND82MQ97LXLhJcV6YiedSp0qEVdIVNxNP c4lIG/c/YyC12ZEatgDzob0wTwX94hXNx+oEpjx1p6CaUkmcRmnSeIVj9Nf6tWDF38wH SAuVXWYZmVfebPvbyhsKb0JQtHoRIwYuDSARVhg/KVuZJpOaWjLDJa1B+yXjQPVxbKKB zYmOfYoABMvA6VwUJJFPHwgk0vYZNOmY9SIjfL8zdflv0wrPVJ9jcbvQAFeLuJb4fpWI qyUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnhgzYZk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id mu12-20020a17090b388c00b0026b71fdd505si1517555pjb.177.2023.10.18.05.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 05:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnhgzYZk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A191F80990D9; Wed, 18 Oct 2023 05:41:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbjJRMkz (ORCPT + 99 others); Wed, 18 Oct 2023 08:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjJRMks (ORCPT ); Wed, 18 Oct 2023 08:40:48 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E3041AB for ; Wed, 18 Oct 2023 05:40:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5D8C433CA; Wed, 18 Oct 2023 12:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697632840; bh=ANCj0Q2OJ1qzkkQO+Sp4XFTRcw4ECnG/L7DzjhbHY0o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PnhgzYZkM/eyLI9CA2rHMDopAQgkqfFT1BRiLbSCJoEyPGzAsGy7SKqrTfX89CTVB pE1qCMR/gLq0c7TJ/JQbahHI+QBWuRfY8qbsL8/u6wI4yYrP9eWrQ8nQyizWPxEdR/ d9GOWpiXjJrCe0mV4YeAYuzCtUbxyb1nqjxSo5yBtCEysiG4Ucjwalxw8kxwO6wqJF U3GIIf0c4YHHMmfKdrVigxcM7U+4QOKPuNK4wvPRh1rnDIU1OaKs2u2oE8tiN7y3tn HtHsjD69uI1pKgYtuVdEdJPQ4SUMvEpJUQhWr4zBmwz+6NE/0qzxjOUl5u6QII5smk hLXYiIrqfAPVw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qt5qo-005LoC-6Y; Wed, 18 Oct 2023 13:40:38 +0100 Date: Wed, 18 Oct 2023 13:40:37 +0100 Message-ID: <86r0lsm7cq.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Oliver Upton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: Independently update HDFGRTR_EL2 and HDFGWTR_EL2 In-Reply-To: <20231018030007.1968317-1-anshuman.khandual@arm.com> References: <20231018030007.1968317-1-anshuman.khandual@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/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 05:41:23 -0700 (PDT) On Wed, 18 Oct 2023 04:00:07 +0100, Anshuman Khandual wrote: > > Currently PMSNEVFR_EL1 system register read, and write access EL2 traps are > disabled, via setting the same bit (i.e 62) in HDFGRTR_EL2, and HDFGWTR_EL2 > respectively. Although very similar, bit fields are not exact same in these > two EL2 trap configure registers particularly when it comes to read-only or > write-only accesses such as ready-only 'HDFGRTR_EL2.nBRBIDR' which needs to > be set while enabling BRBE on NVHE platforms. Using the exact same bit mask > fields for both these trap register risk writing into their RESERVED areas, > which is undesirable. Sorry, I don't understand at all what you are describing. You seem to imply that the read and write effects of the FGT doesn't apply the same way. But my reading of the ARM ARM is that behave completely symmetrically. Also, what is nBRBIDR doing here? It is still set to 0. What 'RESERVED' state are you talking about? > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Oliver Upton > Cc: Marc Zyngier > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > This applies on v6.6-rc6. > > I guess it should be okay to use 'x2' as it is in the clobbered register > list for init_el2_state() function. But please do let me know otherwise. > > arch/arm64/include/asm/el2_setup.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h > index 899b5c10f84c..c534afb1a30d 100644 > --- a/arch/arm64/include/asm/el2_setup.h > +++ b/arch/arm64/include/asm/el2_setup.h > @@ -206,16 +206,19 @@ > cbz x1, .Lskip_fgt_\@ > > mov x0, xzr > + mov x2, xzr > mrs x1, id_aa64dfr0_el1 > ubfx x1, x1, #ID_AA64DFR0_EL1_PMSVer_SHIFT, #4 > cmp x1, #3 > b.lt .Lset_debug_fgt_\@ > + > /* Disable PMSNEVFR_EL1 read and write traps */ > - orr x0, x0, #(1 << 62) > + orr x0, x0, #HDFGRTR_EL2_nPMSNEVFR_EL1_MASK > + orr x2, x2, #HDFGWTR_EL2_nPMSNEVFR_EL1_MASK > > .Lset_debug_fgt_\@: > msr_s SYS_HDFGRTR_EL2, x0 > - msr_s SYS_HDFGWTR_EL2, x0 > + msr_s SYS_HDFGWTR_EL2, x2 So what has changed here, aside from clobbering an extra register? The masks are the same, the initial values are the same... Is it in preparation for some other work? /me puzzled. M. -- Without deviation from the norm, progress is not possible.