x86/sev: Move SEV compilation units
PATCH 1/1 x86/sev: Move SEV compilation units
From: "Borislav Petkov (AMD)" <[email protected]>
A long time ago we said that we're going to move the coco stuff where it belongs
https://lore.kernel.org/all/[email protected]
and not keep it in arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.
No functional changes.
---
arch/x86/boot/compressed/sev.c | 2 +-
arch/x86/coco/Makefile | 1 +
arch/x86/coco/sev/Makefile | 3 +++
arch/x86/{kernel/sev.c => coco/sev/core.c} | 2 +-
arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} | 0
arch/x86/kernel/Makefile | 2 --
6 files changed, 6 insertions(+), 4 deletions(-)
create mode 100644 arch/x86/coco/sev/Makefile
rename arch/x86/{kernel/sev.c => coco/sev/core.c} (99%)
rename arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} (100%)arch/x86/boot/compressed/sev.c +1 -1
@@ -127,7 +127,7 @@ static bool fault_in_kernel_space(unsigned long address)#include "../../lib/insn.c" /* Include code for early handlers */ -#include "../../kernel/sev-shared.c" +#include "../../coco/sev/shared.c" static struct svsm_ca *svsm_get_caa (void ) {
arch/x86/coco/Makefile +1 -0
@@ -6,3 +6,4 @@ CFLAGS_core.o += -fno-stack-protector obj-y += core.o obj-$(CONFIG_INTEL_TDX_GUEST) += tdx/ +obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev/
arch/x86/coco/sev/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += core.o
arch/x86/coco/sev/core.c renamed from arch/x86/kernel/sev.c +1 -1
@@ -613,7 +613,7 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt) }/* Include code shared with pre-decompression boot stage */ -#include "sev-shared.c" +#include "shared.c" static inline struct svsm_ca *svsm_get_caa (void ) {
arch/x86/coco/sev/shared.c renamed from arch/x86/kernel/sev-shared.c +0 -0
arch/x86/kernel/Makefile +0 -2
@@ -142,8 +142,6 @@ obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o -obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev.o - obj-$(CONFIG_CFI_CLANG) += cfi.o obj-$(CONFIG_CALL_THUNKS) += callthunks.o
Signature · 1 line
2.43.0
Quoted 11 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
A long time ago we said that we're going to move the coco stuff where it belongs
https://lore.kernel.org/all/[email protected]
and not keep it in
arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.
Quoted 8 lines
No functional changes.
Cc Ashish Kalra <[email protected]>Cc Joerg Roedel <[email protected]>Cc Michael Roth <[email protected]>Cc Nikunj A Dadhania <[email protected]>Cc Tom Lendacky <[email protected]>Signed-off-by Borislav Petkov (AMD) <[email protected]>
I have rebased Secure TSC guest series on top of this patch and will post it after testing.
Regards
Nikunj
Hello Boris,
Quoted 87 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
A long time ago we said that we're going to move the coco stuff where it belongs
https://lore.kernel.org/all/[email protected]
and not keep it in
arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.No functional changes.
Cc Ashish Kalra <[email protected]>Cc Joerg Roedel <[email protected]>Cc Michael Roth <[email protected]>Cc Nikunj A Dadhania <[email protected]>Cc Tom Lendacky <[email protected]>Signed-off-by Borislav Petkov (AMD) <[email protected]>--- arch/x86/boot/compressed/sev.c | 2 +- arch/x86/coco/Makefile | 1 + arch/x86/coco/sev/Makefile | 3 +++ arch/x86/{kernel/sev.c => coco/sev/core.c} | 2 +- arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} | 0 arch/x86/kernel/Makefile | 2 -- 6 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 arch/x86/coco/sev/Makefile rename arch/x86/{kernel/sev.c => coco/sev/core.c} (99%) rename arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} (100%)arch/x86/boot/compressed/sev.c +1
-1@@ -127,7 +127,7 @@ static bool fault_in_kernel_space(unsigned long address)#include "../../lib/insn.c" /* Include code for early handlers */ -#include "../../kernel/sev-shared.c" +#include "../../coco/sev/shared.c" static struct svsm_ca *svsm_get_caa (void ) {arch/x86/coco/Makefile +1
-0@@ -6,3 +6,4 @@ CFLAGS_core.o += -fno-stack-protector obj-y += core.o obj-$(CONFIG_INTEL_TDX_GUEST) += tdx/ +obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev/arch/x86/coco/sev/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += core.oarch/x86/coco/sev/core.c renamed from arch/x86/kernel/sev.c +1
-1@@ -613,7 +613,7 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt) }/* Include code shared with pre-decompression boot stage */ -#include "sev-shared.c" +#include "shared.c" static inline struct svsm_ca *svsm_get_caa (void ) {arch/x86/coco/sev/shared.c renamed from arch/x86/kernel/sev-shared.c +0
-0arch/x86/kernel/Makefile +0
-0
arch/x86/kernel/Makefile obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o · line 147
Quoted 8 lines
arch/x86/kernel/Makefile +0
-2@@ -142,8 +142,6 @@ obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o -obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev.o - obj-$(CONFIG_CFI_CLANG) += cfi.o obj-$(CONFIG_CALL_THUNKS) += callthunks.o
I have rebased SNP guest kexec and kdump patches on top of this patch and they work without any issues with this patch applied.
Will be posting SNP guest kexec and kdump rebased on top of this patch.
Thanks, Ashish
The following commit has been merged into the x86/sev branch of tip:
The following commit has been merged into the x86/sev branch of tip:
Commit-ID: 06685975c2090e180851a0ff175c140188b6b54a Gitweb: https://git.kernel.org/tip/06685975c2090e180851a0ff175c140188b6b54a Author: Borislav Petkov (AMD) <[email protected]> AuthorDate: Wed, 19 Jun 2024 11:03:16 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Fri, 21 Jun 2024 12:31:59 +02:00
x86/sev: Move SEV compilation units
A long time ago we said that we're going to move the coco stuff where it belongs
https://lore.kernel.org/all/[email protected]
and not keep it in arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.
No functional changes.
--- arch/x86/boot/compressed/sev.c | 2 +- arch/x86/coco/Makefile | 1 +- arch/x86/coco/sev/Makefile | 3 +- arch/x86/coco/sev/core.c | 2606 +++++++++++++++++++++++++++++++- arch/x86/coco/sev/shared.c | 1717 ++++++++++++++++++++- arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/sev-shared.c | 1717 +-------------------- arch/x86/kernel/sev.c | 2606 +------------------------------- 8 files changed, 4328 insertions(+), 4326 deletions(-) create mode 100644 arch/x86/coco/sev/Makefile create mode 100644 arch/x86/coco/sev/core.c create mode 100644 arch/x86/coco/sev/shared.c delete mode 100644 arch/x86/kernel/sev-shared.c delete mode 100644 arch/x86/kernel/sev.c
arch/x86/boot/compressed/sev.c +1 -1
@@ -127,7 +127,7 @@ static bool fault_in_kernel_space(unsigned long address)#include "../../lib/insn.c" /* Include code for early handlers */ -#include "../../kernel/sev-shared.c" +#include "../../coco/sev/shared.c" static struct svsm_ca *svsm_get_caa (void ) {
arch/x86/coco/Makefile +1 -0
@@ -6,3 +6,4 @@ CFLAGS_core.o += -fno-stack-protector obj-y += core.o obj-$(CONFIG_INTEL_TDX_GUEST) += tdx/ +obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev/
arch/x86/coco/sev/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += core.o
arch/x86/coco/sev/core.c new file +2606 -0
2,606 lines not on this page · raw message
arch/x86/coco/sev/shared.c new file +1717 -0
379 lines not on this page · raw message
arch/x86/kernel/sev-shared.c deleted +0 -1717
1,717 lines not on this page · raw message
arch/x86/kernel/sev.c deleted +0 -2606
2,606 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 11 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
A long time ago we said that we're going to move the coco stuff where it belongs
https://lore.kernel.org/all/[email protected]
and not keep it in
arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.
Quoted 8 lines
No functional changes.
Cc Ashish Kalra <[email protected]>Cc Joerg Roedel <[email protected]>Cc Michael Roth <[email protected]>Cc Nikunj A Dadhania <[email protected]>Cc Tom Lendacky <[email protected]>Signed-off-by Borislav Petkov (AMD) <[email protected]>
Quoted 12 lines
---
arch/x86/boot/compressed/sev.c | 2 +-
arch/x86/coco/Makefile | 1 +
arch/x86/coco/sev/Makefile | 3 +++
arch/x86/{kernel/sev.c => coco/sev/core.c} | 2 +-
arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} | 0
arch/x86/kernel/Makefile | 2 --
6 files changed, 6 insertions(+), 4 deletions(-)
create mode 100644 arch/x86/coco/sev/Makefile
rename arch/x86/{kernel/sev.c => coco/sev/core.c} (99%)
rename arch/x86/{kernel/sev-shared.c => coco/sev/shared.c} (100%)kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Borislav,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/master]
[also build test WARNING on tip/x86/core tip/auto-latest linus/master v6.10-rc4 next-20240621] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Borislav-Petkov/x86-sev-Move-SEV-compilation-units/20240619-173322 base: tip/master patch link: https://lore.kernel.org/r/20240619093014.17962-1-bp%40kernel.org patch subject: [PATCH] x86/sev: Move SEV compilation units config: x86_64-buildonly-randconfig-004-20240622 (https://download.01.org/0day-ci/archive/20240622/[email protected]/config) compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240622/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> vmlinux.o: warning: objtool: __sev_put_ghcb+0x7a: call to __asan_memset() leaves .noinstr.text section >> vmlinux.o: warning: objtool: __sev_es_nmi_complete+0x42: call to __asan_memset() leaves .noinstr.text section
objdump-func vmlinux.o __sev_put_ghcb:
0000 0000000000000190 <__sev_put_ghcb>:
0000 190: 53 push %rbx 0001 191: 9c pushf 0002 192: 5a pop %rdx 0003 193: 65 48 8b 1d 00 00 00 00 mov %gs:0x0(%rip),%rbx # 19b <__sev_put_ghcb+0xb> 197: R_X86_64_PC32 .data..percpu+0x24 000b 19b: 48 8b 37 mov (%rdi),%rsi 000e 19e: 48 85 f6 test %rsi,%rsi 0011 1a1: 74 4e je 1f1 <__sev_put_ghcb+0x61> 0013 1a3: 48 8b 16 mov (%rsi),%rdx 0016 1a6: 48 89 f8 mov %rdi,%rax 0019 1a9: 48 8d 7b 08 lea 0x8(%rbx),%rdi 001d 1ad: 48 89 d9 mov %rbx,%rcx 0020 1b0: 48 83 e7 f8 and $0xfffffffffffffff8,%rdi 0024 1b4: 48 89 13 mov %rdx,(%rbx) 0027 1b7: 48 29 f9 sub %rdi,%rcx 002a 1ba: 48 8b 96 f8 0f 00 00 mov 0xff8(%rsi),%rdx 0031 1c1: 48 29 ce sub %rcx,%rsi 0034 1c4: 81 c1 00 10 00 00 add $0x1000,%ecx 003a 1ca: 48 89 93 f8 0f 00 00 mov %rdx,0xff8(%rbx) 0041 1d1: c1 e9 03 shr $0x3,%ecx 0044 1d4: f3 48 a5 rep movsq %ds:(%rsi),%es:(%rdi) 0047 1d7: c6 83 01 20 00 00 00 movb $0x0,0x2001(%rbx) 004e 1de: 48 c7 00 00 00 00 00 movq $0x0,(%rax) 0055 1e5: 5b pop %rbx 0056 1e6: 31 c0 xor %eax,%eax 0058 1e8: 31 d2 xor %edx,%edx 005a 1ea: 31 c9 xor %ecx,%ecx 005c 1ec: 31 f6 xor %esi,%esi 005e 1ee: 31 ff xor %edi,%edi 0060 1f0: c3 ret 0061 1f1: 48 8d bb f0 03 00 00 lea 0x3f0(%rbx),%rdi 0068 1f8: ba 10 00 00 00 mov $0x10,%edx 006d 1fd: 31 f6 xor %esi,%esi 006f 1ff: 48 c7 83 90 03 00 00 00 00 00 00 movq $0x0,0x390(%rbx) 007a 20a: e8 00 00 00 00 call 20f <__sev_put_ghcb+0x7f> 20b: R_X86_64_PLT32 __asan_memset-0x4 007f 20f: c6 83 00 20 00 00 00 movb $0x0,0x2000(%rbx) 0086 216: 5b pop %rbx 0087 217: 31 c0 xor %eax,%eax 0089 219: 31 d2 xor %edx,%edx 008b 21b: 31 c9 xor %ecx,%ecx 008d 21d: 31 f6 xor %esi,%esi 008f 21f: 31 ff xor %edi,%edi 0091 221: c3 ret 0092 222: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 cs nopw 0x0(%rax,%rax,1) 009d 22d: 0f 1f 00 nopl (%rax)
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
The following commit has been merged into the x86/sev branch of tip:
The following commit has been merged into the x86/sev branch of tip:
Commit-ID: 38918e0bb2c51c21ea464b071a254b27ff9aa71d Gitweb: https://git.kernel.org/tip/38918e0bb2c51c21ea464b071a254b27ff9aa71d Author: Borislav Petkov (AMD) <[email protected]> AuthorDate: Wed, 19 Jun 2024 11:03:16 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Thu, 11 Jul 2024 11:55:58 +02:00
x86/sev: Move SEV compilation units
A long time ago it was agreed upon that the coco stuff needs to go where it belongs:
https://lore.kernel.org/all/[email protected]
and not keep it in arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script.
No functional changes.
Move the instrumentation exclusion bits too, as helpfully caught and reported by the 0day folks.
--- arch/x86/boot/compressed/sev.c | 2 +- arch/x86/coco/Makefile | 1 +- arch/x86/coco/sev/Makefile | 15 +- arch/x86/coco/sev/core.c | 2606 +++++++++++++++++++++++++++++++- arch/x86/coco/sev/shared.c | 1717 ++++++++++++++++++++- arch/x86/kernel/Makefile | 6 +- arch/x86/kernel/sev-shared.c | 1717 +-------------------- arch/x86/kernel/sev.c | 2606 +------------------------------- 8 files changed, 4340 insertions(+), 4330 deletions(-) create mode 100644 arch/x86/coco/sev/Makefile create mode 100644 arch/x86/coco/sev/core.c create mode 100644 arch/x86/coco/sev/shared.c delete mode 100644 arch/x86/kernel/sev-shared.c delete mode 100644 arch/x86/kernel/sev.c
arch/x86/boot/compressed/sev.c +1 -1
@@ -127,7 +127,7 @@ static bool fault_in_kernel_space(unsigned long address)#include "../../lib/insn.c" /* Include code for early handlers */ -#include "../../kernel/sev-shared.c" +#include "../../coco/sev/shared.c" static struct svsm_ca *svsm_get_caa (void ) {
arch/x86/coco/Makefile +1 -0
@@ -6,3 +6,4 @@ CFLAGS_core.o += -fno-stack-protector obj-y += core.o obj-$(CONFIG_INTEL_TDX_GUEST) += tdx/ +obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev/
arch/x86/coco/sev/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += core.o + +ifdef CONFIG_FUNCTION_TRACER +CFLAGS_REMOVE_core.o = -pg +endif + +KASAN_SANITIZE_core.o := n +KMSAN_SANITIZE_core.o := n +KCOV_INSTRUMENT_core.o := n + +# With some compiler versions the generated code results in boot hangs, caused +# by several compilation units. To be safe, disable all instrumentation. +KCSAN_SANITIZE := n
arch/x86/coco/sev/core.c new file +2606 -0
2,606 lines not on this page · raw message
arch/x86/coco/sev/shared.c new file +1717 -0
367 lines not on this page · raw message
arch/x86/kernel/sev-shared.c deleted +0 -1717
1,717 lines not on this page · raw message
arch/x86/kernel/sev.c deleted +0 -2606
2,606 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.