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

Re: [PATCH v5 19/44] x86/boot: use consumed boot module flag for microcode


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 8 Oct 2024 11:56:55 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=apertussolutions.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4WlfGc3hhiPsTYyaOy5XjpupH0pBE9z7x2O0qbdzlCw=; b=DyhWLYhCqo6M578aG9gOz1Q6CQgfmZSSRSY0N3Nx2ezZLTMwIp/7ZqVHmDaHH8gN3iqfWlmUzxkfMxWp/49rijIxkYF31QEelE8Qyj2dQkVNQJ4rRNIJvOoopDW1urRRYiDHLcbdKJZngdrGQLawlAYO+j1xAp9HO2D2GEUxRKjz0PEf4AHK2m1aPCnwyDCxoj1izU4bURtmjFauQzOmCVmRWvK5CTXuXSiaIrSBj5KxT+ev1anpzeinuzTMcL79RhQ4Jon2DalbufCQAMXkWmCa9wL1f/Ojf6NOjmtkZrHkj4YzRAke8mg8FJy3txGih7uIYEH3GWooht2sKRSs3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ybON4rfynR8EKOsXiNMhl45lLIFjFqKnhPpkj4vQLDcBplq6DBjfh96TVoemR25YJOEqHw+mhNg+88IUuB/cqLrKZ1Ab0+6wft6/2ykv2/ZXSynqtdqILqidExv7yK9OohVG0nhV7z5/GyNLwzcZqOLWwR5doKSJD5UyY/TfoL0fWsbv0c/1z7JbC41CLda5rd5SaDQpTrLeq1bFJPseU9xsGs0sVn0yxE+MFbuDFEMBeTeoTDnkNC9Pd3cW3AupQ6BXYzlbgVSJUprYTuGTp3j5UU661YqSPXCg6J48BlYZ8Vtep8MkZU4sZWofNJ0ps3Dx3b9SZ3bXkwEiLRrkuQ==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 08 Oct 2024 15:57:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-10-06 17:49, Daniel P. Smith wrote:
To track if the microcode boot module was loaded, a copy of the boot module is
kept. The size element of this copy is set to zero as the indicator that the
microcode was loaded. A side effect is that the modules have to be rescanned to
find the boot module post-relocation, so the cache copy can be created.

Use the consumed boot module flag to track the loading of the microcode boot
module. This removes the need to manipulate the boot module size element, no
longer requiring the copy, thus allowing it to be replaced by a reference. As a
result it is no longer necessary to rescan the boot modules after relocation
has occurred.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
  xen/arch/x86/cpu/microcode/core.c | 28 ++++++++++++++--------------
  1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c 
b/xen/arch/x86/cpu/microcode/core.c
index 7bcc17e0ab2f..5b42aad2fdd0 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c

@@ -826,14 +826,14 @@ int __init microcode_init_cache(
      if ( !ucode_ops.apply_microcode )
          return -ENODEV;
- if ( ucode_scan )
-        /* Need to rescan the modules because they might have been relocated */
+    /* Scan if microcode was not detected earlier */
+    if ( !ucode_mod )

ucode_scan is a user-controlled variable (ucode=scan=$bool), so I think it still needs to be respected.

          microcode_scan_module(module_map, bi);
- if ( ucode_mod.size )
-        rc = early_update_cache(bootstrap_map_bm(&ucode_mod),
-                                ucode_mod.size);
-    else if ( ucode_blob.size )
+    if ( ucode_mod && !(ucode_mod->flags & BOOTMOD_FLAG_X86_CONSUMED) )
+        rc = early_update_cache(bootstrap_map_bm(ucode_mod),
+                                ucode_mod->size);
+    else if ( ucode_mod && ucode_blob.size )

ucode_blob seems independent of ucode_mod, so I don't see why this didn't stay `else if ( ucode_blob.size )`

          rc = early_update_cache(ucode_blob.data, ucode_blob.size);
return rc;
@@ -851,10 +851,10 @@ static int __init early_microcode_update_cpu(void)

Regards,
Jason



 


Rackspace

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