mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.linux.dev, oliver.upton@linux.dev,
	suzuki.poulose@arm.com, coresight@lists.linaro.org,
	James Clark <james.clark@arm.com>,
	Mark Brown <broonie@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Mike Leach <mike.leach@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Shiqi Liu <shiqiliu@hust.edu.cn>,
	James Morse <james.morse@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Fuad Tabba <tabba@google.com>,
	"Rob Herring (Arm)" <robh@kernel.org>,
	Raghavendra Rao Ananta <rananta@google.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 06/10] arm64/sysreg/tools: Move TRFCR definitions to sysreg
Date: Mon, 13 Jan 2025 16:29:01 +0000	[thread overview]
Message-ID: <e9331167-dd9c-44a6-8c59-7e95660959cd@linaro.org> (raw)
In-Reply-To: <87cygsqgkh.wl-maz@kernel.org>



On 12/01/2025 1:58 pm, Marc Zyngier wrote:
> On Tue, 07 Jan 2025 11:32:43 +0000,
> James Clark <james.clark@linaro.org> wrote:
>>
>> From: James Clark <james.clark@arm.com>
>>
>> Convert TRFCR to automatic generation. Add separate definitions for ELx
>> and EL2 as TRFCR_EL1 doesn't have CX. This also mirrors the previous
>> definition so no code change is required.
>>
>> Also add TRFCR_EL12 which will start to be used in a later commit.
>>
>> Unfortunately, to avoid breaking the Perf build with duplicate
>> definition errors, the tools copy of the sysreg.h header needs to be
>> updated at the same time rather than the usual second commit. This is
>> because the generated version of sysreg
>> (arch/arm64/include/generated/asm/sysreg-defs.h), is currently shared
>> and tools/ does not have its own copy.
>>
>> Reviewed-by: Mark Brown <broonie@kernel.org>
>> Signed-off-by: James Clark <james.clark@arm.com>
>> Signed-off-by: James Clark <james.clark@linaro.org>
> 
> I've added the following patch to the series, dropping the TCFCR_ELx
> construct and fixing the code that makes use of it.
> 
> 	M.
> 
>  From fc77862e06ca1c15e44b0c915da193bd8ed855bc Mon Sep 17 00:00:00 2001
> From: Marc Zyngier <maz@kernel.org>
> Date: Sun, 12 Jan 2025 13:08:59 +0000
> Subject: [PATCH] arm64/sysreg: Get rid of TRFCR_ELx SysregFields
> 
> There is no such thing as TRFCR_ELx in the architecture.
> What we have is TRFCR_EL1, for which TRFCR_EL12 is an accessor.
> 
> Rename TRFCR_ELx_* to TRFCR_EL1_*, and fix the bit of code using
> these names.
> 
> Similarly, TRFCR_EL12 is redefined as a mapping to TRFCR_EL1.
> 

I saw your 'mapping' patch but didn't pull it in for whatever reason. LGTM.

Reviewed-by: James Clark <james.clark@linaro.org>

> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> ---
>   arch/arm64/tools/sysreg                          |  8 ++------
>   .../hwtracing/coresight/coresight-etm4x-core.c   | 16 ++++++++--------
>   .../hwtracing/coresight/coresight-etm4x-sysfs.c  | 10 +++++-----
>   drivers/hwtracing/coresight/coresight-trbe.c     |  2 +-
>   4 files changed, 16 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg
> index 4c2c9c6767c93..ac5202e1df862 100644
> --- a/arch/arm64/tools/sysreg
> +++ b/arch/arm64/tools/sysreg
> @@ -1999,7 +1999,7 @@ Field	17:16	ZEN
>   Res0	15:0
>   EndSysreg
>   
> -SysregFields TRFCR_ELx
> +Sysreg	TRFCR_EL1	3	0	1	2	1
>   Res0	63:7
>   UnsignedEnum	6:5	TS
>   	0b0001	VIRTUAL
> @@ -2011,10 +2011,6 @@ Field	1	ExTRE
>   Field	0	E0TRE
>   EndSysregFields
>   
> -Sysreg	TRFCR_EL1	3	0	1	2	1
> -Fields	TRFCR_ELx
> -EndSysreg
> -
>   Sysreg	SMPRI_EL1	3	0	1	2	4
>   Res0	63:4
>   Field	3:0	PRIORITY
> @@ -2991,7 +2987,7 @@ Mapping	ZCR_EL1
>   EndSysreg
>   
>   Sysreg	TRFCR_EL12	3	5	1	2	1
> -Fields	TRFCR_ELx
> +Mapping	TRFCR_EL1
>   EndSysreg
>   
>   Sysreg	SMCR_EL12	3	5	1	2	6
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index fbc4aa3785279..2c1a60577728e 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -275,7 +275,7 @@ static void etm4x_prohibit_trace(struct etmv4_drvdata *drvdata)
>   	if (!drvdata->trfcr)
>   		return;
>   
> -	trfcr = drvdata->trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE);
> +	trfcr = drvdata->trfcr & ~(TRFCR_EL1_ExTRE | TRFCR_EL1_E0TRE);
>   
>   	write_trfcr(trfcr);
>   	kvm_tracing_set_el1_configuration(trfcr);
> @@ -286,9 +286,9 @@ static u64 etm4x_get_kern_user_filter(struct etmv4_drvdata *drvdata)
>   	u64 trfcr = drvdata->trfcr;
>   
>   	if (drvdata->config.mode & ETM_MODE_EXCL_KERN)
> -		trfcr &= ~TRFCR_ELx_ExTRE;
> +		trfcr &= ~TRFCR_EL1_ExTRE;
>   	if (drvdata->config.mode & ETM_MODE_EXCL_USER)
> -		trfcr &= ~TRFCR_ELx_E0TRE;
> +		trfcr &= ~TRFCR_EL1_E0TRE;
>   
>   	return trfcr;
>   }
> @@ -312,7 +312,7 @@ static void etm4x_allow_trace(struct etmv4_drvdata *drvdata)
>   		return;
>   
>   	if (drvdata->config.mode & ETM_MODE_EXCL_HOST)
> -		trfcr = drvdata->trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE);
> +		trfcr = drvdata->trfcr & ~(TRFCR_EL1_ExTRE | TRFCR_EL1_E0TRE);
>   	else
>   		trfcr = etm4x_get_kern_user_filter(drvdata);
>   
> @@ -320,7 +320,7 @@ static void etm4x_allow_trace(struct etmv4_drvdata *drvdata)
>   
>   	/* Set filters for guests and pass to KVM */
>   	if (drvdata->config.mode & ETM_MODE_EXCL_GUEST)
> -		guest_trfcr = drvdata->trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE);
> +		guest_trfcr = drvdata->trfcr & ~(TRFCR_EL1_ExTRE | TRFCR_EL1_E0TRE);
>   	else
>   		guest_trfcr = etm4x_get_kern_user_filter(drvdata);
>   
> @@ -1176,9 +1176,9 @@ static void cpu_detect_trace_filtering(struct etmv4_drvdata *drvdata)
>   	 * tracing at the kernel EL and EL0, forcing to use the
>   	 * virtual time as the timestamp.
>   	 */
> -	trfcr = (TRFCR_ELx_TS_VIRTUAL |
> -		 TRFCR_ELx_ExTRE |
> -		 TRFCR_ELx_E0TRE);
> +	trfcr = (TRFCR_EL1_TS_VIRTUAL |
> +		 TRFCR_EL1_ExTRE |
> +		 TRFCR_EL1_E0TRE);
>   
>   	/* If we are running at EL2, allow tracing the CONTEXTIDR_EL2. */
>   	if (is_kernel_in_hyp_mode())
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> index a9f19629f3f84..c767f8ae4cf1d 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
> @@ -2319,11 +2319,11 @@ static ssize_t ts_source_show(struct device *dev,
>   		goto out;
>   	}
>   
> -	switch (drvdata->trfcr & TRFCR_ELx_TS_MASK) {
> -	case TRFCR_ELx_TS_VIRTUAL:
> -	case TRFCR_ELx_TS_GUEST_PHYSICAL:
> -	case TRFCR_ELx_TS_PHYSICAL:
> -		val = FIELD_GET(TRFCR_ELx_TS_MASK, drvdata->trfcr);
> +	switch (drvdata->trfcr & TRFCR_EL1_TS_MASK) {
> +	case TRFCR_EL1_TS_VIRTUAL:
> +	case TRFCR_EL1_TS_GUEST_PHYSICAL:
> +	case TRFCR_EL1_TS_PHYSICAL:
> +		val = FIELD_GET(TRFCR_EL1_TS_MASK, drvdata->trfcr);
>   		break;
>   	default:
>   		val = -1;
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index d6eb0d525a4d6..fff67aac84181 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1118,7 +1118,7 @@ static u64 cpu_prohibit_trace(void)
>   	u64 trfcr = read_trfcr();
>   
>   	/* Prohibit tracing at EL0 & the kernel EL */
> -	write_trfcr(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE));
> +	write_trfcr(trfcr & ~(TRFCR_EL1_ExTRE | TRFCR_EL1_E0TRE));
>   	/* Return the original value of the TRFCR */
>   	return trfcr;
>   }


  reply	other threads:[~2025-01-13 16:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 11:32 [PATCH v10 00/10] kvm/coresight: Support exclude guest and exclude host James Clark
2025-01-07 11:32 ` [PATCH v10 01/10] KVM: arm64: Drop MDSCR_EL1_DEBUG_MASK James Clark
2025-01-07 11:32 ` [PATCH v10 02/10] KVM: arm64: Get rid of __kvm_get_mdcr_el2() and related warts James Clark
2025-01-07 11:32 ` [PATCH v10 03/10] KVM: arm64: Track presence of SPE/TRBE in kvm_host_data instead of vCPU James Clark
2025-01-07 11:32 ` [PATCH v10 04/10] arm64/sysreg: Add a comment that the sysreg file should be sorted James Clark
2025-01-12 12:49   ` Marc Zyngier
2025-01-13 15:43     ` James Clark
2025-01-13 16:49       ` Marc Zyngier
2025-01-13 17:02         ` Mark Brown
2025-01-14 18:16         ` Rob Herring
2025-01-14 19:45           ` Mark Brown
2025-01-15 10:43           ` James Clark
2025-01-15 13:00             ` Mark Brown
2025-01-07 11:32 ` [PATCH v10 05/10] tools: arm64: Update sysreg.h header files James Clark
2025-01-07 11:32 ` [PATCH v10 06/10] arm64/sysreg/tools: Move TRFCR definitions to sysreg James Clark
2025-01-12 12:58   ` Marc Zyngier
2025-01-12 13:58   ` Marc Zyngier
2025-01-13 16:29     ` James Clark [this message]
2025-01-07 11:32 ` [PATCH v10 07/10] coresight: trbe: Remove redundant disable call James Clark
2025-01-07 11:32 ` [PATCH v10 08/10] KVM: arm64: coresight: Give TRBE enabled state to KVM James Clark
2025-01-07 11:32 ` [PATCH v10 09/10] KVM: arm64: Support trace filtering for guests James Clark
2025-01-07 11:32 ` [PATCH v10 10/10] coresight: Pass guest TRFCR value to KVM James Clark
2025-01-12 14:02 ` (subset) [PATCH v10 00/10] kvm/coresight: Support exclude guest and exclude host 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=e9331167-dd9c-44a6-8c59-7e95660959cd@linaro.org \
    --to=james.clark@linaro.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@arm.com \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=oliver.upton@linux.dev \
    --cc=rananta@google.com \
    --cc=robh@kernel.org \
    --cc=shiqiliu@hust.edu.cn \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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®