drivers/firmware/Kconfig | 1 - drivers/firmware/qemu_fw_cfg.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-)
From: Fabian Vogt <fvogt@suse.de>
Some platforms require CONFIG_NO_IOPORT_MAP=y but would also support
qemu_fw_cfg over MMIO. Currently the qemu_fw_cfg module can't be built for
those as it needs HAS_IOPORT_MAP=y for ioport remapping.
This patch allows to build the qemu_fw_cfg in those cases. If
CONFIG_HAS_IOPORT_MAP=n, qemu_fw_cfg is built without support for ioport
based access.
Signed-off-by: Fabian Vogt <fvogt@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
Resent, as the original submission seems overlooked:
https://lore.kernel.org/2294036.ElGaqSPkdT@linux-e202.suse.de/
The patch has been on openSUSE / SUSE kernels already for years.
drivers/firmware/Kconfig | 1 -
drivers/firmware/qemu_fw_cfg.c | 5 +++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index bbd2155d8483..91442f85f0f0 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -122,7 +122,6 @@ config RASPBERRYPI_FIRMWARE
config FW_CFG_SYSFS
tristate "QEMU fw_cfg device support in sysfs"
depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || RISCV || SPARC || X86)
- depends on HAS_IOPORT_MAP
default n
help
Say Y or M here to enable the exporting of the QEMU firmware
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 2615fb780e3c..e15116f84a70 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -258,6 +258,7 @@ static int fw_cfg_do_platform_probe(struct platform_device *pdev)
return -EFAULT;
}
} else {
+#ifdef CONFIG_HAS_IOPORT_MAP
if (!request_region(fw_cfg_p_base,
fw_cfg_p_size, "fw_cfg_io"))
return -EBUSY;
@@ -266,6 +267,10 @@ static int fw_cfg_do_platform_probe(struct platform_device *pdev)
release_region(fw_cfg_p_base, fw_cfg_p_size);
return -EFAULT;
}
+#else
+ dev_err(&pdev->dev, "IO region given but CONFIG_HAS_IOPORT_MAP=n");
+ return -EINVAL;
+#endif
}
/* were custom register offsets provided (e.g. on the command line)? */
--
2.49.0
Hi Takashi, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.16-rc2 next-20250617] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Takashi-Iwai/firmware-qemu_fw_cfg-Do-not-hard-depend-on-CONFIG_HAS_IOPORT_MAP/20250617-001546 base: linus/master patch link: https://lore.kernel.org/r/20250616161408.26748-1-tiwai%40suse.de patch subject: [PATCH RESEND] firmware: qemu_fw_cfg: Do not hard depend on CONFIG_HAS_IOPORT_MAP config: arm64-randconfig-r073-20250618 (https://download.01.org/0day-ci/archive/20250618/202506181300.OUXh1Amh-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 9.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250618/202506181300.OUXh1Amh-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202506181300.OUXh1Amh-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/firmware/qemu_fw_cfg.c: In function 'fw_cfg_io_cleanup': >> drivers/firmware/qemu_fw_cfg.c:207:3: error: implicit declaration of function 'ioport_unmap' [-Werror=implicit-function-declaration] 207 | ioport_unmap(fw_cfg_dev_base); | ^~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/ioport_unmap +207 drivers/firmware/qemu_fw_cfg.c 2d6d60a3d3eca5 Marc-André Lureau 2018-02-28 199 75f3e8e47f3810 Gabriel Somlo 2016-01-28 200 /* clean up fw_cfg device i/o */ 75f3e8e47f3810 Gabriel Somlo 2016-01-28 201 static void fw_cfg_io_cleanup(void) 75f3e8e47f3810 Gabriel Somlo 2016-01-28 202 { 75f3e8e47f3810 Gabriel Somlo 2016-01-28 203 if (fw_cfg_is_mmio) { 75f3e8e47f3810 Gabriel Somlo 2016-01-28 204 iounmap(fw_cfg_dev_base); 75f3e8e47f3810 Gabriel Somlo 2016-01-28 205 release_mem_region(fw_cfg_p_base, fw_cfg_p_size); 75f3e8e47f3810 Gabriel Somlo 2016-01-28 206 } else { 75f3e8e47f3810 Gabriel Somlo 2016-01-28 @207 ioport_unmap(fw_cfg_dev_base); 75f3e8e47f3810 Gabriel Somlo 2016-01-28 208 release_region(fw_cfg_p_base, fw_cfg_p_size); 75f3e8e47f3810 Gabriel Somlo 2016-01-28 209 } 75f3e8e47f3810 Gabriel Somlo 2016-01-28 210 } 75f3e8e47f3810 Gabriel Somlo 2016-01-28 211 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.