OpenCloudOS-Kernel/arch/x86/realmode
Thomas Gleixner 33e20b07be x86/realmode: Make stack lock work in trampoline_compat()
The stack locking and stack assignment macro LOAD_REALMODE_ESP fails to
work when invoked from the 64bit trampoline entry point:

trampoline_start64
  trampoline_compat
    LOAD_REALMODE_ESP <- lock

Accessing tr_lock is only possible from 16bit mode. For the compat entry
point this needs to be pa_tr_lock so that the required relocation entry is
generated. Otherwise it locks the non-relocated address which is
aside of being wrong never cleared in secondary_startup_64() causing all
but the first CPU to get stuck on the lock.

Make the macro take an argument lock_pa which defaults to 0 and rename it
to LOCK_AND_LOAD_REALMODE_ESP to make it clear what this is about.

Fixes: f6f1ae9128 ("x86/smpboot: Implement a bit spinlock to protect the realmode stack")
Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lore.kernel.org/r/87h6rujdvl.ffs@tglx
2023-05-30 14:11:47 +02:00
..
rm x86/realmode: Make stack lock work in trampoline_compat() 2023-05-30 14:11:47 +02:00
Makefile x86, objtool: Dont exclude arch/x86/realmode/ 2021-05-12 14:54:54 +02:00
init.c x86/smpboot: Implement a bit spinlock to protect the realmode stack 2023-05-15 13:45:03 +02:00
rmpiggy.S x86/asm/realmode: Use SYM_DATA_* instead of GLOBAL 2019-10-18 11:28:47 +02:00