2021-12-22 08:28:45

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 00/10] drm: Make drivers to honour the nomodeset parameter

The nomodeset kernel command line parameter is used to prevent the KMS/DRM
drivers to be registered/probed. But only a few drivers implement support
for this and most DRM drivers just ignore it.

This patch series is a v3 to make DRM drivers to honour nomodeset. It is
posted as separate patches to make easier for drivers maintainers to ack
or pick them independently at their own pace.

The drm_module_{pci,platform}_driver() helper macros are added, which are
just wrappers around module_{pci,platform}_driver() but adding a check for
drm_firmware_drivers_only() and returning -ENODEV if that is true.

PCI and platform DRM drivers are then modified in the following patches to
make use of those macros.

Only KMS drivers will be ported to use these new macros, and only for PCI
and platform DRM drivers. A follow-up series might do the same for drivers
that are rendering-only and for USB/SPI/I2C devices, but it will need more
discussion to agree whether that's desirable or not.

Not all drivers were posted in v3 to avoid flooding the list with too many
patches. I'm only including the patches adding the macros and some patches
as an example of their usage.

I've built tested with 'make allmodconfig && make M=drivers/gpu/drm' but I
don't have hardware to test the drivers, so review/testing is appreciated.

Best regards,
Javier

Changes in v3:
- Include Thomas Zimmermann's patches in the series and rebase on top.
- Add collected Acked-by tags from v2.

Changes in v2:
- Add drm_module_{pci,platform}_driver() macros and put the check there
(Thomas Zimmermann).
- Use the drm_module_*_driver() macros if possible (Thomas Zimmermann).
- Leave the DRM drivers that don't set the DRIVER_MODESET driver feature
(Lucas Stach).
- Leave USB/SPI/I2C drivers and only include PCI and platform ones
(Noralf Trønnes).
- Add collected Reviewed-by tags

Javier Martinez Canillas (5):
drm: Provide platform module-init macro
drm/imx/dcss: Replace module initialization with DRM helpers
drm/komeda: Replace module initialization with DRM helpers
drm/arm/hdlcd: Replace module initialization with DRM helpers
drm/malidp: Replace module initialization with DRM helpers

Thomas Zimmermann (5):
drm: Provide PCI module-init macros
drm/ast: Replace module-init boiler-plate code with DRM helpers
drm/bochs: Replace module-init boiler-plate code with DRM helpers
drm/cirrus: Replace module-init boiler-plate code with DRM helpers
drm/hisilicon/hibmc: Replace module initialization with DRM helpers

Documentation/gpu/drm-internals.rst | 6 +
.../gpu/drm/arm/display/komeda/komeda_drv.c | 3 +-
drivers/gpu/drm/arm/hdlcd_drv.c | 3 +-
drivers/gpu/drm/arm/malidp_drv.c | 3 +-
drivers/gpu/drm/ast/ast_drv.c | 18 +--
.../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 3 +-
drivers/gpu/drm/imx/dcss/dcss-drv.c | 3 +-
drivers/gpu/drm/tiny/bochs.c | 20 +--
drivers/gpu/drm/tiny/cirrus.c | 17 +--
include/drm/drm_module.h | 125 ++++++++++++++++++
10 files changed, 147 insertions(+), 54 deletions(-)
create mode 100644 include/drm/drm_module.h

--
2.33.1



2021-12-22 08:28:47

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 01/10] drm: Provide PCI module-init macros

From: Thomas Zimmermann <[email protected]>

Provide helper macros to register PCI-based DRM drivers. The new
macros behave like module_pci_driver() with an additional test if
DRM modesetting has been enabled.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

Documentation/gpu/drm-internals.rst | 6 ++
include/drm/drm_module.h | 95 +++++++++++++++++++++++++++++
2 files changed, 101 insertions(+)
create mode 100644 include/drm/drm_module.h

diff --git a/Documentation/gpu/drm-internals.rst b/Documentation/gpu/drm-internals.rst
index 607f78f0f189..38afed24a75c 100644
--- a/Documentation/gpu/drm-internals.rst
+++ b/Documentation/gpu/drm-internals.rst
@@ -75,6 +75,12 @@ update it, its value is mostly useless. The DRM core prints it to the
kernel log at initialization time and passes it to userspace through the
DRM_IOCTL_VERSION ioctl.

