mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: linux-efi@vger.kernel.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	kernel test robot <lkp@intel.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] efi: remove modular option for ovmf-debug-log
Date: Wed,  9 Jul 2025 12:11:18 +0200	[thread overview]
Message-ID: <20250709101119.927808-1-kraxel@redhat.com> (raw)

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


             reply	other threads:[~2025-07-09 10:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 10:11 Gerd Hoffmann [this message]
2025-07-09 10:24 ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250709101119.927808-1-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®