From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 5/5] x86/microcode: Disable microcode update handler if DIS_MCU_UPDATE is set
Date: Thu, 22 Jun 2023 16:05:14 +0100 [thread overview]
Message-ID: <6494632c.df0a0220.3b155.47fe@mx.google.com> (raw)
In-Reply-To: <37caa77c-f3ee-3bee-951e-cc0ea417f539@suse.com>
On Tue, Jun 20, 2023 at 11:51:00AM +0200, Jan Beulich wrote:
> On 15.06.2023 17:48, Alejandro Vallejo wrote:
> > --- a/xen/arch/x86/cpu/common.c
> > +++ b/xen/arch/x86/cpu/common.c
> > @@ -352,6 +352,11 @@ void __init early_cpu_init(void)
> > &c->x86_capability[FEATURESET_7c0],
> > &c->x86_capability[FEATURESET_7d0]);
> >
> > + if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
> > + rdmsr(MSR_ARCH_CAPABILITIES,
> > + c->x86_capability[FEATURESET_m10Al],
> > + c->x86_capability[FEATURESET_m10Ah]);
>
> Is this still going to be needed if early_microcode_init() uniformly
> does this, for things to be correct for tsx_init() (as pointed out
> in the other patch)?
Yes. This is needed so MSR_ARCH_CAPS are available in order to check
DIS_MCU_LOAD before the microcode update itself. early_cpu_init() does the
read before the microcode update, while early_microcode_init() refreshes
the fields that might have been modified after the update AND are needed
before the general CPU detection logic.
>
> > --- a/xen/arch/x86/cpu/microcode/intel.c
> > +++ b/xen/arch/x86/cpu/microcode/intel.c
> > @@ -387,8 +387,22 @@ static struct microcode_patch *cf_check cpu_request_microcode(
> >
> > void __init intel_get_ucode_ops(struct microcode_ops *ops)
> > {
> > + uint64_t mcu_ctrl;
> > +
> > ops->cpu_request_microcode = cpu_request_microcode;
> > ops->collect_cpu_info = collect_cpu_info;
> > ops->apply_microcode = apply_microcode;
> > ops->compare_patch = compare_patch;
> > +
> > + if ( cpu_has_mcu_ctrl )
> > + {
> > + rdmsrl(MSR_MCU_CONTROL, mcu_ctrl);
> > + /*
> > + * If DIS_MCU_LOAD is set applying microcode updates won't work. We
> > + * can still query the current version and things like that, so
> > + * we'll leave the other handlers in place.
> > + */
> > + if ( mcu_ctrl & MCU_CONTROL_DIS_MCU_LOAD )
> > + ops->apply_microcode = NULL;
> > + }
>
> While this won't address Andrew's request (afaict), but only the
> cf_clobber requirement, I think you want to drop removing of the struct
> instances from patch 2, return pointers from the new per-vendor
> functions, and simply introduce another static instance of struct
> microcode_ops here, with the one hook simply left unset. This lives in
> init data, so the size increase is of no major concern.
>
> Jan
As mentioned in other email. This is my bad for not having understood the
ultimate readon for cf_clobber. I'll just leave the structs as is.
Alejandro
next prev parent reply other threads:[~2023-06-22 15:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 15:48 [PATCH v2 0/5] Prevent attempting updates known to fail Alejandro Vallejo
2023-06-15 15:48 ` [PATCH v3 1/5] x86/microcode: Allow reading microcode revision even if it can't be updated Alejandro Vallejo
2023-06-19 15:37 ` Jan Beulich
2023-06-19 15:49 ` Andrew Cooper
2023-06-19 15:58 ` Jan Beulich
2023-06-19 16:06 ` Andrew Cooper
2023-06-19 16:10 ` Jan Beulich
2023-06-20 9:53 ` Jan Beulich
2023-06-15 15:48 ` [PATCH v3 2/5] x86/microcode: Create per-vendor microcode_ops builders Alejandro Vallejo
2023-06-19 15:45 ` Jan Beulich
2023-06-22 14:34 ` Alejandro Vallejo
2023-06-15 15:48 ` [PATCH v3 3/5] x86/microcode: Ignore microcode loading interface for revision = -1 Alejandro Vallejo
2023-06-19 15:47 ` Jan Beulich
2023-06-15 15:48 ` [PATCH v3 4/5] x86: Read MSR_ARCH_CAPS immediately after early_microcode_init() Alejandro Vallejo
2023-06-19 15:57 ` Jan Beulich
2023-06-22 14:55 ` Alejandro Vallejo
2023-06-22 15:20 ` Jan Beulich
2023-06-15 15:48 ` [PATCH v3 5/5] x86/microcode: Disable microcode update handler if DIS_MCU_UPDATE is set Alejandro Vallejo
2023-06-20 9:51 ` Jan Beulich
2023-06-22 15:05 ` Alejandro Vallejo [this message]
2023-06-15 15:56 ` [PATCH v2 0/5] Prevent attempting updates known to fail Alejandro Vallejo
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=6494632c.df0a0220.3b155.47fe@mx.google.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.