Re: [PATCH 04/35] drm: Forbid legacy MAP functions for DRIVER_MODESET

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 26, 2016 at 1:29 PM, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote:
> Like in
>
> commit 0e975980d435d58df2d430d688b8c18778b42218
> Author: Peter Antoine <peter.antoine@xxxxxxxxx>
> Date:   Tue Jun 23 08:18:49 2015 +0100
>
>     drm: Turn off Legacy Context Functions
>
> we need to again make an exception for nouveau, but everyone else
> really doesn't need this.
>
> Cc: Peter Antoine <peter.antoine@xxxxxxxxx>
> Cc: Ben Skeggs <bskeggs@xxxxxxxxxx>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>

Not really familiar with why nouveau needs this, but the logic seems correct.
Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>


> ---
>  drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index d92db7007f62..e8a12a4fd400 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
>         if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
>                 return -EPERM;
>
> +       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> +           drm_core_check_feature(dev, DRIVER_MODESET))
> +               return -EINVAL;
> +
>         err = drm_addmap_core(dev, map->offset, map->size, map->type,
>                               map->flags, &maplist);
>
> @@ -438,6 +442,10 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
>         int idx;
>         int i;
>
> +       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> +           drm_core_check_feature(dev, DRIVER_MODESET))
> +               return -EINVAL;
> +
>         idx = map->offset;
>         if (idx < 0)
>                 return -EINVAL;
> @@ -569,6 +577,10 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
>         struct drm_map_list *r_list;
>         int ret;
>
> +       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> +           drm_core_check_feature(dev, DRIVER_MODESET))
> +               return -EINVAL;
> +
>         mutex_lock(&dev->struct_mutex);
>         list_for_each_entry(r_list, &dev->maplist, head) {
>                 if (r_list->map &&
> --
> 2.8.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux