dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Markuss Broks <markuss.broks@gmail.com>
Cc: "open list:FRAMEBUFFER LAYER" <linux-fbdev@vger.kernel.org>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Documentation List <linux-doc@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Wei Ming Chen <jj251510319013@gmail.com>,
	phone-devel@vger.kernel.org, Jiri Slaby <jirislaby@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	Borislav Petkov <bp@suse.de>, Kees Cook <keescook@chromium.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	~postmarketos/upstreaming@lists.sr.ht,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Michal Suchanek <msuchanek@suse.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Helge Deller <deller@gmx.de>
Subject: Re: [PATCH 2/2] efi: earlycon: Add support for generic framebuffers and move to fbdev subsystem
Date: Thu, 28 Jul 2022 23:19:55 +0200	[thread overview]
Message-ID: <CAHp75VdaDyyqRw9fAkUOhNjsyifeozVx6JuYXSU1HpoO+VHDNA@mail.gmail.com> (raw)
In-Reply-To: <20220728142824.3836-3-markuss.broks@gmail.com>

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?

...

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

...

> +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 = ...

> +       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?

-- 
With Best Regards,
Andy Shevchenko

  parent reply	other threads:[~2022-07-28 21:21 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 [this message]
2022-07-30 11:54     ` Markuss Broks
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=CAHp75VdaDyyqRw9fAkUOhNjsyifeozVx6JuYXSU1HpoO+VHDNA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.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=markuss.broks@gmail.com \
    --cc=msuchanek@suse.de \
    --cc=paulmck@kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=rdunlap@infradead.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).