diff options
| author | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
|---|---|---|
| committer | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
| commit | 1ac731c529cd4d6adbce134754b51ff7d822b145 (patch) | |
| tree | 143ab3f35ca5f3b69f583c84e6964b17139c2ec1 /drivers/platform/x86/intel/ifs/ifs.h | |
| parent | 07b4c950f27bef0362dc6ad7ee713aab61d58149 (diff) | |
| parent | 54116d442e001e1b6bd482122043b1870998a1f3 (diff) | |
Merge branch 'next' into for-linus
Prepare input updates for 6.6 merge window.
Diffstat (limited to 'drivers/platform/x86/intel/ifs/ifs.h')
| -rw-r--r-- | drivers/platform/x86/intel/ifs/ifs.h | 68 | 
1 files changed, 48 insertions, 20 deletions
diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 046e39304fd5..93191855890f 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -17,7 +17,7 @@   * In Field Scan (IFS) is a hardware feature to run circuit level tests on   * a CPU core to detect problems that are not caught by parity or ECC checks.   * Future CPUs will support more than one type of test which will show up - * with a new platform-device instance-id, for now only .0 is exposed. + * with a new platform-device instance-id.   *   *   * IFS Image @@ -25,7 +25,10 @@   *   * Intel provides a firmware file containing the scan tests via   * github [#f1]_.  Similar to microcode there is a separate file for each - * family-model-stepping. + * family-model-stepping. IFS Images are not applicable for some test types. + * Wherever applicable the sysfs directory would provide a "current_batch" file + * (see below) for loading the image. + *   *   * IFS Image Loading   * ----------------- @@ -35,7 +38,7 @@   * SHA hashes for the test. Then the tests themselves. Status MSRs provide   * feedback on the success/failure of these steps.   * - * The test files are kept in a fixed location: /lib/firmware/intel/ifs_0/ + * The test files are kept in a fixed location: /lib/firmware/intel/ifs_<n>/   * For e.g if there are 3 test files, they would be named in the following   * fashion:   * ff-mm-ss-01.scan @@ -47,7 +50,7 @@   * (e.g 1, 2 or 3 in the above scenario) into the curent_batch file.   * To load ff-mm-ss-02.scan, the following command can be used::   * - *   # echo 2 > /sys/devices/virtual/misc/intel_ifs_0/current_batch + *   # echo 2 > /sys/devices/virtual/misc/intel_ifs_<n>/current_batch   *   * The above file can also be read to know the currently loaded image.   * @@ -69,16 +72,16 @@   * to migrate those applications to other cores before running a core test.   * It may also be necessary to redirect interrupts to other CPUs.   * - * In all cases reading the SCAN_STATUS MSR provides details on what + * In all cases reading the corresponding test's STATUS MSR provides details on what   * happened. The driver makes the value of this MSR visible to applications   * via the "details" file (see below). Interrupted tests may be restarted.   * - * The IFS driver provides sysfs interfaces via /sys/devices/virtual/misc/intel_ifs_0/ + * The IFS driver provides sysfs interfaces via /sys/devices/virtual/misc/intel_ifs_<n>/   * to control execution:   *   * Test a specific core::   * - *   # echo <cpu#> > /sys/devices/virtual/misc/intel_ifs_0/run_test + *   # echo <cpu#> > /sys/devices/virtual/misc/intel_ifs_<n>/run_test   *   * when HT is enabled any of the sibling cpu# can be specified to test   * its corresponding physical core. Since the tests are per physical core, @@ -87,21 +90,21 @@   *   * For e.g. to test core corresponding to cpu5   * - *   # echo 5 > /sys/devices/virtual/misc/intel_ifs_0/run_test + *   # echo 5 > /sys/devices/virtual/misc/intel_ifs_<n>/run_test   *   * Results of the last test is provided in /sys::   * - *   $ cat /sys/devices/virtual/misc/intel_ifs_0/status + *   $ cat /sys/devices/virtual/misc/intel_ifs_<n>/status   *   pass   *   * Status can be one of pass, fail, untested   *   * Additional details of the last test is provided by the details file::   * - *   $ cat /sys/devices/virtual/misc/intel_ifs_0/details + *   $ cat /sys/devices/virtual/misc/intel_ifs_<n>/details   *   0x8081   * - * The details file reports the hex value of the SCAN_STATUS MSR. + * The details file reports the hex value of the test specific status MSR.   * Hardware defined error codes are documented in volume 4 of the Intel   * Software Developer's Manual but the error_code field may contain one of   * the following driver defined software codes: @@ -127,6 +130,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 @@ -137,6 +141,9 @@  #define SCAN_TEST_PASS				1  #define SCAN_TEST_FAIL				2 +#define IFS_TYPE_SAF			0 +#define IFS_TYPE_ARRAY_BIST		1 +  /* MSR_SCAN_HASHES_STATUS bit fields */  union ifs_scan_hashes_status {  	u64	data; @@ -189,6 +196,17 @@ union ifs_status {  	};  }; +/* MSR_ARRAY_BIST bit fields */ +union ifs_array { +	u64	data; +	struct { +		u32	array_bitmask; +		u16	array_bank; +		u16	rsvd			:15; +		u16	ctrl_result		:1; +	}; +}; +  /*   * Driver populated error-codes   * 0xFD: Test timed out before completing all the chunks. @@ -197,22 +215,22 @@ union ifs_status {  #define IFS_SW_TIMEOUT				0xFD  #define IFS_SW_PARTIAL_COMPLETION		0xFE +struct ifs_test_caps { +	int	integrity_cap_bit; +	int	test_num; +}; +  /**   * struct ifs_data - attributes related to intel IFS driver - * @integrity_cap_bit: MSR_INTEGRITY_CAPS bit enumerating this test   * @loaded_version: stores the currently loaded ifs image version. - * @pkg_auth: array of bool storing per package auth status   * @loaded: If a valid test binary has been loaded into the memory   * @loading_error: Error occurred on another CPU while loading image   * @valid_chunks: number of chunks which could be validated.   * @status: it holds simple status pass/fail/untested   * @scan_details: opaque scan status code from h/w   * @cur_batch: number indicating the currently loaded test file - * @test_num: number indicating the test type   */  struct ifs_data { -	int	integrity_cap_bit; -	bool	*pkg_auth;  	int	loaded_version;  	bool	loaded;  	bool	loading_error; @@ -220,7 +238,6 @@ struct ifs_data {  	int	status;  	u64	scan_details;  	u32	cur_batch; -	int	test_num;  };  struct ifs_work { @@ -229,7 +246,8 @@ struct ifs_work {  };  struct ifs_device { -	struct ifs_data data; +	const struct ifs_test_caps *test_caps; +	struct ifs_data rw_data;  	struct miscdevice misc;  }; @@ -238,11 +256,21 @@ static inline struct ifs_data *ifs_get_data(struct device *dev)  	struct miscdevice *m = dev_get_drvdata(dev);  	struct ifs_device *d = container_of(m, struct ifs_device, misc); -	return &d->data; +	return &d->rw_data; +} + +static inline const struct ifs_test_caps *ifs_get_test_caps(struct device *dev) +{ +	struct miscdevice *m = dev_get_drvdata(dev); +	struct ifs_device *d = container_of(m, struct ifs_device, misc); + +	return d->test_caps;  } +extern bool *ifs_pkg_auth;  int ifs_load_firmware(struct device *dev);  int do_core_test(int cpu, struct device *dev); -const struct attribute_group **ifs_get_groups(void); +extern struct attribute *plat_ifs_attrs[]; +extern struct attribute *plat_ifs_array_attrs[];  #endif  |