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 77D77C4345F for ; Fri, 19 Apr 2024 02:21:29 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PqeY/HoIA6jrOhAtN4MWW8q7VxxJCvVl/x3MfiTGqaw=; b=Clzpqk+Qs7nSnC KTtTZgPgURNMd0Z6xtUqyYtuLmof5/uis9CX2LlL0LlFN1uEtvXJ0yNRx6pwCzbuXS4lIKEHw7oXG 1A3ROlIakZoqcLmtwhNHdZbQsMgq++t3AvN0iZvOrApJDbjhswTf04RiPGO7QbXo02D3vwj7zubwc wPY1zAL1Evyc74cU0yfQTiqiZQdhqyb1cztGRbs+l4LCRw5QxUO+eHog2WgptCvmUp2gFIMehNTt/ dA5ayu7iIjVhcm13Je3vUu2832oGFNSyPNSDO1CR25Io8JW/qFzHTTk2Cq6pQd3FV1TfUJPPf1foC HmxxxYMoQt0rSm1BO+1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxdsO-000000049P2-1BUw; Fri, 19 Apr 2024 02:21:20 +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 1rxdsL-000000049OZ-2Vns for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 02:21:19 +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 BA9AB2F; Thu, 18 Apr 2024 19:21:41 -0700 (PDT) Received: from [10.162.43.7] (a077893.blr.arm.com [10.162.43.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD4F53F64C; Thu, 18 Apr 2024 19:21:12 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 07:51:09 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [bootwrapper PATCH 1/2] aarch64: Disable trapping into EL3 while accessing MDSELR_EL1 To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org References: <20240404073726.947215-1-anshuman.khandual@arm.com> <20240404073726.947215-2-anshuman.khandual@arm.com> Content-Language: en-US From: Anshuman Khandual In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240418_192117_714334_2E710889 X-CRM114-Status: GOOD ( 14.37 ) 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 4/18/24 15:57, Mark Rutland wrote: > 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. Sure, makes sense. > > 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