Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1109468pxb; Thu, 21 Oct 2021 16:07:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTGs1VZ4mbpmvk3YtMf4JMDwWdGZOnV58C7SbYkmpnzK7yWDp5Y75ROlZa+1LIU3lwndR6 X-Received: by 2002:a63:7456:: with SMTP id e22mr6609570pgn.324.1634857633002; Thu, 21 Oct 2021 16:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634857632; cv=none; d=google.com; s=arc-20160816; b=HGadweRRanAvGTKtak8fJzXZTxrlTff/OTpk/xx+ch85e+xMfgHh50cizDp5dP7O4i /ATk3B6ll61EJP68JAl3HVDF3ryVxPvcfCjN5Ax9gXocs/kvYOKIXXUNv/o1sm4RAxqn id1GU3kRm6saCxs+Rv0iTGlZWeguxESBZ0PwVjtip6iybN2nLG2oJR7KUHaO/HfVPvXU eTKUx2bd3poT7JmxtP+EbVxZT+awWEjibXTwrLCmeHTmC5va1DjgepGA5f9izKWl/6zk HPRv0NEssLkUhGbskkV9tV4PSR38zOs+ZeII8TWp8YKRQ+0sFV6LMCpCHv3hf9QkqKLn ktJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=XwrIduiUgEvSvGIq7HFu4KAFbuFxhEbqCa53ZkuX3xI=; b=UQRXBObHFhvcmSTkL4AcQOK5c/4jXz/xTVD3WjyqvSSuF8RpaidrFyiRo4YiRauy7Y IntB+Cz8u0Vj2kBoHGuSdgupo+3QC+rGc8BbVwqyn0/F1W+Y7fMZNaxBQFICtDIhF5gO 2HV3k+MmslfT06cAVrT2wkbXQtoqS5w6QnKoU8Vd6cotFu7cHBjg3E2HJBXbN8l8BpRb awIIA+fBj5ZISpBMj8UBgstQT8/JtDIsbM6B1JTwtbVQwBEXSUd036K2+fT3artvXOaw K/7fSao7GUcCrNvqBztkOGLVBwv10+YrnHQnOTrvBVyJMzgRIPezuJnT1B/HxohP6PK8 AsyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si7940077pfu.262.2021.10.21.16.07.00; Thu, 21 Oct 2021 16:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232538AbhJUXHk (ORCPT + 99 others); Thu, 21 Oct 2021 19:07:40 -0400 Received: from mga05.intel.com ([192.55.52.43]:58074 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232253AbhJUXHR (ORCPT ); Thu, 21 Oct 2021 19:07:17 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="315380054" X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="315380054" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 16:02:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,170,1631602800"; d="scan'208";a="445033365" Received: from chang-linux-3.sc.intel.com ([172.25.66.175]) by orsmga006.jf.intel.com with ESMTP; 21 Oct 2021 16:02:24 -0700 From: "Chang S. Bae" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@linutronix.de, dave.hansen@linux.intel.com, arjan@linux.intel.com, ravi.v.shankar@intel.com, chang.seok.bae@intel.com Subject: [PATCH 12/23] x86/cpufeatures: Add eXtended Feature Disabling (XFD) feature bit Date: Thu, 21 Oct 2021 15:55:16 -0700 Message-Id: <20211021225527.10184-13-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211021225527.10184-1-chang.seok.bae@intel.com> References: <20211021225527.10184-1-chang.seok.bae@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Intel's eXtended Feature Disable (XFD) feature is an extension of the XSAVE architecture. XFD allows the kernel to enable a feature state in XCR0 and to receive a #NM trap when a task uses instructions accessing that state. This is going to be used to postpone the allocation of a larger XSTATE buffer for a task to the point where it is actually using a related instruction after the permission to use that facility has been granted. XFD is not used by the kernel, but only applied to userspace. This is a matter of policy as the kernel knows how a fpstate is reallocated and the XFD state. The compacted XSAVE format is adjustable for dynamic features. Make XFD depend on XSAVES. Signed-off-by: Chang S. Bae Signed-off-by: Thomas Gleixner Signed-off-by: Chang S. Bae --- Changes from the tglx tree: * Call out the policy to use XFD for userspace. (Dave Hansen) * Make XFD depend on XSAVES. (Dave Hansen) --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index d0ce5cfd3ac1..ab7b3a2de85d 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -277,6 +277,7 @@ #define X86_FEATURE_XSAVEC (10*32+ 1) /* XSAVEC instruction */ #define X86_FEATURE_XGETBV1 (10*32+ 2) /* XGETBV with ECX = 1 instruction */ #define X86_FEATURE_XSAVES (10*32+ 3) /* XSAVES/XRSTORS instructions */ +#define X86_FEATURE_XFD (10*32+ 4) /* "" eXtended Feature Disabling */ /* * Extended auxiliary flags: Linux defined - for features scattered in various diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index defda61f372d..d9ead9c20408 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -75,6 +75,7 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_SGX_LC, X86_FEATURE_SGX }, { X86_FEATURE_SGX1, X86_FEATURE_SGX }, { X86_FEATURE_SGX2, X86_FEATURE_SGX1 }, + { X86_FEATURE_XFD, X86_FEATURE_XSAVES }, {} }; -- 2.17.1