All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
To: Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 0/4] Add Kconfig option to remove microcode loading support
Date: Tue, 18 Nov 2025 11:19:45 +0100	[thread overview]
Message-ID: <DEBQTGUHGDTP.QF2PFIK6CKUZ@amd.com> (raw)
In-Reply-To: <035a9514-9a7f-44ab-86a7-61deab37f7c7@suse.com>

On Mon Nov 17, 2025 at 5:55 PM CET, Jan Beulich wrote:
> On 13.11.2025 09:50, Andrew Cooper wrote:
>> On 12/11/2025 4:22 pm, Alejandro Vallejo wrote:
>>>  xen/arch/x86/Kconfig                    | 12 ++++
>>>  xen/arch/x86/cpu/microcode/Makefile     |  9 ++-
>>>  xen/arch/x86/cpu/microcode/amd-base.c   | 55 +++++++++++++++++++
>>>  xen/arch/x86/cpu/microcode/amd.c        | 55 ++-----------------
>>>  xen/arch/x86/cpu/microcode/amd.h        | 15 +++++
>>>  xen/arch/x86/cpu/microcode/base.c       | 73 +++++++++++++++++++++++++
>>>  xen/arch/x86/cpu/microcode/core.c       | 58 +-------------------
>>>  xen/arch/x86/cpu/microcode/intel-base.c | 50 +++++++++++++++++
>>>  xen/arch/x86/cpu/microcode/intel.c      | 56 +++----------------
>>>  xen/arch/x86/cpu/microcode/intel.h      | 16 ++++++
>>>  xen/arch/x86/cpu/microcode/private.h    | 14 +++++
>>>  xen/arch/x86/efi/efi-boot.h             |  2 +-
>>>  xen/arch/x86/platform_hypercall.c       |  2 +
>>>  13 files changed, 259 insertions(+), 158 deletions(-)
>>>  create mode 100644 xen/arch/x86/cpu/microcode/amd-base.c
>>>  create mode 100644 xen/arch/x86/cpu/microcode/amd.h
>>>  create mode 100644 xen/arch/x86/cpu/microcode/base.c
>>>  create mode 100644 xen/arch/x86/cpu/microcode/intel-base.c
>>>  create mode 100644 xen/arch/x86/cpu/microcode/intel.h
>> 
>> This is awfully invasive for something that ultimately drops only a
>> handful of lines of code.
>> 
>> First, it should be CONFIG_MICROCODE_LOADING.  We're not getting rid of
>> all microcode capabilities.  Also, of all the places where UCODE needs
>> expanding properly, it's Kconfig.
>> 
>> Next, annotate the functions that you conditionally don't reference in
>> {amd,intel}_ucode_ops with __maybe_unused, and dead code elimination
>> should do the rest.

I've done a few tests to see how something along those lines would pan out for
our needs. Our coverage tool correctly ignores ellided functions, so I'll be
sending a v2 shortly.

>
> Are you, btw, sure this would be Misra-compliant? Right now we solely
> deviate __maybe_unused when used on labels which may really be unused,
> afaics.
>
> Jan

Rather than appending an unconditional __maybe_unused (that's, imo, a bad idea),
I'll be creating a local __ucode_loading attribute in private.h that maps to
__maybe_unused when CONFIG_MICROCODE_LOADING is not set and to nothing when it
is set.

However, I'm tentatively keeping the movement from core.c to base.c, as there's
just way too many functions with external linkage to ifdef. It'd be an utterly
confusing file otherwise.

Plus, I'll be conditionally getting rid of earlycpio.c too, which is something I
neglected to do in v1 even if it's only used for microcode loading.

Cheers,
Alejandro


  reply	other threads:[~2025-11-18 10:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 16:22 [PATCH 0/4] Add Kconfig option to remove microcode loading support Alejandro Vallejo
2025-11-12 16:22 ` [PATCH 1/4] x86: Split out AMD-specific code to be executed without ucode loading Alejandro Vallejo
2025-11-12 16:22 ` [PATCH 2/4] x86: Split out Intel-specific " Alejandro Vallejo
2025-11-12 16:22 ` [PATCH 3/4] x86: Split out early_microcode_load() and microcode_load_one() Alejandro Vallejo
2025-11-12 16:22 ` [PATCH 4/4] x86: Add Kconfig option to disable microcode loading Alejandro Vallejo
2025-11-13  7:36 ` [PATCH 0/4] Add Kconfig option to remove microcode loading support Jan Beulich
2025-11-13 12:12   ` Alejandro Vallejo
2025-11-13  8:50 ` Andrew Cooper
2025-11-13 12:11   ` Alejandro Vallejo
2025-11-17 16:55   ` Jan Beulich
2025-11-18 10:19     ` Alejandro Vallejo [this message]
2025-11-18 11:22       ` Andrew Cooper

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=DEBQTGUHGDTP.QF2PFIK6CKUZ@amd.com \
    --to=alejandro.garciavallejo@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@suse.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=roger.pau@citrix.com \
    --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.