From nobody Fri May 17 04:59:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1698257232; cv=none; d=zohomail.com; s=zohoarc; b=hn2yH+08SXqd1iIK27wK22/nS2hcdLdT/2KQNWzxRQolcl1Q59bNGHUfq+QZZ6h8EKq3y5IUek9gA6aLJcLWLSmSjmFOUA/uJk6dyq7MG2OY7t2t+kqDrzg1ziQ2wreIi/zm2AFfdFVEC4RgMj5iCMZSglKJEIjTqOP3OBbMy/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698257232; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bA+Q4JD1JM0t98Y6Sgjns/0fbBa5oLWlKBQe5tOeupQ=; b=MuHLQBzhTQ3DhXbRVRGcrPAVYMPw5o2ag7iolk28iaxY7x9oV4SqzxbL5MKfeTp8H+Hx4Ky6rBiRXPhSRd8ohIaU6DiyAOzDTvVVXEDnwkc5rtojEdEMcuvtlidaaPCO6bXxgx4rZLwreqXSzGLSqhOJdUrx8/itbucy1gzmVL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1698257232704527.7411941012017; Wed, 25 Oct 2023 11:07:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.623150.970684 (Exim 4.92) (envelope-from ) id 1qviHD-0006Xp-5K; Wed, 25 Oct 2023 18:06:43 +0000 Received: by outflank-mailman (output) from mailman id 623150.970684; Wed, 25 Oct 2023 18:06:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qviHD-0006Xi-1o; Wed, 25 Oct 2023 18:06:43 +0000 Received: by outflank-mailman (input) for mailman id 623150; Wed, 25 Oct 2023 18:06:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qviHC-0006Xc-A8 for xen-devel@lists.xenproject.org; Wed, 25 Oct 2023 18:06:42 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3d48b757-7361-11ee-9b0e-b553b5be7939; Wed, 25 Oct 2023 20:06:39 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3d48b757-7361-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1698257199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dhzaHuLiBOH3Th4mbBAgfvjFhVkx5Tp4CfMsMBCY6ic=; b=eGCEhPSghhUvJgUkhrC06qJpZ7jZqZPprikUrHpjWq9jxJTLkQ/Y3V69 ykux8jjWeQ4YbPmPKd601tJQc1MG/u7i6a9sztiQiaRtqAvzL12IUiRum V99oy2kZ9R1Q7BDkCZl4HZAWyVlA3b3kNpv2WxDun8juEg2OpzI2Nq0ze E=; X-CSE-ConnectionGUID: rPmFhqRFQHKpTSN13c+maA== X-CSE-MsgGUID: gmw5g9YcQEWLi4TS+rOTEg== Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 126508414 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:XqcrjKJbvsrrWwVfFE+R45UlxSXFcZb7ZxGr2PjKsXjdYENSgTUOm jMWDGCOaKnYZGT1eN8jO4Sx8ExSvcKHytNhGVFlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAhk/nOHvylULKs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrYwP9TlK6q4mhB5gZjPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5tOWRg9 eUiBgktTQi/vMTvm7n4T+BF05FLwMnDZOvzu1llxDDdS/0nXYrCU+PB4towMDUY354UW6yEP oxANGspM0yojx5nYz/7DLoXmuuyi2a5WDpfsF+P/oI84nTJzRw327/oWDbQUoXQG5gNzhrB+ goq+Uz2Bw5HO42uwgOozVat2tP03jncZK8dQejQGvlC3wTImz175ActfUu2p7y1h1CzX/pbK lcI4Ww+oK4q7kupQ9LhGRqirxasnDQRRt5RGO0S8xyWx+zf5APxLncAZi5MbpohrsBebSc22 1GAmdSvHiBmurCRTXOb95+dqD/0Mi8QRUcSaCkFRE0f6tbiqY06jRXSZt9mHOi+ididJN3r6 2nU9m5k3exV1JNakfrjlbzav96yjoLxSyA1/z/5Z0KG9j9CQtf+bM+t4HGOuJ6sM72lokm9U GkswpbPvLpWUcDcykRhU81XQuv1uazt3Cn0xA43Rcd8rVxB7lb5JehtDCdCyFCF2yruURTue kbX8ThJ/p5VM2DCgURfONnpVJ1CIUQND73YuhHogjlmOMEZmPevpn0GWKJp9zmFfLIQua8+I 4yHVs2nEGwXD69qpBLvGbZNiOBxnH1vnjOOLXwe8/hB+eDADJJyYe5YWGZik8hjtP/UyOkr2 4032zS2J+V3D7SlP3i/HX87JlEWN3krba3LRzhsXrfbeGJOQTh9Y8I9NJt9I+SJaYwJzLaXl px8M2cEoGfCaYrvdlXTNC05Oe2+NXu9xFpiVRER0Z+T8yBLSe6SAG03LsBfkWUPnAC78cNJc g== IronPort-HdrOrdr: A9a23:3fn7D68xjamoZFQbgw9uk+D8I+orL9Y04lQ7vn2ZKCYlEPBw8v rFoB11726WtN98YgBZpTmgAtjmfZq/z+8P3WERVY3SJTUO0VHAROoD0WKL+Vzd8kbFh4pgPM lbAs1D4R7LYWSST/yW3OB1KbkdKaK8gcaVbC7loUtFSQFvZ+V+4xxiCgCde3cGPjV7OQ== X-Talos-CUID: 9a23:8Lb5BmBvXv8Xs9b6EzNf8WAUA/oLS13+1EvrBRbjAiVsQZTAHA== X-Talos-MUID: =?us-ascii?q?9a23=3AYAuH8Q619+Zt1u/O6fspuh4Lxoxn5rvzBxE8mqw?= =?us-ascii?q?rhO2FaRBLeC26sBm4F9o=3D?= X-IronPort-AV: E=Sophos;i="6.03,250,1694750400"; d="scan'208";a="126508414" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Alejandro Vallejo , Stefano Stabellini , Xenia Ragiadakou Subject: [PATCH 1/2] x86/ucode: Move vendor specifics back out of early_microcode_init() Date: Wed, 25 Oct 2023 19:06:29 +0100 Message-ID: <20231025180630.3230010-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231025180630.3230010-1-andrew.cooper3@citrix.com> References: <20231025180630.3230010-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1698257234513100003 I know it was me who dropped microcode_init_{intel,amd}() in c/s dd5f07997f29 ("x86/ucode: Rationalise startup and family/model checks"), but times have moved on. We've gained new conditional support, and a wish to compile-time specialise Xen to single platform. (Re)introduce ucode_probe_{amd,intel}() and move the recent vendor specific additions back out. Encode the conditional support state in the NULL-ness = of hooks as it's already done on other paths. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Alejandro Vallejo CC: Stefano Stabellini CC: Xenia Ragiadakou CC Stefano/Xenia as I know you want to go down this line, but I don't recall patches in this area yet. --- xen/arch/x86/cpu/microcode/amd.c | 10 +++++++++- xen/arch/x86/cpu/microcode/core.c | 16 +++++----------- xen/arch/x86/cpu/microcode/intel.c | 12 ++++++++++-- xen/arch/x86/cpu/microcode/private.h | 16 ++++++++++------ 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/= amd.c index 75fc84e445ce..17e68697d5bf 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -434,9 +434,17 @@ static struct microcode_patch *cf_check cpu_request_mi= crocode( return patch; } =20 -const struct microcode_ops __initconst_cf_clobber amd_ucode_ops =3D { +static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops =3D= { .cpu_request_microcode =3D cpu_request_microcode, .collect_cpu_info =3D collect_cpu_info, .apply_microcode =3D apply_microcode, .compare_patch =3D compare_patch, }; + +void __init ucode_probe_amd(struct microcode_ops *ops) +{ + if ( boot_cpu_data.x86 < 0x10 ) + return; + + *ops =3D amd_ucode_ops; +} diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 65ebeb50deea..09575b19d6dc 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -847,25 +847,19 @@ int __init early_microcode_init(unsigned long *module= _map, { const struct cpuinfo_x86 *c =3D &boot_cpu_data; int rc =3D 0; - bool can_load =3D false; =20 switch ( c->x86_vendor ) { case X86_VENDOR_AMD: - if ( c->x86 >=3D 0x10 ) - { - ucode_ops =3D amd_ucode_ops; - can_load =3D true; - } + ucode_probe_amd(&ucode_ops); break; =20 case X86_VENDOR_INTEL: - ucode_ops =3D intel_ucode_ops; - can_load =3D intel_can_load_microcode(); + ucode_probe_intel(&ucode_ops); break; } =20 - if ( !ucode_ops.apply_microcode ) + if ( !ucode_ops.collect_cpu_info ) { printk(XENLOG_INFO "Microcode loading not available\n"); return -ENODEV; @@ -882,10 +876,10 @@ int __init early_microcode_init(unsigned long *module= _map, * * Take the hint in either case and ignore the microcode interface. */ - if ( this_cpu(cpu_sig).rev =3D=3D ~0 || !can_load ) + if ( !ucode_ops.apply_microcode || this_cpu(cpu_sig).rev =3D=3D ~0 ) { printk(XENLOG_INFO "Microcode loading disabled due to: %s\n", - can_load ? "rev =3D ~0" : "HW toggle"); + ucode_ops.apply_microcode ? "HW toggle" : "rev =3D ~0"); ucode_ops.apply_microcode =3D NULL; return -ENODEV; } diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcod= e/intel.c index 060c529a6e5d..96f34b336b21 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -385,7 +385,7 @@ static struct microcode_patch *cf_check cpu_request_mic= rocode( return patch; } =20 -bool __init intel_can_load_microcode(void) +static bool __init can_load_microcode(void) { uint64_t mcu_ctrl; =20 @@ -398,9 +398,17 @@ bool __init intel_can_load_microcode(void) return !(mcu_ctrl & MCU_CONTROL_DIS_MCU_LOAD); } =20 -const struct microcode_ops __initconst_cf_clobber intel_ucode_ops =3D { +static const struct microcode_ops __initconst_cf_clobber intel_ucode_ops = =3D { .cpu_request_microcode =3D cpu_request_microcode, .collect_cpu_info =3D collect_cpu_info, .apply_microcode =3D apply_microcode, .compare_patch =3D compare_patch, }; + +void __init ucode_probe_intel(struct microcode_ops *ops) +{ + *ops =3D intel_ucode_ops; + + if ( !can_load_microcode() ) + ops->apply_microcode =3D NULL; +} diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index d80787205a5e..b58611e908aa 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -60,13 +60,17 @@ struct microcode_ops { const struct microcode_patch *new, const struct microcode_patch *o= ld); }; =20 -/** - * Checks whether we can perform microcode updates on this Intel system +/* + * Microcode loading falls into one of 3 states. + * - No support at all + * - Read-only (locked by firmware, or we're virtualised) + * - Loading available * - * @return True iff the microcode update facilities are enabled + * These are encoded by (not) filling in ops->collect_cpu_info (i.e. no + * support available) and (not) ops->apply_microcode (i.e. read only). + * Otherwise, all hooks must be filled in. */ -bool intel_can_load_microcode(void); - -extern const struct microcode_ops amd_ucode_ops, intel_ucode_ops; +void ucode_probe_amd(struct microcode_ops *ops); +void ucode_probe_intel(struct microcode_ops *ops); =20 #endif /* ASM_X86_MICROCODE_PRIVATE_H */ --=20 2.30.2 From nobody Fri May 17 04:59:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1698257244; cv=none; d=zohomail.com; s=zohoarc; b=Vwx6ynnBpJaY2yz6nIFy6T4snuRft/CZixcXW+ZYVzcFgVi4FVRDJPlQ4jHvkOc1hnUgV6xemJf2t5oEP8bisK/eexP0FnxbMlbw5NXc/ch7ertgHsNoOfcL7FYA+Qth+imDnMP+qETf2DevcXc1khuAvX6WFfIJh05ZGkDZvLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698257244; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GA9DVusT7tJWkt+FLkgxemvOfYPhEb+H/zDTnO0A+Ec=; b=Gu7pB1PP3tQ8+CNuVEcPh/usoAa1ykfnqgwJfJqCW6sviyktUxX/4DRyHP1M2A7d0k+MHR+kjTWGQRAe92t1anDgWXKHuImxzhffj6EcWe0NJHTjDO7zKdjwf/6aLv+nRD5IQi9QO38XLRg5aLAfvu4Tjn9IXVPf5Tq6AsG+8LQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1698257244123808.9730583591249; Wed, 25 Oct 2023 11:07:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.623151.970694 (Exim 4.92) (envelope-from ) id 1qviHF-0006mj-Ce; Wed, 25 Oct 2023 18:06:45 +0000 Received: by outflank-mailman (output) from mailman id 623151.970694; Wed, 25 Oct 2023 18:06:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qviHF-0006mc-9S; Wed, 25 Oct 2023 18:06:45 +0000 Received: by outflank-mailman (input) for mailman id 623151; Wed, 25 Oct 2023 18:06:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qviHE-0006Zm-02 for xen-devel@lists.xenproject.org; Wed, 25 Oct 2023 18:06:44 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3f4e719d-7361-11ee-98d5-6d05b1d4d9a1; Wed, 25 Oct 2023 20:06:42 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3f4e719d-7361-11ee-98d5-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1698257202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PrWVaHB2rEiz5xABgTcH+1DhAHUFJoymf4nqaft0ID8=; b=fGtB0hcoK68UbRQaMlQyUE1DsFpUujdrjkZDE5XgNIz+HXHy85dZbjqH W9vARzju+94/QcmDBxROD0X2TAPQvzz/rvRYqn0AdJ0GmdryLbXr+YK/Y d01eBjWM6jURAu/9FP1HcjrDXOASOiiCQNoKe6sDx+vrOfBsbAafduHWD 0=; X-CSE-ConnectionGUID: o+bZL5mCRnmfqLITOaXR1g== X-CSE-MsgGUID: QolnCxsJRMuIgBbPu+rrVQ== Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 126508435 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:qSkReKkKnuX+Mn+4Ehw4dv7o5gyyJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIZDG6Bb6mDM2T8ftgjPY+w9kpQ7ZeBm9QxSlNv+y82RSMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+e6UKicfHkpGWeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5K+aVA8w5ARkPqkT5gKGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 ftbIgIpMxWoveSzzqufa9VLj/QZdca+aevzulk4pd3YJfMvQJSFSKTW/95Imjw3g6iiH96HO ZBfM2A2Kk2dMlsQYj/7C7pn9AusrlD5fydVtxS+oq0v7nKI5AdwzKLsIJzefdniqcB9xxzG+ zqWoz+kav0cHOWYzTyu4mmOvMrSvCzRUroPV6eiyMc/1TV/wURMUUZLBDNXu8KRmkO4Ht5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM/JyOeAn7ACGyoLP/h2UQGMDS1Zpd9gOpMIwAzsw2 TehhM/kCzVpt/uOVXuX+7OQrDWzESEQISkJYipsZRsI5djq5ps6gRPGQt9gF7Odh9j5Xzr3x li3QDMW3utJy5RRjuPioAGB3GrESoX1ohAd4UbdbEb46yhDYourfqiJ1X/S3cwZI9PMJrWeh 0Toi/Ry/chXU8DdznTREbRTdF26z6zbamGC2zaDC7Fkp2z3pSP5FWxFyGsmTHqFJProbtMAj KX7kgRL7ZsbB2OwbKl4eOpd4OxxlvC/TLwJuh3OB+eig6SdlyfdpUmCnWbKgwjQfLEEyMnTw 6uzf8e2Fmo9Aq961jewTOp1+eZ1l3BnmjmJGMGgn0nPPV+iiJi9E+lt3LymN71R0U95iF+Nr 4Y32zWikH2zr9ESkgGIqNVOfDjm3FAwBIzsqtw/S9Nv1jFOQTl7Y9eImO9JRmCQt/gN/gs+1 i3nCxAwJZuWrSGvFDhmnVg8OOqxAMwu8yNT0O5FFQ/A5kXPqL2HtM83H6bbt5F9nAC/5ZaYl 8U4Rvg= IronPort-HdrOrdr: A9a23:iTVoFqn2JJEge0IPxMLHY+Q0vFbpDfII3DAbv31ZSRFFG/Fw9v re/sjzsCWftN9/YgBCpTntAtj5fZr8z+8T3WByB8bYYOHm0FHYVb2KhLGKq1aBJ8SXzI9gPM xbAsxD4bPLfD1HZAXBjDVQ0exM/DBKys+VbJzlvhFQpMhRBZ1I6wd8BkKFHlZtRA9AbKBJbq ah2g== X-Talos-CUID: 9a23:91mncGAsUnHsp8H6Ey4k/nwwR8UOSHvYwm70AnOfAFZTEbLAHA== X-Talos-MUID: =?us-ascii?q?9a23=3A83+6ogy+SBx8lL4nQ1hZ80J0ZFqaqJ2pDEYmgY4?= =?us-ascii?q?kgeyZFCNaMQ+Azy6tfLZyfw=3D=3D?= X-IronPort-AV: E=Sophos;i="6.03,250,1694750400"; d="scan'208";a="126508435" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Alejandro Vallejo , Stefano Stabellini , Xenia Ragiadakou Subject: [PATCH 2/2] x86/Kconfig: Introduce CONFIG_{AMD,INTEL} and conditionalise ucode Date: Wed, 25 Oct 2023 19:06:30 +0100 Message-ID: <20231025180630.3230010-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231025180630.3230010-1-andrew.cooper3@citrix.com> References: <20231025180630.3230010-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1698257244595100001 We eventually want to be able to build a stripped down Xen for a single platform. Make a start with CONFIG_{AMD,INTEL} (hidden behind EXPERT, but available to randconfig), and adjust the microcode logic. No practical change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Alejandro Vallejo CC: Stefano Stabellini CC: Xenia Ragiadakou I've intentionally ignored the other vendors for now. They can be put into Kconfig by whomever figures out the actual dependencies between their init routines. CC Stefano/Xenia as I know you want to go down this line, but I don't recall patches to this effect yet. --- xen/arch/x86/Kconfig | 2 ++ xen/arch/x86/Kconfig.cpu | 22 ++++++++++++++++++++++ xen/arch/x86/cpu/microcode/Makefile | 4 ++-- xen/arch/x86/cpu/microcode/private.h | 9 +++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 xen/arch/x86/Kconfig.cpu diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index eac77573bd75..d9eacdd7e0fa 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -49,6 +49,8 @@ config HAS_CC_CET_IBT =20 menu "Architecture Features" =20 +source "arch/x86/Kconfig.cpu" + source "arch/Kconfig" =20 config PV diff --git a/xen/arch/x86/Kconfig.cpu b/xen/arch/x86/Kconfig.cpu new file mode 100644 index 000000000000..0ce09b292045 --- /dev/null +++ b/xen/arch/x86/Kconfig.cpu @@ -0,0 +1,22 @@ +menu "Supported processor vendors" + visible if EXPERT + +config AMD + bool "AMD" + default y + help + Detection, tunings and quirks for AMD processors. + + May be turned off in builds targetting other vendors. Otherwise, + must be enabled for Xen to work suitably on AMD processors. + +config INTEL + bool "Intel" + default y + help + Detection, tunings and quirks for Intel processors. + + May be turned off in builds targetting other vendors. Otherwise, + must be enabled for Xen to work suitably on Intel processors. + +endmenu diff --git a/xen/arch/x86/cpu/microcode/Makefile b/xen/arch/x86/cpu/microco= de/Makefile index aae235245b06..30d600544f45 100644 --- a/xen/arch/x86/cpu/microcode/Makefile +++ b/xen/arch/x86/cpu/microcode/Makefile @@ -1,3 +1,3 @@ -obj-y +=3D amd.o +obj-$(CONFIG_AMD) +=3D amd.o obj-y +=3D core.o -obj-y +=3D intel.o +obj-$(CONFIG_INTEL) +=3D intel.o diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index b58611e908aa..da556fe5060a 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -70,7 +70,16 @@ struct microcode_ops { * support available) and (not) ops->apply_microcode (i.e. read only). * Otherwise, all hooks must be filled in. */ +#ifdef CONFIG_AMD void ucode_probe_amd(struct microcode_ops *ops); +#else +static inline void ucode_probe_amd(struct microcode_ops *ops) {} +#endif + +#ifdef CONFIG_INTEL void ucode_probe_intel(struct microcode_ops *ops); +#else +static inline void ucode_probe_intel(struct microcode_ops *ops) {} +#endif =20 #endif /* ASM_X86_MICROCODE_PRIVATE_H */ --=20 2.30.2