Commit 72b96ee2 authored by Jithu Joseph's avatar Jithu Joseph Committed by Ilpo Järvinen

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: default avatarJithu Joseph <jithu.joseph@intel.com>
Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: default avatarPengfei Xu <pengfei.xu@intel.com>
Link: https://lore.kernel.org/r/20231005195137.3117166-5-jithu.joseph@intel.comSigned-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 07f47c01
...@@ -199,9 +199,17 @@ union ifs_chunks_auth_status_gen2 { ...@@ -199,9 +199,17 @@ union ifs_chunks_auth_status_gen2 {
union ifs_scan { union ifs_scan {
u64 data; u64 data;
struct { struct {
u32 start :8; union {
u32 stop :8; struct {
u32 rsvd :16; u8 start;
u8 stop;
u16 rsvd;
} gen0;
struct {
u16 start;
u16 stop;
} gen2;
};
u32 delay :31; u32 delay :31;
u32 sigmce :1; u32 sigmce :1;
}; };
...@@ -211,9 +219,17 @@ union ifs_scan { ...@@ -211,9 +219,17 @@ union ifs_scan {
union ifs_status { union ifs_status {
u64 data; u64 data;
struct { struct {
u32 chunk_num :8; union {
u32 chunk_stop_index :8; struct {
u32 rsvd1 :16; u8 chunk_num;
u8 chunk_stop_index;
u16 rsvd1;
} gen0;
struct {
u16 chunk_num;
u16 chunk_stop_index;
} gen2;
};
u32 error_code :8; u32 error_code :8;
u32 rsvd2 :22; u32 rsvd2 :22;
u32 control_error :1; u32 control_error :1;
......
...@@ -171,21 +171,31 @@ static void ifs_test_core(int cpu, struct device *dev) ...@@ -171,21 +171,31 @@ static void ifs_test_core(int cpu, struct device *dev)
union ifs_status status; union ifs_status status;
unsigned long timeout; unsigned long timeout;
struct ifs_data *ifsd; struct ifs_data *ifsd;
int to_start, to_stop;
int status_chunk;
u64 msrvals[2]; u64 msrvals[2];
int retries; int retries;
ifsd = ifs_get_data(dev); ifsd = ifs_get_data(dev);
activate.rsvd = 0; activate.gen0.rsvd = 0;
activate.delay = IFS_THREAD_WAIT; activate.delay = IFS_THREAD_WAIT;
activate.sigmce = 0; activate.sigmce = 0;
activate.start = 0; to_start = 0;
activate.stop = ifsd->valid_chunks - 1; to_stop = ifsd->valid_chunks - 1;
if (ifsd->generation) {
activate.gen2.start = to_start;
activate.gen2.stop = to_stop;
} else {
activate.gen0.start = to_start;
activate.gen0.stop = to_stop;
}
timeout = jiffies + HZ / 2; timeout = jiffies + HZ / 2;
retries = MAX_IFS_RETRIES; retries = MAX_IFS_RETRIES;
while (activate.start <= activate.stop) { while (to_start <= to_stop) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
status.error_code = IFS_SW_TIMEOUT; status.error_code = IFS_SW_TIMEOUT;
break; break;
...@@ -196,13 +206,14 @@ static void ifs_test_core(int cpu, struct device *dev) ...@@ -196,13 +206,14 @@ static void ifs_test_core(int cpu, struct device *dev)
status.data = msrvals[1]; status.data = msrvals[1];
trace_ifs_status(cpu, activate, status); trace_ifs_status(cpu, to_start, to_stop, status.data);
/* Some cases can be retried, give up for others */ /* Some cases can be retried, give up for others */
if (!can_restart(status)) if (!can_restart(status))
break; break;
if (status.chunk_num == activate.start) { status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num;
if (status_chunk == to_start) {
/* Check for forward progress */ /* Check for forward progress */
if (--retries == 0) { if (--retries == 0) {
if (status.error_code == IFS_NO_ERROR) if (status.error_code == IFS_NO_ERROR)
...@@ -211,7 +222,11 @@ static void ifs_test_core(int cpu, struct device *dev) ...@@ -211,7 +222,11 @@ static void ifs_test_core(int cpu, struct device *dev)
} }
} else { } else {
retries = MAX_IFS_RETRIES; retries = MAX_IFS_RETRIES;
activate.start = status.chunk_num; if (ifsd->generation)
activate.gen2.start = status_chunk;
else
activate.gen0.start = status_chunk;
to_start = status_chunk;
} }
} }
......
...@@ -10,25 +10,25 @@ ...@@ -10,25 +10,25 @@
TRACE_EVENT(ifs_status, TRACE_EVENT(ifs_status,
TP_PROTO(int cpu, union ifs_scan activate, union ifs_status status), TP_PROTO(int cpu, int start, int stop, u64 status),
TP_ARGS(cpu, activate, status), TP_ARGS(cpu, start, stop, status),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( u64, status ) __field( u64, status )
__field( int, cpu ) __field( int, cpu )
__field( u8, start ) __field( u16, start )
__field( u8, stop ) __field( u16, stop )
), ),
TP_fast_assign( TP_fast_assign(
__entry->cpu = cpu; __entry->cpu = cpu;
__entry->start = activate.start; __entry->start = start;
__entry->stop = activate.stop; __entry->stop = stop;
__entry->status = status.data; __entry->status = status;
), ),
TP_printk("cpu: %d, start: %.2x, stop: %.2x, status: %llx", TP_printk("cpu: %d, start: %.4x, stop: %.4x, status: %.16llx",
__entry->cpu, __entry->cpu,
__entry->start, __entry->start,
__entry->stop, __entry->stop,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment