Skip to contentSkip to conversation

platform/x86: Add Slim Bootloader firmware update support

PATCH Superseded Jithu Joseph 2 participants 5 messages Apr 23, 2020 – Apr 27, 2020 x86 platform drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover platform/x86: Add Slim Bootloader firmware update support

v1 Upstream submission is available here:
https://lore.kernel.org/lkml/[email protected]

v2 primarily addresses review comments from Andy Shevchenko to v1.

Changes in v2
- Rebased on top of tag: v5.7-rc2
- Added ABI documentation file
- Changed the ordering of SBL entry in Makefile and Kconfig
- Replaced kstrtobool() with kstrtouint() for user input processing
- Added DocLink: tag to annottate weblink in commit message
- Minor edits to commit message in p1/1
- Style related changes

From v1 submission:

Slim Bootloader(SBL) [see link below] is a small open-source boot firmware, designed for running on certain Intel platforms. SBL can be thought-of as fulfilling the role of a minimal BIOS implementation, i.e initializing the hardware and booting Operating System.

This driver creates sysfs interfaces which allows user space entities to trigger update of SBL firmware.

Acknowledgment: Initial draft of the driver code was authored by Maurice Ma <[email protected]>

DocLink: https://slimbootloader.github.io

Jithu Joseph (1):
platform/x86: Add Slim Bootloader firmware update signaling driver

 .../ABI/testing/sysfs-platform-sbl-fwu-wmi    |  12 ++
 MAINTAINERS                                   |   7 +
 drivers/platform/x86/Kconfig                  |  10 ++
 drivers/platform/x86/Makefile                 |   1 +
 drivers/platform/x86/sbl_fwu_wmi.c            | 144 ++++++++++++++++++
 5 files changed, 174 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-sbl-fwu-wmi
 create mode 100644 drivers/platform/x86/sbl_fwu_wmi.c

base-commit: ae83d0b416db002fe95601e7f97f64b59514d936

Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 platform/x86: Add Slim Bootloader firmware update signaling driver

Slim Bootloader(SBL) is a small open-source boot firmware, designed for running on certain Intel platforms. SBL can be thought-of as fulfilling the role of a minimal BIOS implementation, i.e initializing the hardware and booting Operating System.

Since SBL is not UEFI compliant, firmware update cannot be triggered using standard UEFI runtime services. Further considering performance impact, SBL doesn't look for a firmware update image on every reset and does so only when firmware update signal is asserted.

SBL exposes an ACPI-WMI device which comes up in sysfs as /sys/bus/wmi/44FADEB1xxx and this driver adds a "firmware_update_request" device attribute. This attribute normally has a value of 0 and userspace can signal SBL to update firmware, on next reboot, by writing a value of 1 like:

echo 1 > /sys/bus/wmi/devices/44FADEB1xxx/firmware_update_request

This driver only implements a signaling mechanism, the actual firmware update process and various details like firmware update image format, firmware image location etc are defined by SBL and are not in the scope of this driver.

DocLink: https://slimbootloader.github.io/security/firmware-update.html

---
 .../ABI/testing/sysfs-platform-sbl-fwu-wmi    |  12 ++
 MAINTAINERS                                   |   7 +
 drivers/platform/x86/Kconfig                  |  10 ++
 drivers/platform/x86/Makefile                 |   1 +
 drivers/platform/x86/sbl_fwu_wmi.c            | 144 ++++++++++++++++++
 5 files changed, 174 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-sbl-fwu-wmi
 create mode 100644 drivers/platform/x86/sbl_fwu_wmi.c
Documentation/ABI/testing/sysfs-platform-sbl-fwu-wmi new file +12 -0
new file mode 100644
index 000000000000..5aa618987cad
@@ -0,0 +1,12 @@
+What:		/sys/bus/wmi/devices/44FADEB1-B204-40F2-8581-394BBDC1B651/firmware_update_request
+Date:		April 2020
+KernelVersion:	5.7
+Contact:	"Jithu Joseph" <[email protected]>
+Description:
+		Allow user space entities to trigger update of Slim
+		Bootloader (SBL). This attribute normally has a value
+		of 0 and userspace can signal SBL to update firmware,
+		on next reboot, by writing a value of 1.
+		There are two available states:
+		    * 0 -> Skip firmware update while rebooting
+		    * 1 -> Attempt firmware update on next reboot
MAINTAINERS +7 -0
index b816a453b10e..fb613308dc4e 100644
@@ -15454,6 +15454,13 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
 F:	include/linux/srcu*.h
 F:	kernel/rcu/srcu*.c
 
