From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V3 1/2] arm64/debug: Drop redundant DBG_MDSCR_* macros
Date: Wed, 11 Jun 2025 10:55:41 +0100 [thread overview]
Message-ID: <aElRi0Usn8dH6O4m@J2N7QTR9R3> (raw)
In-Reply-To: <68d762d4-a755-4ede-976b-0616bf3aab28@arm.com>
On Wed, Jun 11, 2025 at 09:10:45AM +0530, Anshuman Khandual wrote:
>
>
> On 10/06/25 10:43 PM, Mark Rutland wrote:
> > On Tue, Jun 10, 2025 at 11:01:27AM +0530, 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.
> >
> > I think that for now it'd be best to *only* change over to the
> > generated MDSCR_EL1_* defintions, and leave the register sizes as-is.
>
> I had tried doing that originally but without changing mdscr register size,
> there is a build warning because MDSCR_EL1_MDE is defined as GENMASK(15, 15)
> which is represented as 'long unsigned int'.
>
> #define __GENMASK(h, l) (((~_UL(0)) << (l)) & (~_UL(0) >> (BITS_PER_LONG - 1 - (h))))
>
> arch/arm64/kernel/debug-monitors.c: In function ‘disable_debug_monitors’:
> arch/arm64/kernel/debug-monitors.c:108:13: warning: conversion from ‘long unsigned int’ to ‘u32’ {aka ‘unsigned int’} changes value from ‘18446744073709518847’ to ‘4294934527’ [-Woverflow]
> 108 | disable = ~MDSCR_EL1_MDE;
> | ^
Please mention that in the commit message. As-is, the commit message has
no rationale for changing to u64.
More generally, if you need to make a change to avoid a compiler
warning, please describe that as part of the rationale.
> MDSCR_EL1 is a 64 bit system register as per ARM DDI 0487 L.A (D24.3.20).
> Representing it as u32 does not seem right irrespective of whether the
> extended break point support is enabled or not. Besides even arm64 kvm
> uses u64 for mdscr register.
Sure, but that wasn't my complaint.
My complaint was that it was a logically unrelated change, because you
had provided no rationale as for why it was necessary to change to u64
as a conseqeunce of changing to the generated MDSCR_EL1_* definitions.
Please also note that *almost all* system registers have the
"${REGISTER} is a 64-bit register wording", including things like DAIF,
SPSel, etc. It's necessary to consider the context of use.
Mark.
next prev parent reply other threads:[~2025-06-11 14:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 5:31 [PATCH V3 0/2] arm64/debug: Drop redundant DBG_MDSCR_* macros Anshuman Khandual
2025-06-10 5:31 ` [PATCH V3 1/2] " Anshuman Khandual
2025-06-10 17:13 ` Mark Rutland
2025-06-11 3:40 ` Anshuman Khandual
2025-06-11 9:55 ` Mark Rutland [this message]
2025-06-11 10:31 ` Anshuman Khandual
2025-06-10 5:31 ` [PATCH V3 2/2] KVM: selftests: Change MDSCR_EL1 register holding variables as uint64_t Anshuman Khandual
2025-06-10 17:01 ` Marc Zyngier
2025-06-11 3:45 ` Anshuman Khandual
2025-06-11 9:59 ` Mark Rutland
2025-06-11 12:52 ` Marc Zyngier
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=aElRi0Usn8dH6O4m@J2N7QTR9R3 \
--to=mark.rutland@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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