+Module Initialization
+---------------------
+
+.. kernel-doc:: include/drm/drm_module.h
+ :doc: overview
+
Managing Ownership of the Framebuffer Aperture
----------------------------------------------

diff --git a/include/drm/drm_module.h b/include/drm/drm_module.h
new file mode 100644
index 000000000000..eb3fd7bcbec9
--- /dev/null
+++ b/include/drm/drm_module.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: MIT */
+
+#ifndef DRM_MODULE_H
+#define DRM_MODULE_H
+
+#include <linux/pci.h>
+
+#include <drm/drm_drv.h>
+
+/**
+ * DOC: overview
+ *
+ * This library provides helpers registering DRM drivers during module
+ * initialization and shutdown. The provided helpers act like bus-specific
+ * module helpers, such as module_pci_driver(), but respect additional
+ * parameters that control DRM driver registration.
+ *
+ * Below is an example of initializing a DRM driver for a device on the
+ * PCI bus.
+ *
+ * .. code-block:: c
+ *
+ * struct pci_driver my_pci_drv = {
+ * };
+ *
+ * drm_module_pci_driver(my_pci_drv);
+ *
+ * The generated code will test if DRM drivers are enabled and register
+ * the PCI driver my_pci_drv. For more complex module initialization, you
+ * can still use module_init() and module_exit() in your driver.
+ */
+
+/*
+ * PCI drivers
+ */
+
+static inline int __init drm_pci_register_driver(struct pci_driver *pci_drv)
+{
+ if (drm_firmware_drivers_only())
+ return -ENODEV;
+
+ return pci_register_driver(pci_drv);
+}
+
+/**
+ * drm_module_pci_driver - Register a DRM driver for PCI-based devices
+ * @__pci_drv: the PCI driver structure
+ *
+ * Registers a DRM driver for devices on the PCI bus. The helper
+ * macro behaves like module_pci_driver() but tests the state of
+ * drm_firmware_drivers_only(). For more complex module initialization,
+ * use module_init() and module_exit() directly.
+ *
+ * Each module may only use this macro once. Calling it replaces
+ * module_init() and module_exit().
+ */
+#define drm_module_pci_driver(__pci_drv) \
+ module_driver(__pci_drv, drm_pci_register_driver, pci_unregister_driver)
+
+static inline int __init
+drm_pci_register_driver_if_modeset(struct pci_driver *pci_drv, int modeset)
+{
+ if (drm_firmware_drivers_only() && modeset == -1)
+ return -ENODEV;
+ if (modeset == 0)
+ return -ENODEV;
+
+ return pci_register_driver(pci_drv);
+}
+
+static inline void __exit
+drm_pci_unregister_driver_if_modeset(struct pci_driver *pci_drv, int modeset)
+{
+ pci_unregister_driver(pci_drv);
+}
+
+/**
+ * drm_module_pci_driver_if_modeset - Register a DRM driver for PCI-based devices
+ * @__pci_drv: the PCI driver structure
+ * @__modeset: an additional parameter that disables the driver
+ *
+ * This macro is deprecated and only provided for existing drivers. For
+ * new drivers, use drm_module_pci_driver().
+ *
+ * Registers a DRM driver for devices on the PCI bus. The helper macro
+ * behaves like drm_module_pci_driver() with an additional driver-specific
+ * flag. If __modeset is 0, the driver has been disabled, if __modeset is
+ * -1 the driver state depends on the global DRM state. For all other
+ * values, the PCI driver has been enabled. The default should be -1.
+ */
+#define drm_module_pci_driver_if_modeset(__pci_drv, __modeset) \
+ module_driver(__pci_drv, drm_pci_register_driver_if_modeset, \
+ drm_pci_unregister_driver_if_modeset, __modeset)
+
+#endif
--
2.33.1


2021-12-22 08:28:49

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 02/10] drm/ast: Replace module-init boiler-plate code with DRM helpers

From: Thomas Zimmermann <[email protected]>

