From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0BE32297E1 for ; Mon, 13 Jan 2025 16:29:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736785746; cv=none; b=lDxvvzSsI3eXBryuZ9jEyQqxi2rBgJNI2Wji8JEL47rQ9lsdCyC9k+Q3FTPpo6gdyWb8PLvy/MocgNaG3vjl3iLkQNd02f1o0m40sVcQeA2sVlONSFG2D/3iKozWx0ZsFhN4yQvYT5iMtlHq9S7DwTj6R9dJXaiEGwCzvi2UUAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736785746; c=relaxed/simple; bh=aRAJ97/cq2fpEQNhgoJxY3nhr8hcUtlaEsPCnUNWWrc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XNnOE2sScLbhAHGRxvHFgwmfgDsNZInZfpSjwBQwCe8x6CXtt/tzHxo/+Xd4jLbkHUIUpLOhmnzLKdBOiVsW4Hnv7+/sNQ8JgGL/CpO7yFfDTr8oc987u0tW9AFqQ3ZjCeyYyBJMk7E4+MjWtWOa0Fi7CsFDM+e0OPmyPuF0tLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FNlkNasy; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FNlkNasy" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43690d4605dso31620175e9.0 for ; Mon, 13 Jan 2025 08:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736785743; x=1737390543; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=z0Q399qQBeFwQ2AAFvg5rIHC8O+bRX8lVMzO2SMae/g=; b=FNlkNasyje2IuZvX5fQo3mUqBOh7/iM0lUu7+G20/MoewyqELHv1DUt12EkcPcS1Bm H8Prwjcwm6Yf6eDecanbdUBF2Y7wcCS5do5htYI1nSIPTiSCkD8gD/9r7rwIP6Nm5evR D7O+qo2Lmx9ILY24aDmJrdx6VLCvwZLR+iOImAsBCdiG0KdPt9IS+WYBjFvhiD9JChWI Cpc+aW/3GR5D+7Wy7tm6AdaqiF2NseboEr+UyR2lFAAMwsJ3lDPpANSgJTXKo6VCp8zE 52KP0bv8Qj90+7gg9FxGJxm5kx+BEVp6Z4hDs5dZEVgNc5etAGzPwK4chwvZHHu8drWJ SlBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736785743; x=1737390543; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z0Q399qQBeFwQ2AAFvg5rIHC8O+bRX8lVMzO2SMae/g=; b=jJvNj9h6nhgAwf/pEaPZB42LLd1DdXsmykoTPXsuPIMQzm+dQlJFTBwA0tLs208I0L TIVQJjDJBIIaMadMeF794uNvbJRpo401Z7UioHmZuU3vcmXfmdkyk5Kw4HzkGJ1EmZqC 4TuMHT+FWaOU6Fp/TiryXIF/astUQ9rKf14JkVwNS7xcoj7t+pc7ICqLAteVdANpWas1 pmGx8PVdZAlqG08fKvMXAR/fZJ9LgvGV1Wre/vWttUK1y0icW65/G4F7lt/xncJ3DfNr ARaThXGsZVGwwxpmJgCyvE+MA+ULjRVld4CUdaa6o7graMhZCcP3hQRiRS5hNMl5Skoq F/tg== X-Forwarded-Encrypted: i=1; AJvYcCUNyr1fKO1fo3676m49iUE02QizxOTL2b4KxA2vlEUBSZUl0LNol6fGJnGDjdtBMjlOST/CeZ2DivosTX4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywfl6KUqx6K7IzoYJ8Os3N4CtKtbnxg4rYfxWLzkS6TlgPJLR7B ID7ecPwwuWvvdrw/mlF8+99Csq1i5tni4ANTPCOh0mEYuCqXev4LjDqiDXeZxEs= X-Gm-Gg: ASbGncurpQsTV3+x5kK04A8o/eikJdnmmUwhdK8FT4Ii2V4SHM1x83cusUndVJYOzzU HuWqhxpXsFwextBXdyFmxh4yTLa2G94MqSle8CHxKDGj+2mFOw2jbFNGfDUZ5sSQSceekLqXXgy E3C0u82++xWGrbtZslKVfltRTZf1LacRa4DoOFMpeK6qB9tc1UhEfWhcbNQrDpd+5pYq6VTpzwx qJgHcDe9VtK1KKdd+yGzbaCZRDjNExh8sltOAyzVbTlPjWOxnStAO1nzGi21ustQVXS X-Google-Smtp-Source: AGHT+IGulicDFCac9I2VZC0TgSd73omPyF97o27BxwW8eg456AUs6gMtMhOv1+x4cJrRYaETRuDLmA== X-Received: by 2002:a5d:64a1:0:b0:38a:4b8a:ffec with SMTP id ffacd0b85a97d-38a872ef24cmr19513809f8f.33.1736785743184; Mon, 13 Jan 2025 08:29:03 -0800 (PST) Received: from [192.168.68.163] ([212.105.145.205]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a9362947dsm11055865f8f.40.2025.01.13.08.29.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jan 2025 08:29:02 -0800 (PST) Message-ID: Date: Mon, 13 Jan 2025 16:29:01 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 06/10] arm64/sysreg/tools: Move TRFCR definitions to sysreg To: Marc Zyngier Cc: kvmarm@lists.linux.dev, oliver.upton@linux.dev, suzuki.poulose@arm.com, coresight@lists.linaro.org, James Clark , Mark Brown , Joey Gouly , Zenghui Yu , Catalin Marinas , Will Deacon , Mike Leach , Alexander Shishkin , Mark Rutland , Shiqi Liu , James Morse , Anshuman Khandual , Fuad Tabba , "Rob Herring (Arm)" , Raghavendra Rao Ananta , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250107113252.260631-1-james.clark@linaro.org> <20250107113252.260631-7-james.clark@linaro.org> <87cygsqgkh.wl-maz@kernel.org> Content-Language: en-US From: James Clark In-Reply-To: <87cygsqgkh.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/01/2025 1:58 pm, Marc Zyngier wrote: > On Tue, 07 Jan 2025 11:32:43 +0000, > James Clark wrote: >> >> From: James Clark >> >> 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 >> Signed-off-by: James Clark >> Signed-off-by: James Clark > > 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 > 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 > Signed-off-by: Marc Zyngier > Cc: James Clark > Cc: Suzuki K Poulose > Cc: Mark Brown > Cc: Will Deacon > Cc: Catalin Marinas > --- > 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; > }