mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Terry Bowman <terry.bowman@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <bp@suse.de>, <x86@kernel.org>
Subject: Re: [PATCH 3/3] tools/x86/kcpuid: Dump the CPUID function in detailed view
Date: Tue, 7 Feb 2023 11:42:09 +0800	[thread overview]
Message-ID: <Y+HIkTzNh4SXgVEc@feng-clx> (raw)
In-Reply-To: <20230206141832.4162264-4-terry.bowman@amd.com>

On Mon, Feb 06, 2023 at 08:18:32AM -0600, Terry Bowman wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> 
> Sometimes it is useful to know which CPUID leaf contains the fields so
> add it to -d output so that it looks like this:
> 
>   CPUID_0x8000001e_ECX[0x0]:
>            extended_apic_id       : 0x8           - Extended APIC ID
>            core_id                : 0x4           - Identifies the logical core ID
>            threads_per_core       : 0x1           - The number of threads per core is threads_per_core + 1
>            node_id                : 0x0           - Node ID
>            nodes_per_processor    : 0x0           - Nodes per processor { 0: 1 node, else reserved }
> 
>   CPUID_0x8000001f_ECX[0x0]:
>            sme                 -  Secure Memory Encryption

The idea looks good to me, as providing clear info.

I gave it a run on my box, and there are some item with no valid bits
definition, like:

"
CPUID_0xd_ECX[0x2]:

CPUID_0xd_ECX[0x5]:

CPUID_0xd_ECX[0x6]:

CPUID_0xd_ECX[0x7]:

CPUID_0xd_ECX[0x8]:
"

Maybe we can check the sum of subleaf->info.nr[EAX/EBX/ECX/EDX],
and only print it out when it is not zero.

Thanks,
Feng

> 
> ...
> 
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Signed-off-by: Terry Bowman <terry.bowman@amd.com>
> ---
>  tools/arch/x86/kcpuid/kcpuid.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/arch/x86/kcpuid/kcpuid.c b/tools/arch/x86/kcpuid/kcpuid.c
> index dae75511fef7..3bab3398cec3 100644
> --- a/tools/arch/x86/kcpuid/kcpuid.c
> +++ b/tools/arch/x86/kcpuid/kcpuid.c
> @@ -468,13 +468,21 @@ static void show_leaf(struct subleaf *leaf)
>  	if (!leaf)
>  		return;
>  
> -	if (show_raw)
> +	if (show_raw) {
>  		leaf_print_raw(leaf);
> +	} else {
> +		if (show_details)
> +			printf("CPUID_0x%x_ECX[0x%x]:\n",
> +				leaf->index, leaf->sub);
> +	}
>  
>  	decode_bits(leaf->eax, &leaf->info[R_EAX]);
>  	decode_bits(leaf->ebx, &leaf->info[R_EBX]);
>  	decode_bits(leaf->ecx, &leaf->info[R_ECX]);
>  	decode_bits(leaf->edx, &leaf->info[R_EDX]);
> +
> +	if (!show_raw && show_details)
> +		printf("\n");
>  }
>  
>  static void show_func(struct cpuid_func *func)
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-02-07  3:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 14:18 [PATCH 0/3] Update kcpuid leaves and tool Terry Bowman
2023-02-06 14:18 ` [PATCH 1/3] tools/x86/kcpuid: Fix avx512bw and avx512lvl fields in Fn00000007 Terry Bowman
2023-02-07  3:28   ` Feng Tang
2023-03-07 22:41   ` [tip: x86/misc] " tip-bot2 for Terry Bowman
2023-02-06 14:18 ` [PATCH 2/3] tools/x86/kcpuid: Update AMD leaf Fn80000001 Terry Bowman
2023-02-07  3:49   ` Feng Tang
2023-02-07 15:47     ` Borislav Petkov
2023-02-08  6:15       ` Feng Tang
2023-03-07 22:41   ` [tip: x86/misc] " tip-bot2 for Terry Bowman
2023-02-06 14:18 ` [PATCH 3/3] tools/x86/kcpuid: Dump the CPUID function in detailed view Terry Bowman
2023-02-07  3:42   ` Feng Tang [this message]
2023-02-07 16:17     ` Borislav Petkov
2023-02-08  6:13       ` Feng Tang
2023-03-07 22:41   ` [tip: x86/misc] " tip-bot2 for Borislav Petkov (AMD)

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=Y+HIkTzNh4SXgVEc@feng-clx \
    --to=feng.tang@intel.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terry.bowman@amd.com \
    --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

all inboxes | Powered by JetHome®