[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230724211428.3831636-5-michal.winiarski@intel.com>
Date: Mon, 24 Jul 2023 23:14:28 +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>,
Oded Gabbay <ogabbay@...nel.org>,
Christian König <christian.koenig@....com>,
James Zhu <James.Zhu@....com>,
Pekka Paalanen <pekka.paalanen@...labora.com>,
Emil Velikov <emil.l.velikov@...il.com>,
Michał Winiarski <michal.winiarski@...el.com>
Subject: [PATCH v6 4/4] drm: Introduce force_extended_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 c2c6e80e6b31..ef6d7b498784 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,6 +57,11 @@ MODULE_LICENSE("GPL and additional rights");
DEFINE_XARRAY_ALLOC(drm_minors_xa);
+static bool force_extended_minors;
+module_param_unsafe(force_extended_minors, bool, 0400);
+MODULE_PARM_DESC(force_extended_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.
@@ -138,7 +143,7 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data)
static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type)
{
struct drm_minor *minor;
- int r;
+ int r = -EBUSY;
minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL);
if (!minor)
@@ -147,8 +152,9 @@ static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type)
minor->type = type;
minor->dev = dev;
- r = xa_alloc(drm_minor_get_xa(type), &minor->index,
- NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL);
+ if (type == DRM_MINOR_ACCEL || !force_extended_minors)
+ r = xa_alloc(drm_minor_get_xa(type), &minor->index,
+ NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL);
if (r == -EBUSY && (type == DRM_MINOR_PRIMARY || type == DRM_MINOR_RENDER))
r = xa_alloc(&drm_minors_xa, &minor->index,
NULL, DRM_EXTENDED_MINOR_LIMIT, GFP_KERNEL);
--
2.41.0
Powered by blists - more mailing lists