public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/tdx: Dump attributes and TD_CTLS on boot
Date: Tue, 3 Dec 2024 19:46:34 +0200	[thread overview]
Message-ID: <b2bacaab-8264-4532-9a8b-e060f50d41ca@suse.com> (raw)
In-Reply-To: <20241202072458.447455-1-kirill.shutemov@linux.intel.com>



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@linux.intel.com>

Reviewed-by: Nikolay Borisov <nik.borisov@suse.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>


  reply	other threads:[~2024-12-03 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02  7:24 [PATCH] x86/tdx: Dump attributes and TD_CTLS on boot Kirill A. Shutemov
2024-12-03 17:46 ` Nikolay Borisov [this message]
2024-12-04 18:41 ` Dave Hansen
2024-12-05  8:59   ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2bacaab-8264-4532-9a8b-e060f50d41ca@suse.com \
    --to=nik.borisov@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox