lkml.org 
[lkml]   [2020]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 1/3] x86: microcode: intel: read microcode metadata file
Date
Try to read the microcode metadata file in order to see what features
are added or remove by the new microcode blob. If the metadata file
does not exists passthrough normal loading with a warning message.

Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
arch/x86/kernel/cpu/microcode/intel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 6a99535..a54d5e6 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -970,10 +970,12 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,
bool refresh_fw)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
+ const struct firmware *meta_firmware;
const struct firmware *firmware;
struct iov_iter iter;
enum ucode_state ret;
struct kvec kvec;
+ char meta_name[40];
char name[30];

if (is_blacklisted(cpu))
@@ -982,11 +984,21 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,
sprintf(name, "intel-ucode/%02x-%02x-%02x",
c->x86, c->x86_model, c->x86_stepping);

+ sprintf(meta_name, "intel-ucode/%02x-%02x-%02x.metadata",
+ c->x86, c->x86_model, c->x86_stepping);
+
if (request_firmware_direct(&firmware, name, device)) {
pr_debug("data file %s load failed\n", name);
return UCODE_NFOUND;
}

+ if (request_firmware_direct(&meta_firmware, meta_name, device)) {
+ pr_debug("metadata file %s load failed\n", name);
+ pr_debug("no feature check will be done pre-loading the microcode\n");
+ } else {
+ release_firmware(meta_firmware);
+ }
+
kvec.iov_base = (void *)firmware->data;
kvec.iov_len = firmware->size;
iov_iter_kvec(&iter, WRITE, &kvec, 1, firmware->size);
--
1.8.3.1
\
 
 \ /
  Last update: 2020-04-27 10:09    [W:0.058 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site