Re: [PATCH v2 16/17] x86/sev: Drop inline asm LEA instructions for RIP-relative references

From: Kevin Loughlin
Date: Thu Jan 25 2024 - 15:47:03 EST


On Thu, Jan 25, 2024 at 3:33 AM Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
>
> The SEV code that may run early is now built with -fPIC and so there is
> no longer a need for explicit RIP-relative references in inline asm,
> given that is what the compiler will emit as well.
>
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> ---
> arch/x86/mm/mem_encrypt_identity.c | 37 +++-----------------
> 1 file changed, 5 insertions(+), 32 deletions(-)

snp_cpuid_get_table() in arch/x86/kernel/sev-shared.c (a helper
function to provide the same inline assembly pattern for RIP-relative
references) would also no longer be needed, as all calls to it would
now be made in position-independent code. We can therefore eliminate
the function as part of this commit.