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 94353C4345F for ; Thu, 18 Apr 2024 10:29:22 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DvDugSV3+BjBSqFGw/b/0lkXxPVLiEYb1P1ccL//xYU=; b=jab4UXqttDPsGZ nZFiHEZxMcw7XZLNTvbhYlxr6gBST6aB7QTV55sDQOkXZjepud3X1bPgptGyTH7rmqcH1SSmI8na1 +Qym8hZwdnsrypg4qEfwTGKDPe2MLu4Dg78FoD/2iebNTYTSWOqTNIwf/Xgm5Nv6EriVUylxmar/F X+CNNRcjCWIGdKpwrN3b6bn3hb7rb4eeVwi3q8vjBvCQkzqwYCNT72RIQWfh20ePlpBoZMTwgCJ0k TqSjeTkrUxC1vkmPqTZwGGHeb2WU15iD+gD77zAfzp/C3Z+XR9Is8MMzj7L6xgYJbAIPgiJkCkx8K hLFFDUIjiDzmI39M50tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxP0x-00000001o5r-1dVv; Thu, 18 Apr 2024 10:29:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxP0v-00000001o50-03N4 for linux-arm-kernel@lists.infradead.org; Thu, 18 Apr 2024 10:29:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED12A339; Thu, 18 Apr 2024 03:29:33 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.19.64]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9C4B73F64C; Thu, 18 Apr 2024 03:29:05 -0700 (PDT) Date: Thu, 18 Apr 2024 11:27:36 +0100 From: Mark Rutland To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org Subject: Re: [bootwrapper PATCH 1/2] aarch64: Disable trapping into EL3 while accessing MDSELR_EL1 Message-ID: References: <20240404073726.947215-1-anshuman.khandual@arm.com> <20240404073726.947215-2-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240404073726.947215-2-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240418_032909_121486_B28984C7 X-CRM114-Status: GOOD ( 16.27 ) 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 On Thu, Apr 04, 2024 at 01:07:25PM +0530, Anshuman Khandual wrote: > This disables trapping into EL3 while accessing MDSELR_EL1 either in EL1 or > EL2 via setting MDCR_EL3.EBWE. But first ensure that FEAT_Debugv8p9 feature > is implemented and enabled looking into ID_AA64DFR0_EL1. The patch itself looks fine, but I'm going to reword the commit message for clarity: | aarch64: Enable access to MDSELR_EL1 from EL2 and below | | FEAT_Debugv8p9 adds a new MDSELR_EL1 register to select between banks of | breakpoints and watchpoints. Accesses to MDSELR_EL1 from EL2 and below trap | to EL3 unless MDCR_EL3.EBWE is set. | | Enable access to MDSELR_EL1 when it is implemented. Mark. > > Signed-off-by: Anshuman Khandual > --- > arch/aarch64/include/asm/cpu.h | 2 ++ > arch/aarch64/init.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h > index d1f8fd9..124ef91 100644 > --- a/arch/aarch64/include/asm/cpu.h > +++ b/arch/aarch64/include/asm/cpu.h > @@ -41,6 +41,7 @@ > #define MDCR_EL3_NSTB_NS_NOTRAP (UL(3) << 24) > #define MDCR_EL3_SBRBE_NOTRAP_NOPROHIBIT (UL(3) << 32) > #define MDCR_EL3_ENPMSN BIT(36) > +#define MDCR_EL3_EBWE BIT(43) > > #define SCR_EL3_RES1 BITS(5, 4) > #define SCR_EL3_NS BIT(0) > @@ -62,6 +63,7 @@ > #define ID_AA64DFR0_EL1_PMSVER BITS(35, 32) > #define ID_AA64DFR0_EL1_TRACEBUFFER BITS(47, 44) > #define ID_AA64DFR0_EL1_BRBE BITS(55, 52) > +#define ID_AA64DFR0_EL1_DEBUGVER BITS(3, 0) > > #define ID_AA64ISAR0_EL1_TME BITS(27, 24) > > diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c > index c4e91e4..37cb45f 100644 > --- a/arch/aarch64/init.c > +++ b/arch/aarch64/init.c > @@ -105,6 +105,9 @@ void cpu_init_el3(void) > if (mrs_field(ID_AA64DFR0_EL1, BRBE)) > mdcr |= MDCR_EL3_SBRBE_NOTRAP_NOPROHIBIT; > > + if (mrs_field(ID_AA64DFR0_EL1, DEBUGVER) >= 11) > + mdcr |= MDCR_EL3_EBWE; > + > msr(MDCR_EL3, mdcr); > > if (mrs_field(ID_AA64PFR0_EL1, SVE)) { > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel