include/linux/efi.h | 2 ++ drivers/firmware/efi/efi.c | 2 +- drivers/firmware/efi/ovmf-debug-log.c | 43 ++++++--------------------- drivers/firmware/efi/Kconfig | 2 +- 4 files changed, 13 insertions(+), 36 deletions(-)
Flip the driver from tristate to bool, so it can not be built modular
any more. Also drop the platform device boilerplate, simply call the
probe function directly instead.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507091432.rbbrjGoU-lkp@intel.com/
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/linux/efi.h | 2 ++
drivers/firmware/efi/efi.c | 2 +-
drivers/firmware/efi/ovmf-debug-log.c | 43 ++++++---------------------
drivers/firmware/efi/Kconfig | 2 +-
4 files changed, 13 insertions(+), 36 deletions(-)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a71830608422..f6da5c226fda 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1346,6 +1346,8 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
+int ovmf_log_probe(unsigned long ovmf_debug_log_table);
+
/*
* efivar ops event type
*/
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 3161f918ce53..1ce428e2ac8a 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -476,7 +476,7 @@ static int __init efisubsys_init(void)
if (IS_ENABLED(CONFIG_OVMF_DEBUG_LOG) &&
efi.ovmf_debug_log != EFI_INVALID_TABLE_ADDR)
- platform_device_register_simple("ovmf_debug_log", 0, NULL, 0);
+ ovmf_log_probe(efi.ovmf_debug_log);
return 0;
diff --git a/drivers/firmware/efi/ovmf-debug-log.c b/drivers/firmware/efi/ovmf-debug-log.c
index d4fec178fa9f..b292f35109b6 100644
--- a/drivers/firmware/efi/ovmf-debug-log.c
+++ b/drivers/firmware/efi/ovmf-debug-log.c
@@ -64,38 +64,33 @@ static struct bin_attribute ovmf_log_bin_attr = {
.read = ovmf_log_read,
};
-static int ovmf_log_probe(struct platform_device *dev)
+__init int ovmf_log_probe(unsigned long ovmf_debug_log_table)
{
u64 size;
int ret = -EINVAL;
- if (efi.ovmf_debug_log == EFI_INVALID_TABLE_ADDR) {
- dev_err(&dev->dev, "OVMF debug log: not available\n");
- return -EINVAL;
- }
-
/* map + verify header */
- hdr = memremap(efi.ovmf_debug_log, sizeof(*hdr), MEMREMAP_WB);
+ hdr = memremap(ovmf_debug_log_table, sizeof(*hdr), MEMREMAP_WB);
if (!hdr) {
- dev_err(&dev->dev, "OVMF debug log: header map failed\n");
+ printk(KERN_ERR "OVMF debug log: header map failed\n");
return -EINVAL;
}
if (hdr->magic1 != OVMF_DEBUG_LOG_MAGIC1 ||
hdr->magic2 != OVMF_DEBUG_LOG_MAGIC2) {
- dev_err(&dev->dev, "OVMF debug log: magic mismatch\n");
+ printk(KERN_ERR "OVMF debug log: magic mismatch\n");
goto err_unmap;
}
size = hdr->hdr_size + hdr->log_size;
- dev_info(&dev->dev, "firmware version: \"%s\"\n", hdr->fw_version);
- dev_info(&dev->dev, "log buffer size: %lluk\n", size / 1024);
+ printk(KERN_INFO "OVMF debug log: firmware version: \"%s\"\n", hdr->fw_version);
+ printk(KERN_INFO "OVMF debug log: buffer size: %lluk\n", size / 1024);
/* map complete log buffer */
memunmap(hdr);
- hdr = memremap(efi.ovmf_debug_log, size, MEMREMAP_WB);
+ hdr = memremap(ovmf_debug_log_table, size, MEMREMAP_WB);
if (!hdr) {
- dev_err(&dev->dev, "OVMF debug log: buffer map failed\n");
+ printk(KERN_ERR "OVMF debug log: buffer map failed\n");
return -EINVAL;
}
logbuf = (void *)hdr + hdr->hdr_size;
@@ -104,7 +99,7 @@ static int ovmf_log_probe(struct platform_device *dev)
ovmf_log_bin_attr.size = size;
ret = sysfs_create_bin_file(efi_kobj, &ovmf_log_bin_attr);
if (ret != 0) {
- dev_err(&dev->dev, "OVMF debug log: sysfs register failed\n");
+ printk(KERN_ERR "OVMF debug log: sysfs register failed\n");
goto err_unmap;
}
@@ -114,23 +109,3 @@ static int ovmf_log_probe(struct platform_device *dev)
memunmap(hdr);
return ret;
}
-
-static void ovmf_log_remove(struct platform_device *dev)
-{
- memunmap(hdr);
-}
-
-static struct platform_driver ovmf_log_driver = {
- .probe = ovmf_log_probe,
- .remove = ovmf_log_remove,
- .driver = {
- .name = "ovmf_debug_log",
- },
-};
-
-module_platform_driver(ovmf_log_driver);
-
-MODULE_DESCRIPTION("OVMF debug log");
-MODULE_AUTHOR("Gerd Hoffmann <kraxel@redhat.com>");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:ovmf_debug_log");
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index ac0a03ec3452..eb1bff6968a5 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -264,7 +264,7 @@ config EFI_COCO_SECRET
allows userspace programs to access the injected secrets.
config OVMF_DEBUG_LOG
- tristate "Expose OVMF firmware debug log via sysfs"
+ bool "Expose OVMF firmware debug log via sysfs"
depends on EFI
help
Recent OVMF versions (edk2-stable202508 + newer) can write
--
2.50.0
On Wed, 9 Jul 2025 at 20:11, Gerd Hoffmann <kraxel@redhat.com> wrote: > > Flip the driver from tristate to bool, so it can not be built modular > any more. Also drop the platform device boilerplate, simply call the > probe function directly instead. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202507091432.rbbrjGoU-lkp@intel.com/ > Suggested-by: Ard Biesheuvel <ardb@kernel.org> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > include/linux/efi.h | 2 ++ > drivers/firmware/efi/efi.c | 2 +- > drivers/firmware/efi/ovmf-debug-log.c | 43 ++++++--------------------- > drivers/firmware/efi/Kconfig | 2 +- > 4 files changed, 13 insertions(+), 36 deletions(-) > Thanks Gerd. I'll fold this into the existing patch instead, so we don't break bisect needlessly. > diff --git a/include/linux/efi.h b/include/linux/efi.h > index a71830608422..f6da5c226fda 100644 > --- a/include/linux/efi.h > +++ b/include/linux/efi.h > @@ -1346,6 +1346,8 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table) > > umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n); > > +int ovmf_log_probe(unsigned long ovmf_debug_log_table); > + > /* > * efivar ops event type > */ > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index 3161f918ce53..1ce428e2ac8a 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -476,7 +476,7 @@ static int __init efisubsys_init(void) > > if (IS_ENABLED(CONFIG_OVMF_DEBUG_LOG) && > efi.ovmf_debug_log != EFI_INVALID_TABLE_ADDR) > - platform_device_register_simple("ovmf_debug_log", 0, NULL, 0); > + ovmf_log_probe(efi.ovmf_debug_log); > > return 0; > > diff --git a/drivers/firmware/efi/ovmf-debug-log.c b/drivers/firmware/efi/ovmf-debug-log.c > index d4fec178fa9f..b292f35109b6 100644 > --- a/drivers/firmware/efi/ovmf-debug-log.c > +++ b/drivers/firmware/efi/ovmf-debug-log.c > @@ -64,38 +64,33 @@ static struct bin_attribute ovmf_log_bin_attr = { > .read = ovmf_log_read, > }; > > -static int ovmf_log_probe(struct platform_device *dev) > +__init int ovmf_log_probe(unsigned long ovmf_debug_log_table) > { > u64 size; > int ret = -EINVAL; > > - if (efi.ovmf_debug_log == EFI_INVALID_TABLE_ADDR) { > - dev_err(&dev->dev, "OVMF debug log: not available\n"); > - return -EINVAL; > - } > - > /* map + verify header */ > - hdr = memremap(efi.ovmf_debug_log, sizeof(*hdr), MEMREMAP_WB); > + hdr = memremap(ovmf_debug_log_table, sizeof(*hdr), MEMREMAP_WB); > if (!hdr) { > - dev_err(&dev->dev, "OVMF debug log: header map failed\n"); > + printk(KERN_ERR "OVMF debug log: header map failed\n"); > return -EINVAL; > } > > if (hdr->magic1 != OVMF_DEBUG_LOG_MAGIC1 || > hdr->magic2 != OVMF_DEBUG_LOG_MAGIC2) { > - dev_err(&dev->dev, "OVMF debug log: magic mismatch\n"); > + printk(KERN_ERR "OVMF debug log: magic mismatch\n"); > goto err_unmap; > } > > size = hdr->hdr_size + hdr->log_size; > - dev_info(&dev->dev, "firmware version: \"%s\"\n", hdr->fw_version); > - dev_info(&dev->dev, "log buffer size: %lluk\n", size / 1024); > + printk(KERN_INFO "OVMF debug log: firmware version: \"%s\"\n", hdr->fw_version); > + printk(KERN_INFO "OVMF debug log: buffer size: %lluk\n", size / 1024); > > /* map complete log buffer */ > memunmap(hdr); > - hdr = memremap(efi.ovmf_debug_log, size, MEMREMAP_WB); > + hdr = memremap(ovmf_debug_log_table, size, MEMREMAP_WB); > if (!hdr) { > - dev_err(&dev->dev, "OVMF debug log: buffer map failed\n"); > + printk(KERN_ERR "OVMF debug log: buffer map failed\n"); > return -EINVAL; > } > logbuf = (void *)hdr + hdr->hdr_size; > @@ -104,7 +99,7 @@ static int ovmf_log_probe(struct platform_device *dev) > ovmf_log_bin_attr.size = size; > ret = sysfs_create_bin_file(efi_kobj, &ovmf_log_bin_attr); > if (ret != 0) { > - dev_err(&dev->dev, "OVMF debug log: sysfs register failed\n"); > + printk(KERN_ERR "OVMF debug log: sysfs register failed\n"); > goto err_unmap; > } > > @@ -114,23 +109,3 @@ static int ovmf_log_probe(struct platform_device *dev) > memunmap(hdr); > return ret; > } > - > -static void ovmf_log_remove(struct platform_device *dev) > -{ > - memunmap(hdr); > -} > - > -static struct platform_driver ovmf_log_driver = { > - .probe = ovmf_log_probe, > - .remove = ovmf_log_remove, > - .driver = { > - .name = "ovmf_debug_log", > - }, > -}; > - > -module_platform_driver(ovmf_log_driver); > - > -MODULE_DESCRIPTION("OVMF debug log"); > -MODULE_AUTHOR("Gerd Hoffmann <kraxel@redhat.com>"); > -MODULE_LICENSE("GPL"); > -MODULE_ALIAS("platform:ovmf_debug_log"); > diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig > index ac0a03ec3452..eb1bff6968a5 100644 > --- a/drivers/firmware/efi/Kconfig > +++ b/drivers/firmware/efi/Kconfig > @@ -264,7 +264,7 @@ config EFI_COCO_SECRET > allows userspace programs to access the injected secrets. > > config OVMF_DEBUG_LOG > - tristate "Expose OVMF firmware debug log via sysfs" > + bool "Expose OVMF firmware debug log via sysfs" > depends on EFI > help > Recent OVMF versions (edk2-stable202508 + newer) can write > -- > 2.50.0 > >
© 2016 - 2025 Red Hat, Inc.