From nobody Wed Dec 4 08:40:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1725536191; cv=none; d=zohomail.com; s=zohoarc; b=AZ+Ma5JTwzkOBJU3DWzqyuZJHi7uuvytiP2XKcMonTxWLp78x1Yy32NZ6cxTmUZ9yGD8lrHISUqTTEbyriOe11J31akd+JZdrDL2ja8jZ7bgpVUN5PcgHV3d7llibYa48O1kX6criKX4wGZOtqtFprr3hPhb8piw81CsanBx7B8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725536191; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UqqT6NlIsb5+wgnjVLOlIfpp2ZuuC/SEjsfn4gdI82I=; b=XbHxtv5A1NDWeXQBJh7Zf/bfNZgXWUgE2gWGhLCo9mp3K12qovm9ptrwVHt7jt6UlUCaTa9fkly4zgNIJu9kVzBGazyaR5kKOZ/66EwzG/3WkSQkr7bvUu0XHCCmrdusFUQD5vhZpYLlJRIhg+C2nh95j6CJU9wvDjnrcyEJf0A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725536191580479.893410150347; Thu, 5 Sep 2024 04:36:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.791044.1200815 (Exim 4.92) (envelope-from ) id 1smAmd-0007FB-Aq; Thu, 05 Sep 2024 11:36:15 +0000 Received: by outflank-mailman (output) from mailman id 791044.1200815; Thu, 05 Sep 2024 11:36:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smAmd-0007F4-85; Thu, 05 Sep 2024 11:36:15 +0000 Received: by outflank-mailman (input) for mailman id 791044; Thu, 05 Sep 2024 11:36:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smAmc-0007Eu-Ad for xen-devel@lists.xenproject.org; Thu, 05 Sep 2024 11:36:14 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0d41d9ba-6b7b-11ef-99a1-01e77a169b0f; Thu, 05 Sep 2024 13:36:12 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c26815e174so738518a12.0 for ; Thu, 05 Sep 2024 04:36:12 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a62038bfesm123802466b.53.2024.09.05.04.36.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Sep 2024 04:36:11 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0d41d9ba-6b7b-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725536171; x=1726140971; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=UqqT6NlIsb5+wgnjVLOlIfpp2ZuuC/SEjsfn4gdI82I=; b=Rgbi9Y4KtP9ng3Smv50QomEWFpW+6U99QWDyzhuJt2ogAT4Y9MkOBbuUqwYQ2L2zD8 WEbkgEj62G/NrDIWSfVvBiF5F26tHX3lpusHmJX7j9odZib4120OU3Ii682nQUcgbrwo CUrTVaKw4SFE4wjBzVINyRM926EkcgJF32li4gVbBARllxZAnRktsXzRW3EuNnLVm4Pk gIhN9urbymFkKVSJ4mAPSMtM1T6PWlZywSzsR6SfoOOWR082uI/FCHFJEwJefghK5eKd mQt2Q+HFQy0JWifqnSaVzZkGNhS7az4AkNHYclBli1XPiA7bWx3UUx6JO2en+R2PaLS8 ZffA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725536171; x=1726140971; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UqqT6NlIsb5+wgnjVLOlIfpp2ZuuC/SEjsfn4gdI82I=; b=m2SeS8q45n+75UoFEymVL01DGA6E2TRfb7DGvN8IamAgYtUMaoq5Q9d1XGU6+ehfIf 6lnAjx1/U8mZeABpVMUmY1yYifdzCWLtjL6v+jDnA03p4PeVqDer/w2KDD439qOnkYBy 9v93veHlrq4SQGhODPSb6DG4FPdi7DDNlBLDSwxwyJClWorTyvE0YE6ZqRG6859bl9pk jHDMGK3FD8EF+jyJ78v9K3ckSPkvMCwnl6ZdIFNvZvOkVd8V3MCsLnMhMrJyZ5r6TIkk YgTwRdpd+X+kHA/HaVAo1CsSD4DXZnQ1u4dHZpYUU76M2G6vkTThYcGwj4b+I1gukyrR Kv4Q== X-Gm-Message-State: AOJu0Yy8pSbIK5S/fWZNTXnAQzXQjW+lWS/IQm6MBkazlseNXEE56nlY qZQtiwx32Ll8519RpRN5cJB9DArsb57ShvREtWdKl+fVgHAqXn3kPdOBkQHlKGeTAdZ2cBimy7s = X-Google-Smtp-Source: AGHT+IFof0kq9Bw5VJtTaRK+P6tv72wJLNHjkxNPz6nxMlClq4uH+tBeJWiPejkaq03UfVP3G8L2Gg== X-Received: by 2002:a17:907:98b:b0:a88:b90b:bd5e with SMTP id a640c23a62f3a-a89d8723fedmr1322870666b.3.1725536171251; Thu, 05 Sep 2024 04:36:11 -0700 (PDT) Message-ID: <8824b408-b27f-44ed-add1-87282e4d40af@suse.com> Date: Thu, 5 Sep 2024 13:36:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Matthew Barnes From: Jan Beulich Subject: [PATCH v4] x86/xstate: enable AMX components Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRW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FKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1725536193752116600 Content-Type: text/plain; charset="utf-8" These being controlled by XCR0, enabling support is relatively straightforward. Note however that there won't be any use of them until their dependent ISA extension CPUID flags are exposed, not the least due to recalculate_xstate() handling the dependencies in kind of a reverse manner. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- Intended to replace part of (and go beyond) "x86/cpufeatures: Add new cpuid features in SPR to featureset". --- v4: Add AMX-FP16 and AMX-COMPLEX. Add dependency on LM. Re-base. Split off of AMX series. v3: Add new states to XSTATE_NONLAZY. v2: New. --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -216,6 +216,9 @@ static void recalculate_xstate(struct cp if ( p->feat.pku ) xstates |=3D X86_XCR0_PKRU; =20 + if ( p->feat.amx_tile ) + xstates |=3D X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA; + /* Subleaf 0 */ p->xstate.max_size =3D xstate_uncompressed_size(xstates & ~XSTATE_XSAVES_ONLY); --- a/xen/arch/x86/include/asm/xstate.h +++ b/xen/arch/x86/include/asm/xstate.h @@ -35,7 +35,8 @@ extern uint32_t mxcsr_mask; XSTATE_NONLAZY) =20 #define XSTATE_ALL (~(1ULL << 63)) -#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU) +#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU= | \ + X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA) #define XSTATE_LAZY (XSTATE_ALL & ~XSTATE_NONLAZY) #define XSTATE_XSAVES_ONLY 0 #define XSTATE_COMPACTION_ENABLED (1ULL << 63) --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -278,8 +278,10 @@ XEN_CPUFEATURE(HYBRID, 9*32+15) / XEN_CPUFEATURE(TSXLDTRK, 9*32+16) /*a TSX load tracking suspend/resu= me insns */ XEN_CPUFEATURE(ARCH_LBR, 9*32+19) /* Architectural Last Branch Reco= rd */ XEN_CPUFEATURE(CET_IBT, 9*32+20) /* CET - Indirect Branch Tracking= */ +XEN_CPUFEATURE(AMX_BF16, 9*32+22) /* AMX BFloat16 instruction */ XEN_CPUFEATURE(AVX512_FP16, 9*32+23) /*A AVX512 FP16 instructions */ XEN_CPUFEATURE(AMX_TILE, 9*32+24) /* AMX Tile architecture */ +XEN_CPUFEATURE(AMX_INT8, 9*32+25) /* AMX 8-bit integer instructions= */ XEN_CPUFEATURE(IBRSB, 9*32+26) /*A IBRS and IBPB support (used by= Intel) */ XEN_CPUFEATURE(STIBP, 9*32+27) /*A STIBP */ XEN_CPUFEATURE(L1D_FLUSH, 9*32+28) /*S MSR_FLUSH_CMD and L1D flush. */ @@ -297,6 +299,7 @@ XEN_CPUFEATURE(FZRM, 10*32+10) / XEN_CPUFEATURE(FSRS, 10*32+11) /*A Fast Short REP STOSB */ XEN_CPUFEATURE(FSRCS, 10*32+12) /*A Fast Short REP CMPSB/SCASB */ XEN_CPUFEATURE(WRMSRNS, 10*32+19) /*S WRMSR Non-Serialising */ +XEN_CPUFEATURE(AMX_FP16, 10*32+21) /* AMX FP16 instruction */ XEN_CPUFEATURE(AVX_IFMA, 10*32+23) /*A AVX-IFMA Instructions */ =20 /* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */ @@ -331,6 +334,7 @@ XEN_CPUFEATURE(MCDT_NO, 13*32 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */ XEN_CPUFEATURE(AVX_VNNI_INT8, 15*32+ 4) /*A AVX-VNNI-INT8 Instructio= ns */ XEN_CPUFEATURE(AVX_NE_CONVERT, 15*32+ 5) /*A AVX-NE-CONVERT Instructi= ons */ +XEN_CPUFEATURE(AMX_COMPLEX, 15*32+ 8) /* AMX Complex Instructions= */ XEN_CPUFEATURE(AVX_VNNI_INT16, 15*32+10) /*A AVX-VNNI-INT16 Instructi= ons */ XEN_CPUFEATURE(PREFETCHI, 15*32+14) /*A PREFETCHIT{0,1} Instruct= ions */ XEN_CPUFEATURE(CET_SSS, 15*32+18) /* CET Supervisor Shadow St= acks safe to use */ --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -252,7 +252,7 @@ def crunch_numbers(state): # instruction groups which are specified to require XSAVE for state # management. XSAVE: [XSAVEOPT, XSAVEC, XGETBV1, XSAVES, - AVX, MPX, PKU, LWP], + AVX, MPX, PKU, AMX_TILE, LWP], =20 # AVX is taken to mean hardware support for 256bit registers (whic= h in # practice depends on the VEX prefix to encode), and the instructi= ons @@ -274,7 +274,7 @@ def crunch_numbers(state): # superpages, PCID and PKU are only available in 4 level paging. # NO_LMSL indicates the absense of Long Mode Segment Limits, which # have been dropped in hardware. - LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL], + LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE], =20 # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the # standard 3DNow in the earlier K6 processors. @@ -338,6 +338,11 @@ def crunch_numbers(state): =20 # The behaviour described by RRSBA depend on eIBRS being active. EIBRS: [RRSBA], + + # AMX-TILE means hardware support for tile registers and general n= on- + # computational instructions. All further AMX features are built = on top + # of AMX-TILE. + AMX_TILE: [AMX_BF16, AMX_INT8, AMX_FP16, AMX_COMPLEX], } =20 deep_features =3D tuple(sorted(deps.keys()))