From patchwork Fri Apr 12 17:23:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13628187 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E811F14EC4A; Fri, 12 Apr 2024 17:30:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943047; cv=none; b=eYPu3K+AKLvLtYr9GagvvXNu0bR3tT0tYycGLrF1aLB5FgZdu37sHwn5RH9Jq9eOa3MNDTROxzMYuNwlb3nxgTOwXH/F8DR9P0K1m5IAxNOHhoR+EIK2jlu1qZgwMLZsYMJ4iDo++BK0i5/Y0Phk2/a95cIwwoCyUYMTxCRX4+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943047; c=relaxed/simple; bh=j6VXfKkHgF7ZyzHZ2Ll+dz8fG0uzNqJxRFoI19lkgis=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iyEhlXNIe5t4LCcXGqqReXFLZ+Q7G1UI/cmVSTglb4o3qthbKcW4UgdD/krFLBvvh+qfECPdBWC8JnGJBQJcnsXoG62oqi7eF5naeeztot2M5kj6oUJRZifHRj7KSxyIf3kA0wrOsjLilvJrYXBH4xc76ZACOZMYWYyQhAslQdc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MoPwyqei; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MoPwyqei" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712943046; x=1744479046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j6VXfKkHgF7ZyzHZ2Ll+dz8fG0uzNqJxRFoI19lkgis=; b=MoPwyqeilSjcpgiyx8NLkN11ERPW9ccH7hEPPx9EEygBdcInDYHH6uka wNDdkRsfcr9BHxQdq1SH5X+cDDRxPjkfCLfU5hkmjUvV3o5eBQoXLQZWy NgKfxCJQeQ21UKv0WEKo/3X/L1Dvs6IPeXYq4Uw8SqUH984NE5g7ul7dI fgxzlJxkLCw8dNxE4V0jkFT6MjZoaMdSJUBVERVZLZrWrYnq3jYCw+pMC /JYZ8ShEXQPTPpcEWXqI7wwxMJWsNBCfa7rOdDW+ixYE036VpGTClP4EU At8TPEH7TZvh5uSjKI0WC3joo1D8iCvhPuogUoCiZRPmIYCY28/PHqt3V Q==; X-CSE-ConnectionGUID: v4K78v4sRcK1IKKbVDMLAg== X-CSE-MsgGUID: ISFrtysQRwqYFGYyo8OWpg== X-IronPort-AV: E=McAfee;i="6600,9927,11042"; a="11365688" X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="11365688" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:42 -0700 X-CSE-ConnectionGUID: UuBykGrERsmnkS9tg+FQhA== X-CSE-MsgGUID: 03gP47ICSL2Vn6ax703TzA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="21780772" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:42 -0700 From: Jithu Joseph To: ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, rostedt@goodmis.org, sathyanarayanan.kuppuswamy@intel.com, ravi.v.shankar@intel.com, patches@lists.linux.dev Subject: [PATCH 1/3] platform/x86/intel/ifs: Classify error scenarios correctly Date: Fri, 12 Apr 2024 10:23:47 -0700 Message-Id: <20240412172349.544064-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240412172349.544064-1-jithu.joseph@intel.com> References: <20240412172349.544064-1-jithu.joseph@intel.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Based on inputs from hardware architects, only "scan signature failures" should be treated as actual hardware/cpu failure. Current driver, in addition, classifies "scan controller error" scenario too as a hardware/cpu failure. Modify the driver to classify this situation with a more appropriate "untested" status instead of "fail" status. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Reviewed-by: Kuppuswamy Sathyanarayanan --- drivers/platform/x86/intel/ifs/runtest.c | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index 95b4b71fab53..282e4bfe30da 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -69,6 +69,19 @@ static const char * const scan_test_status[] = { static void message_not_tested(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_warn(dev, "CPU(s) %*pbl: Scan controller error. Batch: %02x version: 0x%x\n", + cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); + return; + } + if (status.error_code < ARRAY_SIZE(scan_test_status)) { dev_info(dev, "CPU(s) %*pbl: SCAN operation did not start. %s\n", cpumask_pr_args(cpu_smt_mask(cpu)), @@ -90,16 +103,6 @@ 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. Batch: %02x version: 0x%x\n", - cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); - } - /* * signature_error is set when the output from the scan chains does not * match the expected signature. This might be a transient problem (e.g. @@ -285,10 +288,10 @@ static void ifs_test_core(int cpu, struct device *dev) /* Update status for this core */ ifsd->scan_details = status.data; - if (status.control_error || status.signature_error) { + if (status.signature_error) { ifsd->status = SCAN_TEST_FAIL; message_fail(dev, cpu, status); - } else if (status.error_code) { + } else if (status.control_error || status.error_code) { ifsd->status = SCAN_NOT_TESTED; message_not_tested(dev, cpu, status); } else { From patchwork Fri Apr 12 17:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13628188 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8421214D44F; Fri, 12 Apr 2024 17:30:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943047; cv=none; b=JhlIx09WRzU5zdViSxvMJzdwtPwc6aCvG9GRP9PqfBo0nNvengnGNo5oCNBGKzoEQ6k3wW51oOd7LvswnHxQumbA21b3Ho/sebxFLj9P0tzA9Y5+F6VTdwoN9c2mfcZ7UdpnbPi/JoYpqVqQ7AXFj0HJJ7tFgBpoGKV4cYzNa74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943047; c=relaxed/simple; bh=53VPmLYStvI4gEILOZdjzTXxl1Rvmbkp0Ro+tl8CTdM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rnWMog3wxeKH+lq72/m4ekyN0ADbKh52ySklN90HoTY3/L3zreHR5Pum6RIsg956uZMVB5YOL4Xq/as5C7Ln8LXv1TnMKOhK3j22AGD2WcwmwHRbUcLW0QkqAWz/ElphC4tkMPn+uRIGG/JMpCqyol9RreQWvqCduwkntpp4HLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=H1NG5SPd; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="H1NG5SPd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712943047; x=1744479047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=53VPmLYStvI4gEILOZdjzTXxl1Rvmbkp0Ro+tl8CTdM=; b=H1NG5SPdvGw5OikyOl6Xtz1MZSbFhCDlr1GNbcK33CRiDApgEvKdO7bb aQwmRH0dnG3zcA+rtX8sw7qBymKkLYI1pio9O7/BLWtRHpfrCkeC0vdhI wCNALystGcV/L3gAfwyhd0SLGdwGAVH2nnCL5C6gZHT2O1w8rwWsNuCvE DJVM4h9sOTe8DmmTETvyoFLC/F1CKqvv8AiFT2eSi6RPvIBU3FrhrRy8P iScRj7Gt+KYW8IsWAS5kmXdZhIUrn9B8dO5ExAW5/xnfLxwcoDbhBPFjf tipQFNBmsOzY7U2TUNcKBeIP1Yz7gp6w/D9HLqtYuNm2kHbZDAEBBiVTy w==; X-CSE-ConnectionGUID: hMQT4+R1RICs3OGxhFwrjg== X-CSE-MsgGUID: vRIzfe73R0+vgfLYsolRCg== X-IronPort-AV: E=McAfee;i="6600,9927,11042"; a="11365689" X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="11365689" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:43 -0700 X-CSE-ConnectionGUID: BId4IbBrRS2kytb9eccrjQ== X-CSE-MsgGUID: movp/L6LQHq5WdRBvF4hNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="21780775" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:42 -0700 From: Jithu Joseph To: ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, rostedt@goodmis.org, sathyanarayanan.kuppuswamy@intel.com, ravi.v.shankar@intel.com, patches@lists.linux.dev Subject: [PATCH 2/3] platform/x86/intel/ifs: trace: display batch num in hex Date: Fri, 12 Apr 2024 10:23:48 -0700 Message-Id: <20240412172349.544064-3-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240412172349.544064-1-jithu.joseph@intel.com> References: <20240412172349.544064-1-jithu.joseph@intel.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In Field Scan test image files are named in ff-mm-ss-.scan format. Current trace output, prints the batch number in decimal format. Make it easier to correlate the trace line to a test image file by showing the batch number also in hex format. Add 0x prefix to all fields in the trace line to make the type explicit. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Reviewed-by: Kuppuswamy Sathyanarayanan --- include/trace/events/intel_ifs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/intel_ifs.h b/include/trace/events/intel_ifs.h index 8ce2de120f2d..0d88ebf2c980 100644 --- a/include/trace/events/intel_ifs.h +++ b/include/trace/events/intel_ifs.h @@ -28,7 +28,7 @@ TRACE_EVENT(ifs_status, __entry->status = status; ), - TP_printk("batch: %.2d, start: %.4x, stop: %.4x, status: %.16llx", + TP_printk("batch: 0x%.2x, start: 0x%.4x, stop: 0x%.4x, status: 0x%.16llx", __entry->batch, __entry->start, __entry->stop, From patchwork Fri Apr 12 17:23:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13628189 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85C0914EC76; Fri, 12 Apr 2024 17:30:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943049; cv=none; b=PdHVKee6f6KbyeUC72ZbCdLEsaUxPI5tbso3mwunMs8Vf+5OnaD5kzs8qJGM6f2Jn7N+7JiqMPXOIfxAXFFUzJq87yTebyKFN1heZN4ALO+cvox9PZdrgTU1SFcr21eAwTA7Mpi3Ea4a/YTSd8DUbQsiZN2jOaJjxE4yITGtYqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943049; c=relaxed/simple; bh=0q/n4BB5A4qfKK7WTII1e9HuGi84JwM3B21N0UMYoMo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tiIZ9BVbcMitdQJZDQB+dGCGCnRVTR9k6PKuKjuvQO9iF1CpNFb8/0ijiPvGoq0gyZzSJcaLBVKln0QggzUVC+H+dQGicUtRlnQsQRTWzgYvMKWh4Zg3+AnHClk04Io+g/BdoghOJr8SZnf7dEmhf66rmmbK+3RtfONpKv3SP/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eKKRrOyb; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eKKRrOyb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712943048; x=1744479048; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0q/n4BB5A4qfKK7WTII1e9HuGi84JwM3B21N0UMYoMo=; b=eKKRrOybPFyQitMwSC8LilydS1LD+NAA3RKncuHdtoUbcsaiPtuRC4zx UtVK5fELIYAdXX2liXAv1Yb1hJQBy5EwA1ETWlg9OHNbfiJFioYF5wcme jKCUD0TF6LuhmWSD1Gj94/6vm0NSSDZUyBQrr6oW9zFtyGpJO+3txNEug qzNggYevA4X6MvYHwf2R6E2VdU5D47DNSvYoZMfc1qn8zGTDjxi7TBmKc mprn6qs1vy/88KZj0gba0+Pmj116N61pm28yGzk5G1+NTjyWDxdx7Pzaa nC+S8ErSGhF/SdFSaYYch/KvlBsX+gqLzrrvHcM805nAw4pnh37DzfH4v A==; X-CSE-ConnectionGUID: dsqflwa8Q7K5Iwdn+80Wbw== X-CSE-MsgGUID: SE20U8scR1G2W+0jQ3LQrQ== X-IronPort-AV: E=McAfee;i="6600,9927,11042"; a="11365694" X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="11365694" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:43 -0700 X-CSE-ConnectionGUID: zPCuEzLMT5miAOxrOYdj0Q== X-CSE-MsgGUID: OFOLKwADSD+tETiNBK/HVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="21780778" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 10:30:43 -0700 From: Jithu Joseph To: ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, rostedt@goodmis.org, sathyanarayanan.kuppuswamy@intel.com, ravi.v.shankar@intel.com, patches@lists.linux.dev Subject: [PATCH 3/3] platform/x86/intel/ifs: Disable irq during one load stage Date: Fri, 12 Apr 2024 10:23:49 -0700 Message-Id: <20240412172349.544064-4-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240412172349.544064-1-jithu.joseph@intel.com> References: <20240412172349.544064-1-jithu.joseph@intel.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 One of the stages in IFS image loading process involves loading individual chunks (test patterns) from test image file to secure memory. Driver issues a WRMSR(MSR_AUTHENTICATE_AND_COPY_CHUNK) operation to do this. This operation can take up to 5 msec, and if an interrupt occurs in between, the AUTH_AND_COPY_CHUNK u-code implementation aborts the operation. Interrupt sources such as NMI or SMI are handled by retrying. Regular interrupts may occur frequently enough to prevent this operation from ever completing. Disable irq on local cpu around the aforementioned WRMSR to allow the operation to complete. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Reviewed-by: Kuppuswamy Sathyanarayanan --- drivers/platform/x86/intel/ifs/load.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 584c44387e10..39f19cb51749 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -233,7 +233,9 @@ static int copy_hashes_authenticate_chunks_gen2(struct device *dev) chunk_table[0] = starting_chunk_nr + i; chunk_table[1] = linear_addr; do { + local_irq_disable(); wrmsrl(MSR_AUTHENTICATE_AND_COPY_CHUNK, (u64)chunk_table); + local_irq_enable(); rdmsrl(MSR_CHUNKS_AUTHENTICATION_STATUS, chunk_status.data); err_code = chunk_status.error_code; } while (err_code == AUTH_INTERRUPTED_ERROR && --retry_count);