linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig
@ 2024-01-12 13:18 Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 1/7] firmware: coreboot: Generate modalias uevent for devices Nícolas F. R. A. Prado
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Abhijit Gangurde, Andy Shevchenko,
	Arnd Bergmann, Bjorn Andersson, Brian Norris, Catalin Marinas,
	Geert Uytterhoeven, Greg Kroah-Hartman, Julius Werner,
	Konrad Dybcio, Krzysztof Kozlowski, Marek Szyprowski,
	Masahiro Yamada, Nathan Chancellor, Neil Armstrong,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, Will Deacon, linux-arm-kernel, linux-kbuild,
	linux-kernel


This series adds the missing pieces to the coreboot bus and the module
alias generation to allow coreboot modules to be automatically loaded
when matching devices are detected.

The configs for cbmem coreboot entries are then enabled in the arm64
defconfig, as modules, to allow reading logs from coreboot on arm64
Chromebooks, which is useful for debugging the boot process.

Changes in v2:
- Added commits for vpd, memconsole and framebuffer drivers to add them
  to the module device table

Nícolas F. R. A. Prado (7):
  firmware: coreboot: Generate modalias uevent for devices
  firmware: coreboot: Generate aliases for coreboot modules
  firmware: google: cbmem: Add to module device table
  firmware: google: vpd: Add to module device table
  firmware: google: memconsole: Add to module device table
  firmware: google: framebuffer: Add to module device table
  arm64: defconfig: Enable support for cbmem entries in the coreboot
    table

 arch/arm64/configs/defconfig                   |  3 +++
 drivers/firmware/google/cbmem.c                |  7 +++++++
 drivers/firmware/google/coreboot_table.c       |  9 +++++++++
 drivers/firmware/google/framebuffer-coreboot.c |  7 +++++++
 drivers/firmware/google/memconsole-coreboot.c  |  7 +++++++
 drivers/firmware/google/vpd.c                  |  7 +++++++
 include/linux/mod_devicetable.h                |  8 ++++++++
 scripts/mod/devicetable-offsets.c              |  3 +++
 scripts/mod/file2alias.c                       | 10 ++++++++++
 9 files changed, 61 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2 1/7] firmware: coreboot: Generate modalias uevent for devices
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules Nícolas F. R. A. Prado
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Brian Norris, Julius Werner,
	linux-kernel

Generate a modalias uevent for devices in the coreboot bus to allow
userspace to automatically load the corresponding modules.

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

(no changes since v1)

 drivers/firmware/google/coreboot_table.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
index 2a4469bf1b81..c1b9a9e8e8ed 100644
--- a/drivers/firmware/google/coreboot_table.c
+++ b/drivers/firmware/google/coreboot_table.c
@@ -53,11 +53,20 @@ static void coreboot_bus_remove(struct device *dev)
 		driver->remove(device);
 }
 
+static int coreboot_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
+{
+	struct coreboot_device *device = CB_DEV(dev);
+	u32 tag = device->entry.tag;
+
+	return add_uevent_var(env, "MODALIAS=coreboot:t%08X", tag);
+}
+
 static struct bus_type coreboot_bus_type = {
 	.name		= "coreboot",
 	.match		= coreboot_bus_match,
 	.probe		= coreboot_bus_probe,
 	.remove		= coreboot_bus_remove,
+	.uevent		= coreboot_bus_uevent,
 };
 
 static void coreboot_device_release(struct device *dev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 1/7] firmware: coreboot: Generate modalias uevent for devices Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-14 17:09   ` Andy Shevchenko
  2024-01-12 13:18 ` [PATCH v2 3/7] firmware: google: cbmem: Add to module device table Nícolas F. R. A. Prado
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Abhijit Gangurde, Andy Shevchenko,
	Greg Kroah-Hartman, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, linux-kbuild, linux-kernel

Generate aliases for coreboot modules to allow automatic module probing.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

(no changes since v1)

 include/linux/mod_devicetable.h   |  8 ++++++++
 scripts/mod/devicetable-offsets.c |  3 +++
 scripts/mod/file2alias.c          | 10 ++++++++++
 3 files changed, 21 insertions(+)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f458469c5ce5..24e0dcfde809 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -960,4 +960,12 @@ struct vchiq_device_id {
 	char name[32];
 };
 
+/**
+ * struct coreboot_device_id - Identifies a coreboot table entry
+ * @tag: tag ID
+ */
+struct coreboot_device_id {
+	__u32 tag;
+};
+
 #endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index e91a3c38143b..518200813d4e 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -274,5 +274,8 @@ int main(void)
 	DEVID(vchiq_device_id);
 	DEVID_FIELD(vchiq_device_id, name);
 
+	DEVID(coreboot_device_id);
+	DEVID_FIELD(coreboot_device_id, tag);
+
 	return 0;
 }
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 4829680a0a6d..5d1c61fa5a55 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1494,6 +1494,15 @@ static int do_vchiq_entry(const char *filename, void *symval, char *alias)
 	return 1;
 }
 
+/* Looks like: coreboot:tN */
+static int do_coreboot_entry(const char *filename, void *symval, char *alias)
+{
+	DEF_FIELD(symval, coreboot_device_id, tag);
+	sprintf(alias, "coreboot:t%08X", tag);
+
+	return 1;
+}
+
 /* Does namelen bytes of name exactly match the symbol? */
 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
 {
@@ -1575,6 +1584,7 @@ static const struct devtable devtable[] = {
 	{"ishtp", SIZE_ishtp_device_id, do_ishtp_entry},
 	{"cdx", SIZE_cdx_device_id, do_cdx_entry},
 	{"vchiq", SIZE_vchiq_device_id, do_vchiq_entry},
+	{"coreboot", SIZE_coreboot_device_id, do_coreboot_entry},
 };
 
 /* Create MODULE_ALIAS() statements.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 3/7] firmware: google: cbmem: Add to module device table
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 1/7] firmware: coreboot: Generate modalias uevent for devices Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 4/7] firmware: google: vpd: " Nícolas F. R. A. Prado
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Brian Norris, Julius Werner,
	linux-kernel

Create an id table and add it to the module device table to allow the
cbmem driver to be automatically loaded when a matching device is found.

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

(no changes since v1)

 drivers/firmware/google/cbmem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c
index 88e587ba1e0d..ceb89b4cdbe0 100644
--- a/drivers/firmware/google/cbmem.c
+++ b/drivers/firmware/google/cbmem.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/kobject.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
@@ -114,6 +115,12 @@ static int cbmem_entry_probe(struct coreboot_device *dev)
 	return 0;
 }
 
+static const struct coreboot_device_id cbmem_ids[] = {
+	{ .tag = LB_TAG_CBMEM_ENTRY },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, cbmem_ids);
+
 static struct coreboot_driver cbmem_entry_driver = {
 	.probe = cbmem_entry_probe,
 	.drv = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 4/7] firmware: google: vpd: Add to module device table
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
                   ` (2 preceding siblings ...)
  2024-01-12 13:18 ` [PATCH v2 3/7] firmware: google: cbmem: Add to module device table Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 5/7] firmware: google: memconsole: " Nícolas F. R. A. Prado
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Brian Norris, Julius Werner,
	linux-kernel

Create an id table and add it to the module device table to allow the
vpd driver to be automatically loaded when a matching device is found.

Suggested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---

Changes in v2:
- Added this commit

 drivers/firmware/google/vpd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index ee6e08c0592b..9e9fe9ca1920 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -14,6 +14,7 @@
 #include <linux/kobject.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -306,6 +307,12 @@ static void vpd_remove(struct coreboot_device *dev)
 	kobject_put(vpd_kobj);
 }
 
+static const struct coreboot_device_id vpd_ids[] = {
+	{ .tag = CB_TAG_VPD },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, vpd_ids);
+
 static struct coreboot_driver vpd_driver = {
 	.probe = vpd_probe,
 	.remove = vpd_remove,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 5/7] firmware: google: memconsole: Add to module device table
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
                   ` (3 preceding siblings ...)
  2024-01-12 13:18 ` [PATCH v2 4/7] firmware: google: vpd: " Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 6/7] firmware: google: framebuffer: " Nícolas F. R. A. Prado
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Brian Norris, Julius Werner,
	linux-kernel

Create an id table and add it to the module device table to allow the
memconsole driver to be automatically loaded when a matching device is
found.

Suggested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---

Changes in v2:
- Added this commit

 drivers/firmware/google/memconsole-coreboot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/firmware/google/memconsole-coreboot.c b/drivers/firmware/google/memconsole-coreboot.c
index 74b5286518ee..b8e65b9d8cc0 100644
--- a/drivers/firmware/google/memconsole-coreboot.c
+++ b/drivers/firmware/google/memconsole-coreboot.c
@@ -11,6 +11,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 
 #include "memconsole.h"
 #include "coreboot_table.h"
@@ -96,6 +97,12 @@ static void memconsole_remove(struct coreboot_device *dev)
 	memconsole_exit();
 }
 
+static const struct coreboot_device_id memconsole_ids[] = {
+	{ .tag = CB_TAG_CBMEM_CONSOLE },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, memconsole_ids);
+
 static struct coreboot_driver memconsole_driver = {
 	.probe = memconsole_probe,
 	.remove = memconsole_remove,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 6/7] firmware: google: framebuffer: Add to module device table
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
                   ` (4 preceding siblings ...)
  2024-01-12 13:18 ` [PATCH v2 5/7] firmware: google: memconsole: " Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-12 13:18 ` [PATCH v2 7/7] arm64: defconfig: Enable support for cbmem entries in the coreboot table Nícolas F. R. A. Prado
  2024-01-17 10:29 ` [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig AngeloGioacchino Del Regno
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Brian Norris, Julius Werner,
	linux-kernel

Create an id table and add it to the module device table to allow the
framebuffer driver to be automatically loaded when a matching device is
found.

Suggested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---

Changes in v2:
- Added this commit

 drivers/firmware/google/framebuffer-coreboot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/firmware/google/framebuffer-coreboot.c b/drivers/firmware/google/framebuffer-coreboot.c
index 5c84bbebfef8..b33e9c6f97d7 100644
--- a/drivers/firmware/google/framebuffer-coreboot.c
+++ b/drivers/firmware/google/framebuffer-coreboot.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_data/simplefb.h>
 #include <linux/platform_device.h>
 
@@ -80,6 +81,12 @@ static void framebuffer_remove(struct coreboot_device *dev)
 	platform_device_unregister(pdev);
 }
 
+static const struct coreboot_device_id framebuffer_ids[] = {
+	{ .tag = CB_TAG_FRAMEBUFFER },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, framebuffer_ids);
+
 static struct coreboot_driver framebuffer_driver = {
 	.probe = framebuffer_probe,
 	.remove = framebuffer_remove,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 7/7] arm64: defconfig: Enable support for cbmem entries in the coreboot table
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
                   ` (5 preceding siblings ...)
  2024-01-12 13:18 ` [PATCH v2 6/7] firmware: google: framebuffer: " Nícolas F. R. A. Prado
@ 2024-01-12 13:18 ` Nícolas F. R. A. Prado
  2024-01-17 10:29 ` [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig AngeloGioacchino Del Regno
  7 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-01-12 13:18 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: kernel, AngeloGioacchino Del Regno, chrome-platform,
	Nícolas F. R. A. Prado, Arnd Bergmann, Bjorn Andersson,
	Catalin Marinas, Geert Uytterhoeven, Konrad Dybcio,
	Krzysztof Kozlowski, Marek Szyprowski, Neil Armstrong,
	Will Deacon, linux-arm-kernel, linux-kernel

Enable the cbmem driver and dependencies in order to support reading
cbmem entries from the coreboot table, which are used to store logs from
coreboot on arm64 Chromebooks, and provide useful information for
debugging the boot process on those devices.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

---

(no changes since v1)

 arch/arm64/configs/defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 0b0ef6877a12..cd94d55b23b2 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -255,6 +255,9 @@ CONFIG_INTEL_STRATIX10_RSU=m
 CONFIG_MTK_ADSP_IPC=m
 CONFIG_QCOM_QSEECOM=y
 CONFIG_QCOM_QSEECOM_UEFISECAPP=y
+CONFIG_GOOGLE_FIRMWARE=y
+CONFIG_GOOGLE_CBMEM=m
+CONFIG_GOOGLE_COREBOOT_TABLE=m
 CONFIG_EFI_CAPSULE_LOADER=y
 CONFIG_IMX_SCU=y
 CONFIG_IMX_SCU_PD=y
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-12 13:18 ` [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules Nícolas F. R. A. Prado
@ 2024-01-14 17:09   ` Andy Shevchenko
  2024-01-23 22:06     ` Brian Norris
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2024-01-14 17:09 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado
  Cc: Tzung-Bi Shih, kernel, AngeloGioacchino Del Regno,
	chrome-platform, Abhijit Gangurde, Greg Kroah-Hartman,
	Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Nipun Gupta,
	Pieter Jansen van Vuuren, Umang Jain, linux-kbuild, linux-kernel

On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote:
> Generate aliases for coreboot modules to allow automatic module probing.

...

> (no changes since v1)

Same Q as per v1.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig
  2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
                   ` (6 preceding siblings ...)
  2024-01-12 13:18 ` [PATCH v2 7/7] arm64: defconfig: Enable support for cbmem entries in the coreboot table Nícolas F. R. A. Prado
@ 2024-01-17 10:29 ` AngeloGioacchino Del Regno
  7 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-01-17 10:29 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Tzung-Bi Shih
  Cc: kernel, chrome-platform, Abhijit Gangurde, Andy Shevchenko,
	Arnd Bergmann, Bjorn Andersson, Brian Norris, Catalin Marinas,
	Geert Uytterhoeven, Greg Kroah-Hartman, Julius Werner,
	Konrad Dybcio, Krzysztof Kozlowski, Marek Szyprowski,
	Masahiro Yamada, Nathan Chancellor, Neil Armstrong,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	U mang Jain, Will Deacon, linux-arm-kernel, linux-kbuild,
	linux-kernel

Il 12/01/24 14:18, Nícolas F. R. A. Prado ha scritto:
> 
> This series adds the missing pieces to the coreboot bus and the module
> alias generation to allow coreboot modules to be automatically loaded
> when matching devices are detected.
> 
> The configs for cbmem coreboot entries are then enabled in the arm64
> defconfig, as modules, to allow reading logs from coreboot on arm64
> Chromebooks, which is useful for debugging the boot process.
> 

For the entire series:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> Changes in v2:
> - Added commits for vpd, memconsole and framebuffer drivers to add them
>    to the module device table
> 
> Nícolas F. R. A. Prado (7):
>    firmware: coreboot: Generate modalias uevent for devices
>    firmware: coreboot: Generate aliases for coreboot modules
>    firmware: google: cbmem: Add to module device table
>    firmware: google: vpd: Add to module device table
>    firmware: google: memconsole: Add to module device table
>    firmware: google: framebuffer: Add to module device table
>    arm64: defconfig: Enable support for cbmem entries in the coreboot
>      table
> 
>   arch/arm64/configs/defconfig                   |  3 +++
>   drivers/firmware/google/cbmem.c                |  7 +++++++
>   drivers/firmware/google/coreboot_table.c       |  9 +++++++++
>   drivers/firmware/google/framebuffer-coreboot.c |  7 +++++++
>   drivers/firmware/google/memconsole-coreboot.c  |  7 +++++++
>   drivers/firmware/google/vpd.c                  |  7 +++++++
>   include/linux/mod_devicetable.h                |  8 ++++++++
>   scripts/mod/devicetable-offsets.c              |  3 +++
>   scripts/mod/file2alias.c                       | 10 ++++++++++
>   9 files changed, 61 insertions(+)
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-14 17:09   ` Andy Shevchenko
@ 2024-01-23 22:06     ` Brian Norris
  2024-01-30 23:51       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: Brian Norris @ 2024-01-23 22:06 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Nícolas F. R. A. Prado, Tzung-Bi Shih, kernel,
	AngeloGioacchino Del Regno, chrome-platform, Abhijit Gangurde,
	Greg Kroah-Hartman, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, linux-kbuild, linux-kernel

On Sun, Jan 14, 2024 at 07:09:29PM +0200, Andy Shevchenko wrote:
> On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote:
> > Generate aliases for coreboot modules to allow automatic module probing.
> 
> ...
> 
> > (no changes since v1)
> 
> Same Q as per v1.

I don't have v1 in my inbox, and this wasn't addressed in v3 either. But
copy/pasted off the archives:

"Don't you want to have a driver data or so associated with this?"

These drivers are super simple, and I doubt they will end up with
multiple tags per driver, so it seems unlikely we'd ever need it.
Additionally, struct coreboot_device already includes the tag
information, so anything that could be included in driver data could be
parsed out by the driver at probe time, if absolutely needed.

Brian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-23 22:06     ` Brian Norris
@ 2024-01-30 23:51       ` Greg Kroah-Hartman
  2024-01-31  0:01         ` Brian Norris
  0 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-30 23:51 UTC (permalink / raw)
  To: Brian Norris
  Cc: Andy Shevchenko, Nícolas F. R. A. Prado, Tzung-Bi Shih,
	kernel, AngeloGioacchino Del Regno, chrome-platform,
	Abhijit Gangurde, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, linux-kbuild, linux-kernel

On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> On Sun, Jan 14, 2024 at 07:09:29PM +0200, Andy Shevchenko wrote:
> > On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote:
> > > Generate aliases for coreboot modules to allow automatic module probing.
> > 
> > ...
> > 
> > > (no changes since v1)
> > 
> > Same Q as per v1.
> 
> I don't have v1 in my inbox, and this wasn't addressed in v3 either. But
> copy/pasted off the archives:
> 
> "Don't you want to have a driver data or so associated with this?"
> 
> These drivers are super simple, and I doubt they will end up with
> multiple tags per driver, so it seems unlikely we'd ever need it.
> Additionally, struct coreboot_device already includes the tag
> information, so anything that could be included in driver data could be
> parsed out by the driver at probe time, if absolutely needed.

But why limit yourself to 32bits now?  Why not make it 64?  It is going
to be sent to userspace, so you have to be very careful about it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-30 23:51       ` Greg Kroah-Hartman
@ 2024-01-31  0:01         ` Brian Norris
  2024-01-31  0:23           ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: Brian Norris @ 2024-01-31  0:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andy Shevchenko, Nícolas F. R. A. Prado, Tzung-Bi Shih,
	kernel, AngeloGioacchino Del Regno, chrome-platform,
	Abhijit Gangurde, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, linux-kbuild, linux-kernel

On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > "Don't you want to have a driver data or so associated with this?"
...
> But why limit yourself to 32bits now?  Why not make it 64?  It is going
> to be sent to userspace, so you have to be very careful about it.

Is that question related to the question I pasted/replied to, about
driver data? Or a new topic? Sorry if I'm misunderstanding.

Anyway, for the size of the tag field: I don't have a strong opinion.
But FWIW, they're coming from this project:

https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36

As you can see there, we're extremely far from exhausting 16 bits, let alone 32.

Brian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-31  0:01         ` Brian Norris
@ 2024-01-31  0:23           ` Greg Kroah-Hartman
  2024-02-01 22:45             ` Nícolas F. R. A. Prado
  0 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-31  0:23 UTC (permalink / raw)
  To: Brian Norris
  Cc: Andy Shevchenko, Nícolas F. R. A. Prado, Tzung-Bi Shih,
	kernel, AngeloGioacchino Del Regno, chrome-platform,
	Abhijit Gangurde, Masahiro Yamada, Nathan Chancellor,
	Nicolas Schier, Nipun Gupta, Pieter Jansen van Vuuren,
	Umang Jain, linux-kbuild, linux-kernel

On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote:
> On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > > "Don't you want to have a driver data or so associated with this?"
> ...
> > But why limit yourself to 32bits now?  Why not make it 64?  It is going
> > to be sent to userspace, so you have to be very careful about it.
> 
> Is that question related to the question I pasted/replied to, about
> driver data? Or a new topic? Sorry if I'm misunderstanding.

Same question, driver data, you make it 32 bits.

> Anyway, for the size of the tag field: I don't have a strong opinion.
> But FWIW, they're coming from this project:
> 
> https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36
> 
> As you can see there, we're extremely far from exhausting 16 bits, let alone 32.

We've run into running out of bits in other subsystems before, it's
"free" now, just be safe and make it 64 like I think Andy is suggesting.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-01-31  0:23           ` Greg Kroah-Hartman
@ 2024-02-01 22:45             ` Nícolas F. R. A. Prado
  2024-02-02  2:21               ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-02-01 22:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Brian Norris, Andy Shevchenko, Tzung-Bi Shih, kernel,
	AngeloGioacchino Del Regno, chrome-platform, Abhijit Gangurde,
	Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Nipun Gupta,
	Pieter Jansen van Vuuren, Umang Jain, linux-kbuild, linux-kernel

On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote:
> On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote:
> > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > > > "Don't you want to have a driver data or so associated with this?"
> > ...
> > > But why limit yourself to 32bits now?  Why not make it 64?  It is going
> > > to be sent to userspace, so you have to be very careful about it.
> > 
> > Is that question related to the question I pasted/replied to, about
> > driver data? Or a new topic? Sorry if I'm misunderstanding.
> 
> Same question, driver data, you make it 32 bits.
> 
> > Anyway, for the size of the tag field: I don't have a strong opinion.
> > But FWIW, they're coming from this project:
> > 
> > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36
> > 
> > As you can see there, we're extremely far from exhausting 16 bits, let alone 32.
> 
> We've run into running out of bits in other subsystems before, it's
> "free" now, just be safe and make it 64 like I think Andy is suggesting.

Either you and Andy are suggesting different things, or I still don't quite get
what you mean.

Andy was suggesting we added a driver_data field, that is:

struct coreboot_device_id {
	__u32 tag;
	kernel_ulong_t driver_data;
};

You're suggesting we make the tag 64 bits long:

struct coreboot_device_id {
	__u64 tag;
};

Like Brian, I'm not sure I see the benefit of either change. As he said, it's
unlikely that having a driver_data would provide any benefit and won't ever be
required anyway, and 32 bits is already a generous space to give to coreboot
tags. That said, I'm also not against either change, and can apply both of them
to the next version if that's indeed what your experience says will work best.
I'll wait another week or so before following up though to make sure we're all
on the same page.

(To be honest I also still don't see how this struct makes it to userspace and
is considered ABI, I only see the generated modalias being ABI and hence 32 vs
64 bit tag is ABI breakage but not adding driver_data, but I'll take your word
for it for now)

Thanks,
Nícolas

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-02-01 22:45             ` Nícolas F. R. A. Prado
@ 2024-02-02  2:21               ` Greg Kroah-Hartman
  2024-02-06 20:53                 ` Nícolas F. R. A. Prado
  0 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-02  2:21 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado
  Cc: Brian Norris, Andy Shevchenko, Tzung-Bi Shih, kernel,
	AngeloGioacchino Del Regno, chrome-platform, Abhijit Gangurde,
	Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Nipun Gupta,
	Pieter Jansen van Vuuren, Umang Jain, linux-kbuild, linux-kernel

On Thu, Feb 01, 2024 at 05:45:19PM -0500, Nícolas F. R. A. Prado wrote:
> On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote:
> > On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote:
> > > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> wrote:
> > > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > > > > "Don't you want to have a driver data or so associated with this?"
> > > ...
> > > > But why limit yourself to 32bits now?  Why not make it 64?  It is going
> > > > to be sent to userspace, so you have to be very careful about it.
> > > 
> > > Is that question related to the question I pasted/replied to, about
> > > driver data? Or a new topic? Sorry if I'm misunderstanding.
> > 
> > Same question, driver data, you make it 32 bits.
> > 
> > > Anyway, for the size of the tag field: I don't have a strong opinion.
> > > But FWIW, they're coming from this project:
> > > 
> > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36
> > > 
> > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32.
> > 
> > We've run into running out of bits in other subsystems before, it's
> > "free" now, just be safe and make it 64 like I think Andy is suggesting.
> 
> Either you and Andy are suggesting different things, or I still don't quite get
> what you mean.
> 
> Andy was suggesting we added a driver_data field, that is:
> 
> struct coreboot_device_id {
> 	__u32 tag;
> 	kernel_ulong_t driver_data;
> };
> 
> You're suggesting we make the tag 64 bits long:
> 
> struct coreboot_device_id {
> 	__u64 tag;
> };

Yeah, I'm confused, sorry.

Yes, add some driver_data, and if you are SURE your tag will NEVER be
larger than 32 bits, stick with that, but really, you are using the
space in empty padding anyway, so just make it 64bits please.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules
  2024-02-02  2:21               ` Greg Kroah-Hartman
@ 2024-02-06 20:53                 ` Nícolas F. R. A. Prado
  0 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-02-06 20:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Brian Norris, Andy Shevchenko, Tzung-Bi Shih, kernel,
	AngeloGioacchino Del Regno, chrome-platform, Abhijit Gangurde,
	Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Nipun Gupta,
	Pieter Jansen van Vuuren, Umang Jain, linux-kbuild, linux-kernel

On Thu, Feb 01, 2024 at 06:21:03PM -0800, Greg Kroah-Hartman wrote:
> On Thu, Feb 01, 2024 at 05:45:19PM -0500, Nícolas F. R. A. Prado wrote:
> > On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote:
> > > On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote:
> > > > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
> > > > <gregkh@linuxfoundation.org> wrote:
> > > > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > > > > > "Don't you want to have a driver data or so associated with this?"
> > > > ...
> > > > > But why limit yourself to 32bits now?  Why not make it 64?  It is going
> > > > > to be sent to userspace, so you have to be very careful about it.
> > > > 
> > > > Is that question related to the question I pasted/replied to, about
> > > > driver data? Or a new topic? Sorry if I'm misunderstanding.
> > > 
> > > Same question, driver data, you make it 32 bits.
> > > 
> > > > Anyway, for the size of the tag field: I don't have a strong opinion.
> > > > But FWIW, they're coming from this project:
> > > > 
> > > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36
> > > > 
> > > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32.
> > > 
> > > We've run into running out of bits in other subsystems before, it's
> > > "free" now, just be safe and make it 64 like I think Andy is suggesting.
> > 
> > Either you and Andy are suggesting different things, or I still don't quite get
> > what you mean.
> > 
> > Andy was suggesting we added a driver_data field, that is:
> > 
> > struct coreboot_device_id {
> > 	__u32 tag;
> > 	kernel_ulong_t driver_data;
> > };
> > 
> > You're suggesting we make the tag 64 bits long:
> > 
> > struct coreboot_device_id {
> > 	__u64 tag;
> > };
> 
> Yeah, I'm confused, sorry.
> 
> Yes, add some driver_data, and if you are SURE your tag will NEVER be
> larger than 32 bits, stick with that, but really, you are using the
> space in empty padding anyway, so just make it 64bits please.

Ok, after giving it a closer look, I've decided we really should just stick with
32 bits.

More fundamental than the previous argument that we aren't close to exhausting
32 bits for the tag in coreboot, is the fact that tags are literally defined as
32 bits long for the table entries [1]. Meaning, a tag being 32 bits long is
part of the coreboot ABI. We have to parse it as 32bits from memory.
Representing it as 64 bits internally and exposing it as 64 bits to userspace
would not only be unecessarily complicating things, but also misrepresenting the
data that we're getting from the firmware.

I can add driver_data for v4 no problem, as we can simply not use it while we
don't need it, but having tags be 64 bits actively complicates things for no
real gain, so it's a no-go.

Thanks,
Nícolas

[1] https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/main/src/commonlib/include/commonlib/coreboot_tables.h#128

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-02-06 20:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 13:18 [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 1/7] firmware: coreboot: Generate modalias uevent for devices Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules Nícolas F. R. A. Prado
2024-01-14 17:09   ` Andy Shevchenko
2024-01-23 22:06     ` Brian Norris
2024-01-30 23:51       ` Greg Kroah-Hartman
2024-01-31  0:01         ` Brian Norris
2024-01-31  0:23           ` Greg Kroah-Hartman
2024-02-01 22:45             ` Nícolas F. R. A. Prado
2024-02-02  2:21               ` Greg Kroah-Hartman
2024-02-06 20:53                 ` Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 3/7] firmware: google: cbmem: Add to module device table Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 4/7] firmware: google: vpd: " Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 5/7] firmware: google: memconsole: " Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 6/7] firmware: google: framebuffer: " Nícolas F. R. A. Prado
2024-01-12 13:18 ` [PATCH v2 7/7] arm64: defconfig: Enable support for cbmem entries in the coreboot table Nícolas F. R. A. Prado
2024-01-17 10:29 ` [PATCH v2 0/7] Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).