Skip to contentSkip to conversation

Platform integrity information in sysfs

PATCH In review Daniel Gutson 4 participants 5 messages Sep 3, 2020 – Sep 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Platform integrity information in sysfs

This patch exports information about the platform integrity firmware configuration in the sysfs filesystem.
In this initial patch, I include some configuration attributes for the system SPI chip.

This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM BIOS Write Protect (SMM_BWP) fields of the BIOS Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.

The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.

The patch provides a new misc driver, as proposed in the previous patch, that provides a registration function for HW Driver devices to register class_attributes.
In this case, the intel SPI flash chip (intel-spi) registers three class_attributes corresponding to the fields mentioned above.

This version of the patch provides a new API supporting regular device attributes rather than custom attributes, and also avoids a race condition when exporting the driver sysfs dir and the attributes files inside it.
Also, this patch renames 'platform lockdown' by 'platform integrity'.

---
 .../ABI/stable/sysfs-class-platform-integrity | 23 +++++
 MAINTAINERS                                   |  7 ++
 drivers/misc/Kconfig                          | 11 +++
 drivers/misc/Makefile                         |  1 +
 drivers/misc/platform-integrity.c             | 61 +++++++++++++
 drivers/mtd/spi-nor/controllers/Kconfig       |  1 +
 .../mtd/spi-nor/controllers/intel-spi-pci.c   | 64 ++++++++++++-
 .../spi-nor/controllers/intel-spi-platform.c  |  2 +-
 drivers/mtd/spi-nor/controllers/intel-spi.c   | 89 ++++++++++++++++++-
 drivers/mtd/spi-nor/controllers/intel-spi.h   |  5 +-
 include/linux/platform-integrity.h            | 20 +++++
 11 files changed, 278 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-class-platform-integrity
 create mode 100644 drivers/misc/platform-integrity.c
 create mode 100644 include/linux/platform-integrity.h
Documentation/ABI/stable/sysfs-class-platform-integrity new file +23 -0
new file mode 100644
index 000000000000..b31ec051ca48
@@ -0,0 +1,23 @@
+What:		/sys/class/platform-integrity/intel-spi/bioswe
+Date:		September 2020
+KernelVersion:	5.9.1
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set BIOS Write Enable.
+		0: writes disabled, 1: writes enabled.
+Users:		https://github.com/fwupd/fwupd
+
+What:		/sys/class/platform-integrity/intel-spi/ble
+Date:		September 2020
+KernelVersion:	5.9.1
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set BIOS Lock Enable.
+		0: SMM lock disabled, 1: SMM lock enabled.
+Users:		https://github.com/fwupd/fwupd
+
+What:		/sys/class/platform-integrity/intel-spi/smm_bwp
+Date:		September 2020
+KernelVersion:	5.9.1
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set SMM BIOS Write Protect.
+		0: writes disabled unless in SMM, 1: writes enabled.
+Users:		https://github.com/fwupd/fwupd
MAINTAINERS +7 -0
index e4647c84c987..771eaf715427 100644
@@ -13744,6 +13744,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
 F:	drivers/iio/chemical/pms7003.c
 
+PLATFORM INTEGRITY DATA MODULE
+M:	Daniel Gutson <[email protected]>
+S:	Supported
+F:	Documentation/ABI/sysfs-class-platform-integrity
+F:	drivers/misc/platform-integrity.c
+F:	include/linux/platform-integrity.h
+
 PLDMFW LIBRARY
 M:	Jacob Keller <[email protected]>
 S:	Maintained
drivers/misc/Kconfig +11 -0
index ce136d685d14..d5d0de5b5706 100644
@@ -456,6 +456,17 @@ config PVPANIC
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
 	  (guest) communicate panic events to the host.
 
+config PLATFORM_INTEGRITY_ATTRS
+	tristate "Platform integrity information in the sysfs"
+	depends on SYSFS
+	help
+	  This kernel module is a helper driver to provide information about
+	  platform integrity settings and configuration.
+	  This module is used by other device drivers -such as the intel-spi-
+	  to publish the information in /sys/class/platform-integrity which is
+	  consumed by software such as fwupd which can verify the platform
+	  has been configured in a secure way.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index c7bd01ac6291..7224019bad51 100644
@@ -57,3 +57,4 @@ obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_UACCE)		+= uacce/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
+obj-$(CONFIG_PLATFORM_INTEGRITY_ATTRS)	+= platform-integrity.o
drivers/misc/platform-integrity.c new file +61 -0

61 lines not on this page · raw message

drivers/mtd/spi-nor/controllers/Kconfig +1 -0
index 5c0e0ec2e6d1..113e349a826b 100644
@@ -29,6 +29,7 @@ config SPI_NXP_SPIFI
 
 config SPI_INTEL_SPI
 	tristate
+	select PLATFORM_INTEGRITY_ATTRS
 
 config SPI_INTEL_SPI_PCI
 	tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
drivers/mtd/spi-nor/controllers/intel-spi-pci.c +63 -1

87 lines not on this page · raw message

drivers/mtd/spi-nor/controllers/intel-spi-platform.c +1 -1
index f80f1086f928..5b1a9989426a 100644
@@ -23,7 +23,7 @@ static int intel_spi_platform_probe(struct platform_device *pdev)
 		return -EINVAL;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ispi = intel_spi_probe(&pdev->dev, mem, info);
+	ispi = intel_spi_probe(&pdev->dev, mem, info, NULL);
 	if (IS_ERR(ispi))
 		return PTR_ERR(ispi);
 
drivers/mtd/spi-nor/controllers/intel-spi.c +86 -3

137 lines not on this page · raw message

drivers/mtd/spi-nor/controllers/intel-spi.h +4 -1
index e2f41b8827bf..9ddf4a002e9e 100644
@@ -15,7 +15,10 @@ struct intel_spi;
 struct resource;
 
 struct intel_spi *intel_spi_probe(struct device *dev,
-	struct resource *mem, const struct intel_spi_boardinfo *info);
+	struct resource *mem, const struct intel_spi_boardinfo *info,
+	struct device *(*register_platform_integrity_cb)(struct device *parent,
+		enum intel_spi_type type));
+
 int intel_spi_remove(struct intel_spi *ispi);
 
 #endif /* INTEL_SPI_H */
include/linux/platform-integrity.h new file +20 -0
new file mode 100644
index 000000000000..a16d0f902345
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Platform integrity data kernel module
+ *
+ * Copyright (C) 2020 Daniel Gutson <[email protected]>
+ * Copyright (C) 2020 Eclypsium Inc.
+ */
+#ifndef PLATFORM_INTEGRITY_H
+#define PLATFORM_INTEGRITY_H
+
+#include <linux/device.h>
+
+extern struct device *create_platform_integrity_device(
+	struct device *parent,
+	const char *name,
+	const struct attribute_group **groups);
+
+extern void destroy_platform_integrity_device(struct device *pi_device);
+
+#endif /* PLATFORM_INTEGRITY_H */
Signature · 1 line
2.25.1
#1 lore raw
Quoted 20 lines · Daniel Gutson

This patch exports information about the platform integrity firmware configuration in the sysfs filesystem.
In this initial patch, I include some configuration attributes for the system SPI chip.

This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM BIOS Write Protect (SMM_BWP) fields of the BIOS Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.

The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.

The patch provides a new misc driver, as proposed in the previous patch, that provides a registration function for HW Driver devices to register class_attributes.
In this case, the intel SPI flash chip (intel-spi) registers three class_attributes corresponding to the fields mentioned above.

Quoted 8 lines

This version of the patch provides a new API supporting regular device attributes rather than custom attributes, and also avoids a race condition when exporting the driver sysfs dir and the attributes files inside it.
Also, this patch renames 'platform lockdown' by 'platform integrity'.

---

Always version your patches, there's no way this is "v1", right?

greg k-h

#2 lore raw
Quoted 28 lines · Greg Kroah-Hartman
Quoted 26 lines · Daniel Gutson

This patch exports information about the platform integrity firmware configuration in the sysfs filesystem.
In this initial patch, I include some configuration attributes for the system SPI chip.

This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM BIOS Write Protect (SMM_BWP) fields of the BIOS Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.

The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.

The patch provides a new misc driver, as proposed in the previous patch, that provides a registration function for HW Driver devices to register class_attributes.
In this case, the intel SPI flash chip (intel-spi) registers three class_attributes corresponding to the fields mentioned above.

This version of the patch provides a new API supporting regular device attributes rather than custom attributes, and also avoids a race condition when exporting the driver sysfs dir and the attributes files inside it.
Also, this patch renames 'platform lockdown' by 'platform integrity'.

Quoted 4 lines
Quoted 2 lines

---

Always version your patches, there's no way this is "v1", right?

Sorry, I thought the version was reseted after the title changed.

Quoted 2 lines

greg k-h

Signature · 8 lines
Daniel Gutson
Argentina Site Director
Enginieering Director
Eclypsium

Below The Surface: Get the latest threat research and insights on
firmware and supply chain threats from the research team at Eclypsium.
https://eclypsium.com/research/#threatreport
#3 lore raw
In reply to Daniel Gutson

Hi,

Quoted 5 lines · Daniel Gutson

This patch exports information about the platform integrity firmware configuration in the sysfs filesystem.
In this initial patch, I include some configuration attributes for the system SPI chip.

Please avoid first-person singular pronouns instead use imperative mood.

Quoted 9 lines

This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM BIOS Write Protect (SMM_BWP) fields of the BIOS Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.

The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.

s/avilable/available

Quoted 4 lines

The patch provides a new misc driver, as proposed in the previous patch, that provides a registration function for HW Driver devices to register class_attributes.
In this case, the intel SPI flash chip (intel-spi) registers three

s/intel SPI/Intel SPI

Quoted 7 lines

class_attributes corresponding to the fields mentioned above.

This version of the patch provides a new API supporting regular device attributes rather than custom attributes, and also avoids a race condition when exporting the driver sysfs dir and the attributes files inside it.
Also, this patch renames 'platform lockdown' by 'platform integrity'.

Changes wrt to previous versions should not be part of commit message but instead should be below tearline (b/w "---" and diffstat below)

Quoted 3 lines

---

Changes wrt previous versions go here...

Quoted 7 lines
 .../ABI/stable/sysfs-class-platform-integrity | 23 +++++
 MAINTAINERS                                   |  7 ++
 drivers/misc/Kconfig                          | 11 +++
 drivers/misc/Makefile                         |  1 +
 drivers/misc/platform-integrity.c             | 61 +++++++++++++
 drivers/mtd/spi-nor/controllers/Kconfig       |  1 +
 .../mtd/spi-nor/controllers/intel-spi-pci.c   | 64 ++++++++++++-
Quoted 9 lines
 .../spi-nor/controllers/intel-spi-platform.c  |  2 +-
 drivers/mtd/spi-nor/controllers/intel-spi.c   | 89 ++++++++++++++++++-
 drivers/mtd/spi-nor/controllers/intel-spi.h   |  5 +-
 include/linux/platform-integrity.h            | 20 +++++
 11 files changed, 278 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-class-platform-integrity
 create mode 100644 drivers/misc/platform-integrity.c
 create mode 100644 include/linux/platform-integrity.h

You forgot to cc linux-mtd lists and hence patch did not show up in my queue.. MTD Patches are managed via patchoworks and if linux-mtd is not cc'd then they will most likely be ignored. Please use scripts/get_maintainer.pl to get list of maintainters and mailing lists to cc.

Also, this patch needs to be split into at least two patches: one introducing platform-integrity module and another adding suuport for intel-spi driver to use the same.

Also, I see there are multiple iterations of the patch posted but are not versioned. Please use appropriate version number in $subject.

Please read Documentation/process/submitting-patches.rst for more details.

Documentation/ABI/stable/sysfs-class-platform-integrity line 3

Quoted 9 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +3 -0
new file mode 100644
index 000000000000..b31ec051ca48
@@ -0,0 +1,23 @@
+What:		/sys/class/platform-integrity/intel-spi/bioswe
+Date:		September 2020
+KernelVersion:	5.9.1

5.9 merge window is closed. This won't make it to 5.9... Maybe 5.10

Documentation/ABI/stable/sysfs-class-platform-integrity line 9

Quoted 6 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +6 -0
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set BIOS Write Enable.
+		0: writes disabled, 1: writes enabled.
+Users:		https://github.com/fwupd/fwupd
+
+What:		/sys/class/platform-integrity/intel-spi/ble

Naming seems inconsistent... Previous entry was bioswe (BIOS write enable) but this one is called ble (BIOS latch enable). Maybe rename previous one as bwe to be consistent with other entries?

Documentation/ABI/stable/sysfs-class-platform-integrity line 22

Quoted 13 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +13 -0
+Date:		September 2020
+KernelVersion:	5.9.1
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set BIOS Lock Enable.
+		0: SMM lock disabled, 1: SMM lock enabled.
+Users:		https://github.com/fwupd/fwupd
+
+What:		/sys/class/platform-integrity/intel-spi/smm_bwp
+Date:		September 2020
+KernelVersion:	5.9.1
+Contact:	Daniel Gutson <[email protected]>
+Description:	If the system firmware set SMM BIOS Write Protect.
+		0: writes disabled unless in SMM, 1: writes enabled.

Is SMM a standard abbreviation in Intel world? If not you may want to expand what it means in Description.

Quoted 38 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +1 -0
+Users:		https://github.com/fwupd/fwupd
MAINTAINERS +7 -0
index e4647c84c987..771eaf715427 100644
@@ -13744,6 +13744,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
 F:	drivers/iio/chemical/pms7003.c
 
+PLATFORM INTEGRITY DATA MODULE
+M:	Daniel Gutson <[email protected]>
+S:	Supported
+F:	Documentation/ABI/sysfs-class-platform-integrity
+F:	drivers/misc/platform-integrity.c
+F:	include/linux/platform-integrity.h
+
 PLDMFW LIBRARY
 M:	Jacob Keller <[email protected]>
 S:	Maintained
drivers/misc/Kconfig +11 -0
index ce136d685d14..d5d0de5b5706 100644
@@ -456,6 +456,17 @@ config PVPANIC
 	  a paravirtualized device provided by QEMU; it lets a virtual machine
 	  (guest) communicate panic events to the host.
 
+config PLATFORM_INTEGRITY_ATTRS
+	tristate "Platform integrity information in the sysfs"
+	depends on SYSFS
+	help
+	  This kernel module is a helper driver to provide information about
+	  platform integrity settings and configuration.
+	  This module is used by other device drivers -such as the intel-spi-
+	  to publish the information in /sys/class/platform-integrity which is
+	  consumed by software such as fwupd which can verify the platform
+	  has been configured in a secure way.
+

[...]

drivers/mtd/spi-nor/controllers/Kconfig config SPI_NXP_SPIFI · line 33

Quoted 10 lines
drivers/mtd/spi-nor/controllers/Kconfig +1 -0
index 5c0e0ec2e6d1..113e349a826b 100644
@@ -29,6 +29,7 @@ config SPI_NXP_SPIFI
 
 config SPI_INTEL_SPI
 	tristate
+	select PLATFORM_INTEGRITY_ATTRS
 

Not a good idea to use select clause on symbols that have dependencies as select will force a symbol to a value without visiting the dependencies. Instead use depends on

Quoted 27 lines
drivers/mtd/spi-nor/controllers/Kconfig +0 -0
 config SPI_INTEL_SPI_PCI
 	tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
drivers/mtd/spi-nor/controllers/intel-spi-pci.c +8 -0
index c72aa1ab71ad..e1bca8aedf7c 100644
@@ -10,11 +10,19 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/platform-integrity.h>
 
 #include "intel-spi.h"
 
 #define BCR		0xdc
 #define BCR_WPD		BIT(0)
