From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sinclair Yeh Subject: Re: [PATCH] drm/vmwgfx: Work around drm removal of control nodes Date: Tue, 21 Feb 2017 14:05:26 -0800 Message-ID: <20170221220524.GA6861@ubuntu> References: <20170221104227.2854-1-thellstrom@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: Content-Disposition: inline In-Reply-To: <20170221104227.2854-1-thellstrom@vmware.com> Sender: stable-owner@vger.kernel.org To: Thomas Hellstrom Cc: airlied@gmail.com, daniel.vetter@intel.com, dri-devel@lists.freedesktop.org, stable@vger.kernel.org List-Id: dri-devel@lists.freedesktop.org Reviewed-by: Sinclair Yeh On Tue, Feb 21, 2017 at 05:42:27PM +0700, Thomas Hellstrom wrote: > vmware tools has a daemon that gets layout information from the GUI and > forwards it to DRM so that the modesetting code can set preferred connector > locations and modes. This daemon was using control nodes but since control > nodes were just removed, make it possible for the daemon to use render- or > primary nodes instead. This is a bit ugly but will allow drm to proceed with > removal of the mostly unused control-node code and allow vmware to proceed > with fixing up automatic layout settings for gnome-shell/wayland. > > We bump minor to inform user-space about the api change. > > Cc: > Signed-off-by: Thomas Hellstrom > --- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 ++++++++++- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > index 541a588..d08f269 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > @@ -199,9 +199,14 @@ static const struct drm_ioctl_desc vmw_ioctls[] = { > VMW_IOCTL_DEF(VMW_PRESENT_READBACK, > vmw_present_readback_ioctl, > DRM_MASTER | DRM_AUTH), > + /* > + * The permissions of the below ioctl are overridden in > + * vmw_generic_ioctl(). We require either > + * DRM_MASTER or capable(CAP_SYS_ADMIN). > + */ > VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT, > vmw_kms_update_layout_ioctl, > - DRM_MASTER | DRM_CONTROL_ALLOW), > + DRM_RENDER_ALLOW), > VMW_IOCTL_DEF(VMW_CREATE_SHADER, > vmw_shader_define_ioctl, > DRM_AUTH | DRM_RENDER_ALLOW), > @@ -1123,6 +1128,10 @@ static long vmw_generic_ioctl(struct file *filp, unsigned int cmd, > > return (long) vmw_execbuf_ioctl(dev, arg, file_priv, > _IOC_SIZE(cmd)); > + } else if (nr == DRM_COMMAND_BASE + DRM_VMW_UPDATE_LAYOUT) { > + if (!drm_is_current_master(file_priv) && > + !capable(CAP_SYS_ADMIN)) > + return -EACCES; > } > > if (unlikely(ioctl->cmd != cmd)) > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > index 1e59a48..59ff419 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > @@ -41,9 +41,9 @@ > #include > #include "vmwgfx_fence.h" > > -#define VMWGFX_DRIVER_DATE "20160210" > +#define VMWGFX_DRIVER_DATE "20170221" > #define VMWGFX_DRIVER_MAJOR 2 > -#define VMWGFX_DRIVER_MINOR 11 > +#define VMWGFX_DRIVER_MINOR 12 > #define VMWGFX_DRIVER_PATCHLEVEL 0 > #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 > #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) > -- > 2.9.3 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam03on0088.outbound.protection.outlook.com ([104.47.42.88]:34395 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752898AbdBUWFj (ORCPT ); Tue, 21 Feb 2017 17:05:39 -0500 Date: Tue, 21 Feb 2017 14:05:26 -0800 From: Sinclair Yeh To: Thomas Hellstrom CC: , , , Subject: Re: [PATCH] drm/vmwgfx: Work around drm removal of control nodes Message-ID: <20170221220524.GA6861@ubuntu> References: <20170221104227.2854-1-thellstrom@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20170221104227.2854-1-thellstrom@vmware.com> Sender: stable-owner@vger.kernel.org List-ID: Reviewed-by: Sinclair Yeh On Tue, Feb 21, 2017 at 05:42:27PM +0700, Thomas Hellstrom wrote: > vmware tools has a daemon that gets layout information from the GUI and > forwards it to DRM so that the modesetting code can set preferred connector > locations and modes. This daemon was using control nodes but since control > nodes were just removed, make it possible for the daemon to use render- or > primary nodes instead. This is a bit ugly but will allow drm to proceed with > removal of the mostly unused control-node code and allow vmware to proceed > with fixing up automatic layout settings for gnome-shell/wayland. > > We bump minor to inform user-space about the api change. > > Cc: > Signed-off-by: Thomas Hellstrom > --- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 ++++++++++- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > index 541a588..d08f269 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > @@ -199,9 +199,14 @@ static const struct drm_ioctl_desc vmw_ioctls[] = { > VMW_IOCTL_DEF(VMW_PRESENT_READBACK, > vmw_present_readback_ioctl, > DRM_MASTER | DRM_AUTH), > + /* > + * The permissions of the below ioctl are overridden in > + * vmw_generic_ioctl(). We require either > + * DRM_MASTER or capable(CAP_SYS_ADMIN). > + */ > VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT, > vmw_kms_update_layout_ioctl, > - DRM_MASTER | DRM_CONTROL_ALLOW), > + DRM_RENDER_ALLOW), > VMW_IOCTL_DEF(VMW_CREATE_SHADER, > vmw_shader_define_ioctl, > DRM_AUTH | DRM_RENDER_ALLOW), > @@ -1123,6 +1128,10 @@ static long vmw_generic_ioctl(struct file *filp, unsigned int cmd, > > return (long) vmw_execbuf_ioctl(dev, arg, file_priv, > _IOC_SIZE(cmd)); > + } else if (nr == DRM_COMMAND_BASE + DRM_VMW_UPDATE_LAYOUT) { > + if (!drm_is_current_master(file_priv) && > + !capable(CAP_SYS_ADMIN)) > + return -EACCES; > } > > if (unlikely(ioctl->cmd != cmd)) > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > index 1e59a48..59ff419 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h > @@ -41,9 +41,9 @@ > #include > #include "vmwgfx_fence.h" > > -#define VMWGFX_DRIVER_DATE "20160210" > +#define VMWGFX_DRIVER_DATE "20170221" > #define VMWGFX_DRIVER_MAJOR 2 > -#define VMWGFX_DRIVER_MINOR 11 > +#define VMWGFX_DRIVER_MINOR 12 > #define VMWGFX_DRIVER_PATCHLEVEL 0 > #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 > #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) > -- > 2.9.3 >