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@xxxxxxxxx> --- 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