Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1051724lqm; Thu, 2 May 2024 04:02:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1ZlFmXtExaTa3msRvA4mCPVCn/B7D7b9ziGfLJ4LBJyIgoGqwcy/wwbTxiEJZb+++0WLDJ46WL2XK0sWkx12R0f2rueAYQVw4NJXQWg== X-Google-Smtp-Source: AGHT+IFGWwmf/fzB3qm4iaYMN3+ZFiAx2XSDl5NbW284BfiZu9K/LM4ZeJ3ALxsXqhltxxgz0Gev X-Received: by 2002:a05:6e02:198b:b0:36c:3856:4383 with SMTP id g11-20020a056e02198b00b0036c38564383mr2210328ilf.26.1714647735691; Thu, 02 May 2024 04:02:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714647735; cv=pass; d=google.com; s=arc-20160816; b=zDKWdiS7t80A3d/MUCPd2KfIwqjNs29OGasw+bYN9IvIjqJd9Io0In7/Pq5z30DI9n 7J3jF6uda9ZkZZ2fX6y5riYBIvdBO52Zimmsacpcv8N35fmIqjVp+A8oH82evJfsZ8Rg 2hcrNXkGsN/vNVNkJBBZjDGEf91923o0bu4rM2k8YGYAJh+e1lWqLIbJ8od3VfWLmWkB n474yxzP2cDWHpx6avYeTroEuY4zdYn5C9Uhk8OW0A5yP8pL56Pn9J8MnAmocW/yYXOP IojizT6CTwcL6hl0KODZRxW0zH8mMyH2gXj0XoNMxrJOLbEw5ieZYL47gGcxqCMvnhvi FSTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=ISkaV3NBo+vP9/m8b+1d8sDt+tKmfvM81w0ptDbE/h8=; fh=l0j8qJTpKMzZ4FkE9hM4S6fq2/WVm07gacHSN0jCzeI=; b=A0HIaD82R16YtgezDpO+c9ozkEglBhhvsahiqzNXSumPl58nFHzm9N5M0wEUBb+FqE 9Rv7trMarx/Txsoo6JUlU2D2P5Ek06G824mfMIbJ9Pe9BplIpr1amP0SojYKvNMi1uRX tEKAAfjVYyTRE7H9k1c6ZZU8nvchl/TJmquN7DI05ks/rUxaDHTeruaGWZqprzMSZEaY V/mPUHMBuHxvm9NlbkCVYEF52RTIcojhx+j41uQ+9NYq3pQejqV/eB+TxDQKTCOuEZfW mS9C2+UwVtMTzzYK6ZbI1crUic6HyR1OkYxbRiG59LvezJ4/lAAtkhgFNvRWK8f/eMmV wwyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TVXEveIN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-166367-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166367-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a37-20020a630b65000000b005f07209a2efsi794007pgl.760.2024.05.02.04.02.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 04:02:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166367-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TVXEveIN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-166367-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166367-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFA9328A0D9 for ; Thu, 2 May 2024 11:02:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCB17651A4; Thu, 2 May 2024 11:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TVXEveIN" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 3B473657AE; Thu, 2 May 2024 11:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714647619; cv=none; b=EpiPrJ/cXb56VCKm8oWbZeRjPu7tcFXlLrOqq/CxFKTAeh9HBVPcnhlhls+s2vBDHQXFgoTsnCce+VLW4KP6Bc9Fz77o81/jqCp7v/wSedTYRfLCEdBY3YsSAlJzsZ6f4pNfO48fCGrRU77hw4GvmY8fy/Eq5rdyuouJ+n6yAIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714647619; c=relaxed/simple; bh=lmtz+epT2zQrOYIcCikEEH5WfUpPn0LSP4C6ZySsU/s=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=KLyGzkNb6RW51Drh30+4u2QljsdKUiZ4TuiikW9AZLYXZqviG27Ne7C7MKEthryz3sE8eTpTsKKxPeHHcPf8KQxqno1U6W/Ind4beB3r2ZN70lQmp8F91ZVnhpqRR2vpXxwq7I4YCTrB8tM/gZt0U4H/NBdjQG/DT9IQ7cgLd48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TVXEveIN; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714647618; x=1746183618; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=lmtz+epT2zQrOYIcCikEEH5WfUpPn0LSP4C6ZySsU/s=; b=TVXEveIN46K1TNXzGPw7wjN9rzVqvMuxOh3buIPrRRFldloewctBZjLM vNFMWW23774bVymHP3fzEjOJxYCaX53MP8UcSUnwlpxD89swGwZQxlqzE 9eDHtJYlxHdeE9lfAZyzmdo6JDjVLbe/h+uEwi6+PHj9Jy3RAEtDn3KBb lXtMAhbMkWaEUDsy66Ws/KF5+akznHxY0QepeGd2tXRH4RQFaDsS2zzTs FmhxxriGOPFMLH3m+f6O2VdC8thaBfk6km3N7O7O4J5dU/SmqnRS0NCtl 0JJLuQBooTriyby8QGzWSQvvxy+4+gRO6ngBwaMlQS+FXYNkZV92TjrV/ A==; X-CSE-ConnectionGUID: lPJvOzWaTQCj2oGSe7RdXw== X-CSE-MsgGUID: V2t4EWf3RhSnlovzuVpGYw== X-IronPort-AV: E=McAfee;i="6600,9927,11061"; a="10265956" X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="10265956" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 04:00:17 -0700 X-CSE-ConnectionGUID: DCbRcM49RX6PpE8SItRZNw== X-CSE-MsgGUID: cik+Sa9/R0OVu95UN4wpKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="27693417" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.54]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 04:00:13 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 2 May 2024 14:00:06 +0300 (EEST) To: "Chang S. Bae" cc: LKML , x86@kernel.org, platform-driver-x86@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, Hans de Goede , tony.luck@intel.com, ashok.raj@intel.com, jithu.joseph@intel.com Subject: Re: [PATCH 2/2] platform/x86/intel/ifs: Initialize AMX state for the scan test In-Reply-To: <20240430212508.105117-3-chang.seok.bae@intel.com> Message-ID: References: <20240430212508.105117-1-chang.seok.bae@intel.com> <20240430212508.105117-3-chang.seok.bae@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Tue, 30 Apr 2024, Chang S. Bae wrote: > The scan test does not start when the AMX state remains active and is not > re-initialized. With the extension of kernel_fpu_begin_mask(), the driver > code can now initialize the state properly. > > Introduce custom FPU handling wrappers to ensure compliant with the > established FPU API semantics, as kernel_fpu_begin() exclusively sets > legacy states. This follows the EFI case from commit b0dc553cfc9d > ("x86/fpu: Make the EFI FPU calling convention explicit"). > > Then, use these wrappers to surround the MSR_ACTIVATE_SCAN write to > minimize the critical section. To prevent unnecessary delays, invoke > ifs_fpu_begin() before entering the rendezvous loop. > > Signed-off-by: Chang S. Bae > Reviewed-by: Jithu Joseph > Tested-by: Jithu Joseph > --- > drivers/platform/x86/intel/ifs/ifs.h | 14 ++++++++++++++ > drivers/platform/x86/intel/ifs/runtest.c | 6 ++++++ > 2 files changed, 20 insertions(+) > > diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h > index 56b9f3e3cf76..71d8b50854b2 100644 > --- a/drivers/platform/x86/intel/ifs/ifs.h > +++ b/drivers/platform/x86/intel/ifs/ifs.h > @@ -325,4 +325,18 @@ int do_core_test(int cpu, struct device *dev); > extern struct attribute *plat_ifs_attrs[]; > extern struct attribute *plat_ifs_array_attrs[]; > > +static inline void ifs_fpu_begin(void) > +{ > + /* > + * The AMX state must be initialized prior to executing In-Field > + * Scan tests, according to Intel SDM. > + */ > + kernel_fpu_begin_mask(KFPU_AMX); > +} > + > +static inline void ifs_fpu_end(void) > +{ > + kernel_fpu_end(); > +} > + > #endif > diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c > index 95b4b71fab53..a35eac7c0b44 100644 > --- a/drivers/platform/x86/intel/ifs/runtest.c > +++ b/drivers/platform/x86/intel/ifs/runtest.c > @@ -188,6 +188,9 @@ static int doscan(void *data) > /* Only the first logical CPU on a core reports result */ > first = cpumask_first(cpu_smt_mask(cpu)); > > + /* Prepare FPU state before entering the rendezvous loop*/ Missing space -- i.