Re: [PATCH v3 2/2] x86/head64: Replace pointer fixups with RIP_RELATIVE_ADDR()
From: Kirill A. Shutemov
Date: Wed Jan 31 2024 - 03:24:29 EST
On Tue, Jan 30, 2024 at 10:08:45PM +0000, Kevin Loughlin wrote:
> @@ -594,15 +579,15 @@ static void set_bringup_idt_handler(gate_desc *idt, int n, void *handler)
> /* This runs while still in the direct mapping */
> static void __head startup_64_load_idt(unsigned long physbase)
> {
> - struct desc_ptr *desc = fixup_pointer(&bringup_idt_descr, physbase);
> - gate_desc *idt = fixup_pointer(bringup_idt_table, physbase);
> + struct desc_ptr *desc = RIP_RELATIVE_ADDR(bringup_idt_descr);
> + gate_desc *idt = RIP_RELATIVE_ADDR(bringup_idt_table);
>
>
> if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT)) {
> void *handler;
>
> /* VMM Communication Exception */
> - handler = fixup_pointer(vc_no_ghcb, physbase);
> + handler = RIP_RELATIVE_ADDR(vc_no_ghcb);
> set_bringup_idt_handler(idt, X86_TRAP_VC, handler);
> }
>
Looks like you removed all physbase users in the function. No need to pass
it to it.
> @@ -629,7 +614,7 @@ void early_setup_idt(void)
> void __head startup_64_setup_env(unsigned long physbase)
> {
> /* Load GDT */
> - startup_gdt_descr.address = (unsigned long)fixup_pointer(startup_gdt, physbase);
> + startup_gdt_descr.address = (unsigned long)RIP_RELATIVE_ADDR(startup_gdt);
> native_load_gdt(&startup_gdt_descr);
>
> /* New GDT is live - reload data segment registers */
With startup_64_load_idt() fixed, no users for physbase in this function
either.
--
Kiryl Shutsemau / Kirill A. Shutemov