From patchwork Wed Jul 29 13:41:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11691041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A66E013B1 for ; Wed, 29 Jul 2020 13:42:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E31B2070B for ; Wed, 29 Jul 2020 13:42:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E31B2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 779786E514; Wed, 29 Jul 2020 13:41:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id BDA446E517 for ; Wed, 29 Jul 2020 13:41:53 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0401DAD1E; Wed, 29 Jul 2020 13:42:04 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, kraxel@redhat.com, b.zolnierkie@samsung.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, jani.nikula@intel.com, peda@axentia.se, dan.carpenter@oracle.com, natechancellor@gmail.com Subject: [PATCH 1/5] fbdev: Remove trailing whitespace Date: Wed, 29 Jul 2020 15:41:44 +0200 Message-Id: <20200729134148.6855-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729134148.6855-1-tzimmermann@suse.de> References: <20200729134148.6855-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Removes trailing whitespaces in several places. Signed-off-by: Thomas Zimmermann Acked-by: Daniel Vetter --- drivers/video/fbdev/core/fbmem.c | 10 +++++----- include/linux/fb.h | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 30e73ec4ad5c..dd0ccf35f7b7 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -777,7 +777,7 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) if (info->fbops->fb_read) return info->fbops->fb_read(info, buf, count, ppos); - + total_size = info->screen_size; if (total_size == 0) @@ -842,7 +842,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) if (info->fbops->fb_write) return info->fbops->fb_write(info, buf, count, ppos); - + total_size = info->screen_size; if (total_size == 0) @@ -1061,7 +1061,7 @@ EXPORT_SYMBOL(fb_set_var); int fb_blank(struct fb_info *info, int blank) -{ +{ struct fb_event event; int ret = -EINVAL; @@ -1437,7 +1437,7 @@ __releases(&info->lock) return res; } -static int +static int fb_release(struct inode *inode, struct file *file) __acquires(&info->lock) __releases(&info->lock) @@ -1627,7 +1627,7 @@ static int do_register_framebuffer(struct fb_info *fb_info) fb_info->pixmap.access_align = 32; fb_info->pixmap.flags = FB_PIXMAP_DEFAULT; } - } + } fb_info->pixmap.offset = 0; if (!fb_info->pixmap.blit_x) diff --git a/include/linux/fb.h b/include/linux/fb.h index 2b530e6d86e4..714187bc13ac 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -124,7 +124,7 @@ struct fb_cursor_user { * Register/unregister for framebuffer events */ -/* The resolution of the passed in fb_info about to change */ +/* The resolution of the passed in fb_info about to change */ #define FB_EVENT_MODE_CHANGE 0x01 #ifdef CONFIG_GUMSTIX_AM200EPD @@ -459,12 +459,12 @@ struct fb_info { #if IS_ENABLED(CONFIG_FB_BACKLIGHT) /* assigned backlight device */ - /* set before framebuffer registration, + /* set before framebuffer registration, remove after unregister */ struct backlight_device *bl_dev; /* Backlight level curve */ - struct mutex bl_curve_mutex; + struct mutex bl_curve_mutex; u8 bl_curve[FB_BACKLIGHT_LEVELS]; #endif #ifdef CONFIG_FB_DEFERRED_IO @@ -483,8 +483,8 @@ struct fb_info { char __iomem *screen_base; /* Virtual address */ char *screen_buffer; }; - unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */ - void *pseudo_palette; /* Fake palette of 16 colors */ + unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */ + void *pseudo_palette; /* Fake palette of 16 colors */ #define FBINFO_STATE_RUNNING 0 #define FBINFO_STATE_SUSPENDED 1 u32 state; /* Hardware state i.e suspend */ @@ -587,11 +587,11 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { * `Generic' versions of the frame buffer device operations */ -extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); -extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); +extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); +extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); extern int fb_blank(struct fb_info *info, int blank); -extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); -extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); +extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); +extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); /* * Drawing operations where framebuffer is in system RAM From patchwork Wed Jul 29 13:41:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11691037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34AF613B1 for ; Wed, 29 Jul 2020 13:41:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C4D42070B for ; Wed, 29 Jul 2020 13:41:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C4D42070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4259F6E517; Wed, 29 Jul 2020 13:41:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7ACE6E514 for ; Wed, 29 Jul 2020 13:41:53 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0864DAF3B; Wed, 29 Jul 2020 13:42:04 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, kraxel@redhat.com, b.zolnierkie@samsung.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, jani.nikula@intel.com, peda@axentia.se, dan.carpenter@oracle.com, natechancellor@gmail.com Subject: [PATCH 2/5] fbdev/core: Export framebuffer read and write code as cfb_ function Date: Wed, 29 Jul 2020 15:41:45 +0200 Message-Id: <20200729134148.6855-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729134148.6855-1-tzimmermann@suse.de> References: <20200729134148.6855-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DRM fb helpers require read and write functions for framebuffer memory. Export the existing code from fbdev. Signed-off-by: Thomas Zimmermann Signed-off-by: Sam Ravnborg --- drivers/video/fbdev/core/fbmem.c | 53 ++++++++++++++++++++++---------- include/linux/fb.h | 5 +++ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index dd0ccf35f7b7..b496ff90db3e 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -759,25 +759,18 @@ static struct fb_info *file_fb_info(struct file *file) return info; } -static ssize_t -fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) +ssize_t fb_cfb_read(struct fb_info *info, char __user *buf, size_t count, + loff_t *ppos) { unsigned long p = *ppos; - struct fb_info *info = file_fb_info(file); u8 *buffer, *dst; u8 __iomem *src; int c, cnt = 0, err = 0; unsigned long total_size; - if (!info || ! info->screen_base) - return -ENODEV; - if (info->state != FBINFO_STATE_RUNNING) return -EPERM; - if (info->fbops->fb_read) - return info->fbops->fb_read(info, buf, count, ppos); - total_size = info->screen_size; if (total_size == 0) @@ -823,16 +816,12 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) return (err) ? err : cnt; } +EXPORT_SYMBOL(fb_cfb_read); static ssize_t -fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) +fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { - unsigned long p = *ppos; struct fb_info *info = file_fb_info(file); - u8 *buffer, *src; - u8 __iomem *dst; - int c, cnt = 0, err = 0; - unsigned long total_size; if (!info || !info->screen_base) return -ENODEV; @@ -840,8 +829,20 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) if (info->state != FBINFO_STATE_RUNNING) return -EPERM; - if (info->fbops->fb_write) - return info->fbops->fb_write(info, buf, count, ppos); + if (info->fbops->fb_read) + return info->fbops->fb_read(info, buf, count, ppos); + else + return fb_cfb_read(info, buf, count, ppos); +} + +ssize_t fb_cfb_write(struct fb_info *info, const char __user *buf, + size_t count, loff_t *ppos) +{ + unsigned long p = *ppos; + u8 *buffer, *src; + u8 __iomem *dst; + int c, cnt = 0, err = 0; + unsigned long total_size; total_size = info->screen_size; @@ -895,6 +896,24 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) return (cnt) ? cnt : err; } +EXPORT_SYMBOL(fb_cfb_write); + +static ssize_t +fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) +{ + struct fb_info *info = file_fb_info(file); + + if (!info || !info->screen_base) + return -ENODEV; + + if (info->state != FBINFO_STATE_RUNNING) + return -EPERM; + + if (info->fbops->fb_write) + return info->fbops->fb_write(info, buf, count, ppos); + else + return fb_cfb_write(info, buf, count, ppos); +} int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) diff --git a/include/linux/fb.h b/include/linux/fb.h index 714187bc13ac..12ad83963db5 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -593,6 +593,11 @@ extern int fb_blank(struct fb_info *info, int blank); extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); +extern ssize_t fb_cfb_read(struct fb_info *info, char __user *buf, + size_t count, loff_t *ppos); +extern ssize_t fb_cfb_write(struct fb_info *info, const char __user *buf, + size_t count, loff_t *ppos); + /* * Drawing operations where framebuffer is in system RAM */ From patchwork Wed Jul 29 13:41:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11691043 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D615F13B1 for ; Wed, 29 Jul 2020 13:42:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEDD22070B for ; Wed, 29 Jul 2020 13:42:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEDD22070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB9F96E519; Wed, 29 Jul 2020 13:41:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id F08686E504 for ; Wed, 29 Jul 2020 13:41:53 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3C129AF90; Wed, 29 Jul 2020 13:42:04 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, kraxel@redhat.com, b.zolnierkie@samsung.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, jani.nikula@intel.com, peda@axentia.se, dan.carpenter@oracle.com, natechancellor@gmail.com Subject: [PATCH 3/5] drm: Add infrastructure for vmap operations of I/O memory Date: Wed, 29 Jul 2020 15:41:46 +0200 Message-Id: <20200729134148.6855-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729134148.6855-1-tzimmermann@suse.de> References: <20200729134148.6855-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Most platforms allow for accessing framebuffer I/O memory with regular load and store operations. Some platforms, such as sparc64, require the use of special instructions instead. This patch adds vmap_iomem to struct drm_gem_object_funcs. The new interface drm_client_buffer_vmap_iomem() gives DRM clients access to the I/O memory buffer. The semantics of struct drm_gem_objcet_funcs.vmap change slightly. It used to return system or I/O memory. Now it is expected to return memory addresses that can be accessed with regular load and store operations. So nothing changes for existing implementations of GEM objects. If the GEM object also implements vmap_iomem, a call to vmap shall only return system memory, even if I/O memory could be accessed with loads and stores. The existing interface drm_client_buffer_vmap() shall only return memory as given by drm_gem_vmap ((i.e., that is accessible via regular load and store). The new interface drm_client_buffer_vmap_iomem() shall only return I/O memory. DRM clients must map buffers by calling drm_client_buffer_vmap_iomem() and drm_client_buffer_vmap() to get the buffer in I/O or system memory. Each function returns NULL if the buffer is in the other memory area. Depending on the type of the returned memory, clients must access the framebuffer with the appropriate operations. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_client.c | 52 ++++++++++++++++++++++++++++++++-- drivers/gpu/drm/drm_gem.c | 19 +++++++++++++ drivers/gpu/drm/drm_internal.h | 1 + include/drm/drm_client.h | 8 +++++- include/drm/drm_gem.h | 17 +++++++++-- 5 files changed, 91 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 495f47d23d87..b5bbe089a41e 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -327,6 +327,46 @@ void *drm_client_buffer_vmap(struct drm_client_buffer *buffer) } EXPORT_SYMBOL(drm_client_buffer_vmap); +/** + * drm_client_buffer_vmap_iomem - Map DRM client buffer into address space + * @buffer: DRM client buffer + * + * This function maps a client buffer into kernel address space. If the + * buffer is already mapped, it returns the mapping's address. + * + * Client buffer mappings are not ref'counted. Each call to + * drm_client_buffer_vmap() should be followed by a call to + * drm_client_buffer_vunmap(); or the client buffer should be mapped + * throughout its lifetime. + * + * Returns: + * The mapped memory's address + */ +void __iomem *drm_client_buffer_vmap_iomem(struct drm_client_buffer *buffer) +{ + void __iomem *vaddr_iomem; + + if (buffer->vaddr_iomem) + return buffer->vaddr_iomem; + + /* + * FIXME: The dependency on GEM here isn't required, we could + * convert the driver handle to a dma-buf instead and use the + * backend-agnostic dma-buf vmap support instead. This would + * require that the handle2fd prime ioctl is reworked to pull the + * fd_install step out of the driver backend hooks, to make that + * final step optional for internal users. + */ + vaddr_iomem = drm_gem_vmap_iomem(buffer->gem); + if (IS_ERR(vaddr_iomem)) + return vaddr_iomem; + + buffer->vaddr_iomem = vaddr_iomem; + + return vaddr_iomem; +} +EXPORT_SYMBOL(drm_client_buffer_vmap_iomem); + /** * drm_client_buffer_vunmap - Unmap DRM client buffer * @buffer: DRM client buffer @@ -337,8 +377,16 @@ EXPORT_SYMBOL(drm_client_buffer_vmap); */ void drm_client_buffer_vunmap(struct drm_client_buffer *buffer) { - drm_gem_vunmap(buffer->gem, buffer->vaddr); - buffer->vaddr = NULL; + drm_WARN_ON(buffer->client->dev, buffer->vaddr && buffer->vaddr_iomem); + + if (buffer->vaddr) { + drm_gem_vunmap(buffer->gem, buffer->vaddr); + buffer->vaddr = NULL; + } + if (buffer->vaddr_iomem) { + drm_gem_vunmap(buffer->gem, (void *)buffer->vaddr_iomem); + buffer->vaddr_iomem = NULL; + } } EXPORT_SYMBOL(drm_client_buffer_vunmap); diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index a57f5379fc08..a001be8c0965 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1227,6 +1227,25 @@ void *drm_gem_vmap(struct drm_gem_object *obj) vaddr = obj->funcs->vmap(obj); else if (obj->dev->driver->gem_prime_vmap) vaddr = obj->dev->driver->gem_prime_vmap(obj); + else if (obj->funcs && obj->funcs->vmap_iomem) + vaddr = NULL; /* requires mapping as I/O memory */ + else + vaddr = ERR_PTR(-EOPNOTSUPP); + + if (!vaddr) + vaddr = ERR_PTR(-ENOMEM); + + return vaddr; +} + +void __iomem *drm_gem_vmap_iomem(struct drm_gem_object *obj) +{ + void __iomem *vaddr; + + if (obj->funcs && obj->funcs->vmap_iomem) + vaddr = obj->funcs->vmap_iomem(obj); + else if (obj->funcs && obj->funcs->vmap) + vaddr = NULL; /* requires mapping as system memory */ else vaddr = ERR_PTR(-EOPNOTSUPP); diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 8e01caaf95cc..aa1a3d4f9223 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -187,6 +187,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent, int drm_gem_pin(struct drm_gem_object *obj); void drm_gem_unpin(struct drm_gem_object *obj); void *drm_gem_vmap(struct drm_gem_object *obj); +void __iomem *drm_gem_vmap_iomem(struct drm_gem_object *obj); void drm_gem_vunmap(struct drm_gem_object *obj, void *vaddr); /* drm_debugfs.c drm_debugfs_crc.c */ diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 7aaea665bfc2..94aa075ee4b6 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -141,10 +141,15 @@ struct drm_client_buffer { struct drm_gem_object *gem; /** - * @vaddr: Virtual address for the buffer + * @vaddr: Virtual address for the buffer in system memory */ void *vaddr; + /** + * @vaddr: Virtual address for the buffer in I/O memory + */ + void *vaddr_iomem; + /** * @fb: DRM framebuffer */ @@ -156,6 +161,7 @@ drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 heig void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect); void *drm_client_buffer_vmap(struct drm_client_buffer *buffer); +void __iomem *drm_client_buffer_vmap_iomem(struct drm_client_buffer *buffer); void drm_client_buffer_vunmap(struct drm_client_buffer *buffer); int drm_client_modeset_create(struct drm_client_dev *client); diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 337a48321705..bc735ff522a8 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -134,17 +134,28 @@ struct drm_gem_object_funcs { * @vmap: * * Returns a virtual address for the buffer. Used by the - * drm_gem_dmabuf_vmap() helper. + * drm_gem_dmabuf_vmap() helper. If the buffer is not + * located in system memory, the function returns NULL. * * This callback is optional. */ void *(*vmap)(struct drm_gem_object *obj); + /** + * @vmap_iomem: + * + * Returns a virtual address for the buffer. If the buffer is not + * located in I/O memory, the function returns NULL. + * + * This callback is optional. + */ + void __iomem *(*vmap_iomem)(struct drm_gem_object *obj); + /** * @vunmap: * - * Releases the address previously returned by @vmap. Used by the - * drm_gem_dmabuf_vunmap() helper. + * Releases the address previously returned by @vmap or @vmap_iomem. + * Used by the drm_gem_dmabuf_vunmap() helper. * * This callback is optional. */ From patchwork Wed Jul 29 13:41:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11691045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F181913B1 for ; Wed, 29 Jul 2020 13:42:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA9732070B for ; Wed, 29 Jul 2020 13:42:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA9732070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F225D6E51A; Wed, 29 Jul 2020 13:41:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D8706E514 for ; Wed, 29 Jul 2020 13:41:54 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 722D0AF9F; Wed, 29 Jul 2020 13:42:04 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, kraxel@redhat.com, b.zolnierkie@samsung.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, jani.nikula@intel.com, peda@axentia.se, dan.carpenter@oracle.com, natechancellor@gmail.com Subject: [PATCH 4/5] drm/fb_helper: Use I/O-memory mappings if available Date: Wed, 29 Jul 2020 15:41:47 +0200 Message-Id: <20200729134148.6855-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729134148.6855-1-tzimmermann@suse.de> References: <20200729134148.6855-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" At least sparc64 requires I/O-specific access to framebuffers. This patch prepares the fbdev console accordingly. For drivers with direct access to the framebuffer memory, the callback functions test for the type of memory and call the rsp fb_sys_ of fb_cfb_ functions. For drivers that employ a shadow buffer, fbdev's blit function maps the framebuffer as either I/O or system memory, and uses the correct memcpy function. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_fb_helper.c | 132 ++++++++++++++++++++++++++++---- 1 file changed, 116 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 88146f7245c5..7d928f92cba7 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -394,14 +394,25 @@ static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper, unsigned int cpp = fb->format->cpp[0]; size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp; void *src = fb_helper->fbdev->screen_buffer + offset; - void *dst = fb_helper->buffer->vaddr + offset; size_t len = (clip->x2 - clip->x1) * cpp; unsigned int y; - for (y = clip->y1; y < clip->y2; y++) { - memcpy(dst, src, len); - src += fb->pitches[0]; - dst += fb->pitches[0]; + if (fb_helper->buffer->vaddr_iomem) { + void __iomem *dst = fb_helper->buffer->vaddr_iomem + offset; + + for (y = clip->y1; y < clip->y2; y++) { + memcpy_toio(dst, src, len); + src += fb->pitches[0]; + dst += fb->pitches[0]; + } + } else { + void *dst = fb_helper->buffer->vaddr + offset; + + for (y = clip->y1; y < clip->y2; y++) { + memcpy(dst, src, len); + src += fb->pitches[0]; + dst += fb->pitches[0]; + } } } @@ -412,6 +423,7 @@ static void drm_fb_helper_dirty_work(struct work_struct *work) struct drm_clip_rect *clip = &helper->dirty_clip; struct drm_clip_rect clip_copy; unsigned long flags; + void __iomem *vaddr_iomem; void *vaddr; spin_lock_irqsave(&helper->dirty_lock, flags); @@ -425,9 +437,15 @@ static void drm_fb_helper_dirty_work(struct work_struct *work) /* Generic fbdev uses a shadow buffer */ if (helper->buffer) { - vaddr = drm_client_buffer_vmap(helper->buffer); - if (IS_ERR(vaddr)) + vaddr_iomem = + drm_client_buffer_vmap_iomem(helper->buffer); + if (IS_ERR(vaddr_iomem)) { return; + } else if (!vaddr_iomem) { + vaddr = drm_client_buffer_vmap(helper->buffer); + if (IS_ERR(vaddr)) + return; + } drm_fb_helper_dirty_blit_real(helper, &clip_copy); } if (helper->fb->funcs->dirty) @@ -766,6 +784,25 @@ void drm_fb_helper_sys_imageblit(struct fb_info *info, } EXPORT_SYMBOL(drm_fb_helper_sys_imageblit); +static ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf, + size_t count, loff_t *ppos) +{ + return fb_cfb_read(info, buf, count, ppos); +} + +static ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf, + size_t count, loff_t *ppos) +{ + ssize_t ret; + + ret = fb_cfb_write(info, buf, count, ppos); + if (ret > 0) + drm_fb_helper_dirty(info, 0, 0, info->var.xres, + info->var.yres); + + return ret; +} + /** * drm_fb_helper_cfb_fillrect - wrapper around cfb_fillrect * @info: fbdev registered by the helper @@ -2038,6 +2075,61 @@ static int drm_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) return -ENODEV; } +static ssize_t drm_fbdev_fb_read(struct fb_info *info, char __user *buf, + size_t count, loff_t *ppos) +{ + struct drm_fb_helper *fb_helper = info->par; + + if (fb_helper->buffer->vaddr_iomem) + return drm_fb_helper_cfb_read(info, buf, count, ppos); + else + return drm_fb_helper_sys_read(info, buf, count, ppos); +} + +static ssize_t drm_fbdev_fb_write(struct fb_info *info, const char __user *buf, + size_t count, loff_t *ppos) +{ + struct drm_fb_helper *fb_helper = info->par; + + if (fb_helper->buffer->vaddr_iomem) + return drm_fb_helper_cfb_write(info, buf, count, ppos); + else + return drm_fb_helper_sys_write(info, buf, count, ppos); +} + +static void drm_fbdev_fb_fillrect(struct fb_info *info, + const struct fb_fillrect *rect) +{ + struct drm_fb_helper *fb_helper = info->par; + + if (fb_helper->buffer->vaddr_iomem) + drm_fb_helper_cfb_fillrect(info, rect); + else + drm_fb_helper_sys_fillrect(info, rect); +} + +static void drm_fbdev_fb_copyarea(struct fb_info *info, + const struct fb_copyarea *area) +{ + struct drm_fb_helper *fb_helper = info->par; + + if (fb_helper->buffer->vaddr_iomem) + drm_fb_helper_cfb_copyarea(info, area); + else + drm_fb_helper_sys_copyarea(info, area); +} + +static void drm_fbdev_fb_imageblit(struct fb_info *info, + const struct fb_image *image) +{ + struct drm_fb_helper *fb_helper = info->par; + + if (fb_helper->buffer->vaddr_iomem) + drm_fb_helper_cfb_imageblit(info, image); + else + drm_fb_helper_sys_imageblit(info, image); +} + static const struct fb_ops drm_fbdev_fb_ops = { .owner = THIS_MODULE, DRM_FB_HELPER_DEFAULT_OPS, @@ -2045,11 +2137,11 @@ static const struct fb_ops drm_fbdev_fb_ops = { .fb_release = drm_fbdev_fb_release, .fb_destroy = drm_fbdev_fb_destroy, .fb_mmap = drm_fbdev_fb_mmap, - .fb_read = drm_fb_helper_sys_read, - .fb_write = drm_fb_helper_sys_write, - .fb_fillrect = drm_fb_helper_sys_fillrect, - .fb_copyarea = drm_fb_helper_sys_copyarea, - .fb_imageblit = drm_fb_helper_sys_imageblit, + .fb_read = drm_fbdev_fb_read, + .fb_write = drm_fbdev_fb_write, + .fb_fillrect = drm_fbdev_fb_fillrect, + .fb_copyarea = drm_fbdev_fb_copyarea, + .fb_imageblit = drm_fbdev_fb_imageblit, }; static struct fb_deferred_io drm_fbdev_defio = { @@ -2072,6 +2164,7 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, struct drm_framebuffer *fb; struct fb_info *fbi; u32 format; + void __iomem *vaddr_iomem; void *vaddr; drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", @@ -2108,11 +2201,18 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, fb_deferred_io_init(fbi); } else { /* buffer is mapped for HW framebuffer */ - vaddr = drm_client_buffer_vmap(fb_helper->buffer); - if (IS_ERR(vaddr)) - return PTR_ERR(vaddr); + vaddr_iomem = drm_client_buffer_vmap_iomem(fb_helper->buffer); + if (IS_ERR(vaddr_iomem)) { + return PTR_ERR(vaddr_iomem); + } else if (!vaddr_iomem) { + vaddr = drm_client_buffer_vmap(fb_helper->buffer); + if (IS_ERR(vaddr)) + return PTR_ERR(vaddr); + fbi->screen_buffer = vaddr; + } else { + fbi->screen_buffer = vaddr_iomem; + } - fbi->screen_buffer = vaddr; /* Shamelessly leak the physical address to user-space */ #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0) From patchwork Wed Jul 29 13:41:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11691047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 268C513B6 for ; Wed, 29 Jul 2020 13:42:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F81D2070B for ; Wed, 29 Jul 2020 13:42:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F81D2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D8AC6E51C; Wed, 29 Jul 2020 13:42:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 153796E519 for ; Wed, 29 Jul 2020 13:41:55 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A3FEBAFA0; Wed, 29 Jul 2020 13:42:04 +0000 (UTC) From: Thomas Zimmermann To: airlied@redhat.com, daniel@ffwll.ch, sam@ravnborg.org, kraxel@redhat.com, b.zolnierkie@samsung.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, jani.nikula@intel.com, peda@axentia.se, dan.carpenter@oracle.com, natechancellor@gmail.com Subject: [PATCH 5/5] drm/vram_helper: Implement struct drm_gem_object_funcs.vmap_iomem Date: Wed, 29 Jul 2020 15:41:48 +0200 Message-Id: <20200729134148.6855-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729134148.6855-1-tzimmermann@suse.de> References: <20200729134148.6855-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The vmap_iomem function in struct drm_gem_object_funcs returns the memory of the buffer if located in I/O memory, or NULL if it isn't. The patch also updates the semantics of the vmap function to return NULL if the buffer is not in system memory. The main user is the fb-helper's console, which is prepared of this change. The other use if the ast cursor code. It maintains two GEM buffers in VRAM. The patch changes ast to map the buffers by calling drm_gem_vram_vmap_iomem(). Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ast/ast_cursor.c | 12 ++- drivers/gpu/drm/drm_gem_vram_helper.c | 106 +++++++++++++++++++++++--- include/drm/drm_gem_vram_helper.h | 1 + 3 files changed, 108 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_cursor.c b/drivers/gpu/drm/ast/ast_cursor.c index acf0d23514e8..fac0079d213f 100644 --- a/drivers/gpu/drm/ast/ast_cursor.c +++ b/drivers/gpu/drm/ast/ast_cursor.c @@ -77,12 +77,22 @@ int ast_cursor_init(struct ast_private *ast) drm_gem_vram_put(gbo); goto err_drm_gem_vram_put; } - vaddr = drm_gem_vram_vmap(gbo); + vaddr = drm_gem_vram_vmap_iomem(gbo); if (IS_ERR(vaddr)) { ret = PTR_ERR(vaddr); drm_gem_vram_unpin(gbo); drm_gem_vram_put(gbo); goto err_drm_gem_vram_put; + } else if (drm_WARN_ON(dev, !vaddr)) { + /* + * BUG: We successfully pinned the cursor to VRAM, + * but cannot get an I/O memory mapping. This + * is a bug in the VRAM helpers. + */ + ret = -ENODEV; + drm_gem_vram_unpin(gbo); + drm_gem_vram_put(gbo); + goto err_drm_gem_vram_put; } ast->cursor.gbo[i] = gbo; diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 3296ed3df358..d36e8ba0b5e0 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -505,8 +505,11 @@ EXPORT_SYMBOL(drm_gem_vram_kunmap); * space * @gbo: The GEM VRAM object to map * - * The vmap function pins a GEM VRAM object to its current location, either - * system or video memory, and maps its buffer into kernel address space. + * The vmap function pins a GEM VRAM object to its current location in + * system memory, and maps its buffer into kernel address space. The function + * returns NULL if the buffer is not located in system memory. You should + * call drm_gem_vram_vmap_iomem() in this case. + * * As pinned object cannot be relocated, you should avoid pinning objects * permanently. Call drm_gem_vram_vunmap() with the returned address to * unmap and unpin the GEM VRAM object. @@ -515,13 +518,15 @@ EXPORT_SYMBOL(drm_gem_vram_kunmap); * call drm_gem_vram_pin() and drm_gem_vram_kmap() directly. * * Returns: - * The buffer's virtual address on success, or + * The buffer's virtual address on success, + * NULL if the buffer is located in I/O memory, or * an ERR_PTR()-encoded error code otherwise. */ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) { int ret; void *base; + bool is_iomem; ret = ttm_bo_reserve(&gbo->bo, true, false, NULL); if (ret) @@ -530,10 +535,18 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) ret = drm_gem_vram_pin_locked(gbo, 0); if (ret) goto err_ttm_bo_unreserve; - base = drm_gem_vram_kmap_locked(gbo, true, NULL); + base = drm_gem_vram_kmap_locked(gbo, true, &is_iomem); if (IS_ERR(base)) { ret = PTR_ERR(base); goto err_drm_gem_vram_unpin_locked; + } else if (is_iomem) { + /* + * The buffer is located in I/O memory. Unpin and + * return NULL. This is not an error. + */ + drm_gem_vram_kunmap_locked(gbo); + drm_gem_vram_unpin_locked(gbo); + base = NULL; } ttm_bo_unreserve(&gbo->bo); @@ -548,6 +561,67 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) } EXPORT_SYMBOL(drm_gem_vram_vmap); +/** + * drm_gem_vram_vmap_iomem() - Pins and maps a GEM VRAM object into kernel + * address space + * @gbo: The GEM VRAM object to map + * + * The vmap_iomem function pins a GEM VRAM object to its current location in + * I/O memory, and maps its buffer into kernel address space. The function + * returns NULL if the buffer is not located in I/O memory. You should call + * drm_gem_vram_vmap() in this case. + * + * If you have special requirements for the pinning or mapping operations, + * call drm_gem_vram_pin() and drm_gem_vram_kmap() directly. + * + * As pinned object cannot be relocated, you should avoid pinning objects + * permanently. Call drm_gem_vram_vunmap() with the returned address to + * unmap and unpin the GEM VRAM object. + * + * Returns: + * The buffer's virtual address on success, or + * NULL if the buffer is not located in I/O memory, or + * an ERR_PTR()-encoded error code otherwise. + */ +void __iomem *drm_gem_vram_vmap_iomem(struct drm_gem_vram_object *gbo) +{ + int ret; + void __iomem *base; + bool is_iomem; + + ret = ttm_bo_reserve(&gbo->bo, true, false, NULL); + if (ret) + return ERR_PTR(ret); + + ret = drm_gem_vram_pin_locked(gbo, 0); + if (ret) + goto err_ttm_bo_unreserve; + base = drm_gem_vram_kmap_locked(gbo, true, &is_iomem); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + goto err_drm_gem_vram_unpin_locked; + } else if (!is_iomem) { + /* + * The buffer is not located in I/O memory. Unpin and + * return NULL. This is not an error. + */ + drm_gem_vram_kunmap_locked(gbo); + drm_gem_vram_unpin_locked(gbo); + base = NULL; + } + + ttm_bo_unreserve(&gbo->bo); + + return base; + +err_drm_gem_vram_unpin_locked: + drm_gem_vram_unpin_locked(gbo); +err_ttm_bo_unreserve: + ttm_bo_unreserve(&gbo->bo); + return ERR_PTR(ret); +} +EXPORT_SYMBOL(drm_gem_vram_vmap_iomem); + /** * drm_gem_vram_vunmap() - Unmaps and unpins a GEM VRAM object * @gbo: The GEM VRAM object to unmap @@ -931,6 +1005,17 @@ static void *drm_gem_vram_object_vmap(struct drm_gem_object *gem) return base; } +static void __iomem *drm_gem_vram_object_vmap_iomem(struct drm_gem_object *gem) +{ + struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem); + void __iomem *base; + + base = drm_gem_vram_vmap(gbo); + if (IS_ERR(base)) + return NULL; + return base; +} + /** * drm_gem_vram_object_vunmap() - \ Implements &struct drm_gem_object_funcs.vunmap @@ -950,12 +1035,13 @@ static void drm_gem_vram_object_vunmap(struct drm_gem_object *gem, */ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = { - .free = drm_gem_vram_object_free, - .pin = drm_gem_vram_object_pin, - .unpin = drm_gem_vram_object_unpin, - .vmap = drm_gem_vram_object_vmap, - .vunmap = drm_gem_vram_object_vunmap, - .mmap = drm_gem_ttm_mmap, + .free = drm_gem_vram_object_free, + .pin = drm_gem_vram_object_pin, + .unpin = drm_gem_vram_object_unpin, + .vmap = drm_gem_vram_object_vmap, + .vmap_iomem = drm_gem_vram_object_vmap_iomem, + .vunmap = drm_gem_vram_object_vunmap, + .mmap = drm_gem_ttm_mmap, .print_info = drm_gem_ttm_print_info, }; diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h index 035332f3723f..ea53a475edc9 100644 --- a/include/drm/drm_gem_vram_helper.h +++ b/include/drm/drm_gem_vram_helper.h @@ -105,6 +105,7 @@ void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map, bool *is_iomem); void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo); void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo); +void __iomem *drm_gem_vram_vmap_iomem(struct drm_gem_vram_object *gbo); void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, void *vaddr); int drm_gem_vram_fill_create_dumb(struct drm_file *file,