Re: [PATCH v15 4/6] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

Chao Fan
2019-01-11T01:28:18Z

On Thu, Jan 10, 2019 at 10:27:47PM +0100, Borislav Petkov wrote:
>On Mon, Jan 07, 2019 at 11:22:41AM +0800, Chao Fan wrote:
>> Memory information in SRAT table is necessary to fix the conflict
>> between KASLR and memory-hotremove. So RSDP and SRAT should be parsed.
>>
>> When booting form KEXEC/EFI/BIOS, the methods to compute RSDP
>> are different. When booting from BIOS, there is no variable who can
>> point to RSDP directly, so scan memory for the RSDP and verify RSDP
>> by signature and checksum.
>>
>> Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
>> ---
>> arch/x86/boot/compressed/acpi.c | 86 +++++++++++++++++++++++++++++++++
>> 1 file changed, 86 insertions(+)
>
>...
>
>> +/* Search RSDP address, based on acpi_find_root_pointer(). */
>> +static acpi_physical_address bios_get_rsdp_addr(void)
>> +{
>> + u8 *table_ptr;
>> + u32 address;
>> + u8 *rsdp;
>
>But those u8's together:
>
> u8 *table_ptr, *rsdp;
> u32 address;

Thanks, will change that.

>
>> +
>> + /* Get the location of the Extended BIOS Data Area (EBDA) */
>> + table_ptr = (u8 *)ACPI_EBDA_PTR_LOCATION;
>> + address = *(u16 *)table_ptr;
>> + address <<= 4;
>> + table_ptr = (u8 *)(long)address;
>> +
>> + /*
>> + * Search EBDA paragraphs (EBDA is required to be a minimum of
>> + * 1K length)
>> + */
>> + if (address > 0x400) {
>> + rsdp = scan_mem_for_rsdp(table_ptr, ACPI_EBDA_WINDOW_SIZE);
>> + if (rsdp) {
>> + address += (u32)ACPI_PTR_DIFF(rsdp, table_ptr);
>> + return address;
>> + }
>> + }
>> +
>> + /* Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
>> + table_ptr = (u8 *)ACPI_HI_RSDP_WINDOW_BASE;
>> + rsdp = scan_mem_for_rsdp(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
>> +
>
>Superfluous newline.

Will drop it.

Thanks,
Chao Fan

>
>> + if (rsdp) {
>> + address = (u32)(ACPI_HI_RSDP_WINDOW_BASE +
>> + ACPI_PTR_DIFF(rsdp, table_ptr));
>> + return address;
>> + }
>> + return 0;
>> +}
>
>--
>Regards/Gruss,
> Boris.
>
>Good mailing practices for 400: avoid top-posting and trim the reply.
>
>