+SLIM BOOTLOADER (SBL) FIRMWARE UPDATE WMI DRIVER
+M:	Jithu Joseph <[email protected]>
+R:	Maurice Ma <[email protected]>
+S:	Maintained
+W:	https://slimbootloader.github.io/security/firmware-update.html
+F:	drivers/platform/x86/sbl_fwu_wmi.c
+
 SMACK SECURITY MODULE
 M:	Casey Schaufler <[email protected]>
 L:	[email protected]
drivers/platform/x86/Kconfig +10 -0
index 0ad7ad8cf8e1..69cfc2904265 100644
@@ -104,6 +104,16 @@ config PEAQ_WMI
 	help
 	 Say Y here if you want to support WMI-based hotkeys on PEAQ 2-in-1s.
 
+config SBL_FWU_WMI
+	tristate "WMI driver for Slim Bootloader firmware update signaling"
+	depends on ACPI_WMI
+	help
+	  Say Y here if you want to be able to use the WMI interface to signal
+	  Slim Bootloader to trigger update on next reboot.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called sbl-fwu-wmi.
+
 config XIAOMI_WMI
 	tristate "Xiaomi WMI key driver"
 	depends on ACPI_WMI
drivers/platform/x86/Makefile +1 -0
index 53408d965874..65455c2214c9 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_HUAWEI_WMI)		+= huawei-wmi.o
 obj-$(CONFIG_INTEL_WMI_THUNDERBOLT)	+= intel-wmi-thunderbolt.o
 obj-$(CONFIG_MXM_WMI)			+= mxm-wmi.o
 obj-$(CONFIG_PEAQ_WMI)			+= peaq-wmi.o
+obj-$(CONFIG_SBL_FWU_WMI)		+= sbl_fwu_wmi.o
 obj-$(CONFIG_XIAOMI_WMI)		+= xiaomi-wmi.o
 
 # Acer
drivers/platform/x86/sbl_fwu_wmi.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw
In reply to Jithu Joseph
Quoted 4 lines · Jithu Joseph

v1 Upstream submission is available here:
https://lore.kernel.org/lkml/[email protected]

Pushed to my review and testing queue, thanks!

Quoted 44 lines

v2 primarily addresses review comments from Andy Shevchenko to v1.

Changes in v2
- Rebased on top of tag: v5.7-rc2
- Added ABI documentation file
- Changed the ordering of SBL entry in Makefile and Kconfig
- Replaced kstrtobool() with kstrtouint() for user input processing
- Added DocLink: tag to annottate weblink in commit message
- Minor edits to commit message in p1/1
- Style related changes

From v1 submission:

Slim Bootloader(SBL) [see link below] is a small open-source boot firmware, designed for running on certain Intel platforms. SBL can be thought-of as fulfilling the role of a minimal BIOS implementation, i.e initializing the hardware and booting Operating System.

This driver creates sysfs interfaces which allows user space entities to trigger update of SBL firmware.

Acknowledgment: Initial draft of the driver code was authored by Maurice Ma <[email protected]>

DocLink: https://slimbootloader.github.io

Jithu Joseph (1):
platform/x86: Add Slim Bootloader firmware update signaling driver

 .../ABI/testing/sysfs-platform-sbl-fwu-wmi    |  12 ++
 MAINTAINERS                                   |   7 +
 drivers/platform/x86/Kconfig                  |  10 ++
 drivers/platform/x86/Makefile                 |   1 +
 drivers/platform/x86/sbl_fwu_wmi.c            | 144 ++++++++++++++++++
 5 files changed, 174 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-sbl-fwu-wmi
 create mode 100644 drivers/platform/x86/sbl_fwu_wmi.c

base-commit: ae83d0b416db002fe95601e7f97f64b59514d936 --
2.17.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 4 lines · Jithu Joseph

v1 Upstream submission is available here:
https://lore.kernel.org/lkml/[email protected]

Pushed to my review and testing queue, thanks!

One question, though.

We use a bit different template for module names

vendor-...-wmi

(yes, with exception to TBT)

I would like to rename sbl_fwu_wmi to something like this:

intel-wmi-sbl-fw-update

What do you think?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 6 lines · Andy Shevchenko

We use a bit different template for module names

vendor-...-wmi

Quoted 7 lines

(yes, with exception to TBT)

I would like to rename sbl_fwu_wmi to something like this:

intel-wmi-sbl-fw-update

What do you think?

Yes I think it is better to rename this driver to intel-wmi-sbl-fw- update as you suggested, given many drivers follow vendor-wmi-* pattern. Thanks for pointing this out.

I will send v3 which addresses this.

Thanks
Jithu