[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2bacaab-8264-4532-9a8b-e060f50d41ca@suse.com>
Date: Tue, 3 Dec 2024 19:46:34 +0200
From: Nikolay Borisov <nik.borisov@...e.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/tdx: Dump attributes and TD_CTLS on boot
On 2.12.24 г. 9:24 ч., Kirill A. Shutemov wrote:
> Dump TD configuration on boot. Attributes and TD_CTLS define TD
> behavior. This information is useful for tracking down bugs.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Reviewed-by: Nikolay Borisov <nik.borisov@...e.com>
> ---
> arch/x86/coco/tdx/Makefile | 2 +-
> arch/x86/coco/tdx/debug.c | 69 +++++++++++++++++++++++++++++++
> arch/x86/coco/tdx/tdx.c | 27 ++++++++----
> arch/x86/include/asm/shared/tdx.h | 39 +++++++++++++++--
> arch/x86/include/asm/tdx.h | 3 ++
> 5 files changed, 128 insertions(+), 12 deletions(-)
> create mode 100644 arch/x86/coco/tdx/debug.c
>
> diff --git a/arch/x86/coco/tdx/Makefile b/arch/x86/coco/tdx/Makefile
> index 2c7dcbf1458b..b3c47d3700e2 100644
> --- a/arch/x86/coco/tdx/Makefile
> +++ b/arch/x86/coco/tdx/Makefile
> @@ -1,3 +1,3 @@
> # SPDX-License-Identifier: GPL-2.0
>
> -obj-y += tdx.o tdx-shared.o tdcall.o
> +obj-y += debug.o tdcall.o tdx.o tdx-shared.o
> diff --git a/arch/x86/coco/tdx/debug.c b/arch/x86/coco/tdx/debug.c
> new file mode 100644
> index 000000000000..cef847c8bb67
> --- /dev/null
> +++ b/arch/x86/coco/tdx/debug.c
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#undef pr_fmt
> +#define pr_fmt(fmt) "tdx: " fmt
> +
> +#include <linux/array_size.h>
> +#include <linux/printk.h>
> +#include <asm/tdx.h>
> +
> +#define DEF_TDX_ATTR_NAME(_name) [TDX_ATTR_##_name##_BIT] = __stringify(_name)
> +
> +static __initdata const char *tdx_attributes[] = {
> + DEF_TDX_ATTR_NAME(DEBUG),
> + DEF_TDX_ATTR_NAME(HGS_PLUS_PROF),
> + DEF_TDX_ATTR_NAME(PERF_PROF),
> + DEF_TDX_ATTR_NAME(PMT_PROF),
> + DEF_TDX_ATTR_NAME(ICSSD),
> + DEF_TDX_ATTR_NAME(LASS),
> + DEF_TDX_ATTR_NAME(SEPT_VE_DISABLE),
> + DEF_TDX_ATTR_NAME(MIGRTABLE),
> + DEF_TDX_ATTR_NAME(PKS),
> + DEF_TDX_ATTR_NAME(KL),
> + DEF_TDX_ATTR_NAME(TPA),
> + DEF_TDX_ATTR_NAME(PERFMON),
> +};
> +
> +#define DEF_TD_CTLS_NAME(_name) [TD_CTLS_##_name##_BIT] = __stringify(_name)
> +
> +static __initdata const char *tdcs_td_ctls[] = {
> + DEF_TD_CTLS_NAME(PENDING_VE_DISABLE),
> + DEF_TD_CTLS_NAME(ENUM_TOPOLOGY),
> + DEF_TD_CTLS_NAME(VIRT_CPUID2),
> + DEF_TD_CTLS_NAME(REDUCE_VE),
> + DEF_TD_CTLS_NAME(LOCK),
nit: That's a bit wasteful for sparsely populated fields but I guess the
extra complexity of having a struct in the array with the bit definition
and the name isn't worth the space saving.
> +};
> +
<snip>
Powered by blists - more mailing lists