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 D3375D3C919 for ; Sat, 19 Oct 2024 16:01:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.822585.1236543 (Exim 4.92) (envelope-from ) id 1t2Bsr-000566-07; Sat, 19 Oct 2024 16:00:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 822585.1236543; Sat, 19 Oct 2024 16:00:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t2Bsq-00055z-TP; Sat, 19 Oct 2024 16:00:52 +0000 Received: by outflank-mailman (input) for mailman id 822585; Sat, 19 Oct 2024 16:00:51 +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 1t2Bso-00055t-WF for xen-devel@lists.xenproject.org; Sat, 19 Oct 2024 16:00:51 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4ee1fb73-8e33-11ef-a0be-8be0dac302b0; Sat, 19 Oct 2024 18:00:49 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso29913725e9.0 for ; Sat, 19 Oct 2024 09:00:49 -0700 (PDT) Received: from [192.168.1.10] (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ecf027a50sm4735122f8f.15.2024.10.19.09.00.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Oct 2024 09:00:47 -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: 4ee1fb73-8e33-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1729353648; x=1729958448; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=d0DVluRQMgQwqA5P8D1A1X7VBqpmGdcgsjJkPsiIBNw=; b=BchEC3JLRtEYqj8/lY1+i4z2GLb3QNLVhj7ni/CJ70tRCljLrmR0Y5NC12LeIi0GB5 inpcYe9Oct39pP6jYljcLDNRRGDuudmDSrA1sf3leIHWhy32xqpMoPbTB/DCKl8JrOq9 vKvtTln2eQvhfcp6QtxDo9Ew1e+7oNuNGURic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729353648; x=1729958448; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=d0DVluRQMgQwqA5P8D1A1X7VBqpmGdcgsjJkPsiIBNw=; b=EeF4Nd0yvDqQjqvxzhvSyk6dzDLGhO8OzJG6hCLaUme0o5upUnV6WR7qz/+bqVfWSm pSqoEZnCMGbC1YUKdCE+N20CjN7hzZ3cs+b9QiKC5K30an6a5zn7D1Prkvj5drjp3CUh 1DmugjWo+DNRuK/JJ7Xer0urLv/97EqodzWw+0j5iR0fgS4hGeUTbkcxMYuZ86K73owS U3vTT/8bjuUrmj6C3O0BUqPwzf2oZTfIJ5VvJtC9EpRCQVRnadJxkgwuVTFLKh/NJ+TS Lj3RNbkQ2bRy0JbVxx4JAHyYHomN2YB9WP519PCprxSSvpQrDIisJKBABzC9qb6xzwDU d8ig== X-Forwarded-Encrypted: i=1; AJvYcCWBW7pOngt+liPUVp8tkvE7k2P7QKlZOdtaGr+w/XXdvk5qatrUrPkBE5+rFFgBMt62Ngg4BHvwk5Q=@lists.xenproject.org X-Gm-Message-State: AOJu0Yxnn0+Nn60jdNnmzXecMeuU7BKIJB4R6XSwVMhlo0fO0kzmICua WJHX4kb5bXPjG2nzhnBGKYz6zvicsY2W0uEMgiOn5p5td/tRb9glbQz4Au27Ayo= X-Google-Smtp-Source: AGHT+IGCLVRMxLqwXI3ADi2W95qGXRBye3CnV//hMHW20/cQeosjAXy7omADYLLdF9TQBX2kHfDPbQ== X-Received: by 2002:a05:600c:34c1:b0:431:52a3:d9d9 with SMTP id 5b1f17b1804b1-431615bd3f2mr47416075e9.0.1729353648520; Sat, 19 Oct 2024 09:00:48 -0700 (PDT) Message-ID: <34770deb-4fff-4b9a-af2e-668a17a40c93@citrix.com> Date: Sat, 19 Oct 2024 17:00:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 17/44] x86/boot: convert microcode loading to consume struct boot_info To: "Daniel P. Smith" , xen-devel@lists.xenproject.org Cc: jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <20241017170325.3842-1-dpsmith@apertussolutions.com> <20241017170325.3842-18-dpsmith@apertussolutions.com> Content-Language: en-GB From: Andrew Cooper Autocrypt: addr=andrew.cooper3@citrix.com; keydata= xsFNBFLhNn8BEADVhE+Hb8i0GV6mihnnr/uiQQdPF8kUoFzCOPXkf7jQ5sLYeJa0cQi6Penp VtiFYznTairnVsN5J+ujSTIb+OlMSJUWV4opS7WVNnxHbFTPYZVQ3erv7NKc2iVizCRZ2Kxn srM1oPXWRic8BIAdYOKOloF2300SL/bIpeD+x7h3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znEns5EAAXEbITrgKWXDDUWGYxd pnjj2u+GkVdsOAGk0kxczX6s+VRBhpbBI2PWnOsRJgU2n10PZ3mZD4Xu9kU2IXYmuW+e5KCA vTArRUdCrAtIa1k01sPipPPw6dfxx2e5asy21YOytzxuWFfJTGnVxZZSCyLUO83sh6OZhJkk b9rxL9wPmpN/t2IPaEKoAc0FTQZS36wAMOXkBh24PQ9gaLJvfPKpNzGD8XWR5HHF0NLIJhgg 4ZlEXQ2fVp3XrtocHqhu4UZR4koCijgB8sB7Tb0GCpwK+C4UePdFLfhKyRdSXuvY3AHJd4CP 4JzW0Bzq/WXY3XMOzUTYApGQpnUpdOmuQSfpV9MQO+/jo7r6yPbxT7CwRS5dcQPzUiuHLK9i nvjREdh84qycnx0/6dDroYhp0DFv4udxuAvt1h4wGwTPRQZerSm4xaYegEFusyhbZrI0U9tJ B8WrhBLXDiYlyJT6zOV2yZFuW47VrLsjYnHwn27hmxTC/7tvG3euCklmkn9Sl9IAKFu29RSo d5bD8kMSCYsTqtTfT6W4A3qHGvIDta3ptLYpIAOD2sY3GYq2nf3Bbzx81wZK14JdDDHUX2Rs 6+ahAA== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 19/10/2024 4:49 pm, Daniel P. Smith wrote: > On 10/17/24 21:14, Andrew Cooper wrote: >> On 17/10/2024 6:02 pm, Daniel P. Smith wrote: >>> diff --git a/xen/arch/x86/cpu/microcode/core.c >>> b/xen/arch/x86/cpu/microcode/core.c >>> index 8564e4d2c94c..22fea80bc97e 100644 >>> --- a/xen/arch/x86/cpu/microcode/core.c >>> +++ b/xen/arch/x86/cpu/microcode/core.c >>> @@ -178,16 +177,16 @@ static void __init microcode_scan_module( >>>       /* >>>        * Try all modules and see whichever could be the microcode blob. >>>        */ >>> -    for ( i = 1 /* Ignore dom0 kernel */; i < mbi->mods_count; i++ ) >>> +    for ( i = 1 /* Ignore dom0 kernel */; i < bi->nr_modules; i++ ) >>>       { >>>           if ( !test_bit(i, module_map) ) >>>               continue; >>>   >> >> Somewhere in this series, it would be nice to purge the these "module 0 >> is dom0" special cases.  I'm not sure where best in the series to do it, >> and it may not be here. >> >> Later, in "x86/boot: remove module_map usage from microcode loading" you >> convert this test_bit() into a type != UNKNOWN check, but the pattern is >> used elsewhere too. >> >> How about a for_each_unknown_module(bi, bm) helper?  (which at this >> point can even use module_map in scope). > > So I do have the first_boot_module_index() iterator which I am using > to effectively open-code your suggested for_each_unknown_module() in > one or two places. I can introduce that helper when I first do the > open coding, > though I would like to make it a little more generic. I would prefer > to do it as for_each_bootmodule(bi, bm, type). There is a > scenario/enhancement that I would like to get to that may require > doing an iteration on a type other than BOOTMOD_UNKNOWN. > > Would you be okay with leaving the module_map usage at this point and > changing over to the for_each_bootmodule() when it is dropped? As I > see it, otherwise I would have to make the helper initially work with > module_map only to turn around and drop it when module_map goes away. > At least to me, seems like unnecessary churn unless you see a way > without causing the churn in the helper. I'll leave it to your judgement about when is best to introduce the helper.  You know the series better than I do. ~Andrew