[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 3/4] x86: Read MSR_ARCH_CAPS immediately after early_microcode_init()


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 23 Jun 2023 09:33:56 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o4Xd0UQMgpKt5+fDXNhj6kI5ul0pMYtXMtbQXzu3rL8=; b=Q5S06AFbw0DTff1skVu/4VD+YZXxhUFJP+8KU8x20E5g6KyARV44+7z2jqXJjffYXAsh/eaK2K8f4uWtEUZSN/HExGloB9ToWox1+CU42cRduLNgdphrcjQijwVHETHDC7/6I6m6EF73MXR0JQK4EHLTl/tFSFH96F2mrXp/c/bA1rYooXtW3D8sWqhaErVARES3xFgg5Ho5EBEr3Xg3OBbARkVKJUkf6GQtNgEEJ7e8fSKvRTmI34zcPUwuyIyUhnb9j+xXZSHA741lMrs4qLRULDKlyVrJca1sUpy/MmbpQd5xpdRNlNLWPhaA405JClztmkYPAOvfcm7lhjhkDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kE/29+yFE6JygY6uflYOqKYbTyOjJ/y8O4lO//tzvEmD1D0xFan4mCh1vHGvjn5HYOunWDV4ixPOQg+PZUvhArtqyCUt7WriPNGXixShCJhJGdv3gh3B+Wj+VxtjlBf3XoostUBOs57u6t9EwU52tOMuDtrIfG+DPHVJomOyCQq/12kRY0CXQevX2AwCrGgIyTiEQ95cUb8cc8E7LK1wbdgov04W4d+pMRnV29WhDZAYUUCO/FO+fV4naz5LTeSB7qq6AYE6myg2fDXfpOb56DRlvo7mmadVY+w1w/T4Tt84BAZpJCg05HjAYIBMeyMfmFslVTljyRlJHvf4Vo3WWQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 23 Jun 2023 07:34:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.06.2023 19:42, Alejandro Vallejo wrote:
> --- a/xen/arch/x86/cpu/microcode/core.c
> +++ b/xen/arch/x86/cpu/microcode/core.c
> @@ -885,5 +885,18 @@ int __init early_microcode_init(unsigned long 
> *module_map,
>      if ( ucode_mod.mod_end || ucode_blob.size )
>          rc = early_microcode_update_cpu();
>  
> +    /*
> +     * MSR_ARCH_CAPS may have appeared after the microcode update.
> +     * Reload relevant fields in boot_cpu_data if so because they are
> +     * needed in tsx_init().
> +     */
> +    if ( boot_cpu_data.cpuid_level >= 7 )
> +        boot_cpu_data.x86_capability[FEATURESET_7d0]
> +            = cpuid_count_edx(7, 0);
> +    if ( cpu_has_arch_caps )
> +        rdmsr(MSR_ARCH_CAPABILITIES,
> +              boot_cpu_data.x86_capability[FEATURESET_m10Al],
> +              boot_cpu_data.x86_capability[FEATURESET_m10Ah]);
> +
>      return rc;
>  }

Did you consider simply calling early_cpu_init() a 2nd time, and then
perhaps from setup.c and only if ucode load didn't report an error?
There's a printk() in there which will want avoiding on the 2nd pass,
but otherwise this would look more future-proof to me.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.