Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp171241rdb; Fri, 29 Sep 2023 23:07:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHow4IgarE+AZQq5ZeXy23r2RmEwA5CScPHB7CrjdD4bAiG6oYY2MWAemQ6Q/7KBo+u8WZe X-Received: by 2002:a05:6808:f8b:b0:3a8:6a03:c0c with SMTP id o11-20020a0568080f8b00b003a86a030c0cmr7355753oiw.27.1696054031216; Fri, 29 Sep 2023 23:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696054031; cv=none; d=google.com; s=arc-20160816; b=R7cFT4e2KAWEQeONk9iWgbo8i11DCbeu061wGLPWhrLAk/QDTcY3gGThTVWMkbbb9C zEA1/YdtqAWaBnObKnRf6bEyU85duC3zXDbXo9BPKhnqSflUnBVPJt/vXZCIwumGYyW+ HncgxGnXIMzcYHgI9QiY+03Ozd+UU+vFlLlBDZBLQfU4IvIRRZ8MObgwd4uuJinWAcQD dhR3H87QSXIx238lbUcAYHimyzOYZUmX+3ev1+hq6MYKs1i6U/GxiMCJKXwf3EIlSw5X XdyBUSHQ3vR3NVn3bRE2Cp2gxc4WzU7VicOY0A1O+URm2Axu28jJ0Qz5LxAiCpXbIONP zc1g== 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=kVrRISwcTCm6GSlWdr91UaX8jJQL82zhPemCrqNAV0s=; fh=DZTEBuCdFfe2DSdaI+6ceTR59ce872SNjmboNXW/0pA=; b=nNkN+JUDE2XVR6CAEt75Oi+RjjSY7beCwzfcac6pqTS3eqtIPzJNNE+p31C2IIRsS4 7gzRRwBIODGyIX3UN5+TKJ4AAC7ppRX6VThYIDLFyheDgsAY/k400BiPha2ILa6WR03M tkrro5dgAqfl5jwoTjl66ubB3780vOEfAnK0ilM+piCA4qQ3hF7nkdbh+LNNuP3JCBLF AQUey+1onevRsEe3zlpRwF/8toDbnBnCRPsY4tAzmv3PuMcFahtb6jsyKXiPA3quxh0U WZ4bl8z5tDoclQS8UbBTo/VLxZh8VIKGSYY/ZgVuehLTVZBhuYJ1MZ3bKzCw9vhcixiK jSsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fpOyatQQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z1-20020a63c041000000b005789f552066si22413276pgi.335.2023.09.29.23.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 23:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fpOyatQQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 5F2BF8026ACA; Fri, 29 Sep 2023 13:46:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233902AbjI2Upe (ORCPT + 99 others); Fri, 29 Sep 2023 16:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233732AbjI2Up0 (ORCPT ); Fri, 29 Sep 2023 16:45:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77ED91B4; Fri, 29 Sep 2023 13:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696020323; x=1727556323; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GFqLc8p6pPvXpjsCa6/6EHo9+RoENVd9m1UYC2efxdc=; b=fpOyatQQMtTDqbThw4/3BHG387aE1BJp9w6pQ4nB6zOyH5ZRqjFOf+GE 6IXtGF1XLpFY8fzbwaPM+BmBDZEGc/qdWYyqCt05tHgOeGS/TNLWl9Ayj Tm+Gp4BsW4txzq35JmeB1/Gt+I9uFiw42Lyv5gKmd4iNKJ6RxLfL5/CC9 tCKPwqGk9KQjELU6GC3Uw6zaq8fKv92CWY7SoDyXGzp/gn4B74fhwDYM8 Qtsr5KeXkoY1eVNDhLplolriujW43AJ0e7JKZApj7VqIQM77MGg5S3Eih 4+ADHihIcVLFQNDl+o0TTRKf3ZYG2mGEau/TaAhtDydzBnIJXHL6h/Etn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="468654449" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="468654449" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 13:28:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="893539226" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="893539226" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 13:27:29 -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 v3 4/9] platform/x86/intel/ifs: Gen2 Scan test support Date: Fri, 29 Sep 2023 13:24:31 -0700 Message-Id: <20230929202436.2850388-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230929202436.2850388-1-jithu.joseph@intel.com> References: <20230922232606.1928026-1-jithu.joseph@intel.com> <20230929202436.2850388-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,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 13:46:03 -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 | 29 ++++++++++++++++++------ 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 4824316b3acd..f0dd849b3400 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..925c30c79011 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -171,21 +171,31 @@ 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.gen0.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 +206,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 +222,11 @@ static void ifs_test_core(int cpu, struct device *dev) } } else { retries = MAX_IFS_RETRIES; - activate.start = status.chunk_num; + if (ifsd->generation) + activate.gen2.start = status_chunk; + else + activate.gen0.start = status_chunk; + to_start = status_chunk; } } -- 2.25.1