[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] Add Kconfig option to remove microcode loading support


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Tue, 18 Nov 2025 11:19:45 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p/9VCwJ30+tlSZHfeU8x6VTrj4Pik8zQbWJTIumAWYI=; b=V0Fxb3GTRFK4hXijuwIPhtT0QjwhyYtTk7pTulMgNQ31KTBGGYdLjKXW9LtfatsL6KOE2aGs4FTRQ48bCgpEbio+H67D2ix6pSb5+GmI2+/g0SJ1dDtd3XCVCdDxTUbQfVZbkmNX4OrIUNBMGKVu9fPpCsBKssMvWcyKBb1RITj2psT1PcY1vPDDbGP3vSJFrce4owkSbZ7tSUB/m2L/gRGMClOi60L75676K+fECj/Q8w6mmECfJmYt/3zOkKM3TJ0Ifa56lVDGMgspNLLILyjJBawCVtghX/QcmE0/wYxPVPFtBHfJS1bIGDOrMdhDEc3XTkT4y2g5XbuUMpWbGA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yrJL0JrMEB0m7a4tht5R3yH1rzrwmSdkQY/WEevBthYob7bMkNHzhkCPTbg4bPFb2fZ2TbAB9MO1r3dNMxZhmrROGD2J7HDixa20RXUst/km/mSbu7mUxkmiv7LtukLV5h+Iy2FRvML36aqkyiTeDcAftBoAEHlWrn6Jkf8pEFZwDDf3bablCvqgsyQmz1jIBC0R1327QReAv+W4m6nXmpkYG28s7BW652xwm9nnyaYAQHGBUB/bCW+zHAZgd8OlvqOQAdKFSyThGV8lgb8lzR31ciSBkHjIPOCd8v5kU+5aeuKaVTFtDR5NrSS/BqKYANLaGrAKNpN4MLsWBTGzzw==
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 Nov 2025 10:20:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.