Re: [PATCH 4/5] platform/x86/intel/ifs: Implement Array BIST test

From: Greg KH
Date: Wed Feb 01 2023 - 00:02:28 EST


On Tue, Jan 31, 2023 at 03:43:01PM -0800, Jithu Joseph wrote:
> Array BIST test (for a particlular core) is triggered by writing
> to MSR_ARRAY_BIST from one sibling of the core.
>
> This will initiate a test for all supported arrays on that
> CPU. Array BIST test may be aborted before completing all the
> arrays in the event of an interrupt or other reasons.
> In this case, kernel will restart the test from that point
> onwards. Array test will also be aborted when the test fails,
> in which case the test is stopped immediately without further
> retry.
>
> Signed-off-by: Jithu Joseph <jithu.joseph@xxxxxxxxx>
> Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---
> drivers/platform/x86/intel/ifs/ifs.h | 12 ++++
> drivers/platform/x86/intel/ifs/runtest.c | 92 ++++++++++++++++++++++++
> 2 files changed, 104 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h
> index 07423bc4e368..b1a997e39216 100644
> --- a/drivers/platform/x86/intel/ifs/ifs.h
> +++ b/drivers/platform/x86/intel/ifs/ifs.h
> @@ -127,6 +127,7 @@
> #include <linux/device.h>
> #include <linux/miscdevice.h>
>
> +#define MSR_ARRAY_BIST 0x00000105
> #define MSR_COPY_SCAN_HASHES 0x000002c2
> #define MSR_SCAN_HASHES_STATUS 0x000002c3
> #define MSR_AUTHENTICATE_AND_COPY_CHUNK 0x000002c4
> @@ -194,6 +195,17 @@ union ifs_status {
> };
> };
>
> +/* MSR_ARRAY_BIST bit fields */
> +union ifs_array {
> + u64 data;
> + struct {
> + u32 array_bitmask :32;
> + u32 array_bank :16;
> + u32 rsvd :15;
> + u32 ctrl_result :1;

This isn't going to work well over time, just mask the bits you want off
properly, don't rely on the compiler to lay them out like this.

Note, we have bitmask and bitfield operations, please use them.

thanks,

greg k-h