From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-arch@vger.kernel.org, linux-fbdev@vger.kernel.org,
linux-ia64@vger.kernel.org, loongarch@lists.linux.dev,
arnd@arndb.de, deller@gmx.de, chenhuacai@kernel.org,
javierm@redhat.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
James.Bottomley@hansenpartnership.com,
linux-m68k@lists.linux-m68k.org, geert@linux-m68k.org,
linux-parisc@vger.kernel.org, vgupta@kernel.org,
sparclinux@vger.kernel.org, kernel@xen0n.name,
linux-snps-arc@lists.infradead.org, davem@davemloft.net,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 5/6] fbdev: Move framebuffer I/O helpers into <asm/fb.h>
Date: Wed, 3 May 2023 08:58:49 +0200 [thread overview]
Message-ID: <df767237-2bae-f299-9cbb-1543f76c9c3a@suse.de> (raw)
In-Reply-To: <20230502200300.GB319489@ravnborg.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 3462 bytes --]
Hi Sam
Am 02.05.23 um 22:03 schrieb Sam Ravnborg:
> Hi Thomas,
>
> On Tue, May 02, 2023 at 03:02:22PM +0200, Thomas Zimmermann wrote:
>> Implement framebuffer I/O helpers, such as fb_read*() and fb_write*(),
>> in the architecture's <asm/fb.h> header file or the generic one.
>
> In reality they are now all implemented in the generic one.
>
>>
>> The common case has been the use of regular I/O functions, such as
>> __raw_readb() or memset_io(). A few architectures used plain system-
>> memory reads and writes. Sparc used helpers for its SBus.
>>
>> The architectures that used special cases provide the same code in
>> their __raw_*() I/O helpers. So the patch replaces this code with the
>> __raw_*() functions and moves it to <asm-generic/fb.h> for all
>> architectures.
> Which is also documented here.
The first paragraph documents the design intention, the other one the
implementation. But I agree that it's not well phrased. I'll see if I
can improve the text.
>
>>
>> v3:
>> * implement all architectures with generic helpers
>> * support reordering and native byte order (Geert, Arnd)
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>> include/asm-generic/fb.h | 101 +++++++++++++++++++++++++++++++++++++++
>> include/linux/fb.h | 53 --------------------
>> 2 files changed, 101 insertions(+), 53 deletions(-)
>>
>> diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
>> index 6922dd248c51..0540eccdbeca 100644
>> --- a/include/asm-generic/fb.h
>> +++ b/include/asm-generic/fb.h
>> @@ -31,4 +31,105 @@ static inline int fb_is_primary_device(struct fb_info *info)
>> }
>> #endif
>>
>> +/*
>> + * I/O helpers for the framebuffer. Prefer these functions over their
>> + * regular counterparts. The regular I/O functions provide in-order
>> + * access and swap bytes to/from little-endian ordering. Neither is
>> + * required for framebuffers. Instead, the helpers read and write
>> + * raw framebuffer data. Independent operations can be reordered for
>> + * improved performance.
>> + */
>> +
>> +#ifndef fb_readb
>> +static inline u8 fb_readb(const volatile void __iomem *addr)
>> +{
>> + return __raw_readb(addr);
>> +}
>> +#define fb_readb fb_readb
>> +#endif
>
> When we need to provide an architecture specific variant the
> #ifndef foo
> ...
> #define foo foo
> can be added. Right now it is just noise as no architectures provide
> their own variants.
Given Arnd's comments, this might change. It also makes sense from a
design POV.
>
> But I am missing something somewhere as I cannot see how this builds.
> asm-generic now provide the fb_read/fb_write helpers.
> But for example sparc has an architecture specifc fb.h so it will not
> use the asm-generic variant. So I wonder how sparc get hold of the
> asm-generic fb.h file?
All architecture's <asm/fb.h> files include <asm-generic/fb.h>, so that
they all get the interfaces which they don't define themselves. For
Sparc, this is at [1].
Best regards
Thomas
[1]
https://cgit.freedesktop.org/drm/drm-tip/tree/arch/sparc/include/asm/fb.h#n19
>
> Maybe it is obvious, but I miss it.
>
> Sam
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next prev parent reply other threads:[~2023-05-03 6:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 13:02 [PATCH v3 0/6] fbdev: Move framebuffer I/O helpers to <asm/fb.h> Thomas Zimmermann
2023-05-02 13:02 ` [PATCH v3 1/6] fbdev/matrox: Remove trailing whitespaces Thomas Zimmermann
2023-05-02 13:02 ` [PATCH v3 2/6] ipu-v3: Include <linux/io.h> Thomas Zimmermann
2023-05-02 13:02 ` [PATCH v3 3/6] fbdev: Include <linux/io.h> in various drivers Thomas Zimmermann
2023-05-02 13:02 ` [PATCH v3 4/6] fbdev: Include <linux/io.h> via <asm/fb.h> Thomas Zimmermann
2023-05-02 19:54 ` Sam Ravnborg
2023-05-03 7:09 ` Thomas Zimmermann
2023-05-03 7:19 ` Javier Martinez Canillas
2023-05-03 8:09 ` Geert Uytterhoeven
2023-05-03 8:12 ` Thomas Zimmermann
2023-05-03 8:52 ` Arnd Bergmann
2023-05-02 13:02 ` [PATCH v3 5/6] fbdev: Move framebuffer I/O helpers into <asm/fb.h> Thomas Zimmermann
2023-05-02 20:03 ` Sam Ravnborg
2023-05-03 6:58 ` Thomas Zimmermann [this message]
2023-05-03 19:03 ` Sam Ravnborg
2023-05-02 20:06 ` Arnd Bergmann
2023-05-03 14:55 ` Thomas Zimmermann
2023-05-03 15:06 ` Arnd Bergmann
2023-05-02 13:02 ` [PATCH v3 6/6] fbdev: Rename fb_mem*() helpers Thomas Zimmermann
2023-05-02 20:08 ` Sam Ravnborg
2023-05-03 8:15 ` Thomas Zimmermann
2023-05-03 19:06 ` Sam Ravnborg
2023-05-03 8:21 ` [PATCH v3 0/6] fbdev: Move framebuffer I/O helpers to <asm/fb.h> Geert Uytterhoeven
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=df767237-2bae-f299-9cbb-1543f76c9c3a@suse.de \
--to=tzimmermann@suse.de \
--cc=James.Bottomley@hansenpartnership.com \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=javierm@redhat.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=sam@ravnborg.org \
--cc=sparclinux@vger.kernel.org \
--cc=vgupta@kernel.org \
/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).