Re: [PATCH v2] x86/boot: Use EFI setup data if provided

From: Chao Fan
Date: Fri Mar 29 2019 - 05:06:51 EST


On Fri, Mar 29, 2019 at 09:39:20AM +0100, Borislav Petkov wrote:
>On Fri, Mar 29, 2019 at 03:05:52AM +0000, Junichi Nomura wrote:
>> > You don't need that variable and can return "table" or 0 after the endif
>> > below.
>>
>> I could do that but it will slightly change the current logic.
>>
>> Existing code does this:
>>
>> if (!(efi_guidcmp(guid, ACPI_TABLE_GUID)))
>> rsdp_addr = table;
>> else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID)))
>> return table;
>>
>> I thought it was to return the table for ACPI_20_TABLE_GUID
>> if both tables exist. If we remove rsdp_addr, the code will be:
>>
>> if (!(efi_guidcmp(guid, ACPI_TABLE_GUID)))
>> return table;
>> else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID)))
>> return table;
>>
>> So if there are 2 tables, we return the one that comes first.
>> Is it ok?
>
>That's a good question.
>
>Chao, what was the intention there, ACPI_20_TABLE_GUID is the preferred
>table to return? If so, why?

Yes, ACPI_20_TABLE_GUID is preferred.

ACPI_20 means version 2.0 and later versions, ACPI_TABLE_GUID is version 1.0
which is earlier than 2003, it's too old. Version 2.0 has more features than 1.0.
Sure the new version is preferred.

So many codes prefers ACPI20, such as in drivers/acpi/osl.c where kernel
parses RSDP ACPI20 firstly. Documentation/ABI/testing/sysfs-firmware-efi says in
/sys/firmware/efi/systab, ACPI20 comes before ACPI. So that kexec-tools
code kexec/arch/i386/crashdump-x86.c can easily get ACPI_20(if there is
ACPI_20) before ACPI 1.0.
But in my code, I am not sure which version will be found firstly, so I
write this logical, if ACPI20 found, return directly, then consider ACPI 1.0.

Thanks,
Chao Fan

>--
>Regards/Gruss,
> Boris.
>
>Good mailing practices for 400: avoid top-posting and trim the reply.
>
>