-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
talos2: port 2 more Linux patches to 6.6.16
Signed-off-by: Sergii Dmytruk <[email protected]> Signed-off-by: Thierry Laurion <[email protected]>
- Loading branch information
1 parent
a03857d
commit e97b379
Showing
2 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...es/linux-6.6.16-openpower/0006-arch-powerpc-Kconfig-enable-inclusion-of-drivers-fir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
From 6fca185285b3c355511885cdb4344a758550c9ba Mon Sep 17 00:00:00 2001 | ||
From: Krystian Hebel <[email protected]> | ||
Date: Wed, 8 Mar 2023 13:53:10 +0100 | ||
Subject: [PATCH 6/7] arch/powerpc/Kconfig: enable inclusion of | ||
drivers/firmware | ||
|
||
Signed-off-by: Krystian Hebel <[email protected]> | ||
--- | ||
arch/powerpc/Kconfig | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig | ||
index 2fe51e0ad..76cfc1277 100644 | ||
--- a/arch/powerpc/Kconfig | ||
+++ b/arch/powerpc/Kconfig | ||
@@ -1309,3 +1309,5 @@ config PPC_LIB_RHEAP | ||
source "arch/powerpc/kvm/Kconfig" | ||
|
||
source "kernel/livepatch/Kconfig" | ||
+ | ||
+source "drivers/firmware/Kconfig" | ||
-- | ||
2.47.1 | ||
|
91 changes: 91 additions & 0 deletions
91
patches/linux-6.6.16-openpower/0007-drivers-firmware-google-expose-CBMEM-as-sysfs-file.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
From 9cdaa84d65888ea288860426a70f36737a6640c6 Mon Sep 17 00:00:00 2001 | ||
From: Krystian Hebel <[email protected]> | ||
Date: Tue, 28 Mar 2023 18:31:21 +0200 | ||
Subject: [PATCH 7/7] drivers/firmware/google: expose CBMEM as sysfs file | ||
|
||
Signed-off-by: Krystian Hebel <[email protected]> | ||
--- | ||
drivers/firmware/google/Kconfig | 8 ++++++ | ||
drivers/firmware/google/coreboot_table.c | 33 ++++++++++++++++++++++++ | ||
2 files changed, 41 insertions(+) | ||
|
||
diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig | ||
index 41b78f5cb..cb0443f9c 100644 | ||
--- a/drivers/firmware/google/Kconfig | ||
+++ b/drivers/firmware/google/Kconfig | ||
@@ -44,6 +44,14 @@ config GOOGLE_COREBOOT_TABLE | ||
device tree node /firmware/coreboot. | ||
If unsure say N. | ||
|
||
+config GOOGLE_COREBOOT_CBMEM | ||
+ bool "Expose CBMEM as file" | ||
+ depends on GOOGLE_COREBOOT_TABLE | ||
+ help | ||
+ This option exposes raw contents of coreboot's CBMEM to be consumed | ||
+ by userspace tools. Path to file: /sys/firmware/cbmem. | ||
+ If unsure say N. | ||
+ | ||
config GOOGLE_MEMCONSOLE | ||
tristate | ||
depends on GOOGLE_MEMCONSOLE_X86_LEGACY || GOOGLE_MEMCONSOLE_COREBOOT | ||
diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c | ||
index 33ae94745..06d6db594 100644 | ||
--- a/drivers/firmware/google/coreboot_table.c | ||
+++ b/drivers/firmware/google/coreboot_table.c | ||
@@ -81,6 +81,18 @@ void coreboot_driver_unregister(struct coreboot_driver *driver) | ||
} | ||
EXPORT_SYMBOL(coreboot_driver_unregister); | ||
|
||
+#ifdef CONFIG_GOOGLE_COREBOOT_CBMEM | ||
+static ssize_t cbmem_read(struct file *filp, struct kobject *kobp, | ||
+ struct bin_attribute *bin_attr, char *buf, | ||
+ loff_t pos, size_t count) | ||
+{ | ||
+ return memory_read_from_buffer(buf, count, &pos, | ||
+ bin_attr->private, bin_attr->size); | ||
+} | ||
+ | ||
+static BIN_ATTR_RO(cbmem, 0); | ||
+#endif | ||
+ | ||
static int coreboot_table_populate(struct device *dev, void *ptr) | ||
{ | ||
int i, ret; | ||
@@ -167,6 +179,20 @@ static int coreboot_table_probe(struct platform_device *pdev) | ||
|
||
memunmap(ptr); | ||
|
||
+#ifdef CONFIG_GOOGLE_COREBOOT_CBMEM | ||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
+ if (res && res->start && res->end && resource_size(res)) { | ||
+ bin_attr_cbmem.size = resource_size(res); | ||
+ bin_attr_cbmem.private = memremap(res->start, | ||
+ resource_size(res), | ||
+ MEMREMAP_WB); | ||
+ if (sysfs_create_bin_file(firmware_kobj, &bin_attr_cbmem)) { | ||
+ bin_attr_cbmem.size = 0; | ||
+ bin_attr_cbmem.private = NULL; | ||
+ } | ||
+ } | ||
+#endif | ||
+ | ||
return ret; | ||
} | ||
|
||
@@ -178,6 +204,13 @@ static int __cb_dev_unregister(struct device *dev, void *dummy) | ||
|
||
static int coreboot_table_remove(struct platform_device *pdev) | ||
{ | ||
+#ifdef CONFIG_GOOGLE_COREBOOT_CBMEM | ||
+ if (bin_attr_cbmem.private) { | ||
+ sysfs_remove_bin_file(firmware_kobj, &bin_attr_cbmem); | ||
+ memunmap(bin_attr_cbmem.private); | ||
+ } | ||
+#endif | ||
+ | ||
bus_for_each_dev(&coreboot_bus_type, NULL, NULL, __cb_dev_unregister); | ||
return 0; | ||
} | ||
-- | ||
2.47.1 | ||
|