public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<tglx@linutronix.de>, <bp@alien8.de>, <kan.liang@linux.intel.com>,
	<mingo@kernel.org>, <peterz@infradead.org>, <tony.luck@intel.com>,
	<pawan.kumar.gupta@linux.intel.com>
Subject: Re: [PATCH 1/5] x86/cpu: Introduce new microcode matching helper
Date: Tue, 10 Dec 2024 13:46:26 +0800	[thread overview]
Message-ID: <Z1fVslUeUwjBNwdI@intel.com> (raw)
In-Reply-To: <20241206193831.3BBA3834@davehans-spike.ostc.intel.com>

On Fri, Dec 06, 2024 at 11:38:31AM -0800, Dave Hansen wrote:
>
>From: Dave Hansen <dave.hansen@linux.intel.com>
>
>The 'x86_cpu_id' and 'x86_cpu_desc' structures are very similar and
>need to be consolidated.  There is a microcode version matching
>function for 'x86_cpu_desc' but not 'x86_cpu_id'.
>
>Create one for 'x86_cpu_id'.
>
>This essentially just leverages the x86_cpu_id->driver_data field
>to replace the less generic x86_cpu_desc->x86_microcode_rev field.
>
>Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
>---
>
> b/arch/x86/include/asm/cpu_device_id.h |    1 +
> b/arch/x86/kernel/cpu/match.c          |   11 +++++++++++
> 2 files changed, 12 insertions(+)
>
>diff -puN arch/x86/include/asm/cpu_device_id.h~min-ucode-rev arch/x86/include/asm/cpu_device_id.h
>--- a/arch/x86/include/asm/cpu_device_id.h~min-ucode-rev	2024-12-06 11:33:15.663128241 -0800
>+++ b/arch/x86/include/asm/cpu_device_id.h	2024-12-06 11:33:15.667128399 -0800
>@@ -278,5 +278,6 @@ struct x86_cpu_desc {
> 
> extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
> extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
>+extern bool x86_match_min_microcode_rev(const struct x86_cpu_id *table);
> 
> #endif /* _ASM_X86_CPU_DEVICE_ID */
>diff -puN arch/x86/kernel/cpu/match.c~min-ucode-rev arch/x86/kernel/cpu/match.c
>--- a/arch/x86/kernel/cpu/match.c~min-ucode-rev	2024-12-06 11:33:15.663128241 -0800
>+++ b/arch/x86/kernel/cpu/match.c	2024-12-06 11:33:15.667128399 -0800
>@@ -86,3 +86,14 @@ bool x86_cpu_has_min_microcode_rev(const
> 	return true;
> }
> EXPORT_SYMBOL_GPL(x86_cpu_has_min_microcode_rev);
>+
>+bool x86_match_min_microcode_rev(const struct x86_cpu_id *table)
>+{
>+	const struct x86_cpu_id *res = x86_match_cpu(table);
>+
>+	if (!res || res->driver_data > boot_cpu_data.microcode)
>+		return false;
>+
>+	return true;

Maybe we can simplify the logic to:

	return res && res->driver_data <= boot_cpu_data.microcode;

>+}
>+EXPORT_SYMBOL_GPL(x86_match_min_microcode_rev);
>_

  reply	other threads:[~2024-12-10  5:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 19:38 [PATCH 0/5] x86/cpu: Remove duplicate microcode version matching infrastructure Dave Hansen
2024-12-06 19:38 ` [PATCH 1/5] x86/cpu: Introduce new microcode matching helper Dave Hansen
2024-12-10  5:46   ` Chao Gao [this message]
2024-12-13 17:55     ` Dave Hansen
2024-12-06 19:38 ` [PATCH 2/5] x86/cpu: Expose only stepping min/max interface Dave Hansen
2024-12-13 16:24   ` Borislav Petkov
2024-12-13 16:27     ` Dave Hansen
2024-12-13 17:44     ` Dave Hansen
2024-12-06 19:38 ` [PATCH 3/5] x86/cpu: Replace PEBS use of 'x86_cpu_desc' use with 'x86_cpu_id' Dave Hansen
2024-12-06 19:55   ` Luck, Tony
2024-12-06 19:58     ` Dave Hansen
2024-12-06 23:58   ` Pawan Gupta
2024-12-07  0:02     ` Dave Hansen
2024-12-06 19:38 ` [PATCH 4/5] x86/cpu: Move AMD erratum 1386 table over to 'x86_cpu_id' Dave Hansen
2024-12-06 19:38 ` [PATCH 5/5] x86/cpu: Remove 'x86_cpu_desc' infrastructure Dave Hansen
2024-12-09 13:06 ` [PATCH 0/5] x86/cpu: Remove duplicate microcode version matching infrastructure Qiuxu Zhuo

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=Z1fVslUeUwjBNwdI@intel.com \
    --to=chao.gao@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.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