[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YdYuqFcFkcK1d+XP@zn.tnic>
Date: Thu, 6 Jan 2022 00:50:00 +0100
From: Borislav Petkov <bp@...en8.de>
To: Brijesh Singh <brijesh.singh@....com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-efi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-mm@...ck.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Joerg Roedel <jroedel@...e.de>,
Tom Lendacky <thomas.lendacky@....com>,
"H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Jim Mattson <jmattson@...gle.com>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Sergio Lopez <slp@...hat.com>, Peter Gonda <pgonda@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
David Rientjes <rientjes@...gle.com>,
Dov Murik <dovmurik@...ux.ibm.com>,
Tobin Feldman-Fitzthum <tobin@....com>,
Michael Roth <michael.roth@....com>,
Vlastimil Babka <vbabka@...e.cz>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Andi Kleen <ak@...ux.intel.com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
tony.luck@...el.com, marcorr@...gle.com,
sathyanarayanan.kuppuswamy@...ux.intel.com
Subject: Re: [PATCH v8 24/40] x86/compressed/acpi: move EFI system table
lookup to helper
On Fri, Dec 10, 2021 at 09:43:16AM -0600, Brijesh Singh wrote:
> +int efi_get_system_table(struct boot_params *boot_params, unsigned long *sys_tbl_pa,
> + bool *is_efi_64)
Nah, that's doing two things in one function.
The signature should be a lot simpler:
unsigned long efi_get_system_table(struct boot_params *bp)
returns 0 on failure, non-null on success and then it returns the
physical address of the system table.
> +{
> + unsigned long sys_tbl;
> + struct efi_info *ei;
> + bool efi_64;
> + char *sig;
> +
> + if (!sys_tbl_pa || !is_efi_64)
> + return -EINVAL;
> +
This...
> + ei = &boot_params->efi_info;
> + sig = (char *)&ei->efi_loader_signature;
> +
> + if (!strncmp(sig, EFI64_LOADER_SIGNATURE, 4)) {
> + efi_64 = true;
> + } else if (!strncmp(sig, EFI32_LOADER_SIGNATURE, 4)) {
> + efi_64 = false;
> + } else {
> + debug_putstr("Wrong EFI loader signature.\n");
> + return -EOPNOTSUPP;
> + }
... up to here needs to be another function:
enum get_efi_type(sig)
where enum is { EFI64, EFI32, INVALID } or so.
And you call this function at the call sites:
if (efi_get_type(sig) == INVALID)
error...
sys_tbl_pa = efi_get_system_table(bp);
if (!sys_tbl_pa)
error...
Completely pseudo but you get the idea.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists