[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220906201629.419160-4-michal.winiarski@intel.com>
Date: Tue, 6 Sep 2022 22:16:29 +0200
From: Michał Winiarski <michal.winiarski@...el.com>
To: <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<intel-gfx@...ts.freedesktop.org>
CC: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Simon Ser <contact@...rsion.fr>,
Matthew Wilcox <willy@...radead.org>,
Michał Winiarski <michal.winiarski@...el.com>
Subject: [PATCH v4 3/3] drm: Introduce skip_legacy_minors modparam
While there is support for >64 DRM devices on kernel side, existing
userspace may still have some hardcoded assumptions and it's possible
that it will require changes to be able to use more than 64 devices.
Add a modparam to simplify testing and development of >64 devices
support on userspace side by allocating minors from the >=192 range
(without the need of having >64 physical devices connected).
Signed-off-by: Michał Winiarski <michal.winiarski@...el.com>
---
drivers/gpu/drm/drm_drv.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 2c6e0b8d3b7a..11c691543fec 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -56,6 +56,11 @@ MODULE_LICENSE("GPL and additional rights");
static DEFINE_XARRAY_ALLOC(drm_minors_xa);
+static bool skip_legacy_minors;
+module_param_unsafe(skip_legacy_minors, bool, 0400);
+MODULE_PARM_DESC(skip_legacy_minors,
+ "Don't allocate minors in 0-192 range. This can be used for testing userspace support for >64 drm devices (default: false)");
+
/*
* If the drm core fails to init for whatever reason,
* we should prevent any drivers from registering with it.
@@ -110,7 +115,7 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
{
struct drm_minor *minor;
u32 id;
- int r;
+ int r = -EBUSY;
minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL);
if (!minor)
@@ -125,8 +130,9 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
* and 128-191 are render nodes.
* After reaching the limit, we're allocating minors dynamically - first-come, first-serve.
*/
- r = xa_alloc(&drm_minors_xa, &id, NULL,
- XA_LIMIT(64 * type, 64 * (type + 1) - 1), GFP_KERNEL);
+ if (!skip_legacy_minors)
+ r = xa_alloc(&drm_minors_xa, &id, NULL,
+ XA_LIMIT(64 * type, 64 * (type + 1) - 1), GFP_KERNEL);
if (r == -EBUSY)
r = xa_alloc(&drm_minors_xa, &id, NULL,
XA_LIMIT(192, (1 << MINORBITS) - 1), GFP_KERNEL);
--
2.37.3
Powered by blists - more mailing lists