Remove custom ast_init() and ast_exit() functions and initialize the
module with DRM module helpers.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/ast/ast_drv.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 6d8613f6fe1c..7465c4f0156a 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -34,6 +34,7 @@
#include <drm/drm_crtc_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_gem_vram_helper.h>
+#include <drm/drm_module.h>
#include <drm/drm_probe_helper.h>

#include "ast_drv.h"
@@ -230,22 +231,7 @@ static struct pci_driver ast_pci_driver = {
.driver.pm = &ast_pm_ops,
};

-static int __init ast_init(void)
-{
- if (drm_firmware_drivers_only() && ast_modeset == -1)
- return -EINVAL;
-
- if (ast_modeset == 0)
- return -EINVAL;
- return pci_register_driver(&ast_pci_driver);
-}
-static void __exit ast_exit(void)
-{
- pci_unregister_driver(&ast_pci_driver);
-}
-
-module_init(ast_init);
-module_exit(ast_exit);
+drm_module_pci_driver_if_modeset(ast_pci_driver, ast_modeset);

MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
--
2.33.1


2021-12-22 08:28:52

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

From: Thomas Zimmermann <[email protected]>

Remove custom bochs_init() and bochs_exit() functions and initialize
the module with DRM module helpers.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/tiny/bochs.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index fc26a1ce11ee..ed971c8bb446 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -10,6 +10,7 @@
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_managed.h>
+#include <drm/drm_module.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>

@@ -716,24 +717,7 @@ static struct pci_driver bochs_pci_driver = {
/* ---------------------------------------------------------------------- */
/* module init/exit */

-static int __init bochs_init(void)
-{
- if (drm_firmware_drivers_only() && bochs_modeset == -1)
- return -EINVAL;
-
- if (bochs_modeset == 0)
- return -EINVAL;
-
- return pci_register_driver(&bochs_pci_driver);
-}
-
-static void __exit bochs_exit(void)
-{
- pci_unregister_driver(&bochs_pci_driver);
-}
-
-module_init(bochs_init);
-module_exit(bochs_exit);
+drm_module_pci_driver_if_modeset(bochs_pci_driver, bochs_modeset);

MODULE_DEVICE_TABLE(pci, bochs_pci_tbl);
MODULE_AUTHOR("Gerd Hoffmann <[email protected]>");
--
2.33.1


2021-12-22 08:28:53

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 04/10] drm/cirrus: Replace module-init boiler-plate code with DRM helpers

From: Thomas Zimmermann <[email protected]>

Remove custom cirrus_init() and cirrus_exit() functions and initialize
the module with DRM module helpers.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/tiny/cirrus.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index c95d9ff7d600..ecf2475d0f16 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -39,6 +39,7 @@
#include <drm/drm_ioctl.h>
#include <drm/drm_managed.h>
#include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_module.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>

@@ -633,21 +634,7 @@ static struct pci_driver cirrus_pci_driver = {
.remove = cirrus_pci_remove,
};

-static int __init cirrus_init(void)
-{
- if (drm_firmware_drivers_only())
- return -EINVAL;
-
- return pci_register_driver(&cirrus_pci_driver);
-}
-
-static void __exit cirrus_exit(void)
-{
- pci_unregister_driver(&cirrus_pci_driver);
-}
-
-module_init(cirrus_init);
-module_exit(cirrus_exit);
+drm_module_pci_driver(cirrus_pci_driver)

MODULE_DEVICE_TABLE(pci, pciidlist);
MODULE_LICENSE("GPL");
--
2.33.1


2021-12-22 08:28:56

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 05/10] drm/hisilicon/hibmc: Replace module initialization with DRM helpers

From: Thomas Zimmermann <[email protected]>

Replace module_pci_driver() with drm_module_pci_driver(). The DRM macro
respects drm_firmware_drivers_only() and fails if the flag has been set.

Signed-off-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 610fc8e135f9..fe4269c5aa0a 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -20,6 +20,7 @@
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_managed.h>
+#include <drm/drm_module.h>
#include <drm/drm_vblank.h>

#include "hibmc_drm_drv.h"
@@ -379,7 +380,7 @@ static struct pci_driver hibmc_pci_driver = {
.driver.pm = &hibmc_pm_ops,
};

-module_pci_driver(hibmc_pci_driver);
+drm_module_pci_driver(hibmc_pci_driver);

