Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2631560ybz; Mon, 27 Apr 2020 01:10:32 -0700 (PDT) X-Google-Smtp-Source: APiQypIuUmwzfw6k07Yf0GigHuHMt5uYLgVLAWr6iNoIzR0riE0qRXCXpz4S02bJKAPDlYBK/c9C X-Received: by 2002:a17:906:1e47:: with SMTP id i7mr18753261ejj.61.1587975032689; Mon, 27 Apr 2020 01:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587975032; cv=none; d=google.com; s=arc-20160816; b=AKzyvrETOLjqk8uoytr/PjIgjW+duJmdJJ3ERsYRaA70umzL6z8oAzA5LGuZgDHm3o UwKsSIFDO+v5Cn0xBhQELaooAx9URpFlaHjkgbzSr4cNOlV0ajg2FlGU3ZNwBr8Uo3yh ED2u1DfOQ6ZwgQlvzszYWkH0RhneWapmoN4g5J4t3xaQABuAwrrOjZZ7tdj2XP9zwcRx ovoyN6dAupnHMPGs7LLcyqbnyPQPcirInx8X5+FjQicel1OopxXtRZa3QxmYU6LDxv3l 3bMLxpIHv2w/Eh1cy5u1KOs33Agn9j4BWX3ubjb0zJsC7mK5fR0Dp2QZwgWw6gsNfPUL S8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=eibm6tEh7qd61BAbNPr7TVs9dtNk45qBSvc+9ZYcnrg=; b=ukpeVJviq4rDoVbnZv1tXRMFf4I1BT/QVjlseNgSp8aeegimH1STGSalCr204g8REm CmZ6rpCbrR5NYZ3KUeQScrRpKTBANm/9B4Gg+NLL7EMBnB2WKKqfM6V+ro1WmQbdxUWD b74jrxzOG/8Dd3HHDoxLVIwAicuoEQY+a94oZ9RMLPT5Hdy0k1xwI1QFoL5SI0BCxMeU ul99836u0STDtbziB50tBTM7jsHrkWQP7UmsgpdD/iw3UhOTv7QKvZ/PkhABjVMQs1DY Q4hRMagUW/N5asU3+vzGobjqUyy+bFFzKBSSmrLNH7B3RU6aD5vl/UHYtZYtu4BVmkTJ zX7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=0cDyc8RC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o19si7978896ejm.258.2020.04.27.01.10.10; Mon, 27 Apr 2020 01:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=0cDyc8RC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbgD0IIw (ORCPT + 99 others); Mon, 27 Apr 2020 04:08:52 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:41568 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbgD0IIt (ORCPT ); Mon, 27 Apr 2020 04:08:49 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03R84Var053345; Mon, 27 Apr 2020 08:08:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=eibm6tEh7qd61BAbNPr7TVs9dtNk45qBSvc+9ZYcnrg=; b=0cDyc8RCrY+Xh0V5/+0HR0gl2kgt35MyhXoDVLelHmqSYFTjPB74kiK7WdNrhaI6noD4 C9sWMbG6CtUrCHknscHj7pzgbHLBishf2UwKWiFiXIMiiSrGNk14o9PLBE8bFd9Hq+lr xnsiDhZ4MXkI4wUqAcOGToWNwWSvD94mp5Xq/M43dabjdp50q8oGhVoSgGhQ4r7KfLwn /Z9hXm6ckY4boYS2hWL0aAqE3qOdxPjutqqoJ5aiNMNNy3bWOMdlty7/aUXgEoaqiAAk CrvuTu+UWuJLfj2fk+tasnJLcXlJx3tSV/CIgoayJ4lu9qTu60nALRW+z6HNXgthSjTv tQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 30nucer2fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 08:08:28 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03R871d7172240; Mon, 27 Apr 2020 08:08:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 30my08nbpv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 08:08:27 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03R88J2H016894; Mon, 27 Apr 2020 08:08:19 GMT Received: from mihai.localdomain (/10.153.73.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Apr 2020 01:08:19 -0700 From: Mihai Carabas To: linux-kernel@vger.kernel.org Cc: Mihai Carabas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH RFC 1/3] x86: microcode: intel: read microcode metadata file Date: Mon, 27 Apr 2020 10:27:57 +0300 Message-Id: <1587972479-10971-2-git-send-email-mihai.carabas@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587972479-10971-1-git-send-email-mihai.carabas@oracle.com> References: <1587972479-10971-1-git-send-email-mihai.carabas@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9603 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 suspectscore=1 adultscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270072 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9603 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 suspectscore=1 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270071 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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