summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/files/clock.patch
blob: 69914a8daa85478547bab8d9e7bfb6a0140cc32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
Received: from PR3PR08MB5803.eurprd08.prod.outlook.com (2603:10a6:102:82::21)
 by PA4PR08MB7411.eurprd08.prod.outlook.com with HTTPS; Fri, 13 Oct 2023
 15:39:10 +0000
Received: from AS4P190CA0056.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::27)
 by PR3PR08MB5803.eurprd08.prod.outlook.com (2603:10a6:102:82::21) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct
 2023 15:39:09 +0000
Received: from AM7EUR03FT064.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:20b:656:cafe::56) by AS4P190CA0056.outlook.office365.com
 (2603:10a6:20b:656::27) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend
 Transport; Fri, 13 Oct 2023 15:39:09 +0000
Authentication-Results: spf=pass (sender IP is 217.140.110.172)
 smtp.mailfrom=arm.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=arm.com;compauth=pass
 reason=100
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
 217.140.110.172 as permitted sender) receiver=protection.outlook.com;
 client-ip=217.140.110.172; helo=foss.arm.com; pr=C
Received: from 64aa7808-inbound-1.mta.getcheckrecipient.com (34.249.187.16) by
 AM7EUR03FT064.mail.protection.outlook.com (100.127.140.127) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.6907.16 via Frontend Transport; Fri, 13 Oct 2023 15:39:09 +0000
Received: ("Tessian outbound 9127ed4230d2:v211"); Fri, 13 Oct 2023 15:39:09 +0000
Received: from foss.arm.com (217.140.110.172) by
 AM4PEPF00027A68.mail.protection.outlook.com (10.167.16.85) with Microsoft
 SMTP Server id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023
 15:39:01 +0000
X-TS-Email-ID: b1faae51-3dbd-45a3-89df-023fea9fa09b
Received: from c98fc1860025.2
	by 64aa7808-inbound-1.mta.getcheckrecipient.com id F244D5FE-DB5B-4C5D-86B6-7C3DB3A10AF7.1;
	Fri, 13 Oct 2023 15:39:04 +0000
Received: from EUR05-AM6-obe.outbound.protection.outlook.com
    by 64aa7808-inbound-1.mta.getcheckrecipient.com with ESMTPS id c98fc1860025.2
    (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
    Fri, 13 Oct 2023 15:39:04 +0000
Received: from AS9PR06CA0231.eurprd06.prod.outlook.com (2603:10a6:20b:45e::28)
 by AS8PR08MB7766.eurprd08.prod.outlook.com (2603:10a6:20b:526::5) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct
 2023 15:39:01 +0000
Received: from AM4PEPF00027A68.eurprd04.prod.outlook.com
 (2603:10a6:20b:45e:cafe::85) by AS9PR06CA0231.outlook.office365.com
 (2603:10a6:20b:45e::28) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend
 Transport; Fri, 13 Oct 2023 15:39:01 +0000
Authentication-Results-Original: spf=pass (sender IP is 217.140.110.172)
 smtp.mailfrom=arm.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=arm.com;compauth=pass
 reason=100
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
 217.140.110.172 as permitted sender) receiver=protection.outlook.com;
 client-ip=217.140.110.172; helo=foss.arm.com; pr=C
Received: from foss.arm.com (217.140.110.172) by
 AM4PEPF00027A68.mail.protection.outlook.com (10.167.16.85) with Microsoft
 SMTP Server id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023
 15:39:01 +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 DF06611FB;
	Fri, 13 Oct 2023 08:39:40 -0700 (PDT)
Received: from donnerap.arm.com (donnerap.manchester.arm.com [10.32.100.55])
	by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 93F3B3F5A1;
	Fri, 13 Oct 2023 08:38:59 -0700 (PDT)
From: Andre Przywara <andre.przywara@arm.com>
To: linux-eng@arm.com
Cc: Ross Burton <ross.burton@arm.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>
Subject: [PATCH] clocksource/drivers/arm_arch_timer: limit XGene-1 workaround
Date: Fri, 13 Oct 2023 16:38:55 +0100
Message-Id: <20231013153855.40953-1-andre.przywara@arm.com>
X-Mailer: git-send-email 2.25.1
Content-Transfer-Encoding: 8bit
X-EOPAttributedMessage: 1
X-MS-TrafficTypeDiagnostic:
 AM4PEPF00027A68:EE_|AS8PR08MB7766:EE_|AM7EUR03FT064:EE_|PR3PR08MB5803:EE_|PA4PR08MB7411:EE_
Content-Type: text/plain
X-MS-Office365-Filtering-Correlation-Id: d337e9a2-63cc-43e1-7195-08dbcc028ac5
X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr
X-MS-Exchange-AtpMessageProperties: SA|SL
x-checktessianinbound: true
GotBanner: true
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
 =?us-ascii?Q?W6VEdjEMnRdhucLaBdHjkUuilbZAdrKo1ou/SH85OrVGGehejCfkOhHRZOt3?=
 =?us-ascii?Q?DjEL18JlqNkVxH7pYA7IxY9udrSoEm3Ncum9PRUsESGQONS2VkNar6xfQCFA?=
 =?us-ascii?Q?FYOiHlIR6DUwooXqezsOhPI7fgMlEvtUMs4be7XvQeYiAucTMTohDp/cvOVe?=
 =?us-ascii?Q?yCcn0IxpZ4RcvTnCeB0dKGGULTVYcUparXgGovSazhKFFeGLdlojR4UxjPgt?=
 =?us-ascii?Q?cBkJ1XnjsrtwkKuOVix6j/dxL3Gq3jOlfguas+CXWwsW/mpuoqjL246bq4fi?=
 =?us-ascii?Q?XW37EN+W/GUflMJkcEbSkPkM48hcSN3uua9MpZZjRwS9P7pfjMWx5WNXBwRR?=
 =?us-ascii?Q?ix4e9G2pFJzriKbb3epmCrqWNH8GSCz2lQLH17/29EgZ7k+3zHOYytpl8cLS?=
 =?us-ascii?Q?04qvCDElqKBskMlT33aWSxYFwJ/yKOI+MhyF8pj1r+igUjJjdAXJOh2RtjDR?=
 =?us-ascii?Q?Yu/5Dr+nqPK5D8w8LVDxT1nnomVYwLNGUButWZ1Tto1+4aLvGK+7ZjYRkKUC?=
 =?us-ascii?Q?euOc/WPKqMiUOyHPIQ26nS+sZyCpjIOLx0laxL4vHvWSGHWP+cmfRrr/6C7T?=
 =?us-ascii?Q?mJ+SnAcTHi15a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:;DIR:INB;
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7766
X-OrganizationHeadersPreserved: AS8PR08MB7766.eurprd08.prod.outlook.com
Original-Authentication-Results: spf=pass (sender IP is 217.140.110.172)
 smtp.mailfrom=arm.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=arm.com;compauth=pass
 reason=100
Return-Path: Andre.Przywara@arm.com
X-MS-Exchange-Organization-ExpirationStartTime: 13 Oct 2023 15:39:09.3253
 (UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id:
 d337e9a2-63cc-43e1-7195-08dbcc028ac5
X-MS-Exchange-Organization-MessageDirectionality: Originating
X-MS-Exchange-SkipListedInternetSender:
 ip=[217.140.110.172];domain=foss.arm.com
X-MS-Exchange-ExternalOriginalInternetSender:
 ip=[217.140.110.172];domain=foss.arm.com
X-MS-Exchange-Organization-SCL: -1
X-CrossPremisesHeadersPromoted:
 AM7EUR03FT064.eop-EUR03.prod.protection.outlook.com
X-CrossPremisesHeadersFiltered:
 AM7EUR03FT064.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
 AM7EUR03FT064.eop-EUR03.prod.protection.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Exchange-Organization-AuthSource:
 AM4PEPF00027A68.eurprd04.prod.outlook.com
X-MS-Exchange-Organization-AuthAs: Anonymous
X-OriginatorOrg: arm.com
X-MS-Office365-Filtering-Correlation-Id-Prvs:
 e404c495-53d4-4a1f-df80-08dbcc028606
X-Microsoft-Antispam: BCL:0;
X-Forefront-Antispam-Report:
 CIP:34.249.187.16;CTRY:US;LANG:en;SCL:-1;SRV:;IPV:NLI;SFV:SKN;H:foss.arm.com;PTR:foss.arm.com;CAT:NONE;SFS:;DIR:INB;
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 15:39:09.2003
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: d337e9a2-63cc-43e1-7195-08dbcc028ac5
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[34.249.187.16];Helo=[64aa7808-inbound-1.mta.getcheckrecipient.com]
X-MS-Exchange-CrossTenant-AuthSource:
 AM4PEPF00027A68.eurprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5803
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.4813893
X-MS-Exchange-Processed-By-BccFoldering: 15.20.6863.027
X-Microsoft-Antispam-Mailbox-Delivery:
	ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(930097)(140003);
X-Microsoft-Antispam-Message-Info:
	=?iso-8859-1?Q?UusbbB4r89+JG1PTwTvzChCIORyc4r9JNAquAeAl98VMFepKOht2iU7/hp?=
 =?iso-8859-1?Q?gJtf9Afb/AW9UrjvdJx9mqxrr7R29kDTrFCAp5gDu+BGAGJoBoK7lX2upZ?=
 =?iso-8859-1?Q?xS/sEhmOLF6IbGSaR/yCMcGhfmJjHduKv4HWNXQ9zctU3+hiGUjZ7eeM64?=
 =?iso-8859-1?Q?cUhLwFyvfAjoNay4vxc5/qT7oDbJLiCRZBvD6loovXawtL+w/LQHNQaq+p?=
 =?iso-8859-1?Q?aPkeT0QudgS4vFqcbqokUTMED6+f5QSxnjhJ7Dtyl3yL8/vaiqTWqC8PFu?=
 =?iso-8859-1?Q?3A5MbRnRDTp0nWMQGTgO9KTqUkri/b+Z2e2nh5NVP/bN6aBz/f86f0aQmA?=
 =?iso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iczhzBJXZpaCXV1Y7Kvg299eUcbNGVOy6k1bCg4HnbFLobEyQzlh?=
 =?iso-8859-1?Q?YauyhJGhujR7FPrGEbQdCQn8zrhTB58VzpA3pyNUw=3D?=
MIME-Version: 1.0

The AppliedMicro XGene-1 CPU has an erratum where the timer condition
would only consider TVAL, not CVAL. We currently apply a workaround when
seeing the PARTNUM field of MIDR_EL1 being 0x000, under the assumption
that this would match only the XGene-1 CPU model.
However even XGene-3 (aka Ampere eMAG) uses that same part number, and
only differs in the "revision" field: XGene-1's MIDR is 0x500f0000, the
eMAG reports 0x503f0002. Experiments show the latter doesn't show the
faulty behaviour.

Increase the specificity of the check to only consider partnum 0x000 and
revision 0x00, to exclude the Ampere eMAG.
We keep the old definition of APM_CPU_PART_POTENZA, since this is used
in KVM, too, and it's some kind of ABI there.

Fixes: 012f18850452 ("clocksource/drivers/arm_arch_timer: Work around broken CVAL implementations")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Upstream-Status: Submitted
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
Hi,

Ross, Robin, can you give this a spin on your eMAG boxes, to see if the
message ("Broken CNTx_CVAL_EL1, using 31 bit TVAL instead.") disappears?
And confirm that the box still works?

Also appreciate any feedback about the wording of the commit message and
the naming of the symbols.

Cheers,
Andre

 arch/arm64/include/asm/cputype.h     | 2 ++
 drivers/clocksource/arm_arch_timer.c | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 74d00feb62f03..225ba48e00e7e 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -87,6 +87,8 @@
 #define ARM_CPU_PART_CORTEX_A78C	0xD4B
 
 #define APM_CPU_PART_POTENZA		0x000
+#define APM_CPU_PART_XGENE		0x000
+#define APM_CPU_VAR_POTENZA		0x00
 
 #define CAVIUM_CPU_PART_THUNDERX	0x0A1
 #define CAVIUM_CPU_PART_THUNDERX_81XX	0x0A2
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 7dd2c615bce23..071b04f1ee730 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -836,8 +836,9 @@ static u64 __arch_timer_check_delta(void)
 		 * Note that TVAL is signed, thus has only 31 of its
 		 * 32 bits to express magnitude.
 		 */
-		MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
-						 APM_CPU_PART_POTENZA)),
+		MIDR_REV_RANGE(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
+					      APM_CPU_PART_XGENE),
+			       APM_CPU_VAR_POTENZA, 0x0, 0xf),
 		{},
 	};
 
-- 
2.25.1