|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 16/28] x86emul: support APX forms of {LD,ST}TILECFG
Besides adding table entries and case labels, re-existing handling can
be re-used. The only special aspect once again is dealing with the
512-bit memory operands in EVEX Disp8 testing.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v4: New.
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -1192,6 +1192,12 @@ static const struct test popcnt[] = {
INSN(popcntw, 66, map4, 88, el, w, no),
};
+static const struct test amx_tile[] = {
+ /* Element size is set arbitrarily here. See test_one(). */
+ INSN(ldtilecfg, , 0f38, 49, el, b, no),
+ INSN(sttilecfg, 66, 0f38, 49, el, b, no),
+};
+
static const unsigned char vl_all[] = { VL_512, VL_128, VL_256 };
static const unsigned char vl_128[] = { VL_128 };
static const unsigned char vl_no128[] = { VL_512, VL_256 };
@@ -1452,6 +1458,13 @@ static void test_one(const struct test *
{
asm volatile ( "kxnorw %k1, %k1, %k1" );
asm volatile ( "vxorps %xmm4, %xmm4, %xmm4" );
+
+ /*
+ * {LD,ST}TILECFG's operand size of 512 bits doesn't match up with
+ * EVEX.L'L being 0.
+ */
+ if ( test->spc == SPC_0f38 && test->opc == 0x49 )
+ vsz = 64;
}
else
{
@@ -1796,6 +1809,7 @@ void evex_disp8_test(void *instr, struct
} while ( false )
RUN(adx);
+ RUN(amx_tile);
RUN(avx512f);
RUN(avx512dq);
RUN(avx512bw);
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1937,6 +1937,8 @@ static const struct evex {
{ { 0x45 }, 2, T, R, pfx_66, Wn, Ln }, /* vpsrlv{d,q} */
{ { 0x46 }, 2, T, R, pfx_66, Wn, Ln }, /* vpsrav{d,q} */
{ { 0x47 }, 2, T, R, pfx_66, Wn, Ln }, /* vpsllv{d,q} */
+ { { 0x49, 0x00 }, 2, F, R, pfx_no, W0, L0 }, /* ldtilecfg */
+ { { 0x49, 0x00 }, 2, F, W, pfx_66, W0, L0 }, /* sttilecfg */
{ { 0x4c }, 2, T, R, pfx_66, Wn, Ln }, /* vrcp14p{s,d} */
{ { 0x4d }, 2, T, R, pfx_66, Wn, LIG }, /* vrcp14s{s,d} */
{ { 0x4e }, 2, T, R, pfx_66, Wn, Ln }, /* vrsqrt14p{s,d} */
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -6218,6 +6218,45 @@ int main(int argc, char **argv)
else
printf("skipped\n");
+ if ( stack_exec && cpu_has_amx_tile && cpu_has_apx_f )
+ {
+ static const struct x86_tilecfg tilecfg_apx = {
+ .palette = 1,
+ .colsb = { 2, 3, 4, 5 },
+ .rows = { 5, 4, 3, 2 },
+ };
+ decl_insn(ldtilecfg_apx);
+ decl_insn(sttilecfg_apx);
+
+ printf("%-40s", "Testing ldtilecfg (%r26)...");
+
+ asm volatile ( put_insn(ldtilecfg_apx,
+ /* ldtilecfg (%%r26) */
+ ".byte 0x62, 0xda, 0x7c, 0x08, 0x49, 0x02") );
+
+ set_insn(ldtilecfg_apx);
+ load_egpr(26, (unsigned long)&tilecfg_apx);
+ rc = x86_emulate(&ctxt, &emulops);
+ if ( rc != X86EMUL_OKAY || !check_eip(ldtilecfg_apx) )
+ goto fail;
+ printf("pending\n");
+
+ printf("%-40s", "Testing sttilecfg -4(%r25)...");
+
+ asm volatile ( put_insn(sttilecfg_apx,
+ /* sttilecfg -4(%%r25) */
+ ".byte 0x62, 0xda, 0x7d, 0x08, 0x49, 0x41,
0xfc") );
+
+ memset(res, ~0, 72);
+ set_insn(sttilecfg_apx);
+ load_egpr(25, (unsigned long)(res + 2));
+ rc = x86_emulate(&ctxt, &emulops);
+ if ( rc != X86EMUL_OKAY || !check_eip(sttilecfg_apx) ||
+ ~res[0] || ~res[17] || memcmp(res + 1, &tilecfg_apx, 64) )
+ goto fail;
+ printf("okay\n");
+ }
+
printf("%-40s", "Testing vzeroupper (compat)...");
if ( cpu_has_avx )
{
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -1271,6 +1271,9 @@ decode_0f38(struct x86_emulate_state *s,
s->simd_size = simd_packed_fp;
break;
+ case X86EMUL_OPC_EVEX_66(0, 0x49): /* sttilecfg */
+ s->promoted_evex = true;
+ fallthrough;
case X86EMUL_OPC_VEX_66(0, 0x49): /* sttilecfg */
case X86EMUL_OPC_VEX_F3(0, 0x4b): /* tilestored */
s->desc = DstMem | SrcImplicit | Mov;
@@ -1308,6 +1311,7 @@ decode_0f38(struct x86_emulate_state *s,
case X86EMUL_OPC_VEX_F2(0, 0xf7): /* shrx */
break;
+ case X86EMUL_OPC_EVEX(0, 0x49): /* ldtilecfg */
case X86EMUL_OPC_EVEX_66(0, 0xe0) ...
X86EMUL_OPC_EVEX_66(0, 0xef): /* cmp<cc>xadd */
case X86EMUL_OPC_EVEX(0, 0xf2): /* andn */
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6650,10 +6650,16 @@ x86_emulate(
generate_exception_if(vex.l, X86_EXC_UD);
goto simd_0f_avx;
+ case X86EMUL_OPC_EVEX(0x0f38, 0x49):
+ generate_exception_if(evex.lr || evex.brs || evex.opmsk, X86_EXC_UD);
+ fallthrough;
case X86EMUL_OPC_VEX(0x0f38, 0x49):
generate_exception_if(!mode_64bit() || vex.l || vex.w, X86_EXC_UD);
if ( ea.type == OP_REG )
{
+ if ( evex_encoded() )
+ goto unrecognized_insn;
+
switch ( modrm )
{
case 0xc0: /* tilerelease */
@@ -6725,6 +6731,9 @@ x86_emulate(
}
goto unrecognized_insn;
+ case X86EMUL_OPC_EVEX_66(0x0f38, 0x49):
+ generate_exception_if(evex.lr || evex.brs || evex.opmsk, X86_EXC_UD);
+ fallthrough;
case X86EMUL_OPC_VEX_66(0x0f38, 0x49):
generate_exception_if(!mode_64bit() || vex.l || vex.w, X86_EXC_UD);
if ( ea.type == OP_REG )
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |