Skip to content

Commit 72b96ee

Browse files
jithu83ij-intel
authored andcommitted
platform/x86/intel/ifs: Gen2 Scan test support
Width of chunk related bitfields is ACTIVATE_SCAN and SCAN_STATUS MSRs are different in newer IFS generation compared to gen0. Make changes to scan test flow such that MSRs are populated appropriately based on the generation supported by hardware. Account for the 8/16 bit MSR bitfield width differences between gen0 and newer generations for the scan test trace event too. Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Link: https://lore.kernel.org/r/20231005195137.3117166-5-jithu.joseph@intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 07f47c0 commit 72b96ee

3 files changed

Lines changed: 52 additions & 21 deletions

File tree

drivers/platform/x86/intel/ifs/ifs.h

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,17 @@ union ifs_chunks_auth_status_gen2 {
199199
union ifs_scan {
200200
u64 data;
201201
struct {
202-
u32 start :8;
203-
u32 stop :8;
204-
u32 rsvd :16;
202+
union {
203+
struct {
204+
u8 start;
205+
u8 stop;
206+
u16 rsvd;
207+
} gen0;
208+
struct {
209+
u16 start;
210+
u16 stop;
211+
} gen2;
212+
};
205213
u32 delay :31;
206214
u32 sigmce :1;
207215
};
@@ -211,9 +219,17 @@ union ifs_scan {
211219
union ifs_status {
212220
u64 data;
213221
struct {
214-
u32 chunk_num :8;
215-
u32 chunk_stop_index :8;
216-
u32 rsvd1 :16;
222+
union {
223+
struct {
224+
u8 chunk_num;
225+
u8 chunk_stop_index;
226+
u16 rsvd1;
227+
} gen0;
228+
struct {
229+
u16 chunk_num;
230+
u16 chunk_stop_index;
231+
} gen2;
232+
};
217233
u32 error_code :8;
218234
u32 rsvd2 :22;
219235
u32 control_error :1;

drivers/platform/x86/intel/ifs/runtest.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,31 @@ static void ifs_test_core(int cpu, struct device *dev)
171171
union ifs_status status;
172172
unsigned long timeout;
173173
struct ifs_data *ifsd;
174+
int to_start, to_stop;
175+
int status_chunk;
174176
u64 msrvals[2];
175177
int retries;
176178

177179
ifsd = ifs_get_data(dev);
178180

179-
activate.rsvd = 0;
181+
activate.gen0.rsvd = 0;
180182
activate.delay = IFS_THREAD_WAIT;
181183
activate.sigmce = 0;
182-
activate.start = 0;
183-
activate.stop = ifsd->valid_chunks - 1;
184+
to_start = 0;
185+
to_stop = ifsd->valid_chunks - 1;
186+
187+
if (ifsd->generation) {
188+
activate.gen2.start = to_start;
189+
activate.gen2.stop = to_stop;
190+
} else {
191+
activate.gen0.start = to_start;
192+
activate.gen0.stop = to_stop;
193+
}
184194

185195
timeout = jiffies + HZ / 2;
186196
retries = MAX_IFS_RETRIES;
187197

188-
while (activate.start <= activate.stop) {
198+
while (to_start <= to_stop) {
189199
if (time_after(jiffies, timeout)) {
190200
status.error_code = IFS_SW_TIMEOUT;
191201
break;
@@ -196,13 +206,14 @@ static void ifs_test_core(int cpu, struct device *dev)
196206

197207
status.data = msrvals[1];
198208

199-
trace_ifs_status(cpu, activate, status);
209+
trace_ifs_status(cpu, to_start, to_stop, status.data);
200210

201211
/* Some cases can be retried, give up for others */
202212
if (!can_restart(status))
203213
break;
204214

205-
if (status.chunk_num == activate.start) {
215+
status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num;
216+
if (status_chunk == to_start) {
206217
/* Check for forward progress */
207218
if (--retries == 0) {
208219
if (status.error_code == IFS_NO_ERROR)
@@ -211,7 +222,11 @@ static void ifs_test_core(int cpu, struct device *dev)
211222
}
212223
} else {
213224
retries = MAX_IFS_RETRIES;
214-
activate.start = status.chunk_num;
225+
if (ifsd->generation)
226+
activate.gen2.start = status_chunk;
227+
else
228+
activate.gen0.start = status_chunk;
229+
to_start = status_chunk;
215230
}
216231
}
217232

include/trace/events/intel_ifs.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111
TRACE_EVENT(ifs_status,
1212

13-
TP_PROTO(int cpu, union ifs_scan activate, union ifs_status status),
13+
TP_PROTO(int cpu, int start, int stop, u64 status),
1414

15-
TP_ARGS(cpu, activate, status),
15+
TP_ARGS(cpu, start, stop, status),
1616

1717
TP_STRUCT__entry(
1818
__field( u64, status )
1919
__field( int, cpu )
20-
__field( u8, start )
21-
__field( u8, stop )
20+
__field( u16, start )
21+
__field( u16, stop )
2222
),
2323

2424
TP_fast_assign(
2525
__entry->cpu = cpu;
26-
__entry->start = activate.start;
27-
__entry->stop = activate.stop;
28-
__entry->status = status.data;
26+
__entry->start = start;
27+
__entry->stop = stop;
28+
__entry->status = status;
2929
),
3030

31-
TP_printk("cpu: %d, start: %.2x, stop: %.2x, status: %llx",
31+
TP_printk("cpu: %d, start: %.4x, stop: %.4x, status: %.16llx",
3232
__entry->cpu,
3333
__entry->start,
3434
__entry->stop,

0 commit comments

Comments
 (0)