Re: [PATCH] modules/firmware: add a new option to denote a firmware group to choose one.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 19, 2023 at 02:36:52PM +1000, Dave Airlie wrote:
From: Dave Airlie <airlied@xxxxxxxxxx>

This adds a tag that will go into the module info, only one firmware from
the group given needs to be available for this driver to work. This allows
dracut to avoid adding in firmware that aren't needed.

This just brackets a module list in the modinfo, the modules in the list
will get entries in reversed order so the last module in the list is the
preferred one.

The corresponding dracut code it at:
https://github.com/dracutdevs/dracut/pull/2309

it would be good to have the example usage in the commit message here so
it can be easily checked as reference for other drivers.

I don't think we ever had any ordering in modinfo being relevant for
other things. Considering the use case and that we could also use a
similar thing for i915 / xe modules wrt to the major version,
couldn't we do something like below?

	MODULE_FIRMWARE_GROUP("nvidia/ga106/gsp/gsp");
	MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5258902.bin");
	MODULE_FIRMWARE("nvidia/ga106/gsp/gsp-5303002.bin");

so the group is created by startswith() rather than by the order the
modinfo appears in the elf section. In i915 we'd have:

MODULE_FIRMWARE_GROUP("i915/tgl_guc")

There is still an order the kernel would probably like: latest version.
But then it's an order only among things with the same key.

Lucas De Marchi


Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Cc: linux-modules@xxxxxxxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
---
include/linux/module.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/module.h b/include/linux/module.h
index 4435ad9439ab..f02448ed5e2b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -289,6 +289,8 @@ extern typeof(name) __mod_##type##__##name##_device_table		\
 * files require multiple MODULE_FIRMWARE() specifiers */
#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)

+#define MODULE_FIRMWARE_GROUP_ONLY_ONE(_grpname) MODULE_INFO(firmware_group_only_one, _grpname)
+
#define MODULE_IMPORT_NS(ns)	MODULE_INFO(import_ns, __stringify(ns))

struct notifier_block;
--
2.39.2




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux