Re: [PATCH v4 04/10] platform/x86/intel/ifs: Read IFS firmware image

From: Greg KH
Date: Tue Apr 26 2022 - 06:47:24 EST


On Fri, Apr 22, 2022 at 01:02:13PM -0700, Tony Luck wrote:
> From: Jithu Joseph <jithu.joseph@xxxxxxxxx>
>
> Driver probe routine allocates structure to communicate status
> and parameters between functions in the driver. Also call
> load_ifs_binary() to load the scan image file.
>
> There is a separate scan image file for each processor family,
> model, stepping combination. This is read from the static path:
>
> /lib/firmware/intel/ifs/{ff-mm-ss}.scan
>
> Step 1 in loading is to generate the correct path and use
> request_firmware_direct() to load into memory.
>
> Subsequent patches will use the IFS MSR interfaces to copy
> the image to BIOS reserved memory and validate the SHA256
> checksums.
>
> Signed-off-by: Jithu Joseph <jithu.joseph@xxxxxxxxx>
> Co-developed-by: Tony Luck <tony.luck@xxxxxxxxx>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---
> drivers/platform/x86/intel/ifs/Makefile | 2 +-
> drivers/platform/x86/intel/ifs/core.c | 36 ++++++++++++++++++++++++-
> drivers/platform/x86/intel/ifs/ifs.h | 25 +++++++++++++++++
> drivers/platform/x86/intel/ifs/load.c | 28 +++++++++++++++++++
> 4 files changed, 89 insertions(+), 2 deletions(-)
> create mode 100644 drivers/platform/x86/intel/ifs/ifs.h
> create mode 100644 drivers/platform/x86/intel/ifs/load.c
>
> diff --git a/drivers/platform/x86/intel/ifs/Makefile b/drivers/platform/x86/intel/ifs/Makefile
> index af904880e959..98b6fde15689 100644
> --- a/drivers/platform/x86/intel/ifs/Makefile
> +++ b/drivers/platform/x86/intel/ifs/Makefile
> @@ -1,3 +1,3 @@
> obj-$(CONFIG_INTEL_IFS) += intel_ifs.o
>
> -intel_ifs-objs := core.o
> +intel_ifs-objs := core.o load.o
> diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c
> index 5713e6ee90f0..ed4ded6755b2 100644
> --- a/drivers/platform/x86/intel/ifs/core.c
> +++ b/drivers/platform/x86/intel/ifs/core.c
> @@ -6,6 +6,8 @@
>
> #include <asm/cpu_device_id.h>
>
> +#include "ifs.h"
> +
> enum test_types {
> IFS_SAF,
> };
> @@ -20,10 +22,27 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = {
> };
> MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
>
> +static struct ifs_device ifs_devices[] = {
> + [IFS_SAF] = {
> + .data = {
> + .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT,
> + },
> + .misc = {
> + .name = "intel_ifs_0",
> + .nodename = "intel_ifs/0",
> + .minor = MISC_DYNAMIC_MINOR,
> + },
> + },
> +};
> +
> +#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices)

Cute way to do this, but I don't see you ever have any more devices
added to this list in this series. Did I miss them?

If not, why all the overhead and complexity involved here for just a
single misc device?

thanks,

greg k-h