From nobody Fri Nov 22 02:57:13 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=1730107180; cv=none; d=zohomail.com; s=zohoarc; b=SJk7Hd+426FMW4lcnKsCK/UftqDFaZMyK+bc9jAVTBWdyOZulpnC62F1MSZK4Wg9K9sYAvGq8TcKljZcjAuLv0k3vzzUfHb9JY/0fZBJXEG9C4iQdjuMsTQSfoxCG6ImG4eEg0Kw74NJ41crlVVsZyAv3XlyeGlWIwgBkcKy89A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730107180; 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=r1bM8SCLj6R5IbsmBphTqHMm0oBQSGTeHlM7ro4wldk=; b=M8ZMsdYA+CVrp3sfWUVY5tJLtbSsccnFjLkgqMoreOGLkyFp+sNoL25hz0IpSxpN0PpGRu6zapFP00Tr1kTwHDCGccd/JmYGVZlfXTSRmnwGR2DJBYSVGk2nwUKrCLTbOyiahlHLl0YpKFzzPxXscptzsUZfxQ0bB4iq7yNudkg= 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 1730107180712104.3371658762228; Mon, 28 Oct 2024 02:19:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.826296.1240515 (Exim 4.92) (envelope-from ) id 1t5Lu2-00064k-W5; Mon, 28 Oct 2024 09:19:10 +0000 Received: by outflank-mailman (output) from mailman id 826296.1240515; Mon, 28 Oct 2024 09:19:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5Lu2-00064a-SM; Mon, 28 Oct 2024 09:19:10 +0000 Received: by outflank-mailman (input) for mailman id 826296; Mon, 28 Oct 2024 09:19:10 +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 1t5Lu2-0005yk-42 for xen-devel@lists.xenproject.org; Mon, 28 Oct 2024 09:19:10 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aec66eb1-950d-11ef-99a3-01e77a169b0f; Mon, 28 Oct 2024 10:19:07 +0100 (CET) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a9a2cdc6f0cso551005066b.2 for ; Mon, 28 Oct 2024 02:19:07 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f05deb6sm355961566b.88.2024.10.28.02.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 02:19:05 -0700 (PDT) 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: aec66eb1-950d-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730107146; x=1730711946; 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=r1bM8SCLj6R5IbsmBphTqHMm0oBQSGTeHlM7ro4wldk=; b=tGPDIzdtk9cV/uYse4W/2FzJp6OoFGsTV/e3+F4pwX1mfo8ky9WSoMp7C64U8nGkgJ oRGYlQCskAASLUsCfFysWBeGvI7g2E3IIKmgU+LFF5MR2IcrYHFWp7gyrOXTPOJjX/Dz p1VqQmxnIcTL6gljCWOBp0f8h51QmMVFBYsXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730107146; x=1730711946; 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=r1bM8SCLj6R5IbsmBphTqHMm0oBQSGTeHlM7ro4wldk=; b=gY5EdRzZsLsNybpBmYVYcTJ+KkqhGO5OQNpd+M278u6dmGm2ZS7/UEIz21m1ibu+NQ VwGWaTwoboqMMsg9Zghz9/HmwUqO8B1260CoKHkdrks4KINGJ+WFI2gMp53JsK1NpdTo lk9oqyYOdjUP2Jy0qSdYt824REIMeLYln5+AGhxDzsaf9xhvbkOUexnsWhYUGRcK5cJ9 0Qjixl+VPve1iYMpyF8c98Bd9dagQCFKkWEPekJqqV/T52aJ4siT4c3kc2rpqAhrj9dr fxRqubU5+B8NgaFLMNbQVjIZbEr4qaBbkmEHMQl+pQU4VJuOjI4zdhC8qANVZIZek8J4 PpXg== X-Gm-Message-State: AOJu0YzAMFzNDoZcPJanZfjhoWvlrPrXcKqx1LK8eIp+a9chD+mY+aNU mmZffjuMLlHWzi+4icAin45Nf9sVqSwpKM3XRbadAmOchmzXDty5NBsvZryI8uZ3z0Fg0aT0Nm8 Y X-Google-Smtp-Source: AGHT+IEP9KlEgbT5966fOb8YxiB5q7SRSyRaOvW6vHnzGKGD9sG85PdUM8qsnLLjc6FJETP54fbglw== X-Received: by 2002:a17:907:1c24:b0:a9a:7f84:940b with SMTP id a640c23a62f3a-a9de5c91b71mr577280266b.10.1730107146079; Mon, 28 Oct 2024 02:19:06 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P . Smith" Subject: [PATCH 04/10] x86/ucode: Fold early_microcode_update_cpu() into it's single caller Date: Mon, 28 Oct 2024 09:18:50 +0000 Message-Id: <20241028091856.2151603-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241028091856.2151603-1-andrew.cooper3@citrix.com> References: <20241028091856.2151603-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: 1730107181340116600 Diff-wise, as early_microcode_update_cpu() is the larger function, this more closely resembles "merge early_microcode_load() into it's single callee", b= ut the end result is the same. At the same time, rename the len variable to size. This is for better consistency with existing logic, and to reduce churn later. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Daniel P. Smith --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Daniel P. Smith --- xen/arch/x86/cpu/microcode/core.c | 38 +++++++++++++------------------ 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index d13f8338e4e6..0b00e70f3b07 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -819,28 +819,38 @@ static int __init cf_check microcode_init_cache(void) } presmp_initcall(microcode_init_cache); =20 -/* BSP calls this function to parse ucode blob and then apply an update. */ -static int __init early_microcode_update_cpu(void) +/* + * There are several tasks: + * - Locate the ucode blob in the boot modules. + * - Parse and attempt in-place load. + * - Inform microcode_init_cache() of how to find the blob again. + */ +static int __init early_microcode_load(struct boot_info *bi) { const void *data =3D NULL; - size_t len; + size_t size; struct microcode_patch *patch; =20 + microcode_grab_module(bi); + + if ( !ucode_mod.mod_end && !ucode_blob.size ) + return 0; + if ( ucode_blob.size ) { - len =3D ucode_blob.size; + size =3D ucode_blob.size; data =3D ucode_blob.data; } else if ( ucode_mod.mod_end ) { - len =3D ucode_mod.mod_end; + size =3D ucode_mod.mod_end; data =3D bootstrap_map(&ucode_mod); } =20 if ( !data ) return -ENOMEM; =20 - patch =3D ucode_ops.cpu_request_microcode(data, len, false); + patch =3D ucode_ops.cpu_request_microcode(data, size, false); if ( IS_ERR(patch) ) { printk(XENLOG_WARNING "Parsing microcode blob error %ld\n", @@ -854,22 +864,6 @@ static int __init early_microcode_update_cpu(void) return microcode_update_cpu(patch, 0); } =20 -/* - * There are several tasks: - * - Locate the ucode blob in the boot modules. - * - Parse and attempt in-place load. - * - Inform microcode_init_cache() of how to find the blob again. - */ -static int __init early_microcode_load(struct boot_info *bi) -{ - microcode_grab_module(bi); - - if ( !ucode_mod.mod_end && !ucode_blob.size ) - return 0; - - return early_microcode_update_cpu(); -} - int __init early_microcode_init(struct boot_info *bi) { const struct cpuinfo_x86 *c =3D &boot_cpu_data; --=20 2.39.5