mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>,
	inux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Ada Couprie Diaz <ada.coupriediaz@arm.com>
Subject: Re: [PATCH] arm64/debug: Drop redundant DBG_MDSCR_* macros
Date: Tue, 6 May 2025 14:10:46 +0100	[thread overview]
Message-ID: <0be8e3be-a029-4eea-a79c-310b8e0a05c3@arm.com> (raw)
In-Reply-To: <20250417105253.3188976-1-anshuman.khandual@arm.com>

Hi Anshuman,

On 17/04/2025 11:52, Anshuman Khandual wrote:
> MDSCR_EL1 has already been defined in tools sysreg format and hence can be
> used in all debug monitor related call paths. Subsequently all DBG_MDSCR_*
> macros become redundant and hence can be dropped off completely. While here
> convert all variables handling MDSCR_EL1 register as u64 which reflects its
> true width as well.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---

I think the changes make sense, even more so given that `kvm/debug.c` 
already uses the sysreg format definition for MDSCR_EL1.

It looks good to me, but I think there is a missing conversion to 64 
bits below.
Would it make sense to convert the two instances of MDSCR_EL1 used in 
`tools/testing/selftests/kvm/arm64/debug-exceptions.c`, in 
`enable_monitor_debug_exceptions()` and `install_ss()` , to 64 bits as 
well ? (They don't rely on `DBG_MDSCR_*`, the test defines its own macros)

> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index b260ddc4d3e9..6dbfc1008007 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -354,7 +354,7 @@ static void cortex_a76_erratum_1463225_svc_handler(void)
>   
>   	__this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 1);
>   	reg = read_sysreg(mdscr_el1);
> -	val = reg | DBG_MDSCR_SS | DBG_MDSCR_KDE;
> +	val = reg | MDSCR_EL1_SS | MDSCR_EL1_KDE;
>   	write_sysreg(val, mdscr_el1);
>   	asm volatile("msr daifclr, #8");
>   	isb();

Given the change of width to 64 bits elsewhere, shouldn't we change val 
and reg to u64 here as well ?

diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index 73cf6a5f41d8..d61a5ddf53d6 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -344,7 +344,7 @@ static DEFINE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa);
  
  static void cortex_a76_erratum_1463225_svc_handler(void)
  {
-	u32 reg, val;
+	u64 reg, val;
  
  	if (!unlikely(test_thread_flag(TIF_SINGLESTEP)))
  		return;

Thanks,
Ada


  parent reply	other threads:[~2025-05-06 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 10:52 Anshuman Khandual
2025-04-21  6:16 ` Anshuman Khandual
2025-05-05  8:31 ` Anshuman Khandual
2025-05-06 13:10 ` Ada Couprie Diaz [this message]
2025-05-06 13:15   ` Ada Couprie Diaz
2025-05-07  4:17   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0be8e3be-a029-4eea-a79c-310b8e0a05c3@arm.com \
    --to=ada.coupriediaz@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=inux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®