From patchwork Mon Nov 7 22:53:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344305wru; Mon, 7 Nov 2022 14:56:19 -0800 (PST) X-Google-Smtp-Source: AMsMyM69OYXH48kg9Ll4KrRbiAmNCsgIus/nZCde2wZXfetUHnn5xinglMf4P06Xs2QMgXsIDstw X-Received: by 2002:aa7:cd58:0:b0:462:d797:483d with SMTP id v24-20020aa7cd58000000b00462d797483dmr54093601edw.343.1667861779232; Mon, 07 Nov 2022 14:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861779; cv=none; d=google.com; s=arc-20160816; b=nf2Rysq8PmslXHINcKgL7vOlp9ToqXyjuvN0ZiZKXJWWurCHZ4PXOmaZfn3Ek3krIf JetmEJVTrVrPgtxKo0nYkWTCp0cPE1VGRc+QHNUhwwbwoP8kT+UozpmMumUn/+2fpsJW JzRfjpIPA52Gf+CKbU4YPAXMomEyIeNGQ3U7F39D0zLEMUkBvKB6q3M72rXmapGZg+eT tbwSsgUYzNhKmrhCCZEbY2WNKgEN/GU98JCotAqob6sEgBZQoOsiJnu0BoKu50F8Q8oM 8euYqIqRJtJgQDylOikV19B5xWgW3MSfCbKsyD7BQgmiHWlIymA8vnAumzKMiTaFM/Qn ULsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=31uAU7YNjIKG6BnCVQASAUaTB00nfFcytfkmuOHWxhk=; b=NeSdWQ5R4CdLWtywDjCt7ys1LMXClnrkHJcVW/DvY3p6b0og77ntUCbssrYjt/ImNJ HiT9CvC+dIlee/TcVhrux7WILv6pG/w8IlHMjliDoXsSTvjBDrPFUUAnYbN7uNb8E2hz h4JqBpTe/rZqHuMtvVxPfX6wArbVockz/zi8O1Y6GCXhvid0uZaOrNgGdR+XDeaWK0wf DS4bpl1VyKr33k/rvcWlV05yqTDJoYIGBbWvU+9HmyuO37kOQMY6R/3I1HYgGR7AHdqi OgWJNCrj+XSwncWBAKDfsZ9i/C7XkaZ6oWa6OMvFxRlT3eiybBNbyK1wRdb4KLK7WeZi 8fjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bqfrtf8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a056402191100b00454599abf52si12786944edz.92.2022.11.07.14.55.55; Mon, 07 Nov 2022 14:56:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bqfrtf8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbiKGWyw (ORCPT + 99 others); Mon, 7 Nov 2022 17:54:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbiKGWyq (ORCPT ); Mon, 7 Nov 2022 17:54:46 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D25D31571D; Mon, 7 Nov 2022 14:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861685; x=1699397685; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MHFgE7gyjINPZEVbivHQy+5kAf7Oj4xtRrBdTlwN9uw=; b=bqfrtf8Qv4LtAXFyVnzQZskyqFrq+3Fw72JMD9qJ7GKDgSZYmqS3rhuE 7hQ6rWeJ6IHf0lZy/iUw49FAPXPv/Z19RTufgC/lgf0OIzP9mqfal84f/ 5j0HVFV8OPaTLoM+OEdyY7+/VdyrTlniG6hDpDHP7Khri39e8T7rL6iAQ w9hcVeJSXYxAgBhcKMsHbl+OivSLOXx+yhVq8A8TwEF352+jezoWj17bo N2yjIpy0WDrN+G1h25KGPG1DNOx3aMnzSRjEZHd/5A8Aj63tvpxFptek/ OyDo0r4pxIWv0aTSuGNCuOKiksj5VCCN7Sl7OA6eyUEhn/DuqfJ5nPZc2 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911819" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911819" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012952" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012952" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:44 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 01/14] platform/x86/intel/ifs: Remove unused selection Date: Mon, 7 Nov 2022 14:53:10 -0800 Message-Id: <20221107225323.2733518-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331193510061542?= X-GMAIL-MSGID: =?utf-8?q?1748879833252869391?= CONFIG_INTEL_IFS_DEVICE is not used anywhere. The selection in Kconfig is therefore pointless. Delete it. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/platform/x86/intel/ifs/Kconfig b/drivers/platform/x86/intel/ifs/Kconfig index c341a27cc1a3..89152d46deee 100644 --- a/drivers/platform/x86/intel/ifs/Kconfig +++ b/drivers/platform/x86/intel/ifs/Kconfig @@ -4,7 +4,6 @@ config INTEL_IFS # Discussion on the list has shown that the sysfs API needs a bit # more work, mark this as broken for now depends on BROKEN - select INTEL_IFS_DEVICE help Enable support for the In Field Scan capability in select CPUs. The capability allows for running low level tests via From patchwork Mon Nov 7 22:53:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344263wru; Mon, 7 Nov 2022 14:56:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM6W5+Vl2R/Q1dXlN4IQyqmydyqM4mxsiv8qlE3teP60IpwQDdltUpj7zZg5pL86TAlK1ncz X-Received: by 2002:a17:907:1c88:b0:7ad:8f76:699e with SMTP id nb8-20020a1709071c8800b007ad8f76699emr49241220ejc.114.1667861771466; Mon, 07 Nov 2022 14:56:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861771; cv=none; d=google.com; s=arc-20160816; b=VTm56VlFTaiSZC6ccXYuEapYAzxlRymtTG7+YQeLTC3HTXimKbXAs7vWu/isE1SYV3 0j3dQr6WDEn2JjhRmmJwr238xQ4qzyRMkv1ECAnwE1gKH9GgKfXt0bnj1XivWOP8/gk1 RiPYoR8/OURD3yc1F50O4EwP1rp3utaoa3jgphpEL4E/sIco6VtkqENc4mffGi+4V4KP X+hnxRj55ezvoVJ5Oi5/tPpRDr8wVwR+Cw6W79bpag9i911YN2gjNBqRo/dwInS16xGN XXWXgde1Hcw/uaBc9+W5QeQ2L49vyatnfJy266Bff58XPyIBHmJi3xNgIgizsEHvRhF5 4EbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wiBJXtTLLUG2NXhmkzcHuFFXxX0k5YNIVLIKIAjsBMU=; b=g0kYz+Ch+1I1FL63LR3HkIBLaXG/mwh9CJ8z6CcmuiW6dIngLeP7c/Roclsi7XE6pT 0zCopQnHxZqWWj6mYroeak/OOPXSmJlvkEW9KmyZ1RZvhn8kjzq+Ys+BgTq556XrV1S2 ehqxQkRuZUu66OiI/QfBmr95tgBqYjv9qco57ySjOiZ2i0vuZGEpP+bedpFpGM1mbMVn 3CAbm4wS/FEwdbTKefYbdJEhNF45omyL3GaZtuE8fdOLlHAddpGmjbY/Q5EACUv8RF5T +HlSK8Dyisx/Biu0EyA5ca3n+TJrjB8Hdz8FWVZcMm0poiJi6MrAQ+c8kJG+80gZC2JX CnXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SIC4Vk8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a056402254600b0045a16f47a9fsi10971448edb.624.2022.11.07.14.55.48; Mon, 07 Nov 2022 14:56:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SIC4Vk8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbiKGWyt (ORCPT + 99 others); Mon, 7 Nov 2022 17:54:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232425AbiKGWyq (ORCPT ); Mon, 7 Nov 2022 17:54:46 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7AC2935D; Mon, 7 Nov 2022 14:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861686; x=1699397686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pUDmXJ81hZPKLSigWUAhVkXDqINWawcz+Tl9WL2UD/A=; b=SIC4Vk8zY3jQAK/+DRD1DbmCEvgHhRvqROTgK/w4O8GI9uazRezPI05y zc9o/G8O4SZ+wX9mdEd7/eWOwSrDfWLDfYhWFyqnG8QgDc9FzJeE/O0Gd G6rLGZCWe+cm6eV/a0Ep730lQHnxGFA1xxeZNbL7ucL9JxkPQP1N7i2ip 1H5fyD20KnhQXDliKwbaAuL+eeIcK9VXFa2mJCq9v7WN/vlobu6QBnhHS ltJNIymTZEXVr6o6cdu7e7bxXmVmp3vmbUkA7dUO3yYWHK+PW332Lk+i1 6YbMRPapMTIAk/Ew87czt7fdMAkP1jgD9SFmomlPjLKOubYbZe1rtLjKw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911822" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911822" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012955" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012955" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 02/14] platform/x86/intel/ifs: return a more appropriate Error code Date: Mon, 7 Nov 2022 14:53:11 -0800 Message-Id: <20221107225323.2733518-3-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331179598573725?= X-GMAIL-MSGID: =?utf-8?q?1748879825136236313?= scan_chunks_sanity_check() returns -ENOMEM if it encounters an error while copying IFS test image from memory to Secure Memory. Return -EIO in this scenario, as it is more appropriate. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/load.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index d056617ddc85..89ce265887ea 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -157,8 +157,10 @@ static int scan_chunks_sanity_check(struct device *dev) INIT_WORK(&local_work.w, copy_hashes_authenticate_chunks); schedule_work_on(cpu, &local_work.w); wait_for_completion(&ifs_done); - if (ifsd->loading_error) + if (ifsd->loading_error) { + ret = -EIO; goto out; + } package_authenticated[curr_pkg] = 1; } ret = 0; From patchwork Mon Nov 7 22:53:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344984wru; Mon, 7 Nov 2022 14:58:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM50lCM0E2QJ1FNaBrbcWdSHdLfEOE6xT/tIUUdVBhNK8D7UDQf7F5XqXJZqcfgPmgBjGLOh X-Received: by 2002:a17:906:8a57:b0:7ad:69fb:3a with SMTP id gx23-20020a1709068a5700b007ad69fb003amr48789833ejc.179.1667861885845; Mon, 07 Nov 2022 14:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861885; cv=none; d=google.com; s=arc-20160816; b=0lBiIsGO+zMD1JHzZ8q9CLDow6LmplwAq83sRStY8BFyeywUeyGmoTAm5C5t/gabFh 3jjEv/JFJBFzGD+s/b/bRko3n0mvV8pLVaWpFp79GEKVEthGyEo+8DAZ7DWXyvreTvM6 zuo/vhqvox+OeviuTJ9+id4WWr/ac2awwarCOFleCiV/3BOBfoOrIitqzFXzAWlr4WfX 6qahbHBDo4QEFgOJOfNe401X+6KimgcwSsg+Xued/Aw1T4WI+BSKp9kzkg1k0OL6tLns NXyDdJK6MJW4VDg0kU9jWGt13K5j3GR32otAUwGQr/whyOD9qQvHsgCsXkcLFd7LR+it THEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oPpMST07F9aprksS2McD5cAFSJjfnPoKIXf09XafdXc=; b=HeDkUbQE5XVCigYV6gX6/uw1LREHzbtwc1L79WLf0aseycVba8jCLjJa4LG2QSV/tQ M+HiDM39mDbtiZbLb9ZDVu2t4xhiKWY5U1tpGbnQI5I6KAUqiazbyZ8oOY0Q4tAG+A0e ym/t/O0MHLRVl22Dyyi14krDXSHUds6yQhPYZppOfjm9dkAXGOmGvKN4Llfv40Y61jfn 24bncAdY/RJneHAso1Y5YpcD1yz6wW3Nnu6+m0aFwCwPUbnOWWTYBoPOYNmS8Je5TJrF w1L+UC3b15++e/cAgxUuXLnFWsFUsvOOX5FcDiasBb0O16X45kyQUSpyXjNpZA0+ylMu zB3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cvcobvUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a50eb92000000b004619253a760si9559184edr.312.2022.11.07.14.57.41; Mon, 07 Nov 2022 14:58:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cvcobvUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232624AbiKGWzD (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232448AbiKGWyr (ORCPT ); Mon, 7 Nov 2022 17:54:47 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AA0DCE0D; Mon, 7 Nov 2022 14:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861686; x=1699397686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dcr0ozJ6OYs4trai4as92Ss4tTrZMrxeoFkgWXi5vd8=; b=cvcobvUuOxu0fgJ4zGlC1gTkVI+z5AXQ5E4yH86KYIsk97mSOBQGScvK 2P6965l89T7qgNGaOQYGFrtf+Az7DwYKmen7pLozyuHCD0Ybv8U4wgGIc Mo3/UZ8zHlXgMgMiNR2rI8LSg/DYh2m+cU+vDm7Lvv5m2yD2TIRSvI30v EgxFg5AZxlrCt9y8uBvNRWghfeyEr67QuNSSwKo2Pi6kzVKwSuY40Ohmq /KVEDT7rgtu7IdVOtOx2oOOeNExEmpSEQ+ACsHo4OqxnLUvbCw4jIHpUD DMDqZTVMUTo8PkmNM2uOPBVB0vJ6U+k7FE3Mv5Z16YKPPe181tRxO9QHP A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911824" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911824" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012960" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012960" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 03/14] platform/x86/intel/ifs: Remove image loading during init Date: Mon, 7 Nov 2022 14:53:12 -0800 Message-Id: <20221107225323.2733518-4-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331231909738895?= X-GMAIL-MSGID: =?utf-8?q?1748879944877321104?= IFS test image is unnecessarily loaded during driver initialization. Drop image loading during ifs_init() and improve module load time. With this change, user has to load one when starting the tests. As a consequence, make ifs_sem static as it is only used within sysfs.c Reviewed-by: Tony Luck Suggested-by: Hans de Goede Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/ifs.h | 2 -- drivers/platform/x86/intel/ifs/core.c | 6 +----- drivers/platform/x86/intel/ifs/sysfs.c | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 73c8e91cf144..3ff1d9aaeaa9 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -229,6 +229,4 @@ void ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); const struct attribute_group **ifs_get_groups(void); -extern struct semaphore ifs_sem; - #endif diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 27204e3d674d..5fb7f655c291 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -51,12 +51,8 @@ static int __init ifs_init(void) ifs_device.misc.groups = ifs_get_groups(); if ((msrval & BIT(ifs_device.data.integrity_cap_bit)) && - !misc_register(&ifs_device.misc)) { - down(&ifs_sem); - ifs_load_firmware(ifs_device.misc.this_device); - up(&ifs_sem); + !misc_register(&ifs_device.misc)) return 0; - } return -ENODEV; } diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 37d8380d6fa8..65dd6fea5342 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -13,7 +13,7 @@ * Protects against simultaneous tests on multiple cores, or * reloading can file while a test is in progress */ -DEFINE_SEMAPHORE(ifs_sem); +static DEFINE_SEMAPHORE(ifs_sem); /* * The sysfs interface to check additional details of last test From patchwork Mon Nov 7 22:53:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344399wru; Mon, 7 Nov 2022 14:56:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM6BEK8Z7YU2gasza94gFkdWDxPqFltY5aJqGrSzbOqwA8wc2d9B7HSyZSRnyCETKOUU3OHO X-Received: by 2002:a05:6402:4511:b0:45c:b2b4:3e69 with SMTP id ez17-20020a056402451100b0045cb2b43e69mr52560074edb.339.1667861792991; Mon, 07 Nov 2022 14:56:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861792; cv=none; d=google.com; s=arc-20160816; b=BHbu3WuJOD1h15qkcCVCgzo6wrBbjaoqgFErcOoglx8h3xyLm3FNA7qdwqin3oDsD0 2AcF55c6y8gACjf3ZB/lc5dd859hQHP9Lru0e+vohNjUO1K1Xs20kRnLGGsxJ/ev1sXW rkxh5TSTSKfC4e2NV7O3KSO+cdh+yGtoWQtT3ORtkXy0NCN1+73WDBg2D/iCcezuDBeD mo2pC+d9VCsS079vWdV8iAu07JKYAvwKQ6ozBJFY5ifpNMx/gucg2/m3FhjAqaXsTBuj ZOVlhIIhN37SFHnsjDqN2fEx64R27zmngRkLUEDrpPh4OaOZ05aFlFm1tDlg482r0XGM jbuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o0JeMBPvmau/Lq8IjpJaasg++a51Lsl5cxVLVABMKV0=; b=iPmJ19yov4Gu5Vd5f9uMIQFafMi+1Ct3l7TCyeC4+i21h6MiuiH2X5leeuu4uZ/01k WlJCA3GmPTo69fTZn3RSoj0cJpfkltkjCiMruycWYm2S1tTCphn6M8zfq+uIFiAoYTV1 jtL9oWBW08X9KXMaqmKr+gbSsCQSUTWuBn5+flSjzz1qvLM6ob0u7mcSsLXdqFQlm96l hMiTb+0wxgeF1J82zaYAp/48Uw7yDvRMMBc5VIrEu1E5JE/2O9o1igXgBeneasDuMKNi VTDE9l+rOVoyjsFPA7itYRzrAJ7WiRgOMWfdNt5phIJT73Ae2I79hR9FEHJ/U3v3oHb7 uTYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VW9GzDD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn4-20020a1709070d0400b007abafd4d7d0si11737113ejc.702.2022.11.07.14.56.09; Mon, 07 Nov 2022 14:56:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VW9GzDD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbiKGWzN (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232422AbiKGWyr (ORCPT ); Mon, 7 Nov 2022 17:54:47 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE17A2A248; Mon, 7 Nov 2022 14:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861686; x=1699397686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xedD5rsR2yMai2pvQoz8bo86kLt8JC/fqw5ikRQeXNM=; b=VW9GzDD9imMwClBKMRKA3mN8/e45msywwT5iLftdbHWpC6vj3TQNWbDg rTsFqPeMJ5SI+uQl/VMBXA3MLpGGxE/nKprCHfWhu8LD+ixPgz7I079SX 8fJeaFADI54H6qxef4IxdZYWn+2K1dPIxAp4voSQTSp5fhr9CqXs3okWb AHoHQWGCEtNcQsqkzZgCyjw+MIClY9ORPBvU8Jrjlmiq9rB2V9nza1wSS oh5j0qi73THOQmQ5pUBC3U9SmvQzVdmjcx/tlZdKQqrABR4dkSozjhs+8 R5/FweD9DV6Rb9qtJh9e99zRzFYuVd2UQUgEMti1yS0wQtZn+UMm4wWfv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911826" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911826" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012966" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012966" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:45 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 04/14] x86/microcode/intel: Expose find_matching_signature() for IFS Date: Mon, 7 Nov 2022 14:53:13 -0800 Message-Id: <20221107225323.2733518-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331226731154380?= X-GMAIL-MSGID: =?utf-8?q?1748879847543707915?= IFS uses 'scan test images' provided by Intel that can be regarded as firmware. IFS test image carries microcode header with extended signature table. Expose find_matching_signature() for verifying if the test image header or the extended signature table indicate whether an IFS test image is fit to run on a system. Move the function to cpu/intel.c and add intel_ prefix to the function name. No functional change Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta --- arch/x86/include/asm/cpu.h | 1 + arch/x86/kernel/cpu/intel.c | 29 ++++++++++++++++++ arch/x86/kernel/cpu/microcode/intel.c | 44 +++++---------------------- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index b472ef76826a..e853440b5c65 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -95,5 +95,6 @@ static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1, } extern u64 x86_read_arch_cap_msr(void); +int intel_find_matching_signature(void *mc, unsigned int csig, int cpf); #endif /* _ASM_X86_CPU_H */ diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 2d7ea5480ec3..b6f9210fb31a 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -216,6 +216,35 @@ int intel_cpu_collect_info(struct ucode_cpu_info *uci) } EXPORT_SYMBOL_GPL(intel_cpu_collect_info); +/* + * Returns 1 if update has been found, 0 otherwise. + */ +int intel_find_matching_signature(void *mc, unsigned int csig, int cpf) +{ + struct microcode_header_intel *mc_hdr = mc; + struct extended_sigtable *ext_hdr; + struct extended_signature *ext_sig; + int i; + + if (intel_cpu_signatures_match(csig, cpf, mc_hdr->sig, mc_hdr->pf)) + return 1; + + /* Look for ext. headers: */ + if (get_totalsize(mc_hdr) <= get_datasize(mc_hdr) + MC_HEADER_SIZE) + return 0; + + ext_hdr = mc + get_datasize(mc_hdr) + MC_HEADER_SIZE; + ext_sig = (void *)ext_hdr + EXT_HEADER_SIZE; + + for (i = 0; i < ext_hdr->count; i++) { + if (intel_cpu_signatures_match(csig, cpf, ext_sig->sig, ext_sig->pf)) + return 1; + ext_sig++; + } + return 0; +} +EXPORT_SYMBOL_GPL(intel_find_matching_signature); + static void early_init_intel(struct cpuinfo_x86 *c) { u64 misc_enable; diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 1fcbd671f1df..4e611a708718 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -45,34 +45,6 @@ static struct microcode_intel *intel_ucode_patch; /* last level cache size per core */ static int llc_size_per_core; -/* - * Returns 1 if update has been found, 0 otherwise. - */ -static int find_matching_signature(void *mc, unsigned int csig, int cpf) -{ - struct microcode_header_intel *mc_hdr = mc; - struct extended_sigtable *ext_hdr; - struct extended_signature *ext_sig; - int i; - - if (intel_cpu_signatures_match(csig, cpf, mc_hdr->sig, mc_hdr->pf)) - return 1; - - /* Look for ext. headers: */ - if (get_totalsize(mc_hdr) <= get_datasize(mc_hdr) + MC_HEADER_SIZE) - return 0; - - ext_hdr = mc + get_datasize(mc_hdr) + MC_HEADER_SIZE; - ext_sig = (void *)ext_hdr + EXT_HEADER_SIZE; - - for (i = 0; i < ext_hdr->count; i++) { - if (intel_cpu_signatures_match(csig, cpf, ext_sig->sig, ext_sig->pf)) - return 1; - ext_sig++; - } - return 0; -} - /* * Returns 1 if update has been found, 0 otherwise. */ @@ -83,7 +55,7 @@ static int has_newer_microcode(void *mc, unsigned int csig, int cpf, int new_rev if (mc_hdr->rev <= new_rev) return 0; - return find_matching_signature(mc, csig, cpf); + return intel_find_matching_signature(mc, csig, cpf); } static struct ucode_patch *memdup_patch(void *data, unsigned int size) @@ -117,7 +89,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne sig = mc_saved_hdr->sig; pf = mc_saved_hdr->pf; - if (find_matching_signature(data, sig, pf)) { + if (intel_find_matching_signature(data, sig, pf)) { prev_found = true; if (mc_hdr->rev <= mc_saved_hdr->rev) @@ -149,7 +121,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne if (!p) return; - if (!find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf)) + if (!intel_find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf)) return; /* @@ -286,8 +258,8 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) size -= mc_size; - if (!find_matching_signature(data, uci->cpu_sig.sig, - uci->cpu_sig.pf)) { + if (!intel_find_matching_signature(data, uci->cpu_sig.sig, + uci->cpu_sig.pf)) { data += mc_size; continue; } @@ -652,9 +624,9 @@ static struct microcode_intel *find_patch(struct ucode_cpu_info *uci) if (phdr->rev <= uci->cpu_sig.rev) continue; - if (!find_matching_signature(phdr, - uci->cpu_sig.sig, - uci->cpu_sig.pf)) + if (!intel_find_matching_signature(phdr, + uci->cpu_sig.sig, + uci->cpu_sig.pf)) continue; return iter->data; From patchwork Mon Nov 7 22:53:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344536wru; Mon, 7 Nov 2022 14:56:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7UF15fuuF0jFlE0jVEHKKEb+xhSCZ/lH1vZhpE8Tq3z4R7Z9KhIYj2SN6GWuFStdDBiOFT X-Received: by 2002:a17:906:2a19:b0:7ae:743c:61be with SMTP id j25-20020a1709062a1900b007ae743c61bemr3923624eje.721.1667861814871; Mon, 07 Nov 2022 14:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861814; cv=none; d=google.com; s=arc-20160816; b=yb4y5FPTaaWmKRIid38J17QTv48Q3f+KlKMOR9JppPkX7Jh6H511zKdZ4qczA1cId/ QWDNvrr7vt55HqvPshmsVqmlGwDTsO0tLKWJRIsruEBTOYjFuSEp4GCCRWE4HRyCkmwS POYpiUbfCdG9m5PUpqJQfnXSKq3YeIiuv+RvK7UNtYIlGqmHudu5K6PgEVmS6YD2kOXM JiycQmzriM+IQ4iVvDcFPkieI4euGYm8OOT8bthE+uPe9Z/VsIN3Yb8ftnptju/gcx5c vyFi0WVpX6Ah1rb0+uGluK5lxcULQigvS5zaZGWaT90PSbLAlAY9c535DZrHVJWJB2/i xh9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pFNsXiBYx92mNDeNQEGarzsbt0DL69XM/sGY6EnnLCw=; b=FWgkeISfCJbIsOyCkBCBJfMb2IrDnHf0fsJnRk0ZgEp4GM2iFkDE45PIB9p2rCQH8t g6kayZT6NAZtNRxhe/TdfpiGtbMT6oivav4DBb9DaFJSPrwiQyLXoC0dbVN/w9Bl3+gv dFukD9sWIbEBQrSRFHhpxsknchJFRtIGQh7cMJU4pdFHH6mXPZ3WPVir6Yae62ZyX7XS WPQVZGUqXVG8Vya62hDfp8wZ9JxgyEMeGEvRXLnldsy+yhYrxSl8wnKWYEYpOTzMcqNa 2h/tcVLTx1Vi0XrFFNTIxThlxO/1D0jlDLC697Vyctf0OTvQDrJUeyyXfWZ+Cq014J1Y j3KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=frxQU7he; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402358c00b004632343b9cesi13178147edc.568.2022.11.07.14.56.31; Mon, 07 Nov 2022 14:56:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=frxQU7he; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232887AbiKGWzK (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232494AbiKGWyr (ORCPT ); Mon, 7 Nov 2022 17:54:47 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FEB226481; Mon, 7 Nov 2022 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861687; x=1699397687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zb6DFxJeoRkypDZP83pg8o1HUltF1td45iw5cJt0xA4=; b=frxQU7hedYdI1/tLDZELMXnTzCFu85PO7Z9W56305HkvwaegKSQXZFza ZWQewH5oDkpUrw5AW/z1W9gcsZzhATvtxmSuGGw31tQ8NWLchJaPvm+Jz nSbnA/DCn9NRLL7etUi5Iiy1mDV1EJ3zAemHFYgKfFNrSUk5kmFimGEjL WLWGFweBU7OBI3UeyejkjtZmcGRSeM3s82F+7c9pPLFBH9mCKBqblMQFA 4V9ITB8UGXI8wMq/HOzxJULApxJsd2+tUgsW8n3zzJqwlhERzXn72tSI7 3dxf54fM9Hnthi9SvChuNkUwAAqXvc+vFJNCyX4tQ6FOr3Fr1LPI0TD94 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911828" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911828" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012970" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012970" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 05/14] x86/microcode/intel: Use appropriate type in microcode_sanity_check() Date: Mon, 7 Nov 2022 14:53:14 -0800 Message-Id: <20221107225323.2733518-6-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331227274266058?= X-GMAIL-MSGID: =?utf-8?q?1748879870322223521?= The data type of print_err parameter used by microcode_sanity_check() is int. In prepration for exporting this function, to be used by the IFS driver, Convert it to a more appropriate bool type for readability. No functional change intended. Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta --- arch/x86/kernel/cpu/microcode/intel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 4e611a708718..234b163806ea 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -135,7 +135,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne intel_ucode_patch = p->data; } -static int microcode_sanity_check(void *mc, int print_err) +static int microcode_sanity_check(void *mc, bool print_err) { unsigned long total_size, data_size, ext_table_size; struct microcode_header_intel *mc_header = mc; @@ -253,7 +253,7 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) mc_size = get_totalsize(mc_header); if (!mc_size || mc_size > size || - microcode_sanity_check(data, 0) < 0) + microcode_sanity_check(data, false) < 0) break; size -= mc_size; @@ -792,7 +792,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter) memcpy(mc, &mc_header, sizeof(mc_header)); data = mc + sizeof(mc_header); if (!copy_from_iter_full(data, data_size, iter) || - microcode_sanity_check(mc, 1) < 0) { + microcode_sanity_check(mc, true) < 0) { break; } From patchwork Mon Nov 7 22:53:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2345302wru; Mon, 7 Nov 2022 14:58:53 -0800 (PST) X-Google-Smtp-Source: AMsMyM5ThETR3GRsLsFTnJ6AG8xlf9nDLirHUAVZRt5asrE223/yvTBBjMWPmlgSKAO4IgkdF/Hb X-Received: by 2002:a05:6402:3546:b0:461:e63f:e870 with SMTP id f6-20020a056402354600b00461e63fe870mr50878805edd.405.1667861933637; Mon, 07 Nov 2022 14:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861933; cv=none; d=google.com; s=arc-20160816; b=x8EbC7Lu8vqyVXjseqQuyAfCqWJBeJmSWDxyCMTBRuuGm7ZJrzitYtImKg3jW1Pyob pkiaLDU57qbB6GHc0zqvlX+i0YAMbw+CJSueL8hladlE75l3YslgRpBGOUUUaD9FPvaA 20cYlNf5oGe52wYbIUJ75Qm9akrgq8f1Lxw1YOXq8Tk7nPjIQK1XYeV5/yDYJFu9agHr lCKZZE3sqxnO8vJJvnjMNT7elz8MLLuJ9ow9X0bzMTRknR1h/M/M/5fU5aGFmGR0A9zY 0WyoKOJcCGLWjIQkuNaRvVEcF5XahhyuubQ+feORcSlZEd5QEktg6JQtPsnOvLgWFH0k Dr/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NrO51LAoH3ks0+Og0l1Q7mtmwJhZ00YjJh6n9+Du71I=; b=gNijwa73jr2bYmikmC7ZSIEHYyI3CMsDUxi40X51iIlxHc1OmdaZMAzx2OQ7ePuTgQ k4X4AgRpLg+Y7FRveA2oXqeWnxImsqNPrUplzZDTvgiFEtGj4ZG1wCz5FPXdjP/WpmQo MNVy3zRDi/GM8TI0kv+zpUXP69hDrgI7r088cFF/LqRR2LWwDSToOa59IMoJIi0STzAx DdcP9oKXGqHkBU8yqTrXkabF8NxoYma3mhtb/C2LLEE0Do2X7tiPHXT3CU8CvvPZ5Rg4 mr2KB8u8uMwmNS/4SmOyVgIWkOLVxWi8+b7baekZbPLJBw4Z28N3RPi/s8LBjFQyan9c Yn7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AgBqnE4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n19-20020a170906165300b007a0f4d6bf83si8302341ejd.305.2022.11.07.14.58.29; Mon, 07 Nov 2022 14:58:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AgBqnE4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231659AbiKGWzU (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232577AbiKGWys (ORCPT ); Mon, 7 Nov 2022 17:54:48 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367A9CE0D; Mon, 7 Nov 2022 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861687; x=1699397687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ar0/IOLoKpjgwdmneDbn5qh+QIaaJXDpP25wZqaQ0CU=; b=AgBqnE4Wz+MWshklAVbE93xkVOvs999vPyB7l7QRcElD3IILTY5kCgEH HvZh5mxKnu1pmo/+5PErtgLTAvQc7gNA3EOOMwK1cWhLWtcZoEV2IZr3L BpiY1xt8lvWPHyyCNWHdd2lUN5FRXGRfh1qTSiTHbktCo9Kq1b8IZOsaP 49SAQhbO/YNKBj2toG6ZFtf/GNAu5lywMG0kTiIGhCA/85gVQeOIp9DMA Iv7KPKUa2A/lS8J8BZV/y7s+FOfXmY7/pN98wYnwMzxpdwwhoJ/1e3/Lg TMKsT4OUGZpAJHX4fSpMCfM/t439xhOMfkvA9HxMUtdaTKl1WUW3sOPsq A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911829" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911829" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012975" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012975" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 06/14] x86/microcode/intel: Expose microcode_sanity_check() Date: Mon, 7 Nov 2022 14:53:15 -0800 Message-Id: <20221107225323.2733518-7-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331272733662935?= X-GMAIL-MSGID: =?utf-8?q?1748879995018495910?= IFS test image carries the same microcode header as regular Intel microcode blobs. Microcode blobs use header version of 1, whereas IFS test images will use header version of 2. microcode_sanity_check() can be used by IFS driver to perform sanity check of the IFS test images too. Refactor header version as a parameter, move it to cpu/intel.c and expose this function. Qualify the function name with intel. Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta --- arch/x86/include/asm/cpu.h | 1 + arch/x86/include/asm/microcode_intel.h | 1 + arch/x86/kernel/cpu/intel.c | 100 ++++++++++++++++++++++++ arch/x86/kernel/cpu/microcode/intel.c | 102 +------------------------ 4 files changed, 104 insertions(+), 100 deletions(-) diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index e853440b5c65..4aff5f263973 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -96,5 +96,6 @@ static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1, extern u64 x86_read_arch_cap_msr(void); int intel_find_matching_signature(void *mc, unsigned int csig, int cpf); +int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_ver); #endif /* _ASM_X86_CPU_H */ diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 4c92cea7e4b5..6626744c577b 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -41,6 +41,7 @@ struct extended_sigtable { #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) #define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) #define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) +#define MICROCODE_HEADER_VER_UCODE 1 #define get_totalsize(mc) \ (((struct microcode_intel *)mc)->hdr.datasize ? \ diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index b6f9210fb31a..f8a5a25ab502 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -245,6 +245,106 @@ int intel_find_matching_signature(void *mc, unsigned int csig, int cpf) } EXPORT_SYMBOL_GPL(intel_find_matching_signature); +int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_ver) +{ + unsigned long total_size, data_size, ext_table_size; + struct microcode_header_intel *mc_header = mc; + struct extended_sigtable *ext_header = NULL; + u32 sum, orig_sum, ext_sigcount = 0, i; + struct extended_signature *ext_sig; + + total_size = get_totalsize(mc_header); + data_size = get_datasize(mc_header); + + if (data_size + MC_HEADER_SIZE > total_size) { + if (print_err) + pr_err("Error: invalid/unknown microcode update format.\n"); + return -EINVAL; + } + + if (mc_header->ldrver != 1 || mc_header->hdrver != hdr_ver) { + if (print_err) + pr_err("Error: invalid/unknown microcode update format. Header version %d\n", + mc_header->hdrver); + return -EINVAL; + } + + ext_table_size = total_size - (MC_HEADER_SIZE + data_size); + if (ext_table_size) { + u32 ext_table_sum = 0; + u32 *ext_tablep; + + if (ext_table_size < EXT_HEADER_SIZE || + ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { + if (print_err) + pr_err("Error: truncated extended signature table.\n"); + return -EINVAL; + } + + ext_header = mc + MC_HEADER_SIZE + data_size; + if (ext_table_size != exttable_size(ext_header)) { + if (print_err) + pr_err("Error: extended signature table size mismatch.\n"); + return -EFAULT; + } + + ext_sigcount = ext_header->count; + + /* + * Check extended table checksum: the sum of all dwords that + * comprise a valid table must be 0. + */ + ext_tablep = (u32 *)ext_header; + + i = ext_table_size / sizeof(u32); + while (i--) + ext_table_sum += ext_tablep[i]; + + if (ext_table_sum) { + if (print_err) + pr_warn("Bad extended signature table checksum, aborting.\n"); + return -EINVAL; + } + } + + /* + * Calculate the checksum of update data and header. The checksum of + * valid update data and header including the extended signature table + * must be 0. + */ + orig_sum = 0; + i = (MC_HEADER_SIZE + data_size) / sizeof(u32); + while (i--) + orig_sum += ((u32 *)mc)[i]; + + if (orig_sum) { + if (print_err) + pr_err("Bad microcode data checksum, aborting.\n"); + return -EINVAL; + } + + if (!ext_table_size) + return 0; + + /* + * Check extended signature checksum: 0 => valid. + */ + for (i = 0; i < ext_sigcount; i++) { + ext_sig = (void *)ext_header + EXT_HEADER_SIZE + + EXT_SIGNATURE_SIZE * i; + + sum = (mc_header->sig + mc_header->pf + mc_header->cksum) - + (ext_sig->sig + ext_sig->pf + ext_sig->cksum); + if (sum) { + if (print_err) + pr_err("Bad extended signature checksum, aborting.\n"); + return -EINVAL; + } + } + return 0; +} +EXPORT_SYMBOL_GPL(intel_microcode_sanity_check); + static void early_init_intel(struct cpuinfo_x86 *c) { u64 misc_enable; diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 234b163806ea..8cd6ecf7dae1 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -135,104 +135,6 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne intel_ucode_patch = p->data; } -static int microcode_sanity_check(void *mc, bool print_err) -{ - unsigned long total_size, data_size, ext_table_size; - struct microcode_header_intel *mc_header = mc; - struct extended_sigtable *ext_header = NULL; - u32 sum, orig_sum, ext_sigcount = 0, i; - struct extended_signature *ext_sig; - - total_size = get_totalsize(mc_header); - data_size = get_datasize(mc_header); - - if (data_size + MC_HEADER_SIZE > total_size) { - if (print_err) - pr_err("Error: bad microcode data file size.\n"); - return -EINVAL; - } - - if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { - if (print_err) - pr_err("Error: invalid/unknown microcode update format.\n"); - return -EINVAL; - } - - ext_table_size = total_size - (MC_HEADER_SIZE + data_size); - if (ext_table_size) { - u32 ext_table_sum = 0; - u32 *ext_tablep; - - if ((ext_table_size < EXT_HEADER_SIZE) - || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { - if (print_err) - pr_err("Error: truncated extended signature table.\n"); - return -EINVAL; - } - - ext_header = mc + MC_HEADER_SIZE + data_size; - if (ext_table_size != exttable_size(ext_header)) { - if (print_err) - pr_err("Error: extended signature table size mismatch.\n"); - return -EFAULT; - } - - ext_sigcount = ext_header->count; - - /* - * Check extended table checksum: the sum of all dwords that - * comprise a valid table must be 0. - */ - ext_tablep = (u32 *)ext_header; - - i = ext_table_size / sizeof(u32); - while (i--) - ext_table_sum += ext_tablep[i]; - - if (ext_table_sum) { - if (print_err) - pr_warn("Bad extended signature table checksum, aborting.\n"); - return -EINVAL; - } - } - - /* - * Calculate the checksum of update data and header. The checksum of - * valid update data and header including the extended signature table - * must be 0. - */ - orig_sum = 0; - i = (MC_HEADER_SIZE + data_size) / sizeof(u32); - while (i--) - orig_sum += ((u32 *)mc)[i]; - - if (orig_sum) { - if (print_err) - pr_err("Bad microcode data checksum, aborting.\n"); - return -EINVAL; - } - - if (!ext_table_size) - return 0; - - /* - * Check extended signature checksum: 0 => valid. - */ - for (i = 0; i < ext_sigcount; i++) { - ext_sig = (void *)ext_header + EXT_HEADER_SIZE + - EXT_SIGNATURE_SIZE * i; - - sum = (mc_header->sig + mc_header->pf + mc_header->cksum) - - (ext_sig->sig + ext_sig->pf + ext_sig->cksum); - if (sum) { - if (print_err) - pr_err("Bad extended signature checksum, aborting.\n"); - return -EINVAL; - } - } - return 0; -} - /* * Get microcode matching with BSP's model. Only CPUs with the same model as * BSP can stay in the platform. @@ -253,7 +155,7 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) mc_size = get_totalsize(mc_header); if (!mc_size || mc_size > size || - microcode_sanity_check(data, false) < 0) + intel_microcode_sanity_check(data, false, MICROCODE_HEADER_VER_UCODE) < 0) break; size -= mc_size; @@ -792,7 +694,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter) memcpy(mc, &mc_header, sizeof(mc_header)); data = mc + sizeof(mc_header); if (!copy_from_iter_full(data, data_size, iter) || - microcode_sanity_check(mc, true) < 0) { + intel_microcode_sanity_check(mc, true, MICROCODE_HEADER_VER_UCODE) < 0) { break; } From patchwork Mon Nov 7 22:53:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344577wru; Mon, 7 Nov 2022 14:57:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM7NE0wBCKdwqu3fFn+14sj7qOPX9O0Z2Yc6RKm79lu8kspzBqhXmyFYMR4pE244v25VyjR/ X-Received: by 2002:a05:6402:94e:b0:463:525e:8738 with SMTP id h14-20020a056402094e00b00463525e8738mr44977393edz.154.1667861820503; Mon, 07 Nov 2022 14:57:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861820; cv=none; d=google.com; s=arc-20160816; b=Uzaf7+5YcJU8Q5fn1e5a6/qwuZoaG82jQOKUolLhm6/Ze2OQmBZewVm4XIbbAGXPqS CXXU9R5/HK0T1f3q3SO6HtlgIhUsOeWNtwzs5ST5OlVM/rIJ3LtXBeJXN4nPo2r37QdC NV2Y+kw8BucFP3bMDStOappLGofBLgmqpkUtpC3tXVVs98p96qk6Kg99+uIUGofRqoGd 8QAKNTijqjTzocE5kNCiTu1KuscAVOw/mXLomPCyVP3PMTKP7Z1mxNsmqlE6kSIxHGdq mIviJCRBwdy245C59gnvEKrHXaYfp58iCzmD4mAuHsMipbj5q5VVWg67ApQnQ8uRX/gc DTxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BH3dxHp+0Wwt9pSTp0kjlb7YOygIF2D7Qcg664D7uP4=; b=xh4AgBEJFoSf72t7zCDJ2URIq+vWPSQQWWaPjFNSRFT/mmgB+3EZzPOh8q9GUyCcp6 A9ZebniQ21TrbWh/wUHEYccXiep0/PU94WqWFWPucRwuBJi+4UIS5nCbXGQ0hBbZso5R XxRsCep9XWJQV2PCJw6Oa81td6o7PV6LbTLx9B3w3n5kX95X/u3axY3ZcyH7StH/HtrP NmRu5M+WzIzotPSTylnS3tRG8Ia0Zst0ENQLmZyDH7H7fzEZs23MOoNUX4ZngmsRG92q NdL4Q6MwSj2JwrzX9DqpH6folq0lJX7m1+s+dkBlpTe7bMpxMrmkuO8rezh7ScjbTrEY slFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Qd/I8lbY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp15-20020a170906c14f00b007adbeb3798asi9924326ejc.482.2022.11.07.14.56.37; Mon, 07 Nov 2022 14:57:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Qd/I8lbY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232901AbiKGWzR (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiKGWys (ORCPT ); Mon, 7 Nov 2022 17:54:48 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B01B31571D; Mon, 7 Nov 2022 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861687; x=1699397687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9L4yTAcmbDrd8Wtf0AHUAz+/qaAhDmvRMsfLMW5DI0M=; b=Qd/I8lbYgrP7VLxd+crsq3YA+4cxOBiFlk+JYPLPEMapMkbE68ltwEgS yHdlgoNwkn3Cwd6qCuuZW60ys8yYNfbQSihIS9wIn79Yb2Ml70rcxmCMS 7RlcFVwczpZOBZmn/c+aHMpRJ1V51qscF8sPXTG0DvzTeuj9yfpM+Qnof EPXDDsHYtiYtesQd3B4cS7n+iFy5rrmU5Lh9+o0wr+sIBFjc957p4weEd GPxrjGNJExe/Xzf4vEuxjOtGSz8Tcbf87bnW+LYxTGsthnqZxhgisYmQu PyOSgQnT9SViiXwZDSBhc9abULaH7CyRypAPqcJUvSVE+42ex5M5ngzsf A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911831" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911831" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012979" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012979" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:46 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 07/14] x86/microcode/intel: Use a reserved field for metasize Date: Mon, 7 Nov 2022 14:53:16 -0800 Message-Id: <20221107225323.2733518-8-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748879876360478617?= X-GMAIL-MSGID: =?utf-8?q?1748879876360478617?= Intel is using microcode file format for IFS test images too. IFS test images use one of the existing reserved fields in microcode header to indicate the size of the region in the file allocated for metadata structures. In prepration for this, rename first of the existing reserved fields in microcode header to metasize. In subsequent patches IFS specific code will make use of this field while parsing IFS images. Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta --- arch/x86/include/asm/microcode_intel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 6626744c577b..0ff4545f72d2 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -14,7 +14,8 @@ struct microcode_header_intel { unsigned int pf; unsigned int datasize; unsigned int totalsize; - unsigned int reserved[3]; + unsigned int metasize; + unsigned int reserved[2]; }; struct microcode_intel { From patchwork Mon Nov 7 22:53:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344612wru; Mon, 7 Nov 2022 14:57:05 -0800 (PST) X-Google-Smtp-Source: AMsMyM6IGIluSXJdfkVX339UxyFhYWitFHFCi318ge3p1ipi/wFXgQ0W2i8sLQIUEqZC6AX1eJ6H X-Received: by 2002:a17:907:75f2:b0:7ad:e51e:837f with SMTP id jz18-20020a17090775f200b007ade51e837fmr38522076ejc.0.1667861824920; Mon, 07 Nov 2022 14:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861824; cv=none; d=google.com; s=arc-20160816; b=vibW4+yLFANOmRwvNhTUyPG5OKRpcqdYxayrii6ECLkXsc/TvVOoENVdLGDhmdu9hH kF08vL7XXnL6FLSyci3KEe3Y3++ZZP+NzsmCxVXW2yzi8x37LNRl7Ga2bEekRDN8WhNJ csyLuo0/wQbhgaBBIVV56FYxZrcg3N7Jc88tQa7Sliv8WkYha5OPWKwc8PsSO7EqTL8U AZHppfICFQ1G0XVgyCfw/VTIxS1kPNSX9ib8dwFk9A75lvZGrLW8rh81SzU6cV6vS1h3 Ep8c6KEvuAcY7OXSpz+eQTMTsZRp6lXfXKiOaKvdKoDnqjdTdUYREipgImMRA5uBAfSn s2HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mhmbWWu0P1Dy8eol9kckohgVUJphcqG9Q8sy6Dw48pA=; b=RAaoXCHSXs8+Wyq+V5T3ADqsbDdqg9jUd9TPCLCCc7M905c8U5DhhUn0bKPngUVPrw eqNX4SDeG9cVisfsg7chZq1Udi4ZximJ3MixQW+B6AAb8Dd/VAYoWhOMUumDg4k17GkA 4JWiNKhbITNtSoI6T/xLFNqDlrEvNvAhsgUVmuus01dGeAEYxawzsp6FYhffHLFEraJ4 6ZNk1ewVsOaPc5Xlr+BUqq2AbEPUGQr83cbnDvKUd5/MGMOBuQwaft6V/Z1xUGW0r1AW Bi7RQRFF2zv0QYGhLZa9lszEz57Zy4uwJoO38yn1xWgnaYE4WNWwygWHdbYGAncIRUgR 5xwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k9Qw2A+r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a056402190e00b004643f382880si12520872edz.401.2022.11.07.14.56.41; Mon, 07 Nov 2022 14:57:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k9Qw2A+r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232448AbiKGWzX (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232387AbiKGWys (ORCPT ); Mon, 7 Nov 2022 17:54:48 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09B62935D; Mon, 7 Nov 2022 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861687; x=1699397687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mk+Vz7rzmu4MdLLvCybyRG1sgfbqtsuXJMMpfrS3JGA=; b=k9Qw2A+r8FatH5CZrGoYG91w+ZON67gClZegulWPYfIPb93vRDiBaWom treX+UEOe3bnPfsWwkW9tDUnhp4YLwyyVf6+45ODKrR9YUP30CtNle5xP J647rztBHX3P88YjKfQDDN6Ix9A7XF+nptwhRRGNDPBF9VnZ45FvUEC4v jPbfCvKNbhD+sULUNntUdl/YhjM5j8j2lFMJNlA5PZOUOrXyT48ZKpqFL BEZ93JkbkOVC3CtGIk9V0ev1KhbK+FMzf5WZWGZRdWN+Vg3rdUDHfwTY0 xpGNXOQTlCf5nP2x8ztaPx1ZlSg+jC33lOUB+Hn+tL/OAoITVmdg7zZ51 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911834" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911834" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012982" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012982" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:47 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 08/14] platform/x86/intel/ifs: Add metadata support Date: Mon, 7 Nov 2022 14:53:17 -0800 Message-Id: <20221107225323.2733518-9-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748879880756249924?= X-GMAIL-MSGID: =?utf-8?q?1748879880756249924?= From: Ashok Raj One of the existing reserved fields in microcode header has been allocated to indicate the size for metadata structures. The metadata section within microcode header is as shown below: Microcode Format +----------------------+ Base |Header Version | +----------------------+ |Update revision | +----------------------+ |Date DDMMYYYY | +----------------------+ |Sig | +----------------------+ |Checksum | +----------------------+ |Loader Version | +----------------------+ |Processor Flags | +----------------------+ |Data Size | +----------------------+ |Total Size | +----------------------+ |Meta Size | +----------------------+ |Reserved | +----------------------+ |Reserved | +----------------------+ Base+48 | | | | | | | | | Microcode | | | | Data | | | | | +----------------------+ Base+48+data_size- | | meta_size | Meta Data | | structure(s) | | | +----------------------+ Base+48+data_size | Extended Signature | | Table | | | | | | | | | | | +----------------------+ Base+total_size Add an accessor function which will return a pointer to the start of a specific meta_type being queried. In subsequent patches, IFS test image file (which reuse microcode header format) will make use of metadata section. Reviewed-by: Tony Luck Signed-off-by: Ashok Raj Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/load.c | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 89ce265887ea..60ba5a057f91 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -44,6 +44,38 @@ static const char * const scan_authentication_status[] = { [2] = "Chunk authentication error. The hash of chunk did not match expected value" }; +#define META_TYPE_END (0) + +struct metadata_header { + unsigned int type; + unsigned int blk_size; +}; + +static struct metadata_header *ifs_find_meta_data(void *ucode, unsigned int meta_type) +{ + struct metadata_header *meta_header; + unsigned long data_size, total_meta; + unsigned long meta_size = 0; + + data_size = get_datasize(ucode); + total_meta = ((struct microcode_intel *)ucode)->hdr.metasize; + + if (!total_meta) + return NULL; + + meta_header = (ucode + MC_HEADER_SIZE + data_size) - total_meta; + + while ((meta_header->type != META_TYPE_END) && meta_header->blk_size && + meta_size < total_meta) { + meta_size += meta_header->blk_size; + if (meta_header->type == meta_type) + return meta_header; + + meta_header = (void *)meta_header + meta_header->blk_size; + } + return NULL; +} + /* * To copy scan hashes and authenticate test chunks, the initiating cpu must point * to the EDX:EAX to the test image in linear address. From patchwork Mon Nov 7 22:53:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2345358wru; Mon, 7 Nov 2022 14:59:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM7o9awNy2FL0W3mHID/gjCYE89vY+1CEt6GadGrKr5sScgywVvaYnPRpwCrcA76zfqWnbbR X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr51356846ejc.676.1667861942542; Mon, 07 Nov 2022 14:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861942; cv=none; d=google.com; s=arc-20160816; b=pdz4Qndl2JQnSfKWTQ3VAbpHy+tO5J7zPzyoZkXfjVTVSExtuIXzTl3EJYwHtPmk+w 2tbaSviSxWrKFygAq4ijlUdcXKd7ND9JiTAqhtToQUGw4DAlRY0usj0AJabRg2AGCETx XYUUHThCGgOUqAQUWrLkbemB5Zyn5FYPl8imJrn2CHtBVqeTsIiSvYudXc6nUVWMVVei BBgm6JHnCkNoHNstdEMhtNWE6Y+0mnZJfdmhVW3aUvVhvZesHLXEWCBx2/K0FH4cSTf9 DNCKzrbmWFq+VReMe0FDMlTENgw0cSM1okWA2mUdQDNMXUX4NV9C7f/GAFpx2UEF5PQ4 8gJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O8VWgEHhpYOmEMLuke6f11h1QXoC+1SOWJ1KHp7OdWQ=; b=QwfbWjvrhpXCONIS83kZisLuRes4svrEoBvhw/6gtalfKNk3DCuvOc+f+exih3T4Rd 8QBFwoOFnlTq13pInJ8nxaIp8ToNTMhk0EDbVSRMI1YmHzk+PjJsB3ai/KEY9tWiP0Ja p/Ky+ueWtriIDCZ4r87aMvrXmLAkckPcNo4ni4r+9jtClZT0A8kfCaTs743OSji+2Ql7 NmLByTzSeohMAw5ZwYAZVyfn3ip8xe9zx9nzbSfw5YIyRbh3qmykcfNAfxJYSAL2wiNb TCi7b/uSR73I3opsfDv6jz85uylbVUbZYkz9p+JLCEl3s3P0iUn1dLU+i9mX89IJD48N nACg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bsrB++UX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm20-20020a170907949400b007adc3b6dcfdsi12135362ejc.392.2022.11.07.14.58.39; Mon, 07 Nov 2022 14:59:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bsrB++UX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbiKGWz1 (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232699AbiKGWyt (ORCPT ); Mon, 7 Nov 2022 17:54:49 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34DA32A264; Mon, 7 Nov 2022 14:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861688; x=1699397688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xk3wu53viXULrrqCXnqhCdTb0C0obxsJ7pgLlcSNlt0=; b=bsrB++UX/5sluX0u6/0rTbzzH4ly1Z3dRoG+hQxNPlgxBLRGL0HxVogN 4244CGI8yC027BXqvZ9gWakm1f2CdGzjP21YSUB2CQBtGzef2Wi80CUus BakUcDPwVH0HmR2Wy2pL18rOhf5XEKA06nNJJ7KHb78f5ExdMmGV14XcI Uf41cAkEh0/H8KhobzrgjMnCmnNgBqmD26pqH1S5w8CFVFFOsLgzza7lR zvTWjxx6VqA6lpV8tDeFkrNDr99Xxmuj5I/px+p59iuQre5T1agELC2jP tJvM3rdvYexZt56Jf36NVLVRwcroQTOiMl4DyjUV0YcT19EV+MJ1omzvd Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911835" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911835" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:48 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012985" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012985" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:47 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 09/14] platform/x86/intel/ifs: Use generic microcode headers and functions Date: Mon, 7 Nov 2022 14:53:18 -0800 Message-Id: <20221107225323.2733518-10-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331280254736478?= X-GMAIL-MSGID: =?utf-8?q?1748880004299165718?= Existing implementation (broken) of IFS used a header format (for IFS test images) which was very similar to microcode format, but didn’t accommodate extended signatures. This meant same IFS test image had to be duplicated for different steppings and the validation code in the driver was only looking at the primary header parameters. Going forward IFS test image headers has been tweaked to become fully compatible with microcode format. Newer IFS test image headers will use microcode_header_intel->hdrver = 2, so as to distinguish it from microcode images and older IFS test images. In light of the above, use struct microcode_header_intel directly in IFS driver instead of duplicating into a separate ifs_header structure. Further use existing microcode_sanity_check() and find_matching_signature() directly instead of implementing separate ones within the driver. More IFS specific checks will be added subsequently. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- arch/x86/include/asm/microcode_intel.h | 1 + drivers/platform/x86/intel/ifs/load.c | 102 +++++-------------------- 2 files changed, 20 insertions(+), 83 deletions(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 0ff4545f72d2..f905238748fc 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -43,6 +43,7 @@ struct extended_sigtable { #define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) #define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) #define MICROCODE_HEADER_VER_UCODE 1 +#define MICROCODE_HEADER_VER_IFS 2 #define get_totalsize(mc) \ (((struct microcode_intel *)mc)->hdr.datasize ? \ diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 60ba5a057f91..7c0d8602817b 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -8,22 +8,8 @@ #include "ifs.h" -struct ifs_header { - u32 header_ver; - u32 blob_revision; - u32 date; - u32 processor_sig; - u32 check_sum; - u32 loader_rev; - u32 processor_flags; - u32 metadata_size; - u32 total_size; - u32 fusa_info; - u64 reserved; -}; - -#define IFS_HEADER_SIZE (sizeof(struct ifs_header)) -static struct ifs_header *ifs_header_ptr; /* pointer to the ifs image header */ +#define IFS_HEADER_SIZE (sizeof(struct microcode_header_intel)) +static struct microcode_header_intel *ifs_header_ptr; /* pointer to the ifs image header */ static u64 ifs_hash_ptr; /* Address of ifs metadata (hash) */ static u64 ifs_test_image_ptr; /* 256B aligned address of test pattern */ static DECLARE_COMPLETION(ifs_done); @@ -150,33 +136,18 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) */ static int scan_chunks_sanity_check(struct device *dev) { - int metadata_size, curr_pkg, cpu, ret = -ENOMEM; struct ifs_data *ifsd = ifs_get_data(dev); + int curr_pkg, cpu, ret = -ENOMEM; bool *package_authenticated; struct ifs_work local_work; - char *test_ptr; package_authenticated = kcalloc(topology_max_packages(), sizeof(bool), GFP_KERNEL); if (!package_authenticated) return ret; - metadata_size = ifs_header_ptr->metadata_size; - /* Spec says that if the Meta Data Size = 0 then it should be treated as 2000 */ - if (metadata_size == 0) - metadata_size = 2000; - - /* Scan chunk start must be 256 byte aligned */ - if ((metadata_size + IFS_HEADER_SIZE) % 256) { - dev_err(dev, "Scan pattern offset within the binary is not 256 byte aligned\n"); - return -EINVAL; - } - - test_ptr = (char *)ifs_header_ptr + IFS_HEADER_SIZE + metadata_size; ifsd->loading_error = false; - - ifs_test_image_ptr = (u64)test_ptr; - ifsd->loaded_version = ifs_header_ptr->blob_revision; + ifsd->loaded_version = ifs_header_ptr->rev; /* copy the scan hash and authenticate per package */ cpus_read_lock(); @@ -203,67 +174,33 @@ static int scan_chunks_sanity_check(struct device *dev) return ret; } -static int ifs_sanity_check(struct device *dev, - const struct microcode_header_intel *mc_header) +static int ifs_image_sanity_check(struct device *dev, const struct microcode_header_intel *data) { - unsigned long total_size, data_size; - u32 sum, *mc; - - total_size = get_totalsize(mc_header); - data_size = get_datasize(mc_header); + struct ucode_cpu_info uci; - if ((data_size + MC_HEADER_SIZE > total_size) || (total_size % sizeof(u32))) { - dev_err(dev, "bad ifs data file size.\n"); + /* Provide a specific error message when loading an older/unsupported image */ + if (data->hdrver != MICROCODE_HEADER_VER_IFS) { + dev_err(dev, "Header version %d not supported\n", data->hdrver); return -EINVAL; } - if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { - dev_err(dev, "invalid/unknown ifs update format.\n"); + if (intel_microcode_sanity_check((void *)data, true, MICROCODE_HEADER_VER_IFS)) { + dev_err(dev, "sanity check failed\n"); return -EINVAL; } - mc = (u32 *)mc_header; - sum = 0; - for (int i = 0; i < total_size / sizeof(u32); i++) - sum += mc[i]; + intel_cpu_collect_info(&uci); - if (sum) { - dev_err(dev, "bad ifs data checksum, aborting.\n"); + if (!intel_find_matching_signature((void *)data, + uci.cpu_sig.sig, + uci.cpu_sig.pf)) { + dev_err(dev, "cpu signature, processor flags not matching\n"); return -EINVAL; } return 0; } -static bool find_ifs_matching_signature(struct device *dev, struct ucode_cpu_info *uci, - const struct microcode_header_intel *shdr) -{ - unsigned int mc_size; - - mc_size = get_totalsize(shdr); - - if (!mc_size || ifs_sanity_check(dev, shdr) < 0) { - dev_err(dev, "ifs sanity check failure\n"); - return false; - } - - if (!intel_cpu_signatures_match(uci->cpu_sig.sig, uci->cpu_sig.pf, shdr->sig, shdr->pf)) { - dev_err(dev, "ifs signature, pf not matching\n"); - return false; - } - - return true; -} - -static bool ifs_image_sanity_check(struct device *dev, const struct microcode_header_intel *data) -{ - struct ucode_cpu_info uci; - - intel_cpu_collect_info(&uci); - - return find_ifs_matching_signature(dev, &uci, data); -} - /* * Load ifs image. Before loading ifs module, the ifs image must be located * in /lib/firmware/intel/ifs and named as {family/model/stepping}.{testname}. @@ -284,12 +221,11 @@ void ifs_load_firmware(struct device *dev) goto done; } - if (!ifs_image_sanity_check(dev, (struct microcode_header_intel *)fw->data)) { - dev_err(dev, "ifs header sanity check failed\n"); + ret = ifs_image_sanity_check(dev, (struct microcode_header_intel *)fw->data); + if (ret) goto release; - } - ifs_header_ptr = (struct ifs_header *)fw->data; + ifs_header_ptr = (struct microcode_header_intel *)fw->data; ifs_hash_ptr = (u64)(ifs_header_ptr + 1); ret = scan_chunks_sanity_check(dev); From patchwork Mon Nov 7 22:53:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344630wru; Mon, 7 Nov 2022 14:57:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM6cd2K3moz/y+1yLIPQ+0D7I4/rLS112LqkmS+YF99ZPcGoMG+k/vAavVL7Q8ckYUWbMqNx X-Received: by 2002:a17:906:9253:b0:7ae:5a6:22f8 with SMTP id c19-20020a170906925300b007ae05a622f8mr29488389ejx.108.1667861826877; Mon, 07 Nov 2022 14:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861826; cv=none; d=google.com; s=arc-20160816; b=T+z4fRIBQ5V1Dn+mjU0zEhOitHEk8hj7b2AYjD6L9BkLCFAj/9pSU2+zdsqiFkykUi sKaH0z6el/QOdw+an06CCwJ+QqQGIJXCB6UoiAQP76MFLZMWfVWFCmNGSwnHpmOPWlOY 7InFn7ZVHsZ8Ta8iVtTMzuSoAyacUInQeTVNizGli4wtgiK/EgdYH72jBiWIgrkprEDK B7qyNfTHiyKtJjoEoL/k/vQ+eleC6TgjbEwkZ3ZQlSSAqasQauSkK9v1X1y3ZmzvKhdj hcrELvKO633082/Hp7HGIpJdwOqbGvb/rIS4JwGQRY7Aojs+Xw1sMPQ9uwFqAKBXCvFw VyqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=All8fpxQH7+AGdmxvWVwvxabtptSw6mc6/U9gulcORQ=; b=jHhFlwQmNjk/wqdAgJXaOYxrhBmW109puV8tT2fdN6s8dvOaQ24CNieq1GztaOoxC+ mf/CLCahwX9+Od26+FNuQFgxrWKBqn9PLnO9rcQF1qzUWvkrW8TORAlFUjabZoCdGnIP lj0IVAJfZucrQAn5VQK02cJb0ZO5JqGSOsaIwyi4U+/2juYoTPUZAVKj07bAFzuCdkfO QAdGO5epyzwvLHIC1N3rEo3W0M1dPK1GeBvc6IUNcGbf3jz48G4O87gmkbZFP2YgiVc3 2JqnsxOH6MXLSZEk7G/r456q+5l0YYE+Ap8w71jiyv1U2/0mUR9W6Y1qhNFoDCikL2ah B2Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pbwsfgym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs20-20020a170906dc9400b0079b40c09982si10664459ejc.340.2022.11.07.14.56.43; Mon, 07 Nov 2022 14:57:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pbwsfgym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbiKGWzc (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232693AbiKGWyt (ORCPT ); Mon, 7 Nov 2022 17:54:49 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86C941571D; Mon, 7 Nov 2022 14:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861688; x=1699397688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WqEb7bkqzB9awU+zIFi5Shc5FWp2eKID0NmWlt0sCJQ=; b=PbwsfgymAIVonXFszJxQ2sEZmMInoSMtQugjnXwJaYqcRhjFY6cA2fAd MBoM/YYySfXsstmGy9doGRGByne+N2325rzGZ85F7IS0WbYkNDHs6XdDq GRaCpqYVQcq1wm/E5tbMJvbImXMEnUMOfXOUF4IPA9305vIYgBMsQOyDV EihQq3zfafeti/NXz+ZZZgoYstgEjTsVbO8evxtPDFQlpm1x1GnB6aIIy xc1lUnFIeg23oYdQNBM9n0Q1I+ap6pUd5QzDwgjKlepHVJ8pytB6Uzz5a fG7/m15TgSzeK2cw/W37Cgo7vavS3LfyPbJ8wOjSFpo4GwvXYMFZg2up/ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911836" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911836" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:48 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012988" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012988" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:47 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 10/14] platform/x86/intel/ifs: Add metadata validation Date: Mon, 7 Nov 2022 14:53:19 -0800 Message-Id: <20221107225323.2733518-11-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331215878125259?= X-GMAIL-MSGID: =?utf-8?q?1748879883040782014?= The data portion of IFS test image file contains a metadata region containing possibly multiple metadata structures in addition to test data and hashes. Introduce the layout of this meta_data structure and validate the sanity of certain fields of the new image before loading. Tweak references to IFS test image chunks to reflect the updated layout of the test image. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/ifs.h | 2 + drivers/platform/x86/intel/ifs/load.c | 53 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 3ff1d9aaeaa9..98ca91bdd5ca 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -196,6 +196,7 @@ union ifs_status { * @valid_chunks: number of chunks which could be validated. * @status: it holds simple status pass/fail/untested * @scan_details: opaque scan status code from h/w + * @cur_batch: number indicating the currently loaded test file */ struct ifs_data { int integrity_cap_bit; @@ -205,6 +206,7 @@ struct ifs_data { int valid_chunks; int status; u64 scan_details; + int cur_batch; }; struct ifs_work { diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 7c0d8602817b..f361fd42a320 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -8,7 +8,23 @@ #include "ifs.h" +struct meta_data { + unsigned int meta_type; // metadata type + unsigned int meta_size; // size of this entire struct including hdrs. + unsigned int test_type; // IFS test type + unsigned int fusa_info; // Fusa info + unsigned int total_images; // Total number of images + unsigned int current_image; // Current Image # + unsigned int total_chunks; // Total number of chunks in this image + unsigned int starting_chunk; // Starting chunk number in this image + unsigned int size_per_chunk; // size of each chunk + unsigned int chunks_per_stride; // number of chunks in a stride + unsigned int reserved[54]; // Align to 256 bytes for chunk alignment. +}; + #define IFS_HEADER_SIZE (sizeof(struct microcode_header_intel)) +#define META_TYPE_IFS 1 +#define IFS_CHUNK_ALIGNMENT 256 static struct microcode_header_intel *ifs_header_ptr; /* pointer to the ifs image header */ static u64 ifs_hash_ptr; /* Address of ifs metadata (hash) */ static u64 ifs_test_image_ptr; /* 256B aligned address of test pattern */ @@ -129,6 +145,40 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) complete(&ifs_done); } +static int validate_ifs_metadata(struct device *dev) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + struct meta_data *ifs_meta; + char test_file[64]; + int ret = -EINVAL; + + snprintf(test_file, sizeof(test_file), "%02x-%02x-%02x-%02x.scan", + boot_cpu_data.x86, boot_cpu_data.x86_model, + boot_cpu_data.x86_stepping, ifsd->cur_batch); + + ifs_meta = (struct meta_data *)ifs_find_meta_data(ifs_header_ptr, META_TYPE_IFS); + if (!ifs_meta) { + dev_err(dev, "IFS Metadata missing in file %s\n", test_file); + return ret; + } + + ifs_test_image_ptr = (u64)ifs_meta + sizeof(struct meta_data); + + /* Scan chunk start must be 256 byte aligned */ + if (!IS_ALIGNED(ifs_test_image_ptr, IFS_CHUNK_ALIGNMENT)) { + dev_err(dev, "Scan pattern offset is not 256 byte aligned in %s\n", test_file); + return ret; + } + + if (ifs_meta->current_image != ifsd->cur_batch) { + dev_warn(dev, "Mismatch between filename %s and batch metadata 0x%02x\n", + test_file, ifs_meta->current_image); + return ret; + } + + return 0; +} + /* * IFS requires scan chunks authenticated per each socket in the platform. * Once the test chunk is authenticated, it is automatically copied to secured memory @@ -145,6 +195,9 @@ static int scan_chunks_sanity_check(struct device *dev) if (!package_authenticated) return ret; + ret = validate_ifs_metadata(dev); + if (ret) + return ret; ifsd->loading_error = false; ifsd->loaded_version = ifs_header_ptr->rev; From patchwork Mon Nov 7 22:53:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344652wru; Mon, 7 Nov 2022 14:57:09 -0800 (PST) X-Google-Smtp-Source: AMsMyM6/AJ7BZZ4dl9yHq4JqPaqwaxVOtjmQKUIWEZvntl/+wAQYq3ux9eHynDJKi169Z2gU6aR6 X-Received: by 2002:aa7:c0cf:0:b0:463:8ba0:522f with SMTP id j15-20020aa7c0cf000000b004638ba0522fmr41461881edp.176.1667861829568; Mon, 07 Nov 2022 14:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861829; cv=none; d=google.com; s=arc-20160816; b=ubIrxSoiRn/aRK2I1vFjxtkPu77LHTDuQMJIkMpklyhM7VDiZHGl9QNOSn+toF7vX8 EGONujJ0AY4MJgpIaKSpdWbu5ZRreWgtQu4JD8MkoUIx0k9tsQVNpzVjZMrOSL44AGtN WhMsnWtYHcMifwtCYhW1jY6BXPv8svi7OuLsXjqt1otkcmJ7i5qEMCTZyWIztDQhiiKW AeMH72od1pJJyk9ppq0NAWiXpWNO6h2UkXoI6NNzJQNrxjRFmEIzjJREZYH5kp6wEEVW DxFWJJnxZCkomE1gblQUjLJXJ1auMoAKpBJI62jnTxb6osqKXebk8zO/5+b1fynixW+7 wTrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5+xUC75pc7XrJUptIRS+LUax3plYbE0tQGAA58sW+vk=; b=OVEIq40rZAem8RAZAo0vlSjo+bV4XSgr8T82ZaZTmtlJj3+yXxLVhBCIW40kSjpfa2 UoQLtaR8b8C+1l6/tUVHmaq+vTAYglKb1gC6/nv8lqYf4/oBOwc+erBmuPdBf8onTBkT /qRawzf9k00xTqgD+5AiYOxJhsxcYzxR6VVF5XDsZ77eFWQ0cfjFlm/wlAcxngRtot1J Qc1wVM0FeY0GrKZiOPS7CQxSsC/hJcqJZtkIcayghSlVqn3vqzSUJdR3FGkV3z9e5kBw N1VhiwD5r1FiXk/4I/f+xoBPU9dG0sPFni/kAOXcyAlOzp7PFK+fWz9wDvWXnYhjD4Ev 9MMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BZcnB+Cx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd18-20020a1709069b9200b007adadff675fsi13427800ejc.313.2022.11.07.14.56.46; Mon, 07 Nov 2022 14:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BZcnB+Cx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbiKGWzg (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232712AbiKGWyt (ORCPT ); Mon, 7 Nov 2022 17:54:49 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEE62935D; Mon, 7 Nov 2022 14:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861689; x=1699397689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w7zyU0EMZtiBlCMi0pWV2TZ8XEkOY6y3ce2a9bhJ6dI=; b=BZcnB+CxME1goxSDHKYZq6aUQTYRBlC0FG3CyYZHi7R42k3ZLnXUStjX zamkIxAGfDwMnLWs+b2r5St3lIepPgG/6A93inKwD4ZVmgojRLU7GYuSj 2cPMuXoD0tOlzRU+Pk+fgcqH9aAP4LAvxbqoxNMvhwR//OCyKmaM7H5f9 PaIyJY12Mng4cYUw5RhHzcqoS5kBo/oRVaUaQb8mhfcqCKeGVQCcdRrmH WJupKc7xxJQFW03BfxAChGrwXO7pktE8BlraFvHLTMxoaFv1IG1ibwAv3 obDbZXPMw9x87+MpCJZHzz6BaqqXYAZskuML6QW0Q/7kfPsWeL8wguhKU g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911839" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911839" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:49 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012991" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012991" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:48 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 11/14] platform/x86/intel/ifs: Remove reload sysfs entry Date: Mon, 7 Nov 2022 14:53:20 -0800 Message-Id: <20221107225323.2733518-12-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331272330861188?= X-GMAIL-MSGID: =?utf-8?q?1748879885411098992?= Reload sysfs entry will be replaced by current_batch, drop it. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/sysfs.c | 29 -------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 65dd6fea5342..e077910c5d28 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -87,34 +87,6 @@ static ssize_t run_test_store(struct device *dev, static DEVICE_ATTR_WO(run_test); -/* - * Reload the IFS image. When user wants to install new IFS image - */ -static ssize_t reload_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ifs_data *ifsd = ifs_get_data(dev); - bool res; - - - if (kstrtobool(buf, &res)) - return -EINVAL; - if (!res) - return count; - - if (down_interruptible(&ifs_sem)) - return -EINTR; - - ifs_load_firmware(dev); - - up(&ifs_sem); - - return ifsd->loaded ? count : -ENODEV; -} - -static DEVICE_ATTR_WO(reload); - /* * Display currently loaded IFS image version. */ @@ -136,7 +108,6 @@ static struct attribute *plat_ifs_attrs[] = { &dev_attr_details.attr, &dev_attr_status.attr, &dev_attr_run_test.attr, - &dev_attr_reload.attr, &dev_attr_image_version.attr, NULL }; From patchwork Mon Nov 7 22:53:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344740wru; Mon, 7 Nov 2022 14:57:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf6h+ybyTTQ1+6WCk7ejQDRAVoY9Yu3BG5ez/4W6mkownH4HeXEDibyanYhW5tpPain5KEyE X-Received: by 2002:a17:906:3e95:b0:7ae:6cdd:9b9f with SMTP id a21-20020a1709063e9500b007ae6cdd9b9fmr5669544ejj.296.1667861840193; Mon, 07 Nov 2022 14:57:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861840; cv=none; d=google.com; s=arc-20160816; b=WCXCEfq/0Mls9Y+6iU1xHU7UPKfRY2Qp8qwT87O7Q31+36Vfqb0Vm+unuJVu7ILaFR RqtUm/IOPdBWfSWN45wKQrPFbvk8UxlKHmjBLA26YxP9a3w/71oFJLgHjZzu01qMVwOh BUP+WwZL9yOrnApBBzyiwdLtdSATxWT6YkMW85PQD0MWtRHYe1y7hJ/no9YddA/bUFER qPL6Wz9dlHwI+LjLyHe2ukudZ+1KE34ASzQJ1lbDy3Aznc6okvFjeRMtYhKGX1EElmvN e9k0LfeO1A2jz22QFRCbR6whsaRJRX4jzpB2bT3I+AlszUTzbFS/2l3UDMFHoMaxI40w AHug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XeQO4o4n6egZxiAtIbHmGtYCPawRnHn1J3fce7oioAA=; b=KIyHr1HwJYVXPacw2r+dEfLJfBjlexXS4jJRuNr3MMfNUe7I9HAbj3jMQ4PwFLCNy8 DNskpAh5rJ9mxUu8wQ84266gTVmke3B4SwSNUbYDindt/jruFnn5XFAaj2TpIrTRoQfD Wh2ZB2hJyXXjDd76UUSGBKintrdEZQrODbIPaDjeUjA64D1fVdtF1wYCiAPF4iS/pi9z r21foYZYSvJVxcFKRCckTfyi21Q73gI2/h81oFLCfn805uE60CLO4g2/E16wQS8v+fMf 1kX9PyJpl1YXcJnwVH/cEjilftR9CouQlnQQDU7/IQbjqbUEUxkyxZaeWTxIirDvOGKf UsfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HaaewNOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a170906499300b00780837381d8si8145464eju.591.2022.11.07.14.56.56; Mon, 07 Nov 2022 14:57:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HaaewNOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbiKGWzl (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbiKGWyv (ORCPT ); Mon, 7 Nov 2022 17:54:51 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C717C2C136; Mon, 7 Nov 2022 14:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861689; x=1699397689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rGty/ND0dwTw6DFxmOEmfdO/+IKOkgj7e852ob1OgrI=; b=HaaewNOQdV/N8xHGk+7tGAIZN+YMQdlsBkA9CVODvEuKnezTpyc1hbHC ycHrFcI0TcYxVbPDEQa6fRqOrL/1cEDKBQcEcIilfckWAAImoBU5NUsvl 6sblGdi/PRO8ZUbwMv3KSqlroaHsS0rCga5RgEyA1loFykj9qkK2X8n30 MkvBUJdA1SxTux0tenzyLDdnxZjRY2g3cbXhTPARVrnJsImqjotdl1JLO 5tkaogUYHqTw1mM98YPpPJITbb0DtQSnLj7iJ4wmciSLr+gnRJBnErRPN 3w/YIMpahBPFjqne7ClEhUiOFAHyPeLmi4fIsGs98cRehCTzfv/7TxABi w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911840" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911840" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:49 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012994" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012994" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:48 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 12/14] platform/x86/intel/ifs: Add current_batch sysfs entry Date: Mon, 7 Nov 2022 14:53:21 -0800 Message-Id: <20221107225323.2733518-13-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331279893101578?= X-GMAIL-MSGID: =?utf-8?q?1748879896938758253?= Initial implementation assumed a single IFS test image file with a fixed name ff-mm-ss.scan. (where ff, mm, ss refers to family, model and stepping of the core) Subsequently, it became evident that supporting more than one test image file is needed to provide more comprehensive test coverage. (Test coverage in this scenario refers to testing more transistors in the core to identify faults) The other alternative of increasing the size of a single scan test image file would not work as the upper bound is limited by the size of memory area reserved by BIOS for loading IFS test image. Introduce "current_batch" file which accepts a number. Writing a number to the current_batch file would load the test image file by name ff-mm-ss-.scan, where is the number written to the "current_batch" file in hex. Range check of the input is done to verify it not greater than 0xff. For e.g if the scan test image comprises of 6 files, they would be named as show below: 06-8f-06-01.scan 06-8f-06-02.scan 06-8f-06-03.scan 06-8f-06-04.scan 06-8f-06-05.scan 06-8f-06-06.scan And writing 3 to current_batch would result in loading 06-8f-06-03.scan in the above e.g. The file can also be read to know the currently loaded file. And testing a system looks like: for each scan file do load the IFS test image file (write to the batch file) for each core do test the core with this set of tests done done Qualify few error messages with the test image file suffix to provide better context. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/ifs.h | 23 ++++++++++---- drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 18 +++++++---- drivers/platform/x86/intel/ifs/runtest.c | 10 ++++--- drivers/platform/x86/intel/ifs/sysfs.c | 38 ++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 16 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 98ca91bdd5ca..390e508faf57 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -33,13 +33,23 @@ * The driver loads the tests into memory reserved BIOS local to each CPU * socket in a two step process using writes to MSRs to first load the * SHA hashes for the test. Then the tests themselves. Status MSRs provide - * feedback on the success/failure of these steps. When a new test file - * is installed it can be loaded by writing to the driver reload file:: + * feedback on the success/failure of these steps. * - * # echo 1 > /sys/devices/virtual/misc/intel_ifs_0/reload + * The test files are kept in a fixed location: /lib/firmware/intel/ifs_0/ + * For e.g if there are 3 test files, they would be named in the following + * fashion: + * ff-mm-ss-01.scan + * ff-mm-ss-02.scan + * ff-mm-ss-03.scan + * (where ff refers to family, mm indicates model and ss indicates stepping) * - * Similar to microcode, the current version of the scan tests is stored - * in a fixed location: /lib/firmware/intel/ifs.0/family-model-stepping.scan + * A different testfile can be loaded by writing the numerical portion + * (e.g 1, 2 or 3 in the above scenario) into the curent_batch file. + * To load ff-mm-ss-02.scan, the following command can be used:: + * + * # echo 2 > /sys/devices/virtual/misc/intel_ifs_0/current_batch + * + * The above file can also be read to know the currently loaded image. * * Running tests * ------------- @@ -207,6 +217,7 @@ struct ifs_data { int status; u64 scan_details; int cur_batch; + int test_num; }; struct ifs_work { @@ -227,7 +238,7 @@ static inline struct ifs_data *ifs_get_data(struct device *dev) return &d->data; } -void ifs_load_firmware(struct device *dev); +int ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); const struct attribute_group **ifs_get_groups(void); diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 5fb7f655c291..1f040837e8eb 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -22,6 +22,7 @@ MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); static struct ifs_device ifs_device = { .data = { .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, + .test_num = 0, }, .misc = { .name = "intel_ifs_0", diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index f361fd42a320..c6414958a691 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -256,17 +256,18 @@ static int ifs_image_sanity_check(struct device *dev, const struct microcode_hea /* * Load ifs image. Before loading ifs module, the ifs image must be located - * in /lib/firmware/intel/ifs and named as {family/model/stepping}.{testname}. + * in /lib/firmware/intel/ifs_x/ and named as family-model-stepping-02x.{testname}. */ -void ifs_load_firmware(struct device *dev) +int ifs_load_firmware(struct device *dev) { struct ifs_data *ifsd = ifs_get_data(dev); const struct firmware *fw; - char scan_path[32]; - int ret; + char scan_path[64]; + int ret = -EINVAL; - snprintf(scan_path, sizeof(scan_path), "intel/ifs/%02x-%02x-%02x.scan", - boot_cpu_data.x86, boot_cpu_data.x86_model, boot_cpu_data.x86_stepping); + snprintf(scan_path, sizeof(scan_path), "intel/ifs_%d/%02x-%02x-%02x-%02x.scan", + ifsd->test_num, boot_cpu_data.x86, boot_cpu_data.x86_model, + boot_cpu_data.x86_stepping, ifsd->cur_batch); ret = request_firmware_direct(&fw, scan_path, dev); if (ret) { @@ -282,8 +283,13 @@ void ifs_load_firmware(struct device *dev) ifs_hash_ptr = (u64)(ifs_header_ptr + 1); ret = scan_chunks_sanity_check(dev); + if (ret) + dev_err(dev, "Load failure for batch: %02x\n", ifsd->cur_batch); + release: release_firmware(fw); done: ifsd->loaded = (ret == 0); + + return ret; } diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index b2ca2bb4501f..0bfd8fcdd7e8 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -78,14 +78,16 @@ static void message_not_tested(struct device *dev, int cpu, union ifs_status sta static void message_fail(struct device *dev, int cpu, union ifs_status status) { + struct ifs_data *ifsd = ifs_get_data(dev); + /* * control_error is set when the microcode runs into a problem * loading the image from the reserved BIOS memory, or it has * been corrupted. Reloading the image may fix this issue. */ if (status.control_error) { - dev_err(dev, "CPU(s) %*pbl: could not execute from loaded scan image\n", - cpumask_pr_args(cpu_smt_mask(cpu))); + dev_err(dev, "CPU(s) %*pbl: could not execute from loaded scan image. Batch: %02x version: 0x%x\n", + cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); } /* @@ -96,8 +98,8 @@ static void message_fail(struct device *dev, int cpu, union ifs_status status) * the core being tested. */ if (status.signature_error) { - dev_err(dev, "CPU(s) %*pbl: test signature incorrect.\n", - cpumask_pr_args(cpu_smt_mask(cpu))); + dev_err(dev, "CPU(s) %*pbl: test signature incorrect. Batch: %02x version: 0x%x\n", + cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); } } diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index e077910c5d28..d2eeeb04d760 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -87,6 +87,43 @@ static ssize_t run_test_store(struct device *dev, static DEVICE_ATTR_WO(run_test); +static ssize_t current_batch_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + int cur_batch; + int rc; + + rc = kstrtouint(buf, 0, &cur_batch); + if (rc < 0 || cur_batch > 0xff) + return -EINVAL; + + if (down_interruptible(&ifs_sem)) + return -EINTR; + + ifsd->cur_batch = cur_batch; + + rc = ifs_load_firmware(dev); + + up(&ifs_sem); + + return (rc == 0) ? count : rc; +} + +static ssize_t current_batch_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + + if (!ifsd->loaded) + return sysfs_emit(buf, "none\n"); + else + return sysfs_emit(buf, "0x%02x\n", ifsd->cur_batch); +} + +static DEVICE_ATTR_RW(current_batch); + /* * Display currently loaded IFS image version. */ @@ -108,6 +145,7 @@ static struct attribute *plat_ifs_attrs[] = { &dev_attr_details.attr, &dev_attr_status.attr, &dev_attr_run_test.attr, + &dev_attr_current_batch.attr, &dev_attr_image_version.attr, NULL }; From patchwork Mon Nov 7 22:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344870wru; Mon, 7 Nov 2022 14:57:45 -0800 (PST) X-Google-Smtp-Source: AMsMyM6EXE3eMw9uM/QZxSyfM2jl37widUUfHkBeA9mO6pygShy3yGrjLN38HqMS2o1sv7w1FaqQ X-Received: by 2002:a17:906:d555:b0:7ae:fdd:d0b4 with SMTP id cr21-20020a170906d55500b007ae0fddd0b4mr26862329ejc.185.1667861865401; Mon, 07 Nov 2022 14:57:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861865; cv=none; d=google.com; s=arc-20160816; b=mLxdRgmixQbrI0PwxPyAdJpnvIb/2BcKmRYEO1XeXz44aMkV0ptXhXJol/6MKFNLhV i+heDnT+7hq3I6n1p3PHvchm7GyjUhGLA6yGu8ZU6EjfbAscaTSloSKkH6AkiwP41Y6M NEyx4vx4s1p3jT/6GZrkBleyUqSqnQxBLiLvcFKoVwK/nJxf6OUqZ8qp+L6V7J58O0RE +IwxqoolpIfhCQcTKo69oiQQ7svKKddS/afpFXeHxmnFHnPOge9tYFGvYwewvLHmcIsr uv0dGSqevYgxBIf4olMOChy8pwU/ohv+BjoV3bEV8brDGvx2V3ghoob4C2Yka1YWcNf/ Zhpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5vzy3W/AXxWZWcRGhk5sbJ6IZY0ZaMmw6BJOrnDNCts=; b=Qo/HcRgkKT036yFpNVuYBtDJVF2arKNZpj7AM3SAzAQNOD9sALcRf8+ejyhs++5eKE o/45ddA2UnaF3Yt+j3ZT9qus1G44x17x6asfCsUJKXseTKn8BQGkGAYqH/N56vpCbPy7 wLSsK4GEjd7W0ULVu+ue1RxDTdMnCiDaxwCRQ7TYqsKKdqMSjzCaMDIsOFDMvlN6/cEc yolDT1mzIGmT484rPgnwdRYWGY9l9Y7yhkwpcLdohMlNujvTL6xkEmfcfCHcmseW3VxN Nm6LImt/jwcXEtYxZqUI1FkYxkQ7QZg84gJdmJsMmQ7sY3k3kjVpml3goUyk3+MfdIZ2 bCRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jLNXKJI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020aa7d790000000b00458e87a1d83si9740879edq.54.2022.11.07.14.57.18; Mon, 07 Nov 2022 14:57:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jLNXKJI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233019AbiKGWzy (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbiKGWyv (ORCPT ); Mon, 7 Nov 2022 17:54:51 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E37C02A264; Mon, 7 Nov 2022 14:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861689; x=1699397689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ieAw6DOi25+M/PVVeqIKsG7UFRjhjw4Kz3UXCTTfxEQ=; b=jLNXKJI2oqzj1JklbJ3UsotsSG4GhMX5OiI+gaJXWCWjxbVN2I1egimE DFTnhE4Z7D32QRkDvb7JVDmhSmo6SZOyB0w95kd4JEcDtBv8ZMebGqNpW vY4BkgwBwEHW9ep1unP/rRp/bLUQbN6bScPaFLLiSL9Lhk0IhThVto6E1 thCkJBYKLdGt/wVsugygUj1CJeVj/XvZ6R9Eik3CewERNeUxCapcgO+B8 DDbAX8Zk1jEtjlBy6u/o/Slw92UMO3uobMo/q64fLr11qzN6quOl56UCg XJ90YExw/vhWwJ1uRXlVEgdyi+yugfDsidlwEbRrhLPlxCtc+K+1BbGS2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911842" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911842" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:49 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811012997" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811012997" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:49 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 13/14] Documentation/ABI: Update IFS ABI doc Date: Mon, 7 Nov 2022 14:53:22 -0800 Message-Id: <20221107225323.2733518-14-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331321314782951?= X-GMAIL-MSGID: =?utf-8?q?1748879923175620150?= Remove reload documentation and add current_batch documentation. Update the kernel version and date for all the entries. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- .../ABI/testing/sysfs-platform-intel-ifs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-platform-intel-ifs b/Documentation/ABI/testing/sysfs-platform-intel-ifs index 486d6d2ff8a0..f74df3abee57 100644 --- a/Documentation/ABI/testing/sysfs-platform-intel-ifs +++ b/Documentation/ABI/testing/sysfs-platform-intel-ifs @@ -1,39 +1,41 @@ What: /sys/devices/virtual/misc/intel_ifs_/run_test -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Write to trigger IFS test for one online core. Note that the test is per core. The cpu# can be for any thread on the core. Running on one thread completes the test for the core containing that thread. Example: to test the core containing cpu5: echo 5 > - /sys/devices/platform/intel_ifs./run_test + /sys/devices/virtual/misc/intel_ifs_/run_test What: /sys/devices/virtual/misc/intel_ifs_/status -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: The status of the last test. It can be one of "pass", "fail" or "untested". What: /sys/devices/virtual/misc/intel_ifs_/details -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Additional information regarding the last test. The details file reports the hex value of the SCAN_STATUS MSR. Note that the error_code field may contain driver defined software code not defined in the Intel SDM. What: /sys/devices/virtual/misc/intel_ifs_/image_version -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Version (hexadecimal) of loaded IFS binary image. If no scan image is loaded reports "none". -What: /sys/devices/virtual/misc/intel_ifs_/reload -Date: April 21 2022 -KernelVersion: 5.19 +What: /sys/devices/virtual/misc/intel_ifs_/current_batch +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" -Description: Write "1" (or "y" or "Y") to reload the IFS image from - /lib/firmware/intel/ifs/ff-mm-ss.scan. +Description: Write a number less than or equal to 0xff to load an IFS test image. + The number written treated as the 2 digit suffix in the following file name: + /lib/firmware/intel/ifs_/ff-mm-ss-02x.scan + Reading the file will provide the suffix of the currently loaded IFS test image. From patchwork Mon Nov 7 22:53:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 16761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2344821wru; Mon, 7 Nov 2022 14:57:35 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Hc9ZIgNf3/USWG8JjwCChtFXzsM+qXwofrCb9PWVMBOej9Wt/8ZNEFp5rHSz8ImWQ8WtR X-Received: by 2002:a17:907:1dca:b0:7ae:47ee:41c6 with SMTP id og10-20020a1709071dca00b007ae47ee41c6mr14718881ejc.236.1667861854899; Mon, 07 Nov 2022 14:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667861854; cv=none; d=google.com; s=arc-20160816; b=M9feA3nE6o8NOMgGIdO1nOgw0z8cnDdnKIWf7G+SFDFKf2Ibds6L+Ju+Ea6I6MEpZ3 BNED7LOUYWkFs65lK9qLTjDUG4yGrDtELZn1tWM1QjD6D0rGad59zWUMtDWt/FROhpNX WhjFyotXB8jIXusEcUNjXY/ISfRAdSgq3HxzqnELavDGh3RSXNYHD/3r8T/Au6q4UQ+M tUFrPgOVBPSC5YpPITxScGlmJAbdHPOpxCYlTWPZIAB6n1KKaSarCcs3VeSrkF35Q0pj p+ki6DI3jWsSpZwGZ6sT9T33VS3xWJ4m4rOLPDq6o+QJte7Rt+9Kja318CPJ8jO1V1jh 7Bwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nWqzhDkq3Ke2HiAI93PvLqGpeaf3XxZni0fi5297azU=; b=w7HYuLniRjOivEHltNLadj6pKr3XZIOypbu4HyOqqu6G5thtHXk7DTvBK1FQUBLQlk FzU9C4ToNl1hT7uqMUxxAliOx2PjwX7IYhTdbT2QX3wD1ML1hTUCFYUh0PQnb0mPYz3F wqHfQK2ksUqgdhocgBDS39BRFKf+8szT2AltBV7B6E61V828htsSdmOK/fafZzpJFaSP 9Iir6pBGSGvPVVHBSG7akdzolXx9AWfIhdN+pe+THLG5VHrjTTivxzztLS06dq0YvhhL EJUnTwIuCHZXO2Dstd+3/A+ZwgO03e8Z67raYkMXpPEt8z0MDAWZgK4a6x2COqqZJDAV w2FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IM1Zga1P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a056402090c00b0045c786162f5si13447894edz.567.2022.11.07.14.57.11; Mon, 07 Nov 2022 14:57:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IM1Zga1P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232822AbiKGWzu (ORCPT + 99 others); Mon, 7 Nov 2022 17:55:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbiKGWyv (ORCPT ); Mon, 7 Nov 2022 17:54:51 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E962B61F; Mon, 7 Nov 2022 14:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667861691; x=1699397691; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DyrS883OR7AFX4gN5EeEXTzT5dUJ/TdR0BLm14KTOTM=; b=IM1Zga1Ppta/6CWnZJJiVS1nc52O4WgmVQNMmqYtlG9nn7u0BzoaNo2d dUyzCebOi5PRi567CEBCiJTWNyaclkLZtLUJJKnEWM/kl3zQbXnBBG3xT U53SvrvFX2QrIgm34eXwbXgMb9j263Is4Tzy9v3J2onqU/WujFUrPxa2B Zr2kUAUs0pLHJFgZ89Ixi0V9ax9bSAq4qyic4GcVpX9JZ6mi1rISVlUsK 9IKvkGLygMwlLHA5nMZ2X7uCmhGT6Ue9BFwoFxs9p2qpSxIsBMZcJXBmA f2TNhCS5S8JMLqVnmGtZMr8hcoQzllJu7rRYpBzQ5TW2c3/lWsH53HRv5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="293911843" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="293911843" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:50 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811013001" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="811013001" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 14:54:49 -0800 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com, sohil.mehta@intel.com Subject: [PATCH v2 14/14] Revert "platform/x86/intel/ifs: Mark as BROKEN" Date: Mon, 7 Nov 2022 14:53:23 -0800 Message-Id: <20221107225323.2733518-15-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107225323.2733518-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> <20221107225323.2733518-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747331310244036093?= X-GMAIL-MSGID: =?utf-8?q?1748879912644795148?= Issues with user interface [1] to load scan test images has been addressed, so the following can be reverted. commit c483e7ea10fa ("platform/x86/intel/ifs: Mark as BROKEN") Link: https://lore.kernel.org/lkml/26102aca-a730-ddf8-d024-2e7367696757@redhat.com/ [1] Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph Reviewed-by: Sohil Mehta Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/Kconfig b/drivers/platform/x86/intel/ifs/Kconfig index 89152d46deee..3eded966757e 100644 --- a/drivers/platform/x86/intel/ifs/Kconfig +++ b/drivers/platform/x86/intel/ifs/Kconfig @@ -1,9 +1,6 @@ config INTEL_IFS tristate "Intel In Field Scan" depends on X86 && CPU_SUP_INTEL && 64BIT && SMP - # Discussion on the list has shown that the sysfs API needs a bit - # more work, mark this as broken for now - depends on BROKEN help Enable support for the In Field Scan capability in select CPUs. The capability allows for running low level tests via