Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d7e535b
target/ppc: Introduce TRANS*FLAGS macros
Jan 7, 2022
436dee7
target/ppc: moved vector even and odd multiplication to decodetree
Jan 7, 2022
15a766f
target/ppc: Moved vector multiply high and low to decodetree
Jan 7, 2022
9e3bb9e
target/ppc: vmulh* instructions use gvec
Jan 7, 2022
7a2c94d
target/ppc: Implement vmsumcud instruction
vcoracolombo Jan 7, 2022
98ee99f
target/ppc: Implement vmsumudm instruction
vcoracolombo Jan 7, 2022
1336c84
target/ppc: Move vexts[bhw]2[wd] to decodetree
Jan 7, 2022
0e53c7c
target/ppc: Implement vextsd2q
Jan 7, 2022
bcb21e0
target/ppc: Move Vector Compare Equal/Not Equal/Greater Than to decod…
mferst Jan 7, 2022
e3ac733
target/ppc: Move Vector Compare Not Equal or Zero to decodetree
mferst Jan 7, 2022
aa9c72c
target/ppc: Implement Vector Compare Equal Quadword
mferst Jan 7, 2022
f38705b
target/ppc: Implement Vector Compare Greater Than Quadword
mferst Jan 7, 2022
9652b92
target/ppc: Implement Vector Compare Quadword
mferst Jan 7, 2022
1e6eaf6
target/ppc: implement vstri[bh][lr]
mferst Jan 7, 2022
6500969
target/ppc: implement vclrlb
mferst Jan 7, 2022
ceaca22
target/ppc: implement vclrrb
mferst Jan 7, 2022
09e4a69
target/ppc: implement vcntmb[bhwd]
mferst Jan 7, 2022
25050f6
target/ppc: implement vgnb
mferst Jan 7, 2022
8ef6e12
target/ppc: Move vsel and vperm/vpermr to decodetree
mferst Sep 8, 2021
516b63e
target/ppc: Move xxsel to decodetree
mferst Sep 14, 2021
55ff801
target/ppc: move xxperm/xxpermr to decodetree
mferst Sep 10, 2021
565d4b2
target/ppc: Move xxpermdi to decodetree
mferst Sep 10, 2021
213ba85
target/ppc: Implement xxpermx instruction
mferst Sep 8, 2021
4338750
tcg/tcg-op-gvec.c: Introduce tcg_gen_gvec_4i
mferst Sep 2, 2021
63a50fd
target/ppc: Implement xxeval
mferst Sep 2, 2021
26a0c56
target/ppc: Implement xxgenpcv[bhwd]m instruction
mferst Sep 17, 2021
a3e4501
target/ppc: move xs[n]madd[am][ds]p/xs[n]msub[am][ds]p to decodetree
mferst Nov 25, 2021
19bf7ee
target/ppc: implement xs[n]maddqp[o]/xs[n]msubqp[o]
mferst Nov 25, 2021
59b9f68
target/ppc: Implement xvtlsbb instruction
vcoracolombo Nov 30, 2021
0aa9d7e
target/ppc: Remove xscmpnedp instruction
vcoracolombo Jan 6, 2022
ca48bb6
target/ppc: Refactor VSX_SCALAR_CMP_DP
vcoracolombo Dec 13, 2021
562bb9c
target/ppc: Implement xscmp{eq,ge,gt}qp
vcoracolombo Dec 13, 2021
e7bfb62
target/ppc: Implement do_helper_XX3 and move xxperm* to use it
vcoracolombo Jan 5, 2022
e0163c2
target/ppc: Move xscmp{eq,ge,gt}dp to decodetree
vcoracolombo Dec 13, 2021
685eb9b
target/ppc: Move xs{max,min}[cj]dp to use do_helper_XX3
vcoracolombo Jan 5, 2022
7de4af5
target/ppc: Refactor VSX_MAX_MINC helper
vcoracolombo Dec 7, 2021
58fb22b
target/ppc: Implement xs{max,min}cqp
vcoracolombo Dec 7, 2021
beef345
target/ppc: Implement xvcvbf16spn and xvcvspbf16 instructions
vcoracolombo Dec 29, 2021
ab637d6
target/ppc: Fix insn32.decode style issues
vcoracolombo Jan 14, 2022
70c0ec8
target/ppc: Implement mffscdrn[i] instructions
vcoracolombo Jan 18, 2022
269fc54
target/ppc: Move mffsce to decodetree
vcoracolombo Jan 18, 2022
e16242e
target/ppc: Move mffscrn[i] to decodetree
vcoracolombo Jan 18, 2022
6fa9d05
target/ppc: Move mffsl to decodetree
vcoracolombo Jan 18, 2022
fd7e824
target/ppc: Move mffs[.] to decodetree
vcoracolombo Jan 19, 2022
e28778c
target/ppc: Implement hashst(p) and hashchk(p) instructions
vcoracolombo Jan 12, 2022
ea10fce
linux-user/ppc: deliver SIGTRAP on POWERPC_EXCP_TRAP
mferst Jan 13, 2022
1a3aacf
tests/tcg/ppc64le: change signal_save_restore_xer to use SIGTRAP
mferst Jan 13, 2022
c21622d
target/ppc: Fix gen_priv_exception error value in mfspr/mtspr
mferst Jan 13, 2022
8a2269a
tests/tcg/ppc64[le]: add tests for hashst and hashchk
vcoracolombo Jan 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/tcg/tcg-op-gvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,25 @@ typedef struct {
bool write_aofs;
} GVecGen4;

typedef struct {
/*
* Expand inline as a 64-bit or 32-bit integer. Only one of these will be
* non-NULL.
*/
void (*fni8)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64, int64_t);
void (*fni4)(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32, int32_t);
/* Expand inline with a host vector type. */
void (*fniv)(unsigned, TCGv_vec, TCGv_vec, TCGv_vec, TCGv_vec, int64_t);
/* Expand out-of-line helper w/descriptor, data in descriptor. */
gen_helper_gvec_4 *fno;
/* The optional opcodes, if any, utilized by .fniv. */
const TCGOpcode *opt_opc;
/* The vector element size, if applicable. */
uint8_t vece;
/* Prefer i64 to v64. */
bool prefer_i64;
} GVecGen4i;

void tcg_gen_gvec_2(uint32_t dofs, uint32_t aofs,
uint32_t oprsz, uint32_t maxsz, const GVecGen2 *);
void tcg_gen_gvec_2i(uint32_t dofs, uint32_t aofs, uint32_t oprsz,
Expand All @@ -231,6 +250,9 @@ void tcg_gen_gvec_3i(uint32_t dofs, uint32_t aofs, uint32_t bofs,
const GVecGen3i *);
void tcg_gen_gvec_4(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t cofs,
uint32_t oprsz, uint32_t maxsz, const GVecGen4 *);
void tcg_gen_gvec_4i(uint32_t dofs, uint32_t aofs, uint32_t bofs, uint32_t cofs,
uint32_t oprsz, uint32_t maxsz, int64_t c,
const GVecGen4i *);

/* Expand a specific vector operation. */

Expand Down
2 changes: 2 additions & 0 deletions linux-headers/asm-powerpc/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ struct kvm_ppc_cpu_char {
#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3)
#define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)
#define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5)
#define KVM_REG_PPC_HASHKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x00) /* TODO */
#define KVM_REG_PPC_HASHPKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x00) /* TODO */

/* Transactional Memory checkpointed state:
* This is all GPRs, all VSX regs and a subset of SPRs
Expand Down
3 changes: 2 additions & 1 deletion linux-user/ppc/cpu_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ void cpu_loop(CPUPPCState *env)
}
break;
case POWERPC_EXCP_TRAP:
cpu_abort(cs, "Tried to call a TRAP\n");
si_signo = TARGET_SIGTRAP;
si_code = TARGET_TRAP_BRKPT;
break;
default:
/* Should not happen ! */
Expand Down
2 changes: 2 additions & 0 deletions target/ppc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,8 @@ typedef PowerPCCPU ArchCPU;
#define SPR_BOOKE_GIVOR14 (0x1BD)
#define SPR_TIR (0x1BE)
#define SPR_PTCR (0x1D0)
#define SPR_POWER_HASHKEYR (0x1D4)
#define SPR_POWER_HASHPKEYR (0x1D5)
#define SPR_BOOKE_SPEFSCR (0x200)
#define SPR_Exxx_BBEAR (0x201)
#define SPR_Exxx_BBTAR (0x202)
Expand Down
8 changes: 8 additions & 0 deletions target/ppc/cpu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -7592,6 +7592,14 @@ static void init_proc_POWER10(CPUPPCState *env)
spr_read_generic, spr_write_generic,
KVM_REG_PPC_PSSCR, 0);

/* FIXME: should this be here? */
spr_register_kvm(env, SPR_POWER_HASHKEYR, "HASHPKEYR",
SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic,
KVM_REG_PPC_HASHKEYR, 0x0);
spr_register_kvm(env, SPR_POWER_HASHPKEYR, "HASHPKEYR",
SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic,
KVM_REG_PPC_HASHPKEYR, 0x0);

/* env variables */
env->dcache_line_size = 128;
env->icache_line_size = 128;
Expand Down
86 changes: 86 additions & 0 deletions target/ppc/excp_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,92 @@ void helper_td(CPUPPCState *env, target_ulong arg1, target_ulong arg2,
#endif
#endif

static uint32_t helper_SIMON_LIKE_32_64(uint32_t x, uint64_t key, uint32_t lane)
{
uint32_t c = 0xfffc;
uint64_t z0 = 0xfa2561cdf44ac398;
uint16_t z = 0, temp;
uint16_t k[32], eff_k[32], xleft[33], xright[33], fxleft[32];

for (int i = 3; i >= 0; i--) {
k[i] = key & 0xffff;
key >>= 16;
}
xleft[0] = x & 0xffff;
xright[0] = (x >> 16) & 0xffff;

for (int i = 0; i < 28; i++) {
z |= ((z0 >> (63 - i)) & 1) << 48;
temp = ror16(k[i + 3], 3) ^ k[i + 1];
k[i + 4] = c ^ z ^ k[i] ^ temp ^ ror16(temp, 1);
}

for (int i = 0; i < 8; i++)
{
eff_k[4 * i + 0] = k[4 * i + ((0 + lane) % 4)];
eff_k[4 * i + 1] = k[4 * i + ((1 + lane) % 4)];
eff_k[4 * i + 2] = k[4 * i + ((2 + lane) % 4)];
eff_k[4 * i + 3] = k[4 * i + ((3 + lane) % 4)];
}

for (int i = 0; i < 32; i++)
{
fxleft[i] = (rol16(xleft[i], 1) &
rol16(xleft[i], 8)) ^ rol16(xleft[i], 2);
xleft[i + 1] = xright[i] ^ fxleft[i] ^ eff_k[i];
xright[i + 1] = xleft[i];
}

return (((uint32_t)xright[32]) << 16) | xleft[32];
}

/* TODO: check this implementation correctness; make it better */
static uint64_t hash_digest(uint64_t ra, uint64_t rb, uint64_t key)
{
uint64_t stage0_h = 0ULL, stage0_l = 0ULL;
uint64_t stage1_h, stage1_l;

for (int i = 0; i < 4; i++) {
stage0_h |= ror64(rb & 0xff, 8 * (2 * i + 1));
stage0_h |= ((ra >> 32) & 0xff) << (8 * 2 * i);
stage0_l |= ror64((rb >> 32) & 0xff, 8 * (2 * i +1));
stage0_l |= (ra & 0xff) << (8 * 2 * i);
rb >>= 8;
ra >>= 8;
}

stage1_h = (uint64_t)helper_SIMON_LIKE_32_64(stage0_h >> 32, key, 0) << 32;
stage1_h |= helper_SIMON_LIKE_32_64(stage0_h, key, 1);
stage1_l = (uint64_t)helper_SIMON_LIKE_32_64(stage0_l >> 32, key, 2) << 32;
stage1_l |= helper_SIMON_LIKE_32_64(stage0_l, key, 3);

return (stage1_h ^ stage1_l);
}

#define HELPER_HASH(op, key, store) \
void helper_##op(CPUPPCState *env, target_ulong ea, target_ulong ra, \
target_ulong rb) \
{ \
uint64_t chash = hash_digest(ra, rb, key), lhash; \
\
if (store) { \
cpu_stq_data_ra(env, ea, chash, GETPC()); \
} \
else { \
lhash = cpu_ldq_data_ra(env, ea, GETPC()); \
if (lhash != chash) { \
/* hashes don't match, trap */ \
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM, \
POWERPC_EXCP_TRAP, GETPC()); \
} \
} \
}

HELPER_HASH(HASHST, env->spr[SPR_POWER_HASHKEYR], true)
HELPER_HASH(HASHCHK, env->spr[SPR_POWER_HASHKEYR], false)
HELPER_HASH(HASHSTP, env->spr[SPR_POWER_HASHPKEYR], true)
HELPER_HASH(HASHCHKP, env->spr[SPR_POWER_HASHPKEYR], false)

#if !defined(CONFIG_USER_ONLY)
/*****************************************************************************/
/* PowerPC 601 specific instructions (POWER bridge) */
Expand Down
Loading