mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xin Li <xin@zytor.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
	Wieczor-Retman Maciej <maciej.wieczor-retman@intel.com>
Cc: Gleixner Thomas <tglx@linutronix.de>,
	Molnar Ingo <mingo@redhat.com>, Petkov Borislav <bp@alien8.de>,
	Hansen Dave <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Clear LAM and FRED feature bits
Date: Tue, 22 Jul 2025 10:22:01 -0700	[thread overview]
Message-ID: <5654b3bc-15d4-443b-a7b1-2f9fd1d3e0aa@zytor.com> (raw)
In-Reply-To: <A4EB1016-8CF7-4609-BBF1-9AEC83B52A4F@zytor.com>

On 7/22/2025 9:46 AM, H. Peter Anvin wrote:
>> The following code will work as a generic fix:
>>
>> 	c->x86_capability[i] &= ~DISABLED_MASK(i);
>>
>> And DISABLED_MASK(x) needs to be defined like DISABLED_MASK_BIT_SET(x).
>>
>> Thanks!
>>     Xin
> The easiest thing would be to initialize the setup disabled mask with the DISABLED bitmask instead of zero. This can be done statically; if it isn't already the awk script can produce the disabled bitmask in array form.

Yes, something like:

	void __init init_cpu_cap(void)
	{
		for (i = 0; i < NCAPINTS; i++) {
			cpu_caps_set[i] = REQUIRED_MASK(i);
			cpu_caps_cleared[i] = DISABLED_MASK(i);
		}
	}

And it would be better if it could be done at build time (to avoid
changing Xen which has a dedicated startup code path):

	__u32 cpu_caps_{set,cleared}[NCAPINTS + NBUGINTS] = {
		{REQUIRED,DISABLED}_MASK(i),
	};

And then apply_forced_caps() will do the rest automatically :)

  reply	other threads:[~2025-07-22 17:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22  7:44 Maciej Wieczor-Retman
2025-07-22  9:08 ` Xin Li
2025-07-22 14:11   ` Dave Hansen
2025-07-22 15:43     ` Maciej Wieczor-Retman
2025-07-22 15:31   ` Maciej Wieczor-Retman
2025-07-22 16:46   ` H. Peter Anvin
2025-07-22 17:22     ` Xin Li [this message]
2025-07-22 18:19     ` Maciej Wieczor-Retman
2025-07-22 19:26       ` H. Peter Anvin

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=5654b3bc-15d4-443b-a7b1-2f9fd1d3e0aa@zytor.com \
    --to=xin@zytor.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --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

all inboxes | Powered by JetHome®