From: Markuss Broks <markuss.broks@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Ard Biesheuvel <ardb@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>, Helge Deller <deller@gmx.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
Borislav Petkov <bp@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Randy Dunlap <rdunlap@infradead.org>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Javier Martinez Canillas <javierm@redhat.com>,
Michal Suchanek <msuchanek@suse.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Arnd Bergmann <arnd@arndb.de>,
Wei Ming Chen <jj251510319013@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Tony Lindgren <tony@atomide.com>,
Linux Documentation List <linux-doc@vger.kernel.org>,
linux-efi <linux-efi@vger.kernel.org>,
"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
"open list:FRAMEBUFFER LAYER" <linux-fbdev@vger.kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
Rob Herring <robh@kernel.org>
Subject: Re: [PATCH 2/2] efi: earlycon: Add support for generic framebuffers and move to fbdev subsystem
Date: Sat, 30 Jul 2022 14:54:41 +0300 [thread overview]
Message-ID: <3c55e119-5b6f-25ab-99c9-2c99b1dfd9e9@gmail.com> (raw)
In-Reply-To: <CAHp75VdaDyyqRw9fAkUOhNjsyifeozVx6JuYXSU1HpoO+VHDNA@mail.gmail.com>
Hi Andy,
On 7/29/22 00:19, Andy Shevchenko wrote:
> On Thu, Jul 28, 2022 at 4:32 PM Markuss Broks <markuss.broks@gmail.com> wrote:
>>
>> Add early console support for generic linear framebuffer devices.
>> This driver supports probing from cmdline early parameters
>> or from the device-tree using information in simple-framebuffer node.
>> The EFI functionality should be retained in whole.
>> The driver was disabled on ARM because of a bug in early_ioremap
>> implementation on ARM.
>
> ...
>
>> - efifb,[options]
>> + efifb
>> Start an early, unaccelerated console on the EFI
>> - memory mapped framebuffer (if available). On cache
>> - coherent non-x86 systems that use system memory for
>> - the framebuffer, pass the 'ram' option so that it is
>> - mapped with the correct attributes.
>> + memory mapped framebuffer (if available).
>
> If somebody passes those (legacy) options, what will happen?
Those would be ignored. Instead it would be automatically determined if
framebuffer is located in RAM or in the I/O space.
>
> ...
>
>> config EFI_EARLYCON
>> - def_bool y
>> - depends on SERIAL_EARLYCON && !ARM && !IA64
>> - select FONT_SUPPORT
>> - select ARCH_USE_MEMREMAP_PROT
>> + bool "EFI early console support"
>> + depends on FB_EARLYCON && !IA64
>
> This doesn't sound right. Previously on my configuration it was
> selected automatically, now I need to select it explicitly? I mean
> that for me EFI_EARLYCON should be selected by default as it was
> before.
The problem I had with EFI_EARLYCON selected by default was that it
would also carry fbdev with itself. Luckily, that's solved if it's moved
to console subsystem.
>
> ...
>
>> +static int __init simplefb_earlycon_remap_fb(void)
>> +{
>> + int is_ram;
>
> + blank line.
>
>> + /* bail if there is no bootconsole or it has been disabled already */
>> + if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
>> + return 0;
>> +
>> + is_ram = region_intersects(info.phys_base, info.size,
>> + IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
>> + is_ram = is_ram == REGION_INTERSECTS;
>
> Was it in the original code? Otherwise, I would go with plain conditional:
>
> if (region_intersects())
> base = ...
> else
> base = ...
It wasn't in original code. Original code assumed MEMREMAP_WC always
unless "ram" was specified as an option to efifb (e.g.
earlycon=efifb,ram). This code instead checks if the framebuffer is in
RAM, and sets the mapping accordingly.
Another issue is that region_intersects() returns REGION_INTERSECTS
(defined as 0) when true. I suppose we could use something like:
if (region_intersects() == REGION_INTERSECTS)
...
>
>> + info.virt_base = memremap(info.phys_base, info.size,
>> + is_ram ? MEMREMAP_WB : MEMREMAP_WC);
>> +
>> + return info.virt_base ? 0 : -ENOMEM;
>> +}
>
> ...
>
>> +static void simplefb_earlycon_write_char(u8 *dst, unsigned char c, unsigned int h)
>> +{
>> + const u8 *src;
>> + int m, n, bytes;
>> + u8 x;
>> +
>> + bytes = BITS_TO_BYTES(font->width);
>> + src = font->data + c * font->height * bytes + h * bytes;
>> +
>> + for (m = 0; m < font->width; m++) {
>> + n = m % 8;
>> + x = *(src + m / 8);
>> + if ((x >> (7 - n)) & 1)
>> + memset(dst, 0xff, (info.depth / 8));
>> + else
>> + memset(dst, 0, (info.depth / 8));
>> + dst += (info.depth / 8);
>> + }
>> +}
>
> Wondering if we already have something like this in DRM/fbdev and can
> split into a generic helper.
>
> ...
>
>> + ret = sscanf(device->options, "%u,%u,%u", &info.x, &info.y, &info.depth);
>> + if (ret != 3)
>> + return -ENODEV;
>
> Don't we have some standard template of this, something like XxYxD,
> where X, Y, and D are respective decimal numbers?
I'm not aware of this.
>
-Markuss
next prev parent reply other threads:[~2022-07-30 8:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 14:28 [PATCH 0/2] Add generic framebuffer support to EFI earlycon driver Markuss Broks
2022-07-28 14:28 ` [PATCH 1/2] drivers: serial: earlycon: Pass device-tree node Markuss Broks
2022-07-28 14:38 ` Greg Kroah-Hartman
2022-07-28 21:04 ` Andy Shevchenko
2022-07-29 7:57 ` Greg Kroah-Hartman
2022-07-29 10:47 ` Andy Shevchenko
2022-07-28 14:28 ` [PATCH 2/2] efi: earlycon: Add support for generic framebuffers and move to fbdev subsystem Markuss Broks
2022-07-28 14:39 ` Greg Kroah-Hartman
2022-07-28 14:52 ` Markuss Broks
2022-07-28 15:01 ` Greg Kroah-Hartman
2022-08-06 16:26 ` Markuss Broks
2022-08-07 6:53 ` Greg Kroah-Hartman
2022-09-06 19:39 ` Daniel Vetter
2022-07-28 21:06 ` Andy Shevchenko
2022-07-28 14:48 ` Arnd Bergmann
2022-07-28 14:57 ` Markuss Broks
2022-07-28 15:16 ` Arnd Bergmann
2022-07-28 18:13 ` Thomas Zimmermann
2022-07-28 21:19 ` Andy Shevchenko
2022-07-30 11:54 ` Markuss Broks [this message]
2022-07-30 10:25 ` Andy Shevchenko
2022-07-28 21:20 ` kernel test robot
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=3c55e119-5b6f-25ab-99c9-2c99b1dfd9e9@gmail.com \
--to=markuss.broks@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=b.zolnierkie@samsung.com \
--cc=bp@suse.de \
--cc=corbet@lwn.net \
--cc=damien.lemoal@opensource.wdc.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=javierm@redhat.com \
--cc=jirislaby@kernel.org \
--cc=jj251510319013@gmail.com \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=msuchanek@suse.de \
--cc=paulmck@kernel.org \
--cc=phone-devel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=tony@atomide.com \
--cc=tzimmermann@suse.de \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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).