lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <162164275795.261970.6600777460965468381.stgit@djiang5-desk3.ch.intel.com>
Date:   Fri, 21 May 2021 17:19:17 -0700
From:   Dave Jiang <dave.jiang@...el.com>
To:     alex.williamson@...hat.com, kwankhede@...dia.com,
        tglx@...utronix.de, vkoul@...nel.org, jgg@...lanox.com
Cc:     megha.dey@...el.com, jacob.jun.pan@...el.com, ashok.raj@...el.com,
        yi.l.liu@...el.com, baolu.lu@...el.com, kevin.tian@...el.com,
        sanjay.k.kumar@...el.com, tony.luck@...el.com,
        dan.j.williams@...el.com, eric.auger@...hat.com,
        pbonzini@...hat.com, dmaengine@...r.kernel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: [PATCH v6 02/20] dmaengine: idxd: add external module driver support
 for dsa_bus_type

Add support to allow an external driver to be registered to the
dsa_bus_type and also auto-loaded.

Signed-off-by: Dave Jiang <dave.jiang@...el.com>
---
 drivers/dma/idxd/idxd.h  |    6 ++++++
 drivers/dma/idxd/init.c  |    2 ++
 drivers/dma/idxd/sysfs.c |    6 ++++++
 3 files changed, 14 insertions(+)

diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index 0970d0e67976..22afaf7ee637 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -483,11 +483,17 @@ static inline int idxd_wq_refcount(struct idxd_wq *wq)
 	return wq->client_count;
 };
 
+#define MODULE_ALIAS_IDXD_DEVICE(type) MODULE_ALIAS("idxd:t" __stringify(type) "*")
+#define IDXD_DEVICES_MODALIAS_FMT "idxd:t%d"
+
 int __must_check __idxd_driver_register(struct idxd_device_driver *idxd_drv,
 					struct module *module, const char *mod_name);
 #define idxd_driver_register(driver) \
 	__idxd_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
 
+#define module_idxd_driver(driver) \
+	module_driver(driver, idxd_driver_register, idxd_driver_unregister)
+
 void idxd_driver_unregister(struct idxd_device_driver *idxd_drv);
 
 int idxd_register_bus_type(void);
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index 30d3ab0c4051..bed9169152f9 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -843,8 +843,10 @@ int __idxd_driver_register(struct idxd_device_driver *idxd_drv, struct module *o
 
 	return driver_register(drv);
 }
+EXPORT_SYMBOL_GPL(__idxd_driver_register);
 
 void idxd_driver_unregister(struct idxd_device_driver *idxd_drv)
 {
 	driver_unregister(&idxd_drv->drv);
 }
+EXPORT_SYMBOL_GPL(idxd_driver_unregister);
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index ff2f1c97ed74..4fcb8833a4df 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -53,11 +53,17 @@ static int idxd_config_bus_remove(struct device *dev)
 	return 0;
 }
 
+static int idxd_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0);
+}
+
 struct bus_type dsa_bus_type = {
 	.name = "dsa",
 	.match = idxd_config_bus_match,
 	.probe = idxd_config_bus_probe,
 	.remove = idxd_config_bus_remove,
+	.uevent = idxd_bus_uevent,
 };
 
 #define DRIVER_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