From: David Edmondson <david.edmondson@oracle.com>
To: Yang Zhong <yang.zhong@intel.com>
Cc: kevin.tian@intel.com, seanjc@google.com,
jing2.liu@linux.intel.com, qemu-devel@nongnu.org,
wei.w.wang@intel.com, pbonzini@redhat.com, guang.zeng@intel.com
Subject: Re: [PATCH v2 2/8] x86: Add AMX XTILECFG and XTILEDATA components
Date: Mon, 21 Feb 2022 12:53:02 +0000 [thread overview]
Message-ID: <cun5yp8pej5.fsf@oracle.com> (raw)
In-Reply-To: <20220217060434.52460-3-yang.zhong@intel.com> (Yang Zhong's message of "Wed, 16 Feb 2022 22:04:28 -0800")
On Wednesday, 2022-02-16 at 22:04:28 -08, Yang Zhong wrote:
> From: Jing Liu <jing2.liu@intel.com>
>
> The AMX TILECFG register and the TMMx tile data registers are
> saved/restored via XSAVE, respectively in state component 17
> (64 bytes) and state component 18 (8192 bytes).
>
> Add AMX feature bits to x86_ext_save_areas array to set
> up AMX components. Add structs that define the layout of
> AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the
> structs sizes.
>
> Signed-off-by: Jing Liu <jing2.liu@intel.com>
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
> ---
> target/i386/cpu.h | 18 +++++++++++++++++-
> target/i386/cpu.c | 8 ++++++++
> 2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index de1dc124ab..06d2d6bccf 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -537,6 +537,8 @@ typedef enum X86Seg {
> #define XSTATE_ZMM_Hi256_BIT 6
> #define XSTATE_Hi16_ZMM_BIT 7
> #define XSTATE_PKRU_BIT 9
> +#define XSTATE_XTILE_CFG_BIT 17
> +#define XSTATE_XTILE_DATA_BIT 18
>
> #define XSTATE_FP_MASK (1ULL << XSTATE_FP_BIT)
> #define XSTATE_SSE_MASK (1ULL << XSTATE_SSE_BIT)
> @@ -845,6 +847,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
> #define CPUID_7_0_EDX_TSX_LDTRK (1U << 16)
> /* AVX512_FP16 instruction */
> #define CPUID_7_0_EDX_AVX512_FP16 (1U << 23)
> +/* AMX tile (two-dimensional register) */
> +#define CPUID_7_0_EDX_AMX_TILE (1U << 24)
> /* Speculation Control */
> #define CPUID_7_0_EDX_SPEC_CTRL (1U << 26)
> /* Single Thread Indirect Branch Predictors */
> @@ -1348,6 +1352,16 @@ typedef struct XSavePKRU {
> uint32_t padding;
> } XSavePKRU;
>
> +/* Ext. save area 17: AMX XTILECFG state */
> +typedef struct XSaveXTILECFG {
> + uint8_t xtilecfg[64];
> +} XSaveXTILECFG;
> +
> +/* Ext. save area 18: AMX XTILEDATA state */
> +typedef struct XSaveXTILEDATA {
> + uint8_t xtiledata[8][1024];
> +} XSaveXTILEDATA;
> +
> QEMU_BUILD_BUG_ON(sizeof(XSaveAVX) != 0x100);
> QEMU_BUILD_BUG_ON(sizeof(XSaveBNDREG) != 0x40);
> QEMU_BUILD_BUG_ON(sizeof(XSaveBNDCSR) != 0x40);
> @@ -1355,6 +1369,8 @@ QEMU_BUILD_BUG_ON(sizeof(XSaveOpmask) != 0x40);
> QEMU_BUILD_BUG_ON(sizeof(XSaveZMM_Hi256) != 0x200);
> QEMU_BUILD_BUG_ON(sizeof(XSaveHi16_ZMM) != 0x400);
> QEMU_BUILD_BUG_ON(sizeof(XSavePKRU) != 0x8);
> +QEMU_BUILD_BUG_ON(sizeof(XSaveXTILECFG) != 0x40);
> +QEMU_BUILD_BUG_ON(sizeof(XSaveXTILEDATA) != 0x2000);
>
> typedef struct ExtSaveArea {
> uint32_t feature, bits;
> @@ -1362,7 +1378,7 @@ typedef struct ExtSaveArea {
> uint32_t ecx;
> } ExtSaveArea;
>
> -#define XSAVE_STATE_AREA_COUNT (XSTATE_PKRU_BIT + 1)
> +#define XSAVE_STATE_AREA_COUNT (XSTATE_XTILE_DATA_BIT + 1)
>
> extern ExtSaveArea x86_ext_save_areas[XSAVE_STATE_AREA_COUNT];
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 37f06b0b1a..ea7e8f9081 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -1401,6 +1401,14 @@ ExtSaveArea x86_ext_save_areas[XSAVE_STATE_AREA_COUNT] = {
> [XSTATE_PKRU_BIT] =
> { .feature = FEAT_7_0_ECX, .bits = CPUID_7_0_ECX_PKU,
> .size = sizeof(XSavePKRU) },
> + [XSTATE_XTILE_CFG_BIT] = {
> + .feature = FEAT_7_0_EDX, .bits = CPUID_7_0_EDX_AMX_TILE,
> + .size = sizeof(XSaveXTILECFG),
> + },
> + [XSTATE_XTILE_DATA_BIT] = {
> + .feature = FEAT_7_0_EDX, .bits = CPUID_7_0_EDX_AMX_TILE,
> + .size = sizeof(XSaveXTILEDATA)
> + },
> };
>
> static uint32_t xsave_area_size(uint64_t mask)
dme.
--
Would you offer your throat to the wolf with the red roses?
next prev parent reply other threads:[~2022-02-21 13:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 6:04 [PATCH v2 0/8] AMX support in Qemu Yang Zhong
2022-02-17 6:04 ` [PATCH v2 1/8] x86: Fix the 64-byte boundary enumeration for extended state Yang Zhong
2022-02-21 12:51 ` David Edmondson
2022-02-17 6:04 ` [PATCH v2 2/8] x86: Add AMX XTILECFG and XTILEDATA components Yang Zhong
2022-02-21 12:53 ` David Edmondson [this message]
2022-02-17 6:04 ` [PATCH v2 3/8] x86: Grant AMX permission for guest Yang Zhong
2022-02-17 5:58 ` Yang Zhong
2022-02-17 13:44 ` Paolo Bonzini
2022-02-25 10:40 ` Yang Zhong
2022-02-17 6:04 ` [PATCH v2 4/8] x86: Add XFD faulting bit for state components Yang Zhong
2022-02-21 13:00 ` David Edmondson
2022-02-25 7:10 ` Yang Zhong
2022-02-17 6:04 ` [PATCH v2 5/8] x86: Add AMX CPUIDs enumeration Yang Zhong
2022-02-23 11:30 ` David Edmondson
2022-02-17 6:04 ` [PATCH v2 6/8] x86: add support for KVM_CAP_XSAVE2 and AMX state migration Yang Zhong
2022-02-21 13:25 ` David Edmondson
2022-02-25 7:33 ` Yang Zhong
2022-02-17 6:04 ` [PATCH v2 7/8] x86: Support XFD and AMX xsave data migration Yang Zhong
2022-02-21 13:30 ` David Edmondson
2022-02-17 6:04 ` [PATCH v2 8/8] linux-header: Sync the linux headers Yang Zhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cun5yp8pej5.fsf@oracle.com \
--to=david.edmondson@oracle.com \
--cc=guang.zeng@intel.com \
--cc=jing2.liu@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seanjc@google.com \
--cc=wei.w.wang@intel.com \
--cc=yang.zhong@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.