Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp109976lqm; Tue, 30 Apr 2024 14:41:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVU3u5sUptpAGk3gShLFJaS1qplqUuEYdc2Oi429NJeVSzQ8gByspV78fAUyeZc65BXdIeIomH8EJU3eUXj3XR7u3WNFTBIXWuvrA+0sg== X-Google-Smtp-Source: AGHT+IGEfi6+hk7lji4CuF3qn5YbLPZwWbspLh0j0WWxy9kUWzD32xEU1hpaCIrBYOOM4pkucr77 X-Received: by 2002:ac2:5481:0:b0:51b:5490:1b3a with SMTP id t1-20020ac25481000000b0051b54901b3amr407752lfk.53.1714513286636; Tue, 30 Apr 2024 14:41:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714513286; cv=pass; d=google.com; s=arc-20160816; b=jjoIrU2F0076DtuvRMPoXffMLcs6RwGpIuEEZo6Fv+PcSN03rabQbfpZQL+oMAf1Dx MtJTzgdRoE4Tx6H2qQgC7WDm61+XtMAwAEauTFRoTHD/I/wmsSd2dns/ZvWP9L/rRAOe z12g17lr4zLAjiM7kFPmUaZxUFvQyigJitVl6gmZiCIOUs0RrVAQsi9xK0nbuHfDSFUr 2AkMzHtbMvRkPOEKgBE7lBfunuYAWTPinHWzpZh7W+raqzVRlHggA/dvh6+H27nLFNp2 cSzyC4owMO3TAEqfTnPYQ0fBM7XH2QNKD2tbD90gV8uWi1z/nngQRG4O1tuRNQ8/+QjO 3/nQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=6+ZzzJp6NVi/IExH0IvoU4muOgJqv/IRrbRckCjkD9g=; fh=9EffPPASb8a51CWibKbx9Oy9gE7bVYkAL11yIjCiXVE=; b=HqccD99Ah6YloEynSIilx8dT5KRtQIPWBjrCKVNUXZEoZqGw6JsXJfvXBZ7loHNOtj Kez6hOqWm1KU3ssSIMKXrlW/kwDZfRWR5m3wfVeU3hNztJyF1KxklVeHYPR9Yf4tEQ8b ZA4fTSyArzukdzXzSqLp8uGCz5HFTkd4W5CrLfbcpVFs/MzxQPhxvDeyIRb/lllnOCI6 LevB35lNnJs+F5k2hKC1Pk5U5eEiix+zmd4VFuUnkArFkf8a0hlUDGaEHdsNsWDvr1pY DM6AOEd4RH8GHKBQAyRjpOrAxHVPruIHuIvQNcF69Yqrdy1uqjnKX2isH0oUvVji98IR 1rhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZBBbcPhV; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-164749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164749-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id js6-20020a17090797c600b00a58bcad9829si6836934ejc.275.2024.04.30.14.41.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 14:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZBBbcPhV; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-164749-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164749-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 56DF01F22824 for ; Tue, 30 Apr 2024 21:41:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32A8A1BED78; Tue, 30 Apr 2024 21:41:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZBBbcPhV" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 B782B1E52C; Tue, 30 Apr 2024 21:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714513279; cv=none; b=As7W+g85etL3pjbzVQuNV8xoAAa8BMTPsYClcKN1LrHdUM9Ft6zlCpMRant4g0Oa2i7dN6tSHpF7X27BzBvuh5dFKjoDd1qsiuEoxZK5Eq2FefBPiojAVUHPy7kZIrN5axEhKA+F4nXQ266U+paoldTLsol6nv0m/tspN1Br2wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714513279; c=relaxed/simple; bh=9/DOjDzMqqIpe1Cr5IpxE30sH9jmN38JRgc2UZCcRY4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZUvnTqOLqNuAGkfUW9QBYfGcG7z+nmvT66KAN4UdbHIE4Qz3WrpioDIPP0jKy/OyCydSiE8uD7+nI4IwP5lo8uveIqxdsymOCHI40RFm4XM/qxQcyONWFSsfSNERkiY5EbPUKOhpebPfPEzWvE1VTYSpCMDXgmQeRL6EMYV9YX4= 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=ZBBbcPhV; arc=none smtp.client-ip=198.175.65.15 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714513278; x=1746049278; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9/DOjDzMqqIpe1Cr5IpxE30sH9jmN38JRgc2UZCcRY4=; b=ZBBbcPhVltPj7begrFMCcJ4Urnu/JjGWAJKfCqmDDs1cxPEx4XcK+1wx YHTn4FDmNgV4jxV/81KiYDD1uAsPAXEwhhK7DvpZ9vCHkaEB5lw+woEZg 1+PNp8OA0taz4o/RfAFfMkPDmeR3zSV33qK5t8eZXLBMcsEQoBcZf7g20 w+Uzu3LOMbgUnfuFNRJrXY4/0hIgF80wZ/8txfdwO0WcGmNZiO5xwNhRL 7ix0getK9FVGwx9BYlxkJpVrn4zb0kYrlR357RRAaD1tq8Ad4WFFwv2Fr rhIAvBTnKcbPbbD/q+uGdtW7fLX40jQiOaIHcuON5EPH5p089l+sjDaW9 g==; X-CSE-ConnectionGUID: PW5ojW1QTvu6gmapnjZ93A== X-CSE-MsgGUID: au6V1T2pRSaXsqq2WXX8bw== X-IronPort-AV: E=McAfee;i="6600,9927,11060"; a="14023056" X-IronPort-AV: E=Sophos;i="6.07,243,1708416000"; d="scan'208";a="14023056" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 14:41:17 -0700 X-CSE-ConnectionGUID: jyIqOWrdSd6haZJlHP9tDQ== X-CSE-MsgGUID: 8vyoVP9ORxifald+d/axjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,243,1708416000"; d="scan'208";a="26693363" Received: from chang-linux-3.sc.intel.com ([172.25.66.175]) by fmviesa006.fm.intel.com with ESMTP; 30 Apr 2024 14:41:16 -0700 From: "Chang S. Bae" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, tony.luck@intel.com, ashok.raj@intel.com, jithu.joseph@intel.com, chang.seok.bae@intel.com Subject: [PATCH 0/2] x86/fpu: Extend kernel_fpu_begin_mask() for the In-Field Scan driver Date: Tue, 30 Apr 2024 14:25:06 -0700 Message-Id: <20240430212508.105117-1-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The recent update [1] in the SDM highlights the requirement of initializing the AMX state for executing the scan test: "... maintaining AMX state in a non-initialized state ... will prevent the execution of In-Field Scan tests." which is one of CPU state conditions required for the test's execution. In situations where AMX workloads are running, the switched-away active user AMX state remains due to the optimization to reduce the state switching cost. A user state reload is fully completed right before returning to userspace. Consequently, if the switched-in kernel task is executing the scan test, this non-initialized AMX state causes the test to be unable to start. Given the benefit of the scan test in detecting hardware faults, ensuring its seamless execution is not negligible. This necessitates a proper API for the driver code to initialize AMX states. Although fpu_idle_fpregs() may initialize the AMX state, its primary usage should be limited to sleep state handling, making it unsuitable for the scan test. The across-architecture FPU API, kernel_fpu_begin()/kernel_fpu_end(), is universally established for floating-point SIMD code in the kernel. On x86, kernel_fpu_begin_mask() is available, with kernel_fpu_begin() serving as a wrapper to it for initializing legacy states by default. The proposed solution extends kernel_fpu_begin_mask() to accept a new option for initializing the AMX state. Additionally, it introduces custom FPU handling wrappers for the In-Field Scan driver, which are variants of kernel_fpu_begin()/kernel_fpu_end(). This approach is considerably compliant with established semantics, following the EFI case with efi_fpu_begin/efi_fpu_end(). Thanks, Chang [1] Intel Software Development Manual as of March 2024, Section 18.2 RECOMMENDATIONS FOR SYSTEM SOFTWARE of Vol. 1. https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html Chang S. Bae (2): x86/fpu: Extend kernel_fpu_begin_mask() to initialize AMX state platform/x86/intel/ifs: Initialize AMX state for the scan test arch/x86/include/asm/fpu/api.h | 1 + arch/x86/kernel/fpu/core.c | 3 +++ drivers/platform/x86/intel/ifs/ifs.h | 14 ++++++++++++++ drivers/platform/x86/intel/ifs/runtest.c | 6 ++++++ 4 files changed, 24 insertions(+) base-commit: e67572cd2204894179d89bd7b984072f19313b03 -- 2.34.1