[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190329035254.GD1877@MiWiFi-R3L-srv>
Date: Fri, 29 Mar 2019 11:52:54 +0800
From: "bhe@...hat.com" <bhe@...hat.com>
To: Junichi Nomura <j-nomura@...jp.nec.com>
Cc: Borislav Petkov <bp@...en8.de>, Dave Young <dyoung@...hat.com>,
"fanc.fnst@...fujitsu.com" <fanc.fnst@...fujitsu.com>,
"kasong@...hat.com" <kasong@...hat.com>,
"x86@...nel.org" <x86@...nel.org>,
"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] x86/boot: Use EFI setup data if provided
On 03/29/19 at 03:34am, Junichi Nomura wrote:
> On 3/29/19 8:11 AM, bhe@...hat.com wrote:
> > On 03/28/19 at 07:43am, Junichi Nomura wrote:
> >> /* Search EFI system tables for RSDP. */
> >> -static acpi_physical_address efi_get_rsdp_addr(void)
> >> +static acpi_physical_address __efi_get_rsdp_addr(unsigned long config_tables, unsigned int nr_tables, int size, bool efi_64)
> >
> > Here parameter 'size' and 'efi_64' seems a little duplicated on
> > functionality. Only passing efi_64 can deduce the size? Personal
> > opinion.
>
> Yes. But I'm not sure which is preferred.
>
> The current code is:
>
I would like to change them like below two cases. I personally prefer
the 2nd one. Feel free to take one you like better.
1)
__efi_get_rsdp_addr() {
size = efi_64 ? sizeof(efi_config_table_64_t):sizeof(efi_config_table_32_t);;
Or if/else sytle.
for (i = 0; i < nr_tables; i++) {
config_tables += size;
if (efi_64) {
efi_config_table_64_t *tbl = (efi_config_table_64_t *)config_tables;
// get guid and table
} else {
efi_config_table_32_t *tbl = (efi_config_table_32_t *)config_tables;
// get guid and table
}
// check guid and return table if it's valid
}
}
2)
__efi_get_rsdp_addr() {
for (i = 0; i < nr_tables; i++) {
if (efi_64) {
efi_config_table_64_t *tbl = (efi_config_table_64_t *)config_tables + i;
// get guid and table
} else {
efi_config_table_32_t *tbl = (efi_config_table_32_t *)config_tables + i;
// get guid and table
}
// check guid and return table if it's valid
}
}
>
> Or we could create 2 functions, __efi_get_rsdp_addr32() and __efi_get_rsdp_addr64(),
> and let efi_get_rsdp_addr() to choose which one to use based on signature.
>
> > It might be worth adding code comments here to tell why we only care
> > about 64bit kexec booting?
>
> I think so. I'll add a comment.
>
> --
> Jun'ichi Nomura, NEC Corporation / NEC Solution Innovators, Ltd.
Powered by blists - more mailing lists