lkml.org 
[lkml]   [2021]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v10 05/11] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions
Date
On Fri, Oct 08 2021 at 22:37, Kuppuswamy Sathyanarayanan wrote:
>
> +#ifdef CONFIG_INTEL_TDX_GUEST
> +#include <asm/tdx.h>
> +#endif

Please get rid of the #ifdef and make sure that tdx.h can be included unconditionally.

> + /* Restore callee-saved GPRs as mandated by the x86_64 ABI */
> + pop %r12
> + pop %r13
> + pop %r14
> + pop %r15
> +
> + jmp 2f
> +1:

ASM supports named labels.

> + movq $(-EINVAL), %rax
> +2:
> + FRAME_END
> +
> + retq
> +SYM_FUNC_END(__tdx_hypercall)


> +/*
> + * Wrapper for standard use of __tdx_hypercall with BUG_ON() check
> + * for TDCALL error.
> + */
> +static inline u64 _tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14,
> + u64 r15, struct tdx_hypercall_output *out)
> +{
> + struct tdx_hypercall_output outl;
> + u64 err;
> +
> + /* __tdx_hypercall() does not accept NULL output pointer */
> + if (!out)
> + out = &outl;
> +
> + err = __tdx_hypercall(TDX_HYPERCALL_STANDARD, fn, r12, r13, r14,
> + r15, out);
> +
> + /* Non zero return value indicates buggy TDX module, so panic */
> + BUG_ON(err);

BUG() does not necessarily panic. If you want to panic in then invoke
the function which does that, i.e. panic().

Thanks,

tglx

\
 
 \ /
  Last update: 2021-10-14 09:29    [W:0.305 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site