]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mm/cpa: Generalize __set_memory_enc_pgtable()
authorBrijesh Singh <brijesh.singh@amd.com>
Wed, 23 Feb 2022 04:35:28 +0000 (22:35 -0600)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Feb 2022 18:14:29 +0000 (19:14 +0100)
commit0a988afcb5d6f85591ca8423a7ec3cb9ad245ea1
treef20c6e8c3533923f1e057be90f6c26da7303cd2b
parent9323cf365737b91941c44d4e474f9345850a05fb
x86/mm/cpa: Generalize __set_memory_enc_pgtable()

The kernel provides infrastructure to set or clear the encryption mask
from the pages for AMD SEV, but TDX requires few tweaks.

- TDX and SEV have different requirements to the cache and TLB
  flushing.

- TDX has own routine to notify VMM about page encryption status change.

Modify __set_memory_enc_pgtable() and make it flexible enough to cover
both AMD SEV and Intel TDX. The AMD-specific behavior is isolated in the
callbacks under x86_platform.guest. TDX will provide own version of said
callbacks.

  [ bp: Beat into submission. ]

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lore.kernel.org/r/20220223043528.2093214-1-brijesh.singh@amd.com
arch/x86/include/asm/set_memory.h
arch/x86/include/asm/x86_init.h
arch/x86/kernel/x86_init.c
arch/x86/mm/mem_encrypt_amd.c
arch/x86/mm/pat/set_memory.c