From: Sam Ravnborg <sam@ravnborg.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: javierm@redhat.com, daniel@ffwll.ch, deller@gmx.de,
airlied@linux.ie, maarten.lankhorst@linux.intel.com,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/3] fbdev: Put mmap for deferred I/O into drivers
Date: Mon, 25 Apr 2022 19:26:32 +0200 [thread overview]
Message-ID: <YmbZyI0kVzLo2gR6@ravnborg.org> (raw)
In-Reply-To: <20220425112751.25985-2-tzimmermann@suse.de>
Hi Thomas,
> diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
> index 6aaf6d0abf39..6924d489a289 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -181,6 +181,7 @@ int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
> vma->vm_private_data = info;
> return 0;
> }
> +EXPORT_SYMBOL_GPL(fb_deferred_io_mmap);
>
> /* workqueue callback */
> static void fb_deferred_io_work(struct work_struct *work)
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 84427470367b..52440e3f8f69 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1334,7 +1334,6 @@ static int
> fb_mmap(struct file *file, struct vm_area_struct * vma)
> {
> struct fb_info *info = file_fb_info(file);
> - int (*fb_mmap_fn)(struct fb_info *info, struct vm_area_struct *vma);
> unsigned long mmio_pgoff;
> unsigned long start;
> u32 len;
> @@ -1343,14 +1342,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
> return -ENODEV;
> mutex_lock(&info->mm_lock);
>
> - fb_mmap_fn = info->fbops->fb_mmap;
> -
> -#if IS_ENABLED(CONFIG_FB_DEFERRED_IO)
> - if (info->fbdefio)
> - fb_mmap_fn = fb_deferred_io_mmap;
> -#endif
> -
> - if (fb_mmap_fn) {
> + if (info->fbops->fb_mmap) {
> int res;
>
> /*
> @@ -1358,11 +1350,18 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
> * SME protection is removed ahead of the call
> */
> vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
> - res = fb_mmap_fn(info, vma);
> + res = info->fbops->fb_mmap(info, vma);
> mutex_unlock(&info->mm_lock);
> return res;
> }
>
> + /*
> + * FB deferred I/O wants you to handle mmap in your drivers. At a
> + * minimum, point struct fb_ops.fb_mmap to fb_deferred_io_mmap().
> + */
> + if (dev_WARN_ONCE(info->dev, info->fbdefio, "fbdev mmap not set up for defered I/O.\n"))
> + return -ENODEV;
> +
If not configured - then why not just call fb_deferred_io_mmap(), as
this seems to be the default implementation anyway.
Then drivers that needs it can override - and the rest fallback to the
default.
Sam
next prev parent reply other threads:[~2022-04-25 17:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 11:27 [PATCH v2 0/3] fbdev: Decouple deferred I/O from struct page Thomas Zimmermann
2022-04-25 11:27 ` [PATCH v2 1/3] fbdev: Put mmap for deferred I/O into drivers Thomas Zimmermann
2022-04-25 15:53 ` kernel test robot
2022-04-25 17:26 ` Sam Ravnborg [this message]
2022-04-25 17:46 ` Sam Ravnborg
2022-04-26 7:39 ` Thomas Zimmermann
2022-04-25 11:27 ` [PATCH v2 2/3] fbdev: Track deferred-I/O pages in pageref struct Thomas Zimmermann
2022-04-25 18:17 ` Sam Ravnborg
2022-04-26 8:01 ` Thomas Zimmermann
2022-04-26 9:24 ` Sam Ravnborg
2022-04-25 11:27 ` [PATCH v2 3/3] fbdev: Refactor implementation of page_mkwrite Thomas Zimmermann
2022-04-25 18:24 ` Sam Ravnborg
2022-04-26 8:10 ` Thomas Zimmermann
2022-04-26 8:41 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YmbZyI0kVzLo2gR6@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).