[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 3/8] x86/EFI: retrieve EDID
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 5 Apr 2022 17:47:09 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Gv2ptfdss89fam2VXR3H+NHqs3Y+kN17iHb2puE2X1g=; b=KzkwZt2UT01zcOfuxB6QWwjFMiv/oPM6G8+ewJfyWg7l0Re3b1Co+MR5OiVOhUx/5a84XVygL46Op22IdnrlM3N/T5n1Mh0zpm4ILwpUVuP2SJNSOJ0WFWKOKCC9x0kUAfT5rJIW/152mF4J7JicPQdHIhNU5gvAXACpiKqLNM3GAZeYprXLh1gH4BR7H0cfJLLxPFe0Ka6nV7BO+EdwSd0nUwIz5gFkQtzp/zwBVajM3j+k68ZYZ1ChMldlaYpuAGQJbNIdW4Ie1wYSKq+hoLW7UG3h3ExqAGl2q6hlW/goiOWlZBIJznSHma+Rb1/1ZEUXQCUOBqzqHoXxSetCzw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEy66GG0HwI+CtsMCHYj4leiYq9Lna02bdgxV6UlVMnq9TfGol0dYkrFPCxmwggOlO/Kv/o+Objo+knLidXnYKUHpjL9wSeUX3gJRGoNXXj7NFgfmQbT2cAIT2cJMluOQ/k8lp5oY6ln8UZFkvVTu5Rkn7nNNc+A9umbl6ibpcGuY67zyqgYTj8B0mrcPxUrEW1Nu42qN2BUAfsIHsFbGNJ2i+LaGjEwSzMCur7FZxk28n/n71Bb/LFgEDAYT5/hkjPNBACdHVfbfP0D+YVhhSwrKUMdDIj1PbESLII92sisgA12OUxkuiO8SOPXAAOYmCXS/LBvjKpOw5SQqfpgTg==
- Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Volodymyr Babchuk" <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
- Delivery-date: Tue, 05 Apr 2022 15:47:48 +0000
- Ironport-data: A9a23:UGGsf62YaAwupiv5gPbD5SZxkn2cJEfYwER7XKvMYLTBsI5bp2dWm zAYCjvSM/uNM2ugftknadjn90sE657Syt4yQAdqpC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOCn9xGQ7InQLlbGILes1htZGEk1EE/NtTo5w7Rj2tIw3IDja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1ksMSbSlwCb5b9o88CXgljLQ50bb1ZreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9u1pgQR6mHP qL1bxIzSgjESQZABmxMN8Mbo7yTnXXEYgNx/Qf9Sa0fvDGIkV0ZPKLWGMHOZtWASMFRn0CZj mHL5WL0BlcdLtP34SSC9nWgl+rehxTxUYgZFKC73vNy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HPmwU/wuwqUneXJABYBT+ZRj4NQdRXUr2A6ustn7a 5N12WF87JKEBLphk3Glpb1fiAvsnDxjWspkOYVgXAae5AZcqVtoYsW+14QOIscHRj99JssHI BVfY7hDc5tABOnhk3izypSKITGZAVwIv7GeDlPhiWt6UkWoJgjpHFogfD2nR87heUAotd/lq D5259T5cNzp/8tHNFA7dg6ML6K40z2MFvx2TGpUBza/J9uAQO4l3ew2sRz2N2X
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxxxxx>
Thanks, Roger.
|