+#define BCR_BLE		BIT(1)
+#define BCR_SMM_BWP	BIT(5)
+
+struct cnl_spi_attr {
+	struct device_attribute dev_attr;
+	u32 mask;
+};
 
 static const struct intel_spi_boardinfo bxt_info = {
 	.type = INTEL_SPI_BXT,

drivers/mtd/spi-nor/controllers/intel-spi-pci.c static const struct intel_spi_boardinfo cnl_info = { · line 37

Quoted 6 lines
drivers/mtd/spi-nor/controllers/intel-spi-pci.c +3 -0
@@ -24,6 +32,59 @@ static const struct intel_spi_boardinfo cnl_info = {
 	.type = INTEL_SPI_CNL,
 };
 
+static ssize_t cnl_spi_attr_show(struct device *dev,
+	struct device_attribute *attr, char *buf, u32 mask)
+{

Please be consistent with existing code and use intel_spi_ prefix for function names.

Also Alignment should match open parenthesis..
Please run scripts/checkpatch.pl --strict on patch and fix all issue reported.

[...]

Regards
Vignesh

#4 lore raw
Quoted 2 lines · Vignesh Raghavendra

Hi,

Hi, thanks for your review.

Quoted 64 lines · Daniel Gutson
Quoted 5 lines

This patch exports information about the platform integrity firmware configuration in the sysfs filesystem.
In this initial patch, I include some configuration attributes for the system SPI chip.

Please avoid first-person singular pronouns instead use imperative mood.

Quoted 9 lines

This initial version exports the BIOS Write Enable (bioswe), BIOS Lock Enable (ble), and the SMM BIOS Write Protect (SMM_BWP) fields of the BIOS Control register. The idea is to keep adding more flags, not only from the BC but also from other registers in following versions.

The goal is that the attributes are avilable to fwupd when SecureBoot is turned on.

s/avilable/available

Quoted 4 lines

The patch provides a new misc driver, as proposed in the previous patch, that provides a registration function for HW Driver devices to register class_attributes.
In this case, the intel SPI flash chip (intel-spi) registers three

s/intel SPI/Intel SPI

Quoted 7 lines

class_attributes corresponding to the fields mentioned above.

This version of the patch provides a new API supporting regular device attributes rather than custom attributes, and also avoids a race condition when exporting the driver sysfs dir and the attributes files inside it.
Also, this patch renames 'platform lockdown' by 'platform integrity'.

Changes wrt to previous versions should not be part of commit message but instead should be below tearline (b/w "---" and diffstat below)

Quoted 3 lines

---

Changes wrt previous versions go here...

Quoted 7 lines
 .../ABI/stable/sysfs-class-platform-integrity | 23 +++++
 MAINTAINERS                                   |  7 ++
 drivers/misc/Kconfig                          | 11 +++
 drivers/misc/Makefile                         |  1 +
 drivers/misc/platform-integrity.c             | 61 +++++++++++++
 drivers/mtd/spi-nor/controllers/Kconfig       |  1 +
 .../mtd/spi-nor/controllers/intel-spi-pci.c   | 64 ++++++++++++-
Quoted 9 lines
 .../spi-nor/controllers/intel-spi-platform.c  |  2 +-
 drivers/mtd/spi-nor/controllers/intel-spi.c   | 89 ++++++++++++++++++-
 drivers/mtd/spi-nor/controllers/intel-spi.h   |  5 +-
 include/linux/platform-integrity.h            | 20 +++++
 11 files changed, 278 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-class-platform-integrity
 create mode 100644 drivers/misc/platform-integrity.c
 create mode 100644 include/linux/platform-integrity.h
Quoted 5 lines

You forgot to cc linux-mtd lists and hence patch did not show up in my queue.. MTD Patches are managed via patchoworks and if linux-mtd is not cc'd then they will most likely be ignored. Please use scripts/get_maintainer.pl to get list of maintainters and mailing lists to cc.

Sorry, I don't know when I lost the list in the emails, I included it in previous
patches.

Quoted 98 lines

Also, this patch needs to be split into at least two patches: one introducing platform-integrity module and another adding suuport for intel-spi driver to use the same.

Also, I see there are multiple iterations of the patch posted but are not versioned. Please use appropriate version number in $subject.

Please read Documentation/process/submitting-patches.rst for more details.

Documentation/ABI/stable/sysfs-class-platform-integrity line 3

Quoted 9 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +3 -0
new file mode 100644
index 000000000000..b31ec051ca48
@@ -0,0 +1,23 @@
+What:                /sys/class/platform-integrity/intel-spi/bioswe
+Date:                September 2020
+KernelVersion:       5.9.1

5.9 merge window is closed. This won't make it to 5.9... Maybe 5.10

Documentation/ABI/stable/sysfs-class-platform-integrity line 9

Quoted 6 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +6 -0
+Contact:     Daniel Gutson <[email protected]>
+Description: If the system firmware set BIOS Write Enable.
+             0: writes disabled, 1: writes enabled.
+Users:               https://github.com/fwupd/fwupd
+
+What:                /sys/class/platform-integrity/intel-spi/ble

Naming seems inconsistent... Previous entry was bioswe (BIOS write enable) but this one is called ble (BIOS latch enable). Maybe rename previous one as bwe to be consistent with other entries?

Documentation/ABI/stable/sysfs-class-platform-integrity line 22

Quoted 13 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +13 -0
+Date:                September 2020
+KernelVersion:       5.9.1
+Contact:     Daniel Gutson <[email protected]>
+Description: If the system firmware set BIOS Lock Enable.
+             0: SMM lock disabled, 1: SMM lock enabled.
+Users:               https://github.com/fwupd/fwupd
+
+What:                /sys/class/platform-integrity/intel-spi/smm_bwp
+Date:                September 2020
+KernelVersion:       5.9.1
+Contact:     Daniel Gutson <[email protected]>
+Description: If the system firmware set SMM BIOS Write Protect.
+             0: writes disabled unless in SMM, 1: writes enabled.

Is SMM a standard abbreviation in Intel world? If not you may want to expand what it means in Description.

Quoted 38 lines
Documentation/ABI/stable/sysfs-class-platform-integrity new file +1 -0
+Users:               https://github.com/fwupd/fwupd
MAINTAINERS +7 -0
index e4647c84c987..771eaf715427 100644
@@ -13744,6 +13744,13 @@ S:   Maintained
 F:   Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
 F:   drivers/iio/chemical/pms7003.c
 
+PLATFORM INTEGRITY DATA MODULE
+M:   Daniel Gutson <[email protected]>
+S:   Supported
+F:   Documentation/ABI/sysfs-class-platform-integrity
+F:   drivers/misc/platform-integrity.c
+F:   include/linux/platform-integrity.h
+
 PLDMFW LIBRARY
 M:   Jacob Keller <[email protected]>
 S:   Maintained
drivers/misc/Kconfig +11 -0
index ce136d685d14..d5d0de5b5706 100644
@@ -456,6 +456,17 @@ config PVPANIC
        a paravirtualized device provided by QEMU; it lets a virtual machine
        (guest) communicate panic events to the host.
 
+config PLATFORM_INTEGRITY_ATTRS
+     tristate "Platform integrity information in the sysfs"
+     depends on SYSFS
+     help
+       This kernel module is a helper driver to provide information about
+       platform integrity settings and configuration.
+       This module is used by other device drivers -such as the intel-spi-
+       to publish the information in /sys/class/platform-integrity which is
+       consumed by software such as fwupd which can verify the platform
+       has been configured in a secure way.
+

[...]

Quoted 6 lines
drivers/mtd/spi-nor/controllers/Kconfig +0 -0
index 5c0e0ec2e6d1..113e349a826b 100644
@@ -29,6 +29,7 @@ config SPI_NXP_SPIFI
 
Quoted 8 lines

drivers/mtd/spi-nor/controllers/Kconfig config SPI_NXP_SPIFI · line 33

Quoted 4 lines
drivers/mtd/spi-nor/controllers/Kconfig +1 -0
 config SPI_INTEL_SPI
      tristate
+     select PLATFORM_INTEGRITY_ATTRS
 

Not a good idea to use select clause on symbols that have dependencies as select will force a symbol to a value without visiting the dependencies. Instead use depends on

I just tried this, but when selecting the Intel SPI drivers, my new platform integrity driver
was not selected, as it was with the select clause.

Quoted 39 lines
Quoted 29 lines
drivers/mtd/spi-nor/controllers/Kconfig +0 -0
 config SPI_INTEL_SPI_PCI
      tristate "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)"
drivers/mtd/spi-nor/controllers/intel-spi-pci.c +8 -0
index c72aa1ab71ad..e1bca8aedf7c 100644
@@ -10,11 +10,19 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/platform-integrity.h>
 
 #include "intel-spi.h"
 
 #define BCR          0xdc
 #define BCR_WPD              BIT(0)
+#define BCR_BLE              BIT(1)
+#define BCR_SMM_BWP  BIT(5)
+
+struct cnl_spi_attr {
+     struct device_attribute dev_attr;
+     u32 mask;
+};
 
 static const struct intel_spi_boardinfo bxt_info = {
      .type = INTEL_SPI_BXT,

drivers/mtd/spi-nor/controllers/intel-spi-pci.c static const struct intel_spi_boardinfo cnl_info = { · line 37

Quoted 6 lines
drivers/mtd/spi-nor/controllers/intel-spi-pci.c +3 -0
@@ -24,6 +32,59 @@ static const struct intel_spi_boardinfo cnl_info = {
      .type = INTEL_SPI_CNL,
 };
 
+static ssize_t cnl_spi_attr_show(struct device *dev,
+     struct device_attribute *attr, char *buf, u32 mask)
+{

Please be consistent with existing code and use intel_spi_ prefix for function names.

Quoted 3 lines

Also Alignment should match open parenthesis..
Please run scripts/checkpatch.pl --strict on patch and fix all issue reported.

I just added the --strict flag and indeed a lot of alignment issues showed up. I will fix this in the next version. Thanks.

Quoted 5 lines

[...]

Regards
Vignesh

Signature · 12 lines
Daniel Gutson
Argentina Site Director
Enginieering Director
Eclypsium

Below The Surface: Get the latest threat research and insights on
firmware and supply chain threats from the research team at Eclypsium.
https://eclypsium.com/research/#threatreport

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/