From patchwork Fri Apr 5 12:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fouad Hilly X-Patchwork-Id: 13618970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC3FFCD1297 for ; Fri, 5 Apr 2024 12:11:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701226.1095501 (Exim 4.92) (envelope-from ) id 1rsiPx-0007R4-BL; Fri, 05 Apr 2024 12:11:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701226.1095501; Fri, 05 Apr 2024 12:11:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsiPx-0007Qx-8l; Fri, 05 Apr 2024 12:11:37 +0000 Received: by outflank-mailman (input) for mailman id 701226; Fri, 05 Apr 2024 12:11:35 +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 1rsiPv-0007Qe-UW for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 12:11:35 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a4663203-f345-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 14:11:34 +0200 (CEST) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-56e2393b073so2238680a12.0 for ; Fri, 05 Apr 2024 05:11:33 -0700 (PDT) Received: from fhilly.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id j13-20020a50ed0d000000b0056c4372c161sm729425eds.55.2024.04.05.05.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:11:31 -0700 (PDT) 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: a4663203-f345-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1712319091; x=1712923891; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z1i+lAGzw5jmQvcR+ZSadLxyO+lAXMTpWfVS36kD2fk=; b=flGXaGXjIU9FBWcrhayHcXfJQTNzdOiO2u8iwsprPV3dVcJ/Z59xTAkeRij2S6xiSQ TYCj+fam+gi9YMaiTappzOY7/PYBxe/EGd5u2jvOlBhFA/D8gibYas8jpCNmvvfYvW6O rxJoMVSnFmCmKDkz58bgTIy+k+ZzevQnNhARU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319091; x=1712923891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z1i+lAGzw5jmQvcR+ZSadLxyO+lAXMTpWfVS36kD2fk=; b=cNHTWT1IJQ5VrpbgRnhzWJKV8fAc+6MqwpRUdLWWm5vfSEMeKaieFIyNebom+h5hp2 fi6BP50ou/9Nt2uO2lO0RWE9vYeby6hBccVpKhFW/PFMqePSDss50ZKjWS963MOx+Wtz aKT+sVj/dxiCKwq7UCukXgqzCZZsAw9KvCerBRYFTc78+Id6C50zJ9kD3ZXIBgMjCO5+ Ho0ijKQxGiMFsg8PWk39+d08dOPW3zKolJK0wg2dGqisweNWynwbJQumaejpLFmrI2t+ 2FpiRzRz049tovqozWU0+jxJRFZIBbvuDDw4DmO3BFdg8Jd2gtpj/WLMX/TEHaeEzaiG zZaQ== X-Gm-Message-State: AOJu0YyC3g2R0nisESFm/GSfu9xjGFuIUZOqATrZiBOvmcCDp4/WvD71 jXE/wO3GGxptVuTHHSqz0hXhiR+TuJQwnzPKHXaoXMqxGIaxWJjf1fgeSx8SrNZvIc6ZyqtfnwO a X-Google-Smtp-Source: AGHT+IEzZ7vs0wJQzSSeiWHlGqjLSoHJCD9DCOM78+5BxbEVS7rgKCIfI0T86TgsWL9qmrq2hvuIjA== X-Received: by 2002:a50:8753:0:b0:56e:2dfb:da7b with SMTP id 19-20020a508753000000b0056e2dfbda7bmr1390248edv.0.1712319091525; Fri, 05 Apr 2024 05:11:31 -0700 (PDT) From: Fouad Hilly To: Xen-devel Cc: Fouad Hilly , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 1/5] x86: Remove x86 low level version check of microcode Date: Fri, 5 Apr 2024 13:11:24 +0100 Message-ID: <20240405121128.260493-2-fouad.hilly@cloud.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240405121128.260493-1-fouad.hilly@cloud.com> References: <20240405121128.260493-1-fouad.hilly@cloud.com> MIME-Version: 1.0 Remove microcode version check at Intel and AMD Level. Microcode version check will be at higher and common level. Signed-off-by: Fouad Hilly --- xen/arch/x86/cpu/microcode/amd.c | 8 ++------ xen/arch/x86/cpu/microcode/intel.c | 11 +++-------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index 75fc84e445ce..4f805f662701 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -383,12 +383,8 @@ static struct microcode_patch *cf_check cpu_request_microcode( goto skip; } - /* - * If the new ucode covers current CPU, compare ucodes and store the - * one with higher revision. - */ - if ( (microcode_fits(mc->patch) != MIS_UCODE) && - (!saved || (compare_header(mc->patch, saved) == NEW_UCODE)) ) + /* If the provided ucode covers current CPU, then store its revision. */ + if ( (microcode_fits(mc->patch) != MIS_UCODE) && !saved ) { saved = mc->patch; saved_size = mc->len; diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index 060c529a6e5d..e65c02a57987 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -294,8 +294,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch) result = microcode_update_match(patch); - if ( result != NEW_UCODE && - !(opt_ucode_allow_same && result == SAME_UCODE) ) + if ( result != NEW_UCODE && result != SAME_UCODE ) return -EINVAL; wbinvd(); @@ -354,12 +353,8 @@ static struct microcode_patch *cf_check cpu_request_microcode( if ( error ) break; - /* - * If the new update covers current CPU, compare updates and store the - * one with higher revision. - */ - if ( (microcode_update_match(mc) != MIS_UCODE) && - (!saved || compare_revisions(saved->rev, mc->rev) == NEW_UCODE) ) + /* If the provided ucode covers current CPU, then store its revision. */ + if ( (microcode_update_match(mc) != MIS_UCODE) && !saved ) saved = mc; buf += blob_size; From patchwork Fri Apr 5 12:11:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fouad Hilly X-Patchwork-Id: 13618969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18FABCD11C2 for ; Fri, 5 Apr 2024 12:11:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701227.1095507 (Exim 4.92) (envelope-from ) id 1rsiPx-0007TU-ND; Fri, 05 Apr 2024 12:11:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701227.1095507; Fri, 05 Apr 2024 12:11:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsiPx-0007Si-Ep; Fri, 05 Apr 2024 12:11:37 +0000 Received: by outflank-mailman (input) for mailman id 701227; Fri, 05 Apr 2024 12:11:36 +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 1rsiPw-0007Qe-K7 for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 12:11:36 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a549315b-f345-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 14:11:34 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-56e1baf0380so2347475a12.3 for ; Fri, 05 Apr 2024 05:11:34 -0700 (PDT) Received: from fhilly.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id j13-20020a50ed0d000000b0056c4372c161sm729425eds.55.2024.04.05.05.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:11:32 -0700 (PDT) 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: a549315b-f345-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1712319093; x=1712923893; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jH3hIojWMAmkM0omSe+46fQQHwORwtgWu9bXbQQ2VU4=; b=eRJLiiVP0X78uIAv5WYl5lGIfjw8AmhEUvmgKFJLf9AjJkXjV8+ySCH5jAqp+lFNVY IHebFovBKAvizQRH/4FLf7y8jfyTxHQIrlZUnl0G65x13Vg5/otpZWszrf3gBDdXgowP 2ql93WbnfI0Nxe9ti2MJTG451ATE2Tp0u1eAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319093; x=1712923893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jH3hIojWMAmkM0omSe+46fQQHwORwtgWu9bXbQQ2VU4=; b=kNlsuibq7ZjhosZxFTcgxcqCeISKRLinDcYivlvaCiWrPjFbIJ+cjszc1M5jtKDe9K hcnnQumfpE0X3Nk+cZCdEfaWH3tQ7tKkAYrzMq4H13RlvnQo3Xu8Gw2nq+tLXdWb/tks VPl4jpX/FORz05qWGCqMhochGHLQskYOhEZlQUPTPTJvHYz5E0SoNZv5NrkRYbW9ABoA KKW7v9MU4ApzCflN50oKU7lpgQUC8RV6RHQo1QIZ3nZ67aqZuBSdxbGJRVpAwpAU4dRY YsuHW6TJgE4uHhORh7rDYj6J4yy67Ir48xYSSsg6/+Z8PuSkg5l0KMx1z2GgQF4xcJtC P9Cg== X-Gm-Message-State: AOJu0YwGkSbflKfEqSc527l2Yhm3v298RpfNGfPm4MHZUc4nhKnP9HRg f1mYGwzIsujWq8bQFAhELerfNrP/O7h7opTQHmJSnUXekb832d+JSJD3Me7bVssC1hJcDMEIiwN iyqc= X-Google-Smtp-Source: AGHT+IH0csKcmkgnvtFRcZNTVldkebtKuJ51LsPs9hi50Wtq9geN7yu38eg312BRhcu2syiYA8krWw== X-Received: by 2002:a50:8acc:0:b0:56b:9f7c:3c32 with SMTP id k12-20020a508acc000000b0056b9f7c3c32mr849563edk.12.1712319093482; Fri, 05 Apr 2024 05:11:33 -0700 (PDT) From: Fouad Hilly To: Xen-devel Cc: Fouad Hilly , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH 2/5] x86: Refactor microcode_update() hypercall with flags field Date: Fri, 5 Apr 2024 13:11:25 +0100 Message-ID: <20240405121128.260493-3-fouad.hilly@cloud.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240405121128.260493-1-fouad.hilly@cloud.com> References: <20240405121128.260493-1-fouad.hilly@cloud.com> MIME-Version: 1.0 Refactor microcode_update() hypercall by adding flags field. Introduce XENPF_microcode_update2 hypercall to handle flags field. Signed-off-by: Fouad Hilly --- xen/arch/x86/cpu/microcode/core.c | 12 +++++++++--- xen/arch/x86/include/asm/microcode.h | 2 +- xen/arch/x86/platform_hypercall.c | 12 +++++++++++- xen/include/public/platform.h | 8 ++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index 1c9f66ea8a0f..f987b2bd632d 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -40,6 +40,8 @@ #include #include +#include + #include "private.h" /* @@ -100,6 +102,8 @@ static bool ucode_in_nmi = true; bool __read_mostly opt_ucode_allow_same; +bool ucode_force_flag; + /* Protected by microcode_mutex */ static struct microcode_patch *microcode_cache; @@ -633,12 +637,12 @@ static long cf_check microcode_update_helper(void *data) microcode_cache); if ( result != NEW_UCODE && - !(opt_ucode_allow_same && result == SAME_UCODE) ) + !((opt_ucode_allow_same || ucode_force_flag) && result == SAME_UCODE) ) { spin_unlock(µcode_mutex); printk(XENLOG_WARNING "microcode: couldn't find any newer%s revision in the provided blob!\n", - opt_ucode_allow_same ? " (or the same)" : ""); + (opt_ucode_allow_same || ucode_force_flag) ? " (or the same)" : ""); microcode_free_patch(patch); ret = -ENOENT; @@ -708,11 +712,13 @@ static long cf_check microcode_update_helper(void *data) return ret; } -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) +int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len, unsigned int flags) { int ret; struct ucode_buf *buffer; + ucode_force_flag = (flags == XENPF_UCODE_FLAG_FORCE_SET)? 1: 0; + if ( len != (uint32_t)len ) return -E2BIG; diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h index 8f59b20b0289..bcba356b4134 100644 --- a/xen/arch/x86/include/asm/microcode.h +++ b/xen/arch/x86/include/asm/microcode.h @@ -22,7 +22,7 @@ struct cpu_signature { DECLARE_PER_CPU(struct cpu_signature, cpu_sig); void microcode_set_module(unsigned int idx); -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len); +int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len, unsigned int flags); int early_microcode_init(unsigned long *module_map, const struct multiboot_info *mbi); int microcode_init_cache(unsigned long *module_map, diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 95467b88ab64..3b29ede8b316 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -311,7 +311,17 @@ ret_t do_platform_op( guest_from_compat_handle(data, op->u.microcode.data); - ret = microcode_update(data, op->u.microcode.length); + ret = microcode_update(data, op->u.microcode.length, 0); + break; + } + + case XENPF_microcode_update2: + { + XEN_GUEST_HANDLE(const_void) data; + + guest_from_compat_handle(data, op->u.microcode.data); + + ret = microcode_update(data, op->u.microcode.length, op->u.microcode.flags); break; } diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h index 15777b541690..31e59ba3d07b 100644 --- a/xen/include/public/platform.h +++ b/xen/include/public/platform.h @@ -99,6 +99,10 @@ struct xenpf_microcode_update { /* IN variables. */ XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */ uint32_t length; /* Length of microcode data. */ + uint32_t flags; /* Flags to be passed with ucode. */ +/* Force to skip microcode version check when set */ +#define XENPF_UCODE_FLAG_FORCE_NOT_SET 0 +#define XENPF_UCODE_FLAG_FORCE_SET 1 }; typedef struct xenpf_microcode_update xenpf_microcode_update_t; DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t); @@ -624,6 +628,10 @@ struct xenpf_ucode_revision { typedef struct xenpf_ucode_revision xenpf_ucode_revision_t; DEFINE_XEN_GUEST_HANDLE(xenpf_ucode_revision_t); +/* Hypercall to microcode_update with flags */ +#define XENPF_microcode_update2 66 + + /* * ` enum neg_errnoval * ` HYPERVISOR_platform_op(const struct xen_platform_op*); From patchwork Fri Apr 5 12:11:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fouad Hilly X-Patchwork-Id: 13618968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3844DCD1299 for ; Fri, 5 Apr 2024 12:11:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701228.1095521 (Exim 4.92) (envelope-from ) id 1rsiPy-0007uZ-QZ; Fri, 05 Apr 2024 12:11:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701228.1095521; Fri, 05 Apr 2024 12:11:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsiPy-0007uS-Nf; Fri, 05 Apr 2024 12:11:38 +0000 Received: by outflank-mailman (input) for mailman id 701228; Fri, 05 Apr 2024 12:11:37 +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 1rsiPx-0007Qe-KF for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 12:11:37 +0000 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [2a00:1450:4864:20::529]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a60b5cbd-f345-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 14:11:36 +0200 (CEST) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56c1922096cso2486022a12.0 for ; Fri, 05 Apr 2024 05:11:35 -0700 (PDT) Received: from fhilly.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id j13-20020a50ed0d000000b0056c4372c161sm729425eds.55.2024.04.05.05.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:11:33 -0700 (PDT) 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: a60b5cbd-f345-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1712319095; x=1712923895; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K1f0zJeyhworpxxnt42vDWBIMfthsTx6bjHKg+Ate9M=; b=GXHhu3UDpV52cgwOMkmXoF/d5EEH1Orz/QKVdCW6ld6N4nn0p6/z7o92/lZYhyDFNZ JFprhkKff/y7i397LWKzb+nHu65YuHNs2cCklvCi8l5ge0h9w6/wjxuL97YKJUNKGDmb 7eMNiHgqdtNNPqiT2EF4K73PC2hE+1z2y1NGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319095; x=1712923895; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K1f0zJeyhworpxxnt42vDWBIMfthsTx6bjHKg+Ate9M=; b=Kp5SbWHTLstEpcMIPAgoC+5BqKS5jSYPNeZsRJhsxiMbbaLTCKzRkptt4kRCxYJ0Nv GR1YYczb5+oKGtkdFs9n1CEeygv+OCoNWX1lauGWl0sJoshHCM/J6VPHfDKuAZRphEI4 isML76o2kD2gN1+fqD+66TgOn5tA9NrsJrpCChnz6UzVx4NkNnLQDPh1TaAxMfD+uW9I m1HDVkYtnQuiG80Eaj6kwCogYnzcqsZBUJxjfu9kyRBpDwLr1/PYAnK6HpRqnsHMGgLV YMlYof/LbWZxdwtj/B2R5XeWPg7FOHHI/3x80SlWaYjrBlL5Vmpx5DXFmSxe7n+R+r19 y+bw== X-Gm-Message-State: AOJu0Yzm7laDbZlvffB7TNWAF3H2Nn7edITe6Qx6Tqwg72a6rd70YNPm CMA1MUTDn6Z4ff1Z0XZZIOZYoN2h55OG/pJ5pGhyr1ZNuiasjO3d1F7pmNV0I5C0g14Ghs++gye x X-Google-Smtp-Source: AGHT+IG/Pj2OHYse7b+KkYlIJm4/U0oKQUYoQQnaROh8Dw4+ANKLeCwUJjNm4mahij8Y7DKo/Uw5SQ== X-Received: by 2002:a50:d741:0:b0:56e:2ff3:bb89 with SMTP id i1-20020a50d741000000b0056e2ff3bb89mr936055edj.28.1712319094854; Fri, 05 Apr 2024 05:11:34 -0700 (PDT) From: Fouad Hilly To: Xen-devel Cc: Fouad Hilly , Anthony PERARD Subject: [PATCH 3/5] x86: Add usage() to print out usage message Date: Fri, 5 Apr 2024 13:11:26 +0100 Message-ID: <20240405121128.260493-4-fouad.hilly@cloud.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240405121128.260493-1-fouad.hilly@cloud.com> References: <20240405121128.260493-1-fouad.hilly@cloud.com> MIME-Version: 1.0 Refactor xen-ucode tool by adding usage() to handle usage\help messages Signed-off-by: Fouad Hilly --- tools/misc/xen-ucode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c index c6ae6498d659..1edcebfb9f9c 100644 --- a/tools/misc/xen-ucode.c +++ b/tools/misc/xen-ucode.c @@ -17,6 +17,14 @@ static xc_interface *xch; static const char intel_id[] = "GenuineIntel"; static const char amd_id[] = "AuthenticAMD"; +static void usage(const char *name) +{ + printf("%s: Xen microcode updating tool\n" + "Usage: %s [ | show-cpu-info]\n" + "\n" + , name, name); +} + static void show_curr_cpu(FILE *f) { int ret; @@ -88,9 +96,7 @@ int main(int argc, char *argv[]) if ( argc < 2 ) { - fprintf(stderr, - "xen-ucode: Xen microcode updating tool\n" - "Usage: %s [ | show-cpu-info]\n", argv[0]); + usage(argv[0]); show_curr_cpu(stderr); exit(2); } From patchwork Fri Apr 5 12:11:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fouad Hilly X-Patchwork-Id: 13618972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B24CCD129B for ; Fri, 5 Apr 2024 12:11:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701229.1095531 (Exim 4.92) (envelope-from ) id 1rsiQ0-0008Ap-2r; Fri, 05 Apr 2024 12:11:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701229.1095531; Fri, 05 Apr 2024 12:11:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsiPz-0008Ae-Vb; Fri, 05 Apr 2024 12:11:39 +0000 Received: by outflank-mailman (input) for mailman id 701229; Fri, 05 Apr 2024 12:11:38 +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 1rsiPy-0007Qe-P3 for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 12:11:38 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a6cef36e-f345-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 14:11:37 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-56bdf81706aso2867844a12.2 for ; Fri, 05 Apr 2024 05:11:37 -0700 (PDT) Received: from fhilly.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id j13-20020a50ed0d000000b0056c4372c161sm729425eds.55.2024.04.05.05.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:11:35 -0700 (PDT) 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: a6cef36e-f345-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1712319096; x=1712923896; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3PP1USpYqG/PprBDB64mV8RCygjZ51CvebJOr4kcXLM=; b=U/PXqdVCR3NSniSQ96Lya04nSMUj9kiSpvl37ZJpM5n0NAB56zHHELzGK5ipsVZB3/ xcmMdJrwUAddA3SKIh8UnWhgryS6AvfgUT5E4RqZFrqUkxfiAZXFU3ks+VIoK2mgr+CT zaVfD6KBHEuEVGLVGHyofvj1uIJswIEN0ovQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319096; x=1712923896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3PP1USpYqG/PprBDB64mV8RCygjZ51CvebJOr4kcXLM=; b=T2vM+Kup9eD1kMxdDT/BB6w10Hz3TNJDLh+a4SpC9hNIGUZxhUxhBM3nPZro3JrKWG zUsdnR5w1xfWEdg226RUAZbHAzZTdzSxacZ35PJF8P6lyduJPBBbztY14fYKWwLDvtAH 3V3Qn0JI/Vv8qaDnahDmgrS1Sw6xJXOLpHLAuDkUrqnTnLhEFUdwvVe4nxMJSOPC/rkC L/XcehlyIpOWxV3r2my18gNJG8WG5F7qt1hFRzXlBodGqr2EuClVB6qKIAgYBTsbe0cr BdpHcYZkJRcMDFZiTCFDTui7gT/h1dXtk/KcwZos+NktMb3k2z5OHjGfJ9BizcIbL0Yw NimQ== X-Gm-Message-State: AOJu0Yxk8m7OP9M+AskROAwXNmEGpwdyFDEaEEJv2W0L2RYZCPhk5/SB zNzr1sajYgwg8RV4g3aQl+D+mWHYC4GS6ywdRI2W9wXKVDKBiaj4jUdTyiRO5Eff4wGGhJFNOB7 r X-Google-Smtp-Source: AGHT+IEljdvdDVrTJlsqguZfEB3Zp2MkU3GJwFXBzjkddzQxgdL8Ra9lhNxjuKMEbgxFaTorvUbnJQ== X-Received: by 2002:a50:cc95:0:b0:56c:2ef7:f3e6 with SMTP id q21-20020a50cc95000000b0056c2ef7f3e6mr1090981edi.0.1712319096016; Fri, 05 Apr 2024 05:11:36 -0700 (PDT) From: Fouad Hilly To: Xen-devel Cc: Fouad Hilly , Anthony PERARD Subject: [PATCH 4/5] x86: Use getopt to handle command line args Date: Fri, 5 Apr 2024 13:11:27 +0100 Message-ID: <20240405121128.260493-5-fouad.hilly@cloud.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240405121128.260493-1-fouad.hilly@cloud.com> References: <20240405121128.260493-1-fouad.hilly@cloud.com> MIME-Version: 1.0 Use getopt_long() to handle command line arguments. Introduce ext_err for common exit with errors. Signed-off-by: Fouad Hilly --- tools/misc/xen-ucode.c | 49 +++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c index 1edcebfb9f9c..9bde991c5df5 100644 --- a/tools/misc/xen-ucode.c +++ b/tools/misc/xen-ucode.c @@ -11,6 +11,7 @@ #include #include #include +#include static xc_interface *xch; @@ -20,7 +21,10 @@ static const char amd_id[] = "AuthenticAMD"; static void usage(const char *name) { printf("%s: Xen microcode updating tool\n" - "Usage: %s [ | show-cpu-info]\n" + "Usage: %s [ | --show-cpu-info]\n" + "\n" + " -h, --help display this help and exit\n" + " -s, --show-cpu-info show CPU information and exit\n" "\n" , name, name); } @@ -82,9 +86,16 @@ static void show_curr_cpu(FILE *f) int main(int argc, char *argv[]) { int fd, ret; - char *filename, *buf; + char *filename = NULL, *buf; size_t len; struct stat st; + int opt; + + const static struct option options[] = { + {"help", no_argument, NULL, 'h'}, + {"show-cpu-info", no_argument, NULL, 's'}, + {NULL, no_argument, NULL, 0} + }; xch = xc_interface_open(NULL, NULL, 0); if ( xch == NULL ) @@ -94,20 +105,33 @@ int main(int argc, char *argv[]) exit(1); } - if ( argc < 2 ) + if ( argc != 2 ) + goto ext_err; + + while ( (opt = getopt_long(argc, argv, "hs:", options, NULL)) != -1 ) { - usage(argv[0]); - show_curr_cpu(stderr); - exit(2); + switch (opt) + { + case 'h': + usage(argv[0]); + exit(EXIT_SUCCESS); + case 's': + if ( argc > 2 ) + goto ext_err; + show_curr_cpu(stdout); + exit(EXIT_SUCCESS); + default: + goto ext_err; + } } - if ( !strcmp(argv[1], "show-cpu-info") ) + filename = argv[1]; + if ( filename == NULL ) { - show_curr_cpu(stdout); - return 0; + printf("File name error\n"); + goto ext_err; } - filename = argv[1]; fd = open(filename, O_RDONLY); if ( fd < 0 ) { @@ -149,4 +173,9 @@ int main(int argc, char *argv[]) close(fd); return 0; + +ext_err: + usage(argv[0]); + show_curr_cpu(stderr); + exit(STDERR_FILENO); } From patchwork Fri Apr 5 12:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fouad Hilly X-Patchwork-Id: 13618971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3344AC67861 for ; Fri, 5 Apr 2024 12:11:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701230.1095541 (Exim 4.92) (envelope-from ) id 1rsiQ1-0008Sz-HT; Fri, 05 Apr 2024 12:11:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701230.1095541; Fri, 05 Apr 2024 12:11:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsiQ1-0008Ss-Cx; Fri, 05 Apr 2024 12:11:41 +0000 Received: by outflank-mailman (input) for mailman id 701230; Fri, 05 Apr 2024 12:11:40 +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 1rsiQ0-0007Qe-8Z for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 12:11:40 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a7a73133-f345-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 14:11:38 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56e030624d1so3456671a12.2 for ; Fri, 05 Apr 2024 05:11:38 -0700 (PDT) Received: from fhilly.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id j13-20020a50ed0d000000b0056c4372c161sm729425eds.55.2024.04.05.05.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:11:36 -0700 (PDT) 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: a7a73133-f345-11ee-a1ef-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1712319097; x=1712923897; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wdhAQWAGgzqfyVOlZZiidtJ6Xeb+heOhOyk9/vxfLS0=; b=BCR/4nvzPXGSe2aZExlNnkyeFDGpL3gSy+eSFB4tKyeiUG1QoJDmFjygGFMXm1A08W sIAdkIIKkKgT/n+lKOi8/LudOsCj0XPiGd0SV72BTIYPUoWKbDATqC0nFw8efe34YEAy oHb5C7bwtkR5vA++Fs/RGCQ7btOJijllTdhmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712319097; x=1712923897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wdhAQWAGgzqfyVOlZZiidtJ6Xeb+heOhOyk9/vxfLS0=; b=Vc+xoXsNqHcjj3dRjj9O5ebRpMwSMdTwe0rRQqmHQR1jQdCZgUPI1//83eZiKAP2Uk T/iVTdeczswADvE2iSNIgDqMUhH0StBpgMyXBd0a0/OEIut1iYc+9+5PtugC2Z9VP/Uf JPSQa7TVy+ethF+zq8UhOOihpx28nAY+6CfE1ZlJBESs/xGIzo7wqTkkeTcb2b14OEMQ c+TG47cpSuz7xM29BD50ys8ImkOK6hau8YjM1PgIs2hW27f9XUmsWPNP3p6k1LZM1GOK rjVppLdkNTKBnGmjpdYEkSqkHOCI9+9wL4K1UHltDQ1aapeoBS6TSfwVcPtkPqJdpn10 EVXQ== X-Gm-Message-State: AOJu0YyIYUqrhcE79u7lPtJwFPQEboSZSZW8PCVSPrOk2d6B9mSRtgY4 wvDXVEikD8m76I3Ra+fap88JEckq/05/3ipNmnQj9HogELFrqXZ5KbKpbu6qtRhAZ0xpc6pkr3s Q X-Google-Smtp-Source: AGHT+IFc7P4utWajGbqgWpMUxPqCIQeerVOzNOKJFOn8AwBmV1kYyymGlsBRFkuK4n0vtNRUKCAkug== X-Received: by 2002:a50:d49a:0:b0:568:9b13:77fe with SMTP id s26-20020a50d49a000000b005689b1377femr938158edi.37.1712319097311; Fri, 05 Apr 2024 05:11:37 -0700 (PDT) From: Fouad Hilly To: Xen-devel Cc: Fouad Hilly , Anthony PERARD , Juergen Gross , Andrew Cooper Subject: [PATCH 5/5] x86: Add --force option to xen-ucode to override microcode version check Date: Fri, 5 Apr 2024 13:11:28 +0100 Message-ID: <20240405121128.260493-6-fouad.hilly@cloud.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240405121128.260493-1-fouad.hilly@cloud.com> References: <20240405121128.260493-1-fouad.hilly@cloud.com> MIME-Version: 1.0 Introduce --force option to xen-ucode to force skipping microcode version check, which allows the user to update x86 microcode even if both versions are the same. Signed-off-by: Fouad Hilly --- Suggested-by: Andrew Cooper --- tools/include/xenctrl.h | 2 +- tools/libs/ctrl/xc_misc.c | 12 ++++++++++-- tools/misc/xen-ucode.c | 20 +++++++++++++++----- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 2ef8b4e05422..5dbe3e63374a 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -1171,7 +1171,7 @@ typedef uint32_t xc_node_to_node_dist_t; int xc_physinfo(xc_interface *xch, xc_physinfo_t *info); int xc_cputopoinfo(xc_interface *xch, unsigned *max_cpus, xc_cputopo_t *cputopo); -int xc_microcode_update(xc_interface *xch, const void *buf, size_t len); +int xc_microcode_update(xc_interface *xch, const void *buf, size_t len, uint32_t flags); int xc_get_cpu_version(xc_interface *xch, struct xenpf_pcpu_version *cpu_ver); int xc_get_ucode_revision(xc_interface *xch, struct xenpf_ucode_revision *ucode_rev); diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c index 5ecdfa2c7934..edce45bc2a17 100644 --- a/tools/libs/ctrl/xc_misc.c +++ b/tools/libs/ctrl/xc_misc.c @@ -203,7 +203,7 @@ int xc_physinfo(xc_interface *xch, return 0; } -int xc_microcode_update(xc_interface *xch, const void *buf, size_t len) +int xc_microcode_update(xc_interface *xch, const void *buf, size_t len, uint32_t flags) { int ret; struct xen_platform_op platform_op = {}; @@ -215,7 +215,15 @@ int xc_microcode_update(xc_interface *xch, const void *buf, size_t len) memcpy(uc, buf, len); - platform_op.cmd = XENPF_microcode_update; + if ( flags > XENPF_UCODE_FLAG_FORCE_NOT_SET ) + { + platform_op.cmd = XENPF_microcode_update2; + platform_op.u.microcode.flags = flags; + } + else + { + platform_op.cmd = XENPF_microcode_update; + } platform_op.u.microcode.length = len; set_xen_guest_handle(platform_op.u.microcode.data, uc); diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c index 9bde991c5df5..469ce3299381 100644 --- a/tools/misc/xen-ucode.c +++ b/tools/misc/xen-ucode.c @@ -13,6 +13,8 @@ #include #include +#include + static xc_interface *xch; static const char intel_id[] = "GenuineIntel"; @@ -21,10 +23,11 @@ static const char amd_id[] = "AuthenticAMD"; static void usage(const char *name) { printf("%s: Xen microcode updating tool\n" - "Usage: %s [ | --show-cpu-info]\n" + "Usage: %s [[--force] | --show-cpu-info]\n" "\n" " -h, --help display this help and exit\n" " -s, --show-cpu-info show CPU information and exit\n" + " -f, --force force to skip micorocde version check\n" "\n" , name, name); } @@ -89,11 +92,13 @@ int main(int argc, char *argv[]) char *filename = NULL, *buf; size_t len; struct stat st; + uint32_t ucode_flag = XENPF_UCODE_FLAG_FORCE_NOT_SET; int opt; const static struct option options[] = { {"help", no_argument, NULL, 'h'}, {"show-cpu-info", no_argument, NULL, 's'}, + {"force", required_argument, NULL, 'f'}, {NULL, no_argument, NULL, 0} }; @@ -105,10 +110,10 @@ int main(int argc, char *argv[]) exit(1); } - if ( argc != 2 ) + if ( argc < 2 || argc > 3) goto ext_err; - while ( (opt = getopt_long(argc, argv, "hs:", options, NULL)) != -1 ) + while ( (opt = getopt_long(argc, argv, "hsf:", options, NULL)) != -1 ) { switch (opt) { @@ -120,12 +125,17 @@ int main(int argc, char *argv[]) goto ext_err; show_curr_cpu(stdout); exit(EXIT_SUCCESS); + case 'f': + ucode_flag = XENPF_UCODE_FLAG_FORCE_SET; + filename = optarg; + break; default: goto ext_err; } } - filename = argv[1]; + if ( argc == 2 ) + filename = argv[1]; if ( filename == NULL ) { printf("File name error\n"); @@ -155,7 +165,7 @@ int main(int argc, char *argv[]) exit(1); } - ret = xc_microcode_update(xch, buf, len); + ret = xc_microcode_update(xch, buf, len, ucode_flag); if ( ret ) { fprintf(stderr, "Failed to update microcode. (err: %s)\n",