lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f5daedd-0006-b412-ace9-f3f4a9b48931@suse.de>
Date:   Fri, 28 Apr 2023 14:59:32 +0200
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>,
        Robin Murphy <robin.murphy@....com>
Cc:     linux-fbdev@...r.kernel.org, linux-ia64@...r.kernel.org,
        dri-devel@...ts.freedesktop.org,
        James.Bottomley@...senpartnership.com, sparclinux@...r.kernel.org,
        kernel@...0n.name, sam@...nborg.org, linux-arch@...r.kernel.org,
        deller@....de, chenhuacai@...nel.org, javierm@...hat.com,
        vgupta@...nel.org, linux-snps-arc@...ts.infradead.org,
        arnd@...db.de, linux-m68k@...ts.linux-m68k.org,
        loongarch@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
        linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org,
        davem@...emloft.net
Subject: Re: [PATCH v2 5/5] fbdev: Define framebuffer I/O from Linux' I/O
 functions

Hi Robin, Geert

Am 28.04.23 um 14:27 schrieb Geert Uytterhoeven:
> On Fri, Apr 28, 2023 at 2:18 PM Robin Murphy <robin.murphy@....com> wrote:
>> On 2023-04-28 10:27, Thomas Zimmermann wrote:
>>> Implement framebuffer I/O helpers, such as fb_read*() and fb_write*()
>>> with Linux' regular I/O functions. Remove all ifdef cases for the
>>> various architectures.
>>>
>>> Most of the supported architectures use __raw_() I/O functions or treat
>>> framebuffer memory like regular memory. This is also implemented by the
>>> architectures' I/O function, so we can use them instead.
>>>
>>> Sparc uses SBus to connect to framebuffer devices. It provides respective
>>> implementations of the framebuffer I/O helpers. The involved sbus_()
>>> I/O helpers map to the same code as Sparc's regular I/O functions. As
>>> with other platforms, we can use those instead.
>>>
>>> We leave a TODO item to replace all fb_() functions with their regular
>>> I/O counterparts throughout the fbdev drivers.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@...e.de>
>>> ---
>>>    include/linux/fb.h | 63 +++++++++++-----------------------------------
>>>    1 file changed, 15 insertions(+), 48 deletions(-)
>>>
>>> diff --git a/include/linux/fb.h b/include/linux/fb.h
>>> index 08cb47da71f8..4aa9e90edd17 100644
>>> --- a/include/linux/fb.h
>>> +++ b/include/linux/fb.h
>>> @@ -15,7 +15,6 @@
>>>    #include <linux/list.h>
>>>    #include <linux/backlight.h>
>>>    #include <linux/slab.h>
>>> -#include <asm/io.h>
>>>
>>>    struct vm_area_struct;
>>>    struct fb_info;
>>> @@ -511,58 +510,26 @@ struct fb_info {
>>>     */
>>>    #define STUPID_ACCELF_TEXT_SHIT
>>>
>>> -// This will go away
>>> -#if defined(__sparc__)
>>> -
>>> -/* We map all of our framebuffers such that big-endian accesses
>>> - * are what we want, so the following is sufficient.
>>> +/*
>>> + * TODO: Update fbdev drivers to call the I/O helpers directly and
>>> + *       remove the fb_() tokens.
>>>     */
>>> -
>>> -// This will go away
>>> -#define fb_readb sbus_readb
>>> -#define fb_readw sbus_readw
>>> -#define fb_readl sbus_readl
>>> -#define fb_readq sbus_readq
>>> -#define fb_writeb sbus_writeb
>>> -#define fb_writew sbus_writew
>>> -#define fb_writel sbus_writel
>>> -#define fb_writeq sbus_writeq
>>> -#define fb_memset sbus_memset_io
>>> -#define fb_memcpy_fromfb sbus_memcpy_fromio
>>> -#define fb_memcpy_tofb sbus_memcpy_toio
>>> -
>>> -#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) ||      \
>>> -     defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || \
>>> -     defined(__arm__) || defined(__aarch64__) || defined(__mips__)
>>> -
>>> -#define fb_readb __raw_readb
>>> -#define fb_readw __raw_readw
>>> -#define fb_readl __raw_readl
>>> -#define fb_readq __raw_readq
>>> -#define fb_writeb __raw_writeb
>>> -#define fb_writew __raw_writew
>>> -#define fb_writel __raw_writel
>>> -#define fb_writeq __raw_writeq
>>
>> Note that on at least some architectures, the __raw variants are
>> native-endian, whereas the regular accessors are explicitly
>> little-endian, so there is a slight risk of inadvertently changing
>> behaviour on big-endian systems (MIPS most likely, but a few old ARM
>> platforms run BE as well).
> 
> Also on m68k, when ISA or PCI are enabled.
> 
> In addition, the non-raw variants may do some extras to guarantee
> ordering, which you do not need on a frame buffer.
> 
> So I'd go for the __raw_*() variants everywhere.

Ok, makes sense. But it also means that we won't be able to remove the 
fb_() helpers. If we go with this proposal, I'll add your comments to 
the header file, so it's clear why they're still there.

Best regards
Thomas

> 
> Gr{oetje,eeting}s,
> 
>                          Geert
> 

-- 
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)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