From patchwork Thu Oct 24 13:22:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13849025 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 A9DDACE8E75 for ; Thu, 24 Oct 2024 13:22:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.825235.1239415 (Exim 4.92) (envelope-from ) id 1t3xn5-0004KO-T4; Thu, 24 Oct 2024 13:22:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 825235.1239415; Thu, 24 Oct 2024 13:22:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3xn5-0004KH-QL; Thu, 24 Oct 2024 13:22:15 +0000 Received: by outflank-mailman (input) for mailman id 825235; Thu, 24 Oct 2024 13:22:14 +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 1t3xn4-0004K5-9X for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 13:22:14 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fad52a42-920a-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 15:22:12 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-539eb97f26aso905363e87.2 for ; Thu, 24 Oct 2024 06:22:12 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a912ee592sm618574766b.79.2024.10.24.06.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 06:22:10 -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: fad52a42-920a-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729776131; x=1730380931; 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=xI3YWCuDWA5ZJYhHfqCN+eAld5aMRSkjdw5nOvKgkSM=; b=CSsiSgPx6hp3rFeqxVWW3bepQruJrVa2TIhNJo+GMDh98eovRg9dFs63O/yh2Cgv+m DZgiBxXyZdO1E+0cLujA+jUl+1G98bFdNTsYzjPOEF1gKEtQwppCDwTCQetJEBIuDrOa hh8EslyCpsSC2nI1wHyb1mSSu26aiwKnIWBj0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729776131; x=1730380931; 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=xI3YWCuDWA5ZJYhHfqCN+eAld5aMRSkjdw5nOvKgkSM=; b=upr1ylu1NHsSyVakFoaYzfk+0Ywzs0J0ce3IIuKlfkh3BYI0pJU4kl443yZYUitBJe jJOcx3WOMwomju4rvoIYnTt4j0O+OEHcaHbh5Op1i6VdlkkDxxc1+VchzFF9PcIOhP0e npF7vKssOk6t5snM6Zu1+Y2sRuyuraR0hM5CvRmyE7FOT/MSX+lUbx1X184YfXMS92fr ZWu4qjqG0duFZxb6IctsEOr/XsusPWoLQVPvgRAopwUBl6KZUQ3Y9sVG/fvihnWpjhzc UutgmqpAMBvSgvQz2XyOt+906KTCcpBH7wawd9LRWqbLt0P4If4SCpEm3/jyfGP+WShY 7dKg== X-Gm-Message-State: AOJu0Yw2Lj8nAXa0XB+2s+K3pkFokZdrqGAu12h/m/pQmbZmMHN7OVHK QJxlN7bDmMAHz8Fd+fMWJlKN8+WS02+de4+8mNXHlG1CkeBzdppLMJALKyvUtgL1gXA4MnyCMwG q X-Google-Smtp-Source: AGHT+IGMqcL+fx6Snhrn5yxbpjO1LwkkVZDl2+dmTre9UqLBmLZFLFZuDvVKXxiaFY5tSmBazckizw== X-Received: by 2002:a05:6512:b02:b0:539:e3d8:fa33 with SMTP id 2adb3069b0e04-53b1a38d08cmr3893206e87.54.1729776131251; Thu, 24 Oct 2024 06:22:11 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 1/5] x86/ucode: Rename hypercall-context functions Date: Thu, 24 Oct 2024 14:22:01 +0100 Message-Id: <20241024132205.987042-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024132205.987042-1-andrew.cooper3@citrix.com> References: <20241024132205.987042-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 microcode_update{,_helper}() are overly generic names in a file that has multiple update routines and helper functions contexts. Rename microcode_update() to ucode_update_hcall() so it explicitly identifies itself as hypercall context, and rename microcode_update_helper() to ucode_update_hcall_cont() to make it clear it is in continuation context. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jason Andryuk --- CC: Jan Beulich CC: Roger Pau Monné --- xen/arch/x86/cpu/microcode/core.c | 10 +++++----- xen/arch/x86/include/asm/microcode.h | 4 ++-- xen/arch/x86/platform_hypercall.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index 1d58cb0f3bc1..21077b449c38 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -586,7 +586,7 @@ struct ucode_buf { char buffer[]; }; -static long cf_check microcode_update_helper(void *data) +static long cf_check ucode_update_hcall_cont(void *data) { int ret; struct ucode_buf *buffer = data; @@ -722,8 +722,8 @@ static long cf_check microcode_update_helper(void *data) return ret; } -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, - unsigned long len, unsigned int flags) +int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf, + unsigned long len, unsigned int flags) { int ret; struct ucode_buf *buffer; @@ -748,11 +748,11 @@ int microcode_update(XEN_GUEST_HANDLE(const_void) buf, buffer->flags = flags; /* - * Always queue microcode_update_helper() on CPU0. Most of the logic + * Always queue ucode_update_hcall_cont() on CPU0. Most of the logic * won't care, but the update of the Raw CPU policy wants to (re)run on * the BSP. */ - return continue_hypercall_on_cpu(0, microcode_update_helper, buffer); + return continue_hypercall_on_cpu(0, ucode_update_hcall_cont, buffer); } static int __init cf_check microcode_init(void) diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h index a278773f8b5d..dd20cdb9ebb6 100644 --- a/xen/arch/x86/include/asm/microcode.h +++ b/xen/arch/x86/include/asm/microcode.h @@ -22,8 +22,8 @@ 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, unsigned int flags); +int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf, + unsigned long len, unsigned int flags); int microcode_update_one(void); struct boot_info; diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 67f851237def..90abd3197fc9 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -313,7 +313,7 @@ ret_t do_platform_op( guest_from_compat_handle(data, op->u.microcode.data); - ret = microcode_update(data, op->u.microcode.length, 0); + ret = ucode_update_hcall(data, op->u.microcode.length, 0); break; } @@ -323,8 +323,8 @@ ret_t do_platform_op( guest_from_compat_handle(data, op->u.microcode2.data); - ret = microcode_update(data, op->u.microcode2.length, - op->u.microcode2.flags); + ret = ucode_update_hcall(data, op->u.microcode2.length, + op->u.microcode2.flags); break; } From patchwork Thu Oct 24 13:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13849023 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 09A8FCE8E75 for ; Thu, 24 Oct 2024 13:22:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.825238.1239441 (Exim 4.92) (envelope-from ) id 1t3xn7-0004pb-N7; Thu, 24 Oct 2024 13:22:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 825238.1239441; Thu, 24 Oct 2024 13:22:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3xn7-0004p4-Ga; Thu, 24 Oct 2024 13:22:17 +0000 Received: by outflank-mailman (input) for mailman id 825238; Thu, 24 Oct 2024 13:22:16 +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 1t3xn6-0004KA-Gz for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 13:22:16 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fc07d42f-920a-11ef-99a3-01e77a169b0f; Thu, 24 Oct 2024 15:22:14 +0200 (CEST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a86e9db75b9so118895566b.1 for ; Thu, 24 Oct 2024 06:22:14 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a912ee592sm618574766b.79.2024.10.24.06.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 06:22:11 -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: fc07d42f-920a-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729776133; x=1730380933; 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=vje9cjl7S3MEL0v41NICuEDrNpFT2GOVFHe2wP6D174=; b=MXhSz/AgaUTb1+YOyikG/qnyiGBComM/0+9LBZy/bdTjMPfQxNtnFMCpaU0nErfP1f YzAL+afDDYjz4BGriFJzxfwUYgkicL3g+6gpjzEkOxoacP0dWlFlWhm/r4+cJkXUNLuR /mQdldKTrIqExclRjxWKwhBQC9BjS/tEdHlrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729776133; x=1730380933; 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=vje9cjl7S3MEL0v41NICuEDrNpFT2GOVFHe2wP6D174=; b=tSH+PBaulgyhXJ8p2IfeW11ctEgspbr7gz/TAVI2F+Qk+3Vs7WGsGCdRkd69sMdSTY VqGCz+8dByBTFnke0jiXaBoe3R/z5XULebS594XfaVOdVdEzZ8Ffc9DNNioZWmFR68ZY yA4dKiVK4iWvbGj4X5MrFlYZqVMF8BpDIXEShr5VKJmpQrmg26+/pf/xhZ3aHk9Vhk6y bckHQ4T6NbDgUbd76fBcGQ1ECBojCM84lFrFlHZlyrL2/+WItUX+jNiRE4iig2YdrXcb KpPK/qYgZLOPnkriFlgGIhaa0vZcfc6ABOqLHB8sDf+Q7qX8km8rTSyT0rfH1dpVQNTy SSkA== X-Gm-Message-State: AOJu0YzLwEuEd9pX8FzmdzzOREOGwlr7bM9bAq6HVBDV3Icf3/g1T/Nd xWO3VROug9bgykYARHIInkbrliRv67Dc/S616AaemgumFco0KQ5hE4LL5JtTzKkgNQErHw462pY U X-Google-Smtp-Source: AGHT+IHOOtGnTEQAVB2sdCQ4P24Dc8w6u4STtsxpipSi9dy2lm9XP0oMoJtBQDdXW4FOf+OM7Hg54A== X-Received: by 2002:a17:907:6e8c:b0:a9a:46f5:d6d7 with SMTP id a640c23a62f3a-a9abf8459d0mr589610666b.5.1729776133455; Thu, 24 Oct 2024 06:22:13 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 2/5] x86/ucode: Drop the parse_blob() wrapper Date: Thu, 24 Oct 2024 14:22:02 +0100 Message-Id: <20241024132205.987042-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024132205.987042-1-andrew.cooper3@citrix.com> References: <20241024132205.987042-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 This separates the collect_cpu_info() and cpu_request_microcode() calls for later cleanup, and frees up the name to be reused a little differently. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jason Andryuk --- CC: Jan Beulich CC: Roger Pau Monné --- xen/arch/x86/cpu/microcode/core.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index 21077b449c38..cad38d859eee 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -237,19 +237,6 @@ static struct patch_with_flags nmi_patch = .patch = ZERO_BLOCK_PTR, }; -/* - * Return a patch that covers current CPU. If there are multiple patches, - * return the one with the highest revision number. Return error If no - * patch is found and an error occurs during the parsing process. Otherwise - * return NULL. - */ -static struct microcode_patch *parse_blob(const char *buf, size_t len) -{ - alternative_vcall(ucode_ops.collect_cpu_info); - - return alternative_call(ucode_ops.cpu_request_microcode, buf, len, true); -} - static void microcode_free_patch(const struct microcode_patch *patch) { xfree((struct microcode_patch *)patch); @@ -616,7 +603,10 @@ static long cf_check ucode_update_hcall_cont(void *data) goto put; } - patch_with_flags.patch = parse_blob(buffer->buffer, buffer->len); + alternative_vcall(ucode_ops.collect_cpu_info); + patch_with_flags.patch = alternative_call(ucode_ops.cpu_request_microcode, + (const void *)buffer->buffer, + buffer->len, true); patch_with_flags.flags = buffer->flags; xfree(buffer); if ( IS_ERR(patch_with_flags.patch) ) @@ -797,7 +787,8 @@ static int __init early_update_cache(const void *data, size_t len) if ( !data ) return -ENOMEM; - patch = parse_blob(data, len); + alternative_vcall(ucode_ops.collect_cpu_info); + patch = alternative_call(ucode_ops.cpu_request_microcode, data, len, true); if ( IS_ERR(patch) ) { printk(XENLOG_WARNING "Parsing microcode blob error %ld\n", From patchwork Thu Oct 24 13:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13849026 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 5C627CE8E74 for ; Thu, 24 Oct 2024 13:22:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.825237.1239435 (Exim 4.92) (envelope-from ) id 1t3xn7-0004ml-BT; Thu, 24 Oct 2024 13:22:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 825237.1239435; Thu, 24 Oct 2024 13:22:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3xn7-0004me-8n; Thu, 24 Oct 2024 13:22:17 +0000 Received: by outflank-mailman (input) for mailman id 825237; Thu, 24 Oct 2024 13:22:16 +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 1t3xn6-0004K5-1y for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 13:22:16 +0000 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [2a00:1450:4864:20::634]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fc598d78-920a-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 15:22:15 +0200 (CEST) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a9a26a5d6bfso116892066b.1 for ; Thu, 24 Oct 2024 06:22:15 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a912ee592sm618574766b.79.2024.10.24.06.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 06:22:13 -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: fc598d78-920a-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729776134; x=1730380934; 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=XEK8lPkq2pM0BIHJkdhJ3DO8laaRlVDZkwJP1Ftbg9E=; b=o4KPqv5Fn5t/pYZmo/MWrtbkcsoifJMy2fPde2f3O7me/TsYV13iIXcmkn4ALS8NZD kE3nkla79mkqGTwffRSoE0CJcAdCuL9LB9AYWPWl9k+FPaZEW7gdxBPTyKJ7zu/HHGSs dS+9mo9JOEGKf+QrP0ZOMXeCDGbZTfY7+a6FI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729776134; x=1730380934; 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=XEK8lPkq2pM0BIHJkdhJ3DO8laaRlVDZkwJP1Ftbg9E=; b=Y5efT7blj0P3Ig9iPLvNKyNvEJYQUMNONdIepv5Z5d8fhgWhIWCuQJ7Ne2h4NveRGf Bmu3QFVJ+4efqq9ynUv7V6VY31735ItGpYuvLa8/zhhDXMOSHwLwLtSHWoHWnuP4wtoE 8ZEb+B+HUDlYN0yowTeHGNIOfKbE36YJZY5F/CIiu21I4iXVU8jF3Fyqdp5Jcbs9JtY7 IeYU+b+yzthiPu7E8gCHcwcqhD2jM97+bnXt8l3pC2YTtwFuq3NEVANxk4ALnet/D95r 9ebc6VTafLuipXODByTuyGYFJynYMyEaN2uFUt7uNHUIJmMDopPLcQKoRJvCZ6xSSDyh LerA== X-Gm-Message-State: AOJu0YxicycdizUkyPO09hSpOC0OoudTfXGEmgBmkc1SjgKR6zqWlBQK 11lBChRXb547nRvx91GQlJdrVMYhUXdE6ownFzZpsJ1FmHBV8ZaG1cHHbeF32TqZc6cgzZzQjlj u X-Google-Smtp-Source: AGHT+IFGHdvyoTwoaTjUB6lqWKhS3LAmydk5HgOI4qdq1YnBqpDv7EOvvHeclwZXEUaaSPgOAUHlIw== X-Received: by 2002:a17:907:3fa6:b0:a99:c0be:a8ac with SMTP id a640c23a62f3a-a9abf8b233amr554772866b.37.1729776134279; Thu, 24 Oct 2024 06:22:14 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 3/5] x86/ucode: Rename the cpu_request_microcode() hook to parse() Date: Thu, 24 Oct 2024 14:22:03 +0100 Message-Id: <20241024132205.987042-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024132205.987042-1-andrew.cooper3@citrix.com> References: <20241024132205.987042-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 cpu_request_microcode() was never a good name, and the microcode suffix is redundant. Rename it to simply parse(). Introduce ucode_parse() and ucode_parse_dup() wrappers around the parse() hook, also abstracting away the make_copy parameter and associated const-correctness. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jason Andryuk --- CC: Jan Beulich CC: Roger Pau Monné --- xen/arch/x86/cpu/microcode/amd.c | 4 ++-- xen/arch/x86/cpu/microcode/core.c | 22 ++++++++++++++++------ xen/arch/x86/cpu/microcode/intel.c | 4 ++-- xen/arch/x86/cpu/microcode/private.h | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index 0fe869eff119..3f147c10ca67 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -311,7 +311,7 @@ static int scan_equiv_cpu_table(const struct container_equiv_table *et) return -ESRCH; } -static struct microcode_patch *cf_check cpu_request_microcode( +static struct microcode_patch *cf_check amd_ucode_parse( const void *buf, size_t size, bool make_copy) { const struct microcode_patch *saved = NULL; @@ -444,7 +444,7 @@ static struct microcode_patch *cf_check cpu_request_microcode( } static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops = { - .cpu_request_microcode = cpu_request_microcode, + .parse = amd_ucode_parse, .collect_cpu_info = collect_cpu_info, .apply_microcode = apply_microcode, .compare_patch = compare_patch, diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index cad38d859eee..29655a44ae62 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -217,6 +217,18 @@ static void __init microcode_grab_module(struct boot_info *bi) static struct microcode_ops __ro_after_init ucode_ops; +/* Parse a ucode blob. Returns a pointer to a heap-allocated copy, or PTR_ERR. */ +static struct microcode_patch *ucode_parse_dup(const char *buf, size_t len) +{ + return alternative_call(ucode_ops.parse, buf, len, true); +} + +/* Parse a ucode blob. Returns a pointer into @buf, or PTR_ERR. */ +static const struct microcode_patch *ucode_parse(const char *buf, size_t len) +{ + return alternative_call(ucode_ops.parse, buf, len, false); +} + static DEFINE_SPINLOCK(microcode_mutex); DEFINE_PER_CPU(struct cpu_signature, cpu_sig); @@ -604,9 +616,7 @@ static long cf_check ucode_update_hcall_cont(void *data) } alternative_vcall(ucode_ops.collect_cpu_info); - patch_with_flags.patch = alternative_call(ucode_ops.cpu_request_microcode, - (const void *)buffer->buffer, - buffer->len, true); + patch_with_flags.patch = ucode_parse_dup(buffer->buffer, buffer->len); patch_with_flags.flags = buffer->flags; xfree(buffer); if ( IS_ERR(patch_with_flags.patch) ) @@ -788,7 +798,7 @@ static int __init early_update_cache(const void *data, size_t len) return -ENOMEM; alternative_vcall(ucode_ops.collect_cpu_info); - patch = alternative_call(ucode_ops.cpu_request_microcode, data, len, true); + patch = ucode_parse_dup(data, len); if ( IS_ERR(patch) ) { printk(XENLOG_WARNING "Parsing microcode blob error %ld\n", @@ -832,7 +842,7 @@ static int __init early_microcode_update_cpu(void) { const void *data = NULL; size_t len; - struct microcode_patch *patch; + const struct microcode_patch *patch; if ( ucode_blob.size ) { @@ -848,7 +858,7 @@ static int __init early_microcode_update_cpu(void) if ( !data ) return -ENOMEM; - patch = ucode_ops.cpu_request_microcode(data, len, false); + patch = ucode_parse(data, len); if ( IS_ERR(patch) ) { printk(XENLOG_WARNING "Parsing microcode blob error %ld\n", diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index bad51f64724a..3d3f7e57db80 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -334,7 +334,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch, return 0; } -static struct microcode_patch *cf_check cpu_request_microcode( +static struct microcode_patch *cf_check intel_ucode_parse( const void *buf, size_t size, bool make_copy) { int error = 0; @@ -406,7 +406,7 @@ static bool __init can_load_microcode(void) } static const struct microcode_ops __initconst_cf_clobber intel_ucode_ops = { - .cpu_request_microcode = cpu_request_microcode, + .parse = intel_ucode_parse, .collect_cpu_info = collect_cpu_info, .apply_microcode = apply_microcode, .compare_patch = compare_patch, diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h index c72f060ac394..e30acee1536b 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -37,7 +37,7 @@ struct microcode_ops { * If one is not found, (nothing matches the current CPU), return NULL. * Also may return ERR_PTR(-err), e.g. bad container, out of memory. */ - struct microcode_patch *(*cpu_request_microcode)( + struct microcode_patch *(*parse)( const void *buf, size_t size, bool make_copy); /* From patchwork Thu Oct 24 13:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13849024 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 4421BCE8E70 for ; Thu, 24 Oct 2024 13:22:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.825239.1239456 (Exim 4.92) (envelope-from ) id 1t3xnA-0005IA-2p; Thu, 24 Oct 2024 13:22:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 825239.1239456; Thu, 24 Oct 2024 13:22:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3xn9-0005Hz-Vs; Thu, 24 Oct 2024 13:22:19 +0000 Received: by outflank-mailman (input) for mailman id 825239; Thu, 24 Oct 2024 13:22:18 +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 1t3xn8-0004K5-8i for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 13:22:18 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fd91717d-920a-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 15:22:17 +0200 (CEST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5c948c41edeso1032331a12.1 for ; Thu, 24 Oct 2024 06:22:17 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a912ee592sm618574766b.79.2024.10.24.06.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 06:22:14 -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: fd91717d-920a-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729776136; x=1730380936; 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=Df5ZhRz35AbRcfDDCuCuW3JIPnNenLDg73Ag7Qq+uQc=; b=OBeX4gqY7QspMNt5M42vV28J4pvcj6MR52E3TeXyZUTNShUxo4b7lMBvlJvCkb3jvT wOtrudYRifqjYnH7pcYb6LedYkjoud/ijKiC+cKywtzs2+4SlDJFSjUtj2TyQMkOHLuh s0EWG8HLWsE/ZQtBkwVsmEyvXPvyi5lJLVs2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729776136; x=1730380936; 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=Df5ZhRz35AbRcfDDCuCuW3JIPnNenLDg73Ag7Qq+uQc=; b=ms56cUH04Fq9FY7W+HG6FL4xdDowi9HNiteoj2e5G064lL5caT1HB5In+9o2WjxpZW iSl+lCBJUK61Mcn6Ax5ffSKQngM/hlhM9oTEK4xh9yGlFe9rVH4EuSa6voFOktTaDE3F RtdP+nGEFlLP6/1rdHAS/yn4CG+dN4ddGL+YnmwRVGG6dR1jylxMGVHnkcJjfYf4lZlM M527m+OOsFYwFNCGHBVctwZrZ8tHvGjAbxnGKVhQag9tC4Z36erobfFqdDfMdg7sOVJ+ 8jdc5Eokym/4yKbeUp6RUVXLj01WN58n6oV/USONoRlY2JV44D5uENAN2jY1i5WuLBxE KrBQ== X-Gm-Message-State: AOJu0YxG5ppIQ6DZBbCvCtGUQZe6Ne/c1oXef1ffVoYOeYhA1bLG4dAB mf9ajC0giO5pmDosXf6rZJN41KbvxTz2oJUs/bUoAXNNOyP5ccf5Lely2qx+OLRQaYZj4jN+8XG 8 X-Google-Smtp-Source: AGHT+IHTUnP+Aq6o8B4fU0w9na2iXanTiNixUKKg99rw6/LW1fGByVVfMqw13Yi4nOF6XBc/BuDTgw== X-Received: by 2002:a17:906:7309:b0:a99:dde6:9f42 with SMTP id a640c23a62f3a-a9abf96ce04mr630900766b.47.1729776135978; Thu, 24 Oct 2024 06:22:15 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper Subject: [PATCH 4/5] x86/ucode: Rename the apply_microcode() hook to load() Date: Thu, 24 Oct 2024 14:22:04 +0100 Message-Id: <20241024132205.987042-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024132205.987042-1-andrew.cooper3@citrix.com> References: <20241024132205.987042-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The microcode suffix is redundant, and "microcode loading" is the more common term Reviewed-by: Jason Andryuk --- xen/arch/x86/cpu/microcode/amd.c | 6 +++--- xen/arch/x86/cpu/microcode/core.c | 27 ++++++++++++++++----------- xen/arch/x86/cpu/microcode/intel.c | 8 ++++---- xen/arch/x86/cpu/microcode/private.h | 7 +++---- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index 3f147c10ca67..1845f51ba330 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -214,8 +214,8 @@ static enum microcode_match_result cf_check compare_patch( return compare_header(new, old); } -static int cf_check apply_microcode(const struct microcode_patch *patch, - unsigned int flags) +static int cf_check amd_ucode_load(const struct microcode_patch *patch, + unsigned int flags) { int hw_err; unsigned int cpu = smp_processor_id(); @@ -446,7 +446,7 @@ static struct microcode_patch *cf_check amd_ucode_parse( static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops = { .parse = amd_ucode_parse, .collect_cpu_info = collect_cpu_info, - .apply_microcode = apply_microcode, + .load = amd_ucode_load, .compare_patch = compare_patch, }; diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index 29655a44ae62..f320ea87c1dc 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -229,6 +229,12 @@ static const struct microcode_patch *ucode_parse(const char *buf, size_t len) return alternative_call(ucode_ops.parse, buf, len, false); } +/* Load a ucode blob. Returns -errno. */ +static int ucode_load(const struct microcode_patch *patch, unsigned int flags) +{ + return alternative_call(ucode_ops.load, patch, flags); +} + static DEFINE_SPINLOCK(microcode_mutex); DEFINE_PER_CPU(struct cpu_signature, cpu_sig); @@ -333,11 +339,10 @@ static int microcode_update_cpu(const struct microcode_patch *patch, spin_lock(µcode_mutex); if ( patch ) - err = alternative_call(ucode_ops.apply_microcode, patch, flags); + err = ucode_load(patch, flags); else if ( microcode_cache ) { - err = alternative_call(ucode_ops.apply_microcode, microcode_cache, - flags); + err = ucode_load(microcode_cache, flags); if ( err == -EIO ) { microcode_free_patch(microcode_cache); @@ -388,7 +393,7 @@ static int primary_thread_work(const struct microcode_patch *patch, if ( !wait_for_state(LOADING_ENTER) ) return -EBUSY; - ret = alternative_call(ucode_ops.apply_microcode, patch, flags); + ret = ucode_load(patch, flags); if ( !ret ) atomic_inc(&cpu_updated); atomic_inc(&cpu_out); @@ -502,7 +507,7 @@ static int control_thread_fn(const struct microcode_patch *patch, goto out; /* Control thread loads ucode first while others are in NMI handler. */ - ret = alternative_call(ucode_ops.apply_microcode, patch, flags); + ret = ucode_load(patch, flags); if ( !ret ) atomic_inc(&cpu_updated); atomic_inc(&cpu_out); @@ -731,7 +736,7 @@ int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf, if ( flags & ~XENPF_UCODE_FORCE ) return -EINVAL; - if ( !ucode_ops.apply_microcode ) + if ( !ucode_ops.load ) return -EINVAL; buffer = xmalloc_flex_struct(struct ucode_buf, buffer, len); @@ -783,7 +788,7 @@ int microcode_update_one(void) if ( ucode_ops.collect_cpu_info ) alternative_vcall(ucode_ops.collect_cpu_info); - if ( !ucode_ops.apply_microcode ) + if ( !ucode_ops.load ) return -EOPNOTSUPP; return microcode_update_cpu(NULL, 0); @@ -821,7 +826,7 @@ int __init microcode_init_cache(struct boot_info *bi) { int rc = 0; - if ( !ucode_ops.apply_microcode ) + if ( !ucode_ops.load ) return -ENODEV; if ( ucode_scan ) @@ -907,11 +912,11 @@ int __init early_microcode_init(struct boot_info *bi) * * Take the hint in either case and ignore the microcode interface. */ - if ( !ucode_ops.apply_microcode || this_cpu(cpu_sig).rev == ~0 ) + if ( !ucode_ops.load || this_cpu(cpu_sig).rev == ~0 ) { printk(XENLOG_INFO "Microcode loading disabled due to: %s\n", - ucode_ops.apply_microcode ? "rev = ~0" : "HW toggle"); - ucode_ops.apply_microcode = NULL; + ucode_ops.load ? "rev = ~0" : "HW toggle"); + ucode_ops.load = NULL; return -ENODEV; } diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index 3d3f7e57db80..5e6863fd8c9f 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -287,8 +287,8 @@ static enum microcode_match_result cf_check compare_patch( return compare_revisions(old->rev, new->rev); } -static int cf_check apply_microcode(const struct microcode_patch *patch, - unsigned int flags) +static int cf_check intel_ucode_load(const struct microcode_patch *patch, + unsigned int flags) { uint64_t msr_content; unsigned int cpu = smp_processor_id(); @@ -408,7 +408,7 @@ static bool __init can_load_microcode(void) static const struct microcode_ops __initconst_cf_clobber intel_ucode_ops = { .parse = intel_ucode_parse, .collect_cpu_info = collect_cpu_info, - .apply_microcode = apply_microcode, + .load = intel_ucode_load, .compare_patch = compare_patch, }; @@ -417,5 +417,5 @@ void __init ucode_probe_intel(struct microcode_ops *ops) *ops = intel_ucode_ops; if ( !can_load_microcode() ) - ops->apply_microcode = NULL; + ops->load = NULL; } diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h index e30acee1536b..9611efaa979c 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -50,8 +50,7 @@ struct microcode_ops { * Attempt to load the provided patch into the CPU. Returns an error if * anything didn't go as expected. */ - int (*apply_microcode)(const struct microcode_patch *patch, - unsigned int flags); + int (*load)(const struct microcode_patch *patch, unsigned int flags); /* * Given two patches, are they both applicable to the current CPU, and is @@ -68,8 +67,8 @@ struct microcode_ops { * - Loading available * * 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. + * support available) and (not) ops->load (i.e. read only). Otherwise, all + * hooks must be filled in. */ #ifdef CONFIG_AMD void ucode_probe_amd(struct microcode_ops *ops); From patchwork Thu Oct 24 13:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13849022 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 CE0FBCE8E70 for ; Thu, 24 Oct 2024 13:22:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.825240.1239466 (Exim 4.92) (envelope-from ) id 1t3xnB-0005ZI-BC; Thu, 24 Oct 2024 13:22:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 825240.1239466; Thu, 24 Oct 2024 13:22:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t3xnB-0005Z3-7O; Thu, 24 Oct 2024 13:22:21 +0000 Received: by outflank-mailman (input) for mailman id 825240; Thu, 24 Oct 2024 13:22:19 +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 1t3xn9-0004K5-8r for xen-devel@lists.xenproject.org; Thu, 24 Oct 2024 13:22:19 +0000 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [2a00:1450:4864:20::531]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fddcedac-920a-11ef-a0bf-8be0dac302b0; Thu, 24 Oct 2024 15:22:17 +0200 (CEST) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5c9388a00cfso939419a12.3 for ; Thu, 24 Oct 2024 06:22:17 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a912ee592sm618574766b.79.2024.10.24.06.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 06:22:16 -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: fddcedac-920a-11ef-a0bf-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729776137; x=1730380937; 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=4+Vu4sa4HxAQKCzqJBSz5wGkRTNCR1UROUB1VCBQ9dk=; b=vdk772wloLjmp6vG6mwCcBDim4POV6xDwwb/1VIE1F89sEAkyCxl9yqxxyV1w5htOa wnWae8+73GH08WoLGG1wGAqVATfsv1fP7QFt6vtAASRypAO8j/FC5KISSSLc6XQR2cBc fjjWrQEQB5slrqLTVe9FE820PwSokpg9CL5nQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729776137; x=1730380937; 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=4+Vu4sa4HxAQKCzqJBSz5wGkRTNCR1UROUB1VCBQ9dk=; b=BV3pvY2MiSRIbMfJPn0q1uDc0X5Hg11TxLU59EprsThvwzTEeCulsqP9FKoCBE/7mf ssO6FZ/KeyjetjvkyLMcm1X9U2wHYSYb4j94zxtYkQeFdR+wyeH89qC/HGwr4BYu7KFu Jag+HfCnw06mCs7fQG7rxcDAtrYPUdfU69nVUsQeRziUaApCWU+QU6uYsTbcT4bShvYb ECbfLioZzvLNCfnpXPkhDKT54daUz7ajLFpZ4KdT8A6YoEBgcTAEzxdNpFNnl/2s+4ty MFg602pNjNJBO38HxouyGHvQJn/VD4QqRHgEc6YdSNHGnevBH1YSK+UD3evdCVzdMM+Q /oDA== X-Gm-Message-State: AOJu0YyzvHw3utbdlU+XNAiww4DS2qHAXfQMPgPWoe5xtTjFXYEIG7th QNAz8XLri4noSW2Zqitg71M7sIytFNm3hRRQG5UXxGMMd4Q5+D3VOCIYTBjNcB6HcV7EewOtHqQ d X-Google-Smtp-Source: AGHT+IG5UiRpv59wek7ARqF1JmC/N1DSP8R4HlnvXFJTMftXoiNvYECFNOZrMesXeC1zgylbgJaWxg== X-Received: by 2002:a17:907:97cd:b0:a9a:13dd:2734 with SMTP id a640c23a62f3a-a9ad27600cbmr160663366b.36.1729776136782; Thu, 24 Oct 2024 06:22:16 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH 5/5] x86/ucode: Drop the match_reg[] field from AMD's microcode_patch Date: Thu, 24 Oct 2024 14:22:05 +0100 Message-Id: <20241024132205.987042-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024132205.987042-1-andrew.cooper3@citrix.com> References: <20241024132205.987042-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 This was true in the K10 days, but even back then the match registers were really payload data rather than header data. But, it's really model specific data, and these days typically part of the signature, so is random data for all intents and purposes. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jason Andryuk --- CC: Jan Beulich CC: Roger Pau Monné The single difference from this is: @@ -207587,7 +207587,7 @@ ffff82d0402ad261: 4c 89 ce mov %r9,%rsi ffff82d0402ad264: 4c 39 c8 cmp %r9,%rax ffff82d0402ad267: 0f 82 c2 11 f6 ff jb ffff82d04020e42f -ffff82d0402ad26d: 41 83 f9 3f cmp $0x3f,%r9d +ffff82d0402ad26d: 41 83 f9 1f cmp $0x1f,%r9d ffff82d0402ad271: 0f 86 b8 11 f6 ff jbe ffff82d04020e42f ffff82d0402ad277: 85 ed test %ebp,%ebp ffff82d0402ad279: 75 55 jne ffff82d0402ad2d0 which is "mc->len < sizeof(struct microcode_patch)" expression in amd_ucode_parse(). --- xen/arch/x86/cpu/microcode/amd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index 1845f51ba330..54acd6928781 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -48,7 +48,6 @@ struct microcode_patch { uint8_t sb_rev_id; uint8_t bios_api_rev; uint8_t reserved1[3]; - uint32_t match_reg[8]; }; #define UCODE_MAGIC 0x00414d44