Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp525624rdb; Thu, 5 Oct 2023 12:56:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2RsBLtn/HkDBQDo1qIHby1wzAV/rRHsIZ366Cb+PnEcvOi5vhiuIfhlmVMtb3wSvGSsP0 X-Received: by 2002:a05:6a20:938b:b0:156:851e:b167 with SMTP id x11-20020a056a20938b00b00156851eb167mr6576050pzh.44.1696535806944; Thu, 05 Oct 2023 12:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696535806; cv=none; d=google.com; s=arc-20160816; b=RSURLb5zmnwZWWJXnsB3hoXsi8K/3TmiOZhQRYUqVtENLXyutGenN3i74EUzGZ7boO E5tWwDBDZ/4dULd65BZQ6JLCXRiBA0BZMt1WhujX7suwKUI0+tdo5sezWx0WxFeic2Rl tz0Zb93hwY+OJNurTR67Qlo7XTSBTk+hM2uyG/l1rAD5F1Vgm2YMAgNwRWfMuLbQcdLN F6Bx5JxxfMpmpqzsyNFfgl1CImcYs/cl9XynBFTQoS9r8WgIINxsXxcslKlsKiwxoi2t n7WGbKU2BP7gYHXOw3QLba9aoePW7A5tE/pOSUuhFJcv7J9VHs8JGqUAWyeF2bvcLDU6 dyIw== 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=JGFEHtcxs+4eiTGjXPSGL1MRSOg4VIuqcXit08lzeHQ=; fh=dyN8rlR8DIsO7hGArNuYLUXtXvDlE6dkZecyfb1jp0w=; b=AL2mdMIeO/ScCJ1zlPcsBAgbKdp/hCkV2cAu+66dUrdkNMopSKWrbww5ixN3pjr/QS 0k93/j/4ufeADW+VVKCKdzYdWJyJVZb/AqYU8rqdM/hFO9CEI76Fgmoha91zS+eRxkDK WCRAS6flGkehBLeLgKyp75h1gtV1RbtfH7Wveq0NdhhAhmGcmZp25GD2iCP7jcOvtXF+ Ud7N1RbmT/Qsbwy0HND4xo5HRpR0wUmzY4HptlKsJWhs3VXXe9EfRF5dxYBGxjauqyki MfaCfVMDRKN0CXLcn+6VpihxTFKFcONcWnNKxKQanOTn4H/ZsF/WDYP03iGtU2N3t5+F gk6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PugoZF3a; 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 q15-20020a056a00088f00b0068fac3509a9si2042339pfj.350.2023.10.05.12.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:56:46 -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=PugoZF3a; 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 C65FC836F417; Thu, 5 Oct 2023 12:56:35 -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 S231967AbjJETz6 (ORCPT + 99 others); Thu, 5 Oct 2023 15:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231777AbjJETzs (ORCPT ); Thu, 5 Oct 2023 15:55:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D9BE8; Thu, 5 Oct 2023 12:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696535747; x=1728071747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0qxwU6CpEuwqBFRafdL1oSSv96Zw738hw/itYRK/0l8=; b=PugoZF3aCKegWmk7dExkpAQYE9Uabsa74AKhl4pPbTVwmxQ/Lig5rJHv a8l+JHqQIFA6NGmWCk2hRyR5SySlEwgURcpV9Ow7zrdYuKXxbvfiOuAjM AMD+iS1+f2wyQL9a4494J2Rq5QPI2FE3LKW8uLDVotyuDLYNyP8fCiNVr 2vSDdck4VxCsdE2xU+sz94LJ6Giy9JlapDPBzFDqIUGq9vqrHCuGSgQhS FdfVZEqW5g77G/sqvP5Y+tAnsqbRvdJaixG0gEnVv2V10xNicZjlmWFay DFpB8h1RzFvVxzFo995upRbNBqfyQg41QG1GAiajHqDB64zQ7WZitJA0+ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="386432578" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="386432578" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:55:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="755600125" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="755600125" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:55:44 -0700 From: Jithu Joseph To: ilpo.jarvinen@linux.intel.com, 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 Subject: [PATCH v4 4/9] platform/x86/intel/ifs: Gen2 Scan test support Date: Thu, 5 Oct 2023 12:51:32 -0700 Message-Id: <20231005195137.3117166-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231005195137.3117166-1-jithu.joseph@intel.com> References: <20230929202436.2850388-1-jithu.joseph@intel.com> <20231005195137.3117166-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on snail.vger.email 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]); Thu, 05 Oct 2023 12:56:35 -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 Reviewed-by: Ilpo Järvinen 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