linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Thomas Zimmermann" <tzimmermann@suse.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Helge Deller" <deller@gmx.de>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	"Linux Fbdev development list" <linux-fbdev@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: Framebuffer mmap on PowerPC
Date: Thu, 31 Aug 2023 21:44:06 -0400	[thread overview]
Message-ID: <6ddd3504-9833-4ac8-a30c-cd63494f7ed8@app.fastmail.com> (raw)
In-Reply-To: <5501ba80-bdb0-6344-16b0-0466a950f82c@suse.com>

On Thu, Aug 31, 2023, at 10:41, Thomas Zimmermann wrote:
> Hi,
>
> there's a per-architecture function called fb_pgprotect() that sets 
> VMA's vm_page_prot for mmaped framebuffers. Most architectures use a 
> simple implementation based on pgprot_writecomine() [1] or 
> pgprot_noncached(). [2]
>
> On PPC this function uses phys_mem_access_prot() and therefore requires 
> the mmap call's file struct. [3] Removing the file argument would help 
> with simplifying the caller of fb_pgprotect(). [4]
>
> Why is the file even required on PPC?
>
> Is it possible to replace phys_mem_access_prot() with something simpler 
> that does not use the file struct?

What what I can tell, the structure of the code is a result of
these constraints:

- some powerpc platforms use different page table flags for
  prefetchable vs nonprefetchable BARs on PCI memory.

- page table flags must match between all mappings, in particular
  here between /dev/fb0 and /dev/mem, as mismatched attributes
  cause a checkstop. On other architectures this may cause
  undefined behavior instead of a checkstop

It's unfortunate that we have multiple incompatible ways
to determine the page flags based on firmware (ia64),
pci (powerpc) or file->f_flags (arm, csky), when they all
try to solve the same problem here.

Christophe's suggested approach to simplify it is probably
fine, another way would be to pass the f_flags value instead
of the file pointer.

      Arnd

      parent reply	other threads:[~2023-09-01  1:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 14:41 Framebuffer mmap on PowerPC Thomas Zimmermann
2023-08-31 17:38 ` Christophe Leroy
2023-08-31 17:41   ` Christophe Leroy
2023-09-01  6:45   ` Thomas Zimmermann
2023-09-01  1:44 ` Arnd Bergmann [this message]

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=6ddd3504-9833-4ac8-a30c-cd63494f7ed8@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=tzimmermann@suse.com \
    /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).