From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
"Volodymyr Babchuk" <volodymyr_babchuk@epam.com>,
Bertrand Marquis <bertrand.marquis@arm.com>
Subject: Re: [PATCH v4 3/8] x86/EFI: retrieve EDID
Date: Tue, 5 Apr 2022 17:47:09 +0200 [thread overview]
Message-ID: <YkxkfbNpR7yfLP7W@Air-de-Roger> (raw)
In-Reply-To: <39640fec-de8d-0c5a-c9aa-daf83fb785b0@suse.com>
On Tue, Apr 05, 2022 at 04:36:53PM +0200, Jan Beulich wrote:
> On 05.04.2022 12:27, Roger Pau Monné wrote:
> > On Thu, Mar 31, 2022 at 11:45:36AM +0200, Jan Beulich wrote:
> >> --- a/xen/arch/x86/efi/efi-boot.h
> >> +++ b/xen/arch/x86/efi/efi-boot.h
> >> @@ -568,6 +568,49 @@ static void __init efi_arch_video_init(E
> >> #endif
> >> }
> >>
> >> +#ifdef CONFIG_VIDEO
> >> +static bool __init copy_edid(const void *buf, unsigned int size)
> >> +{
> >> + /*
> >> + * Be conservative - for both undersized and oversized blobs it is unclear
> >> + * what to actually do with them. The more that unlike the VESA BIOS
> >> + * interface we also have no associated "capabilities" value (which might
> >> + * carry a hint as to possible interpretation).
> >> + */
> >> + if ( size != ARRAY_SIZE(boot_edid_info) )
> >> + return false;
> >> +
> >> + memcpy(boot_edid_info, buf, size);
> >> + boot_edid_caps = 0;
> >> +
> >> + return true;
> >> +}
> >> +#endif
> >> +
> >> +static void __init efi_arch_edid(EFI_HANDLE gop_handle)
> >> +{
> >> +#ifdef CONFIG_VIDEO
> >> + static EFI_GUID __initdata active_guid = EFI_EDID_ACTIVE_PROTOCOL_GUID;
> >> + static EFI_GUID __initdata discovered_guid = EFI_EDID_DISCOVERED_PROTOCOL_GUID;
> >
> > Is there a need to make those static?
> >
> > I think this function is either called from efi_start or
> > efi_multiboot, but there aren't multiple calls to it? (also both
> > parameters are IN only, so not to be changed by the EFI method?
> >
> > I have the feeling setting them to static is done because they can't
> > be set to const?
>
> Even if they could be const, they ought to also be static. They don't
> strictly need to be, but without "static" code will be generated to
> populate the on-stack variables; quite possibly the compiler would
> even allocate an unnamed static variable and memcpy() from there onto
> the stack.
I thought that making those const (and then annotate with __initconst)
would already have the same effect as having it static, as there will
be no memcpy in that case either.
> >> + EFI_EDID_ACTIVE_PROTOCOL *active_edid;
> >> + EFI_EDID_DISCOVERED_PROTOCOL *discovered_edid;
> >> + EFI_STATUS status;
> >> +
> >> + status = efi_bs->OpenProtocol(gop_handle, &active_guid,
> >> + (void **)&active_edid, efi_ih, NULL,
> >> + EFI_OPEN_PROTOCOL_GET_PROTOCOL);
> >> + if ( status == EFI_SUCCESS &&
> >> + copy_edid(active_edid->Edid, active_edid->SizeOfEdid) )
> >> + return;
> >
> > Isn't it enough to just call EFI_EDID_ACTIVE_PROTOCOL_GUID?
> >
> > From my reading of the UEFI spec this will either return
> > EFI_EDID_OVERRIDE_PROTOCOL_GUID or EFI_EDID_DISCOVERED_PROTOCOL_GUID.
> > If EFI_EDID_OVERRIDE_PROTOCOL is set it must be used, and hence
> > falling back to EFI_EDID_DISCOVERED_PROTOCOL_GUID if
> > EFI_EDID_ACTIVE_PROTOCOL_GUID cannot be parsed would likely mean
> > ignoring EFI_EDID_OVERRIDE_PROTOCOL?
>
> That's the theory. As per one of the post-commit-message remarks I had
> looked at what GrUB does, and I decided to follow its behavior in this
> regard, assuming they do what they do to work around quirks. As said
> in the remark, I didn't want to go as far as also cloning their use of
> the undocumented (afaik) "agp-internal-edid" variable.
Could you add this as a comment here? So it's not lost on commit as
being just a post-commit log remark. With that:
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks, Roger.
next prev parent reply other threads:[~2022-04-05 15:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 9:42 [PATCH v4 0/8] x86/boot: (mostly) video mode handling adjustments Jan Beulich
2022-03-31 9:44 ` [PATCH v4 1/8] x86/boot: make "vga=current" work with graphics modes Jan Beulich
2022-04-04 14:49 ` Roger Pau Monné
2022-04-04 15:50 ` Jan Beulich
2022-04-05 8:24 ` Roger Pau Monné
2022-04-05 8:36 ` Jan Beulich
2022-04-05 8:45 ` Roger Pau Monné
2022-04-06 14:23 ` Jan Beulich
2022-04-11 9:50 ` Ping: " Jan Beulich
2022-04-11 10:11 ` Henry Wang
2022-04-11 10:14 ` Jan Beulich
2022-04-11 10:30 ` Henry Wang
2022-03-31 9:45 ` [PATCH v4 2/8] x86/boot: obtain video info from boot loader Jan Beulich
2022-04-05 9:35 ` Roger Pau Monné
2022-04-05 10:57 ` Jan Beulich
2022-04-05 11:34 ` Roger Pau Monné
2022-03-31 9:45 ` [PATCH v4 3/8] x86/EFI: retrieve EDID Jan Beulich
2022-04-01 10:15 ` Luca Fancellu
2022-04-05 10:27 ` Roger Pau Monné
2022-04-05 14:36 ` Jan Beulich
2022-04-05 15:47 ` Roger Pau Monné [this message]
2022-04-06 8:44 ` Jan Beulich
2022-04-06 9:34 ` Roger Pau Monné
2022-04-06 12:40 ` Jan Beulich
2022-04-06 14:14 ` Roger Pau Monné
2022-04-06 14:21 ` Jan Beulich
2022-04-06 14:24 ` Jan Beulich
2022-04-06 14:34 ` Bertrand Marquis
2022-03-31 9:48 ` [PATCH v4 4/8] x86/boot: simplify mode_table Jan Beulich
2022-04-05 10:44 ` Roger Pau Monné
2022-03-31 9:49 ` [PATCH v4 5/8] x86/boot: fold branches in video handling code Jan Beulich
2022-04-05 10:55 ` Roger Pau Monné
2022-03-31 9:50 ` [PATCH v4 6/8] x86/boot: fold/replace moves " Jan Beulich
2022-04-05 11:13 ` Roger Pau Monné
2022-03-31 9:50 ` [PATCH v4 7/8] x86/boot: LEA -> MOV " Jan Beulich
2022-04-05 11:28 ` Roger Pau Monné
2022-03-31 9:51 ` [PATCH v4 8/8] x86/boot: fold two MOVs into an ADD Jan Beulich
2022-04-05 11:29 ` Roger Pau Monné
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=YkxkfbNpR7yfLP7W@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=volodymyr_babchuk@epam.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.