Messages in this thread | | | Date | Tue, 15 Mar 2022 16:56:14 +0100 | From | Borislav Petkov <> | Subject | Re: [PATCHv5 03/30] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions |
| |
On Fri, Mar 11, 2022 at 12:48:28AM +0300, Kirill A. Shutemov wrote: > Here how it can look like. Is it what you want?
Yap, that's better.
> diff --git a/arch/x86/boot/compressed/tdx.c b/arch/x86/boot/compressed/tdx.c > index f00fd3a39b64..b26eab2c3c59 100644 > --- a/arch/x86/boot/compressed/tdx.c > +++ b/arch/x86/boot/compressed/tdx.c > @@ -3,6 +3,7 @@ > #include "../cpuflags.h" > #include "../string.h" > #include "../io.h" > +#include "error.h" > > #include <vdso/limits.h> > #include <uapi/asm/vmx.h> > @@ -16,6 +17,11 @@ bool early_is_tdx_guest(void) > return tdx_guest_detected; > } > > +void __tdx_hypercall_failed(void) > +{ > + error("TDVMCALL failed. TDX module bug?"); > +} > + > static inline unsigned int tdx_io_in(int size, u16 port) > { > struct tdx_hypercall_args args = {
> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c > index 8e19694d33e2..29fc5941b80c 100644 > --- a/arch/x86/coco/tdx/tdx.c > +++ b/arch/x86/coco/tdx/tdx.c > @@ -53,6 +53,11 @@ static inline u64 _tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15) > return __tdx_hypercall(&args, 0); > } > > +void __tdx_hypercall_failed(void) > +{ > + panic("TDVMCALL failed. TDX module bug?"); > +}
Btw, if there's going to be more code duplication in TDX-land, I'd suggest doing a shared file like
arch/x86/kernel/sev-shared.c
which you can include in both kernel stages.
Thx.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |