Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3106283rdb; Fri, 22 Sep 2023 20:02:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPyyB5hYTpTuOxGLU+JtAHuzdlnOkEJl9dRdTpwyzt5MZdfXiXtquXTs9vg+J/A1FKHSu3 X-Received: by 2002:aa7:88cf:0:b0:68f:fa05:b77a with SMTP id k15-20020aa788cf000000b0068ffa05b77amr1116640pff.31.1695438163634; Fri, 22 Sep 2023 20:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695438163; cv=none; d=google.com; s=arc-20160816; b=mlAhBMIwOLcghNpEvElckUTyUvQS5qxT1oDUqhgE3026sRZ3ThoYLSDypCiFgZ+IaI 7xEWnc1KjZ602BS94hthMtp78wRF2zCwRKhMDnQexriGZkDFHM0nTR494MOecdKVXY7D 7oEG1ET7DRfoUq+b0+u9dGwlWzQmhCsTVKk5eURNFfE8QaNLDV4n6kzcxtN+HtyhlMeT ovdcSQZThU2z0D4JCe2wihaK1ueTouEi3A0o+Chn/ghQa4aoa+b2Mv4s3hv2pZkhfFDt UBVbkcmlkjre06rYAJtbXsrHIZ37fSRXPBNIpISBkrZMvyTV6Zl6VvFhksuQsrvburti 5QWQ== 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=PtQF0C1Qy5P/YN1JzdG1fibMiBWA3agT1e/C1zqPL+o=; fh=DZTEBuCdFfe2DSdaI+6ceTR59ce872SNjmboNXW/0pA=; b=d0lHQ03OSaHEjHiCC3W5M9bPy+vQ6nG6e2T91hWprgav2chMHeQrxZbZyiQmzTCaZu VArKRwufR8BvZkKgeMl9ugMx8ojdqYZ6TRjDCNpkpzL5PhtXIwvUcKqP81L8vYMqF+fV IkcCO7PFHUpXqtIXInpRT1Gi77uulu5AH6BqnX2oK/hTZd23YDmO0F+u5v01TWOQa75h kT68Jn5/MB0mNfi922RcgJA6dr3oL6S4yQ27hSLc9AZCZNjquT9TZHQzu8xp7F0g6qr+ Eb8mEvmZp3MUksPFQSh0TwEYITJc0WjaKh8huKKBQx2JQFNgFagdDon9yt0Tu7knPeXJ /oCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=niJZNdQ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b19-20020a656693000000b005775e2f160fsi4935352pgw.667.2023.09.22.20.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 20:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=niJZNdQ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E521B83713A2; Fri, 22 Sep 2023 16:30:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230410AbjIVXag (ORCPT + 99 others); Fri, 22 Sep 2023 19:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjIVXaV (ORCPT ); Fri, 22 Sep 2023 19:30:21 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B03EB1A5; Fri, 22 Sep 2023 16:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695425414; x=1726961414; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cxXofeerr15tyc6seHR71QAwrN0OZbSQ1GKIOtuE5kg=; b=niJZNdQ+CBoqdztM/CInXLpFQsWBMSQu3fxsgMN+y1GNXbkavVCGTG/a Iuo0MQugrAf8D9tUit/N3yuWm3nIjqluajObq0cISPnompLhs21+0ytz6 VuWUdGrT9htXlH65V38qRajPSsypHVFS79K2s37xaqNkkcdpmEHeY4urb tqfSoPIPubWk8rcSbCJcWl/kRQuArWtjq1G2qLtwfjkKDIen2uW6ERA5O q2FD76VMXeogfsTc03iT2HZfa1AfA1rmEp9CT33RjxumWd9w2Gg7WcoY+ kJq7wQ2gHcq/blJUxhayFSGhtXsdAQeu/eLpq7iJNG3ikp1LOPvPJEDsG g==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="411896953" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="411896953" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="921350837" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="921350837" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:12 -0700 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, rostedt@goodmis.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, pengfei.xu@intel.com, ilpo.jarvinen@linux.intel.com Subject: [PATCH v2 4/9] platform/x86/intel/ifs: Gen2 Scan test support Date: Fri, 22 Sep 2023 16:26:01 -0700 Message-Id: <20230922232606.1928026-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230922232606.1928026-1-jithu.joseph@intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230922232606.1928026-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 16:30:50 -0700 (PDT) Width of chunk related bitfields is ACTIVATE_SCAN and SCAN_STATUS MSRs are different in newer IFS generation compared to gen0. Make changes to scan test flow such that MSRs are populated appropriately based on the generation supported by hardware. Account for the 8/16 bit MSR bitfield width differences between gen0 and newer generations for the scan test trace event too. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Tested-by: Pengfei Xu --- drivers/platform/x86/intel/ifs/ifs.h | 28 +++++++++++++++++++----- include/trace/events/intel_ifs.h | 16 +++++++------- drivers/platform/x86/intel/ifs/runtest.c | 26 ++++++++++++++++------ 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 43281d456a09..cd213b89d278 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -199,9 +199,17 @@ union ifs_chunks_auth_status_gen2 { union ifs_scan { u64 data; struct { - u32 start :8; - u32 stop :8; - u32 rsvd :16; + union { + struct { + u8 start; + u8 stop; + u16 rsvd; + } gen0; + struct { + u16 start; + u16 stop; + } gen2; + }; u32 delay :31; u32 sigmce :1; }; @@ -211,9 +219,17 @@ union ifs_scan { union ifs_status { u64 data; struct { - u32 chunk_num :8; - u32 chunk_stop_index :8; - u32 rsvd1 :16; + union { + struct { + u8 chunk_num; + u8 chunk_stop_index; + u16 rsvd1; + } gen0; + struct { + u16 chunk_num; + u16 chunk_stop_index; + } gen2; + }; u32 error_code :8; u32 rsvd2 :22; u32 control_error :1; diff --git a/include/trace/events/intel_ifs.h b/include/trace/events/intel_ifs.h index d7353024016c..af0af3f1d9b7 100644 --- a/include/trace/events/intel_ifs.h +++ b/include/trace/events/intel_ifs.h @@ -10,25 +10,25 @@ TRACE_EVENT(ifs_status, - TP_PROTO(int cpu, union ifs_scan activate, union ifs_status status), + TP_PROTO(int cpu, int start, int stop, u64 status), - TP_ARGS(cpu, activate, status), + TP_ARGS(cpu, start, stop, status), TP_STRUCT__entry( __field( u64, status ) __field( int, cpu ) - __field( u8, start ) - __field( u8, stop ) + __field( u16, start ) + __field( u16, stop ) ), TP_fast_assign( __entry->cpu = cpu; - __entry->start = activate.start; - __entry->stop = activate.stop; - __entry->status = status.data; + __entry->start = start; + __entry->stop = stop; + __entry->status = status; ), - TP_printk("cpu: %d, start: %.2x, stop: %.2x, status: %llx", + TP_printk("cpu: %d, start: %.4x, stop: %.4x, status: %.16llx", __entry->cpu, __entry->start, __entry->stop, diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index 1061eb7ec399..94d486e5d263 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -171,21 +171,30 @@ static void ifs_test_core(int cpu, struct device *dev) union ifs_status status; unsigned long timeout; struct ifs_data *ifsd; + int to_start, to_stop; + int status_chunk; u64 msrvals[2]; int retries; ifsd = ifs_get_data(dev); - activate.rsvd = 0; activate.delay = IFS_THREAD_WAIT; activate.sigmce = 0; - activate.start = 0; - activate.stop = ifsd->valid_chunks - 1; + to_start = 0; + to_stop = ifsd->valid_chunks - 1; + + if (ifsd->generation) { + activate.gen2.start = to_start; + activate.gen2.stop = to_stop; + } else { + activate.gen0.start = to_start; + activate.gen0.stop = to_stop; + } timeout = jiffies + HZ / 2; retries = MAX_IFS_RETRIES; - while (activate.start <= activate.stop) { + while (to_start <= to_stop) { if (time_after(jiffies, timeout)) { status.error_code = IFS_SW_TIMEOUT; break; @@ -196,13 +205,14 @@ static void ifs_test_core(int cpu, struct device *dev) status.data = msrvals[1]; - trace_ifs_status(cpu, activate, status); + trace_ifs_status(cpu, to_start, to_stop, status.data); /* Some cases can be retried, give up for others */ if (!can_restart(status)) break; - if (status.chunk_num == activate.start) { + status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num; + if (status_chunk == to_start) { /* Check for forward progress */ if (--retries == 0) { if (status.error_code == IFS_NO_ERROR) @@ -211,7 +221,9 @@ static void ifs_test_core(int cpu, struct device *dev) } } else { retries = MAX_IFS_RETRIES; - activate.start = status.chunk_num; + ifsd->generation ? (activate.gen2.start = status_chunk) : + (activate.gen0.start = status_chunk); + to_start = status_chunk; } } -- 2.25.1