MODULE_DEVICE_TABLE(pci, hibmc_pci_table);
MODULE_AUTHOR("RongrongZou <[email protected]>");
--
2.33.1


2021-12-22 08:28:58

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 06/10] drm: Provide platform module-init macro

Provide a helper macro to register platform DRM drivers. The new
macro behaves like module_platform_driver() with an additional
test if DRM modesetting has been enabled.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

include/drm/drm_module.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/include/drm/drm_module.h b/include/drm/drm_module.h
index eb3fd7bcbec9..4db1ae03d9a5 100644
--- a/include/drm/drm_module.h
+++ b/include/drm/drm_module.h
@@ -4,6 +4,7 @@
#define DRM_MODULE_H

#include <linux/pci.h>
+#include <linux/platform_device.h>

#include <drm/drm_drv.h>

@@ -92,4 +93,33 @@ drm_pci_unregister_driver_if_modeset(struct pci_driver *pci_drv, int modeset)
module_driver(__pci_drv, drm_pci_register_driver_if_modeset, \
drm_pci_unregister_driver_if_modeset, __modeset)

+/*
+ * Platform drivers
+ */
+
+static inline int __init
+drm_platform_driver_register(struct platform_driver *platform_drv)
+{
+ if (drm_firmware_drivers_only())
+ return -ENODEV;
+
+ return platform_driver_register(platform_drv);
+}
+
+/**
+ * drm_module_platform_driver - Register a DRM driver for platform devices
+ * @__platform_drv: the platform driver structure
+ *
+ * Registers a DRM driver for devices on the platform bus. The helper
+ * macro behaves like module_platform_driver() but tests the state of
+ * drm_firmware_drivers_only(). For more complex module initialization,
+ * use module_init() and module_exit() directly.
+ *
+ * Each module may only use this macro once. Calling it replaces
+ * module_init() and module_exit().
+ */
+#define drm_module_platform_driver(__platform_drv) \
+ module_driver(__platform_drv, drm_platform_driver_register, \
+ platform_driver_unregister)
+
#endif
--
2.33.1


2021-12-22 08:29:01

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 07/10] drm/imx/dcss: Replace module initialization with DRM helpers

Replace module_platform_driver() with drm_module_platform_driver(). The
DRM macro respects drm_firmware_drivers_only() and fails if the flag has
been set.

Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/imx/dcss/dcss-drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
index 8dc2f85c514b..24147ee7080e 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
@@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
+#include <drm/drm_module.h>
#include <drm/drm_of.h>

#include "dcss-dev.h"
@@ -131,7 +132,7 @@ static struct platform_driver dcss_platform_driver = {
},
};

-module_platform_driver(dcss_platform_driver);
+drm_module_platform_driver(dcss_platform_driver);

MODULE_AUTHOR("Laurentiu Palcu <[email protected]>");
MODULE_DESCRIPTION("DCSS driver for i.MX8MQ");
--
2.33.1


2021-12-22 08:29:02

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 08/10] drm/komeda: Replace module initialization with DRM helpers

Replace module_platform_driver() with drm_module_platform_driver(). The
DRM macro respects drm_firmware_drivers_only() and fails if the flag has
been set.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index e7933930a657..51e51ff299b7 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -9,6 +9,7 @@
#include <linux/platform_device.h>
#include <linux/component.h>
#include <linux/pm_runtime.h>
+#include <drm/drm_module.h>
#include <drm/drm_of.h>
#include "komeda_dev.h"
#include "komeda_kms.h"
@@ -198,7 +199,7 @@ static struct platform_driver komeda_platform_driver = {
},
};

-module_platform_driver(komeda_platform_driver);
+drm_module_platform_driver(komeda_platform_driver);

MODULE_AUTHOR("James.Qian.Wang <[email protected]>");
MODULE_DESCRIPTION("Komeda KMS driver");
--
2.33.1


2021-12-22 08:29:04

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 09/10] drm/arm/hdlcd: Replace module initialization with DRM helpers

Replace module_platform_driver() with drm_module_platform_driver(). The
DRM macro respects drm_firmware_drivers_only() and fails if the flag has
been set.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/arm/hdlcd_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 479c2422a2e0..e89ae0ec60eb 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -30,6 +30,7 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_modeset_helper.h>
+#include <drm/drm_module.h>
#include <drm/drm_of.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
@@ -434,7 +435,7 @@ static struct platform_driver hdlcd_platform_driver = {
},
};

-module_platform_driver(hdlcd_platform_driver);
+drm_module_platform_driver(hdlcd_platform_driver);

MODULE_AUTHOR("Liviu Dudau");
MODULE_DESCRIPTION("ARM HDLCD DRM driver");
--
2.33.1


2021-12-22 08:29:05

by Javier Martinez Canillas

[permalink] [raw]
Subject: [PATCH v3 10/10] drm/malidp: Replace module initialization with DRM helpers

Replace module_platform_driver() with drm_module_platform_driver(). The
DRM macro respects drm_firmware_drivers_only() and fails if the flag has
been set.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---

(no changes since v1)

drivers/gpu/drm/arm/malidp_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 78d15b04b105..d5aef21426cf 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -25,6 +25,7 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_modeset_helper.h>
+#include <drm/drm_module.h>
#include <drm/drm_of.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
@@ -1008,7 +1009,7 @@ static struct platform_driver malidp_platform_driver = {
},
};

-module_platform_driver(malidp_platform_driver);
+drm_module_platform_driver(malidp_platform_driver);

MODULE_AUTHOR("Liviu Dudau <[email protected]>");
MODULE_DESCRIPTION("ARM Mali DP DRM driver");
--
2.33.1


2021-12-22 10:21:47

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

On Wed, Dec 22, 2021 at 09:28:24AM +0100, Javier Martinez Canillas wrote:
> -static int __init bochs_init(void)
> -{
> - if (drm_firmware_drivers_only() && bochs_modeset == -1)
> - return -EINVAL;

Also cleanup bochs_modeset? I guess its not used any more after this
patch ...

take care,
Gerd


2021-12-22 12:19:04

by Javier Martinez Canillas

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

Hello Gerd,

On 12/22/21 11:21, Gerd Hoffmann wrote:
> On Wed, Dec 22, 2021 at 09:28:24AM +0100, Javier Martinez Canillas wrote:
>> -static int __init bochs_init(void)
>> -{
>> - if (drm_firmware_drivers_only() && bochs_modeset == -1)
>> - return -EINVAL;
>
> Also cleanup bochs_modeset? I guess its not used any more after this
> patch ...
>

That's still used. It is passed as an argument to the macro:

drm_module_pci_driver_if_modeset(bochs_pci_driver, bochs_modeset);

Best regards,
--
Javier Martinez Canillas
Linux Engineering
Red Hat


2022-01-11 08:52:35

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v3 00/10] drm: Make drivers to honour the nomodeset parameter

Hi

patches 6 to 10 are

Acked-by: Thomas Zimmermann <[email protected]>

Best regards
Thomas

Am 22.12.21 um 09:28 schrieb Javier Martinez Canillas:
> The nomodeset kernel command line parameter is used to prevent the KMS/DRM
> drivers to be registered/probed. But only a few drivers implement support
> for this and most DRM drivers just ignore it.
>
> This patch series is a v3 to make DRM drivers to honour nomodeset. It is
> posted as separate patches to make easier for drivers maintainers to ack
> or pick them independently at their own pace.
>
> The drm_module_{pci,platform}_driver() helper macros are added, which are
> just wrappers around module_{pci,platform}_driver() but adding a check for
> drm_firmware_drivers_only() and returning -ENODEV if that is true.
>
> PCI and platform DRM drivers are then modified in the following patches to
> make use of those macros.
>
> Only KMS drivers will be ported to use these new macros, and only for PCI
> and platform DRM drivers. A follow-up series might do the same for drivers
> that are rendering-only and for USB/SPI/I2C devices, but it will need more
> discussion to agree whether that's desirable or not.
>
> Not all drivers were posted in v3 to avoid flooding the list with too many
> patches. I'm only including the patches adding the macros and some patches
> as an example of their usage.
>
> I've built tested with 'make allmodconfig && make M=drivers/gpu/drm' but I
> don't have hardware to test the drivers, so review/testing is appreciated.
>
> Best regards,
> Javier
>
> Changes in v3:
> - Include Thomas Zimmermann's patches in the series and rebase on top.
> - Add collected Acked-by tags from v2.
>
> Changes in v2:
> - Add drm_module_{pci,platform}_driver() macros and put the check there
> (Thomas Zimmermann).
> - Use the drm_module_*_driver() macros if possible (Thomas Zimmermann).
> - Leave the DRM drivers that don't set the DRIVER_MODESET driver feature
> (Lucas Stach).
> - Leave USB/SPI/I2C drivers and only include PCI and platform ones
> (Noralf Trønnes).
> - Add collected Reviewed-by tags
>
> Javier Martinez Canillas (5):
> drm: Provide platform module-init macro
> drm/imx/dcss: Replace module initialization with DRM helpers
> drm/komeda: Replace module initialization with DRM helpers
> drm/arm/hdlcd: Replace module initialization with DRM helpers
> drm/malidp: Replace module initialization with DRM helpers
>
> Thomas Zimmermann (5):
> drm: Provide PCI module-init macros
> drm/ast: Replace module-init boiler-plate code with DRM helpers
> drm/bochs: Replace module-init boiler-plate code with DRM helpers
> drm/cirrus: Replace module-init boiler-plate code with DRM helpers
> drm/hisilicon/hibmc: Replace module initialization with DRM helpers
>
> Documentation/gpu/drm-internals.rst | 6 +
> .../gpu/drm/arm/display/komeda/komeda_drv.c | 3 +-
> drivers/gpu/drm/arm/hdlcd_drv.c | 3 +-
> drivers/gpu/drm/arm/malidp_drv.c | 3 +-
> drivers/gpu/drm/ast/ast_drv.c | 18 +--
> .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 3 +-
> drivers/gpu/drm/imx/dcss/dcss-drv.c | 3 +-
> drivers/gpu/drm/tiny/bochs.c | 20 +--
> drivers/gpu/drm/tiny/cirrus.c | 17 +--
> include/drm/drm_module.h | 125 ++++++++++++++++++
> 10 files changed, 147 insertions(+), 54 deletions(-)
> create mode 100644 include/drm/drm_module.h
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


Attachments:
OpenPGP_signature (840.00 B)
OpenPGP digital signature

2022-01-21 19:02:40

by Javier Martinez Canillas

[permalink] [raw]
Subject: Re: [PATCH v3 00/10] drm: Make drivers to honour the nomodeset parameter

On 12/22/21 09:28, Javier Martinez Canillas wrote:
> The nomodeset kernel command line parameter is used to prevent the KMS/DRM
> drivers to be registered/probed. But only a few drivers implement support
> for this and most DRM drivers just ignore it.
>
> This patch series is a v3 to make DRM drivers to honour nomodeset. It is
> posted as separate patches to make easier for drivers maintainers to ack
> or pick them independently at their own pace.
>

[snip]

>
> Thomas Zimmermann (5):
> drm: Provide PCI module-init macros
> drm/ast: Replace module-init boiler-plate code with DRM helpers
> drm/bochs: Replace module-init boiler-plate code with DRM helpers
> drm/cirrus: Replace module-init boiler-plate code with DRM helpers
> drm/hisilicon/hibmc: Replace module initialization with DRM helpers
>

For Thomas' patches (1-5)

Reviewed-by: Javier Martinez Canillas <[email protected]>

Best regards,
--
Javier Martinez Canillas
Linux Engineering
Red Hat

2022-01-21 19:58:15

by Javier Martinez Canillas

[permalink] [raw]
Subject: Re: [PATCH v3 00/10] drm: Make drivers to honour the nomodeset parameter

On 12/22/21 09:28, Javier Martinez Canillas wrote:
> The nomodeset kernel command line parameter is used to prevent the KMS/DRM
> drivers to be registered/probed. But only a few drivers implement support
> for this and most DRM drivers just ignore it.
>
> This patch series is a v3 to make DRM drivers to honour nomodeset. It is
> posted as separate patches to make easier for drivers maintainers to ack
> or pick them independently at their own pace.
>

I've pushed this series to drm-misc-next.

Best regards,
--
Javier Martinez Canillas
Linux Engineering
Red Hat