target-arm queue
It always feels a bit odd to write a message to myself here :-) Anyway, here's the latest pile of arm patches...
The following changes since commit 4a331bb33bdf112ba95470e5d6ea3561b049c280:
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging (2014-06-09 15:00:21 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20140609
for you to fetch changes up to ff00c11324276b8064b3a5d00491d0f9c6291a77:
target-arm: Delete unused iwmmxt_msadb helper (2014-06-09 15:43:26 +0100)
----------------------------------------------------------------
target-arm queue:
* support -bios option in vexpress boards
* register the Cortex-A57 impdef system registers
* implement PD0/PD1 bits in TTBCR
* fix handling of UXN bit in ARMv8 page tables
* complete support of crypto insns in A32/T32
* implement CRC and crypto insns in A64
* fix bugs in generic timer control register
----------------------------------------------------------------
Ard Biesheuvel (1):
target-arm: add support for v8 SHA1 and SHA256 instructions
Fabian Aggeler (2):
target-arm: Prepare cpreg writefns/readfns for EL3/SecExt
target-arm: implement PD0/PD1 bits for TTBCR
Grant Likely (1):
vexpress: Add support for the -bios flag to provide firmware
Ian Campbell (1):
target-arm: Correct handling of UXN bit in ARMv8 LPAE page tables
Peter Maydell (15):
target-arm/cpu64.c: Actually register Cortex-A57 impdef registers
target-arm: Allow 3reg_wide undefreq to encode more bad size options
target-arm: add support for v8 VMULL.P64 instruction
target-arm: A64: Use PMULL feature bit for PMULL
target-arm: arm_any_initfn() should never set ARM_FEATURE_AARCH64
target-arm: Remove unnecessary setting of feature bits
target-arm: Clean up handling of ARMv8 optional feature bits
target-arm: VFPv4 implies half-precision extension
target-arm: A64: Implement CRC instructions
target-arm: A32/T32: Mask CRC value in calling code, not helper
target-arm: A64: Implement AES instructions
target-arm: A64: Implement 3-register SHA instructions
target-arm: A64: Implement two-register SHA instructions
target-arm: Fix errors in writes to generic timer control registers
target-arm: Delete unused iwmmxt_msadb helper
hw/arm/vexpress.c | 13 +++ linux-user/elfload.c | 9 +- target-arm/cpu.c | 13 +-- target-arm/cpu.h | 19 ++++ target-arm/cpu64.c | 15 ++- target-arm/crypto_helper.c | 257 +++++++++++++++++++++++++++++++++++++++++++-- target-arm/helper-a64.c | 60 +++++------ target-arm/helper-a64.h | 4 +- target-arm/helper.c | 136 +++++++++++++----------- target-arm/helper.h | 14 ++- target-arm/iwmmxt_helper.c | 9 -- target-arm/neon_helper.c | 30 ++++++ target-arm/translate-a64.c | 211 ++++++++++++++++++++++++++++++++++++- target-arm/translate.c | 144 ++++++++++++++++++++++--- 14 files changed, 790 insertions(+), 144 deletions(-)
[Qemu-devel] [PULL 20/20] target-arm: Delete unused iwmmxt_msadb helper
The iwmmxt_msadb helper and its corresponding gen function are unused; delete them. (This function appears to have never been used right back to the initial implementation of iwMMXt; it is identical to iwmmxt_madduq, and is presumably an accidental remnant from the initial development.)
Message-id: [email protected]
--- target-arm/helper.h | 2 -- target-arm/iwmmxt_helper.c | 9 --------- target-arm/translate.c | 2 -- 3 files changed, 13 deletions(-)
target-arm/helper.h +0 -2
@@ -456,8 +456,6 @@ DEF_HELPER_3(iwmmxt_avgb1, i64, env, i64, i64) DEF_HELPER_3(iwmmxt_avgw0, i64, env, i64, i64) DEF_HELPER_3(iwmmxt_avgw1, i64, env, i64, i64) -DEF_HELPER_2(iwmmxt_msadb, i64, i64, i64) - DEF_HELPER_3(iwmmxt_align, i64, i64, i64, i32)DEF_HELPER_4 (iwmmxt_insr, i64, i64, i32, i32, i32)
target-arm/iwmmxt_helper.c +0 -9
@@ -369,15 +369,6 @@ IWMMXT_OP_AVGW(1)#undef IWMMXT_OP_AVGW#undef AVGW -uint64_t HELPER (iwmmxt_msadb )(uint64_t a,uint64_t b) -{ - a = ((((a >>0 ) &0xffff ) * ((b >>0 ) &0xffff ) + - ((a >>16 ) &0xffff ) * ((b >>16 ) &0xffff )) &0xffffffff ) | - ((((a >>32 ) &0xffff ) * ((b >>32 ) &0xffff ) + - ((a >>48 ) &0xffff ) * ((b >>48 ) &0xffff )) <<32 ); -return a; -} -uint64_t HELPER (iwmmxt_align )(uint64_t a,uint64_t b,uint32_t n) { a >>= n <<3 ;
target-arm/translate.c +0 -2
@@ -1382,8 +1382,6 @@ IWMMXT_OP_ENV(avgb1) IWMMXT_OP_ENV(avgw0) IWMMXT_OP_ENV(avgw1) -IWMMXT_OP(msadb) - IWMMXT_OP_ENV(packuw) IWMMXT_OP_ENV(packul) IWMMXT_OP_ENV(packuq)
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 15/20] target-arm: A32/T32: Mask CRC value in calling code, not helper
In reply to Peter MaydellBring the 32-bit CRC helper functions into line with the A64 ones, by masking the high bytes of the value in the calling code rather than the helper. This is more efficient since we can determine the mask at translation time.
Message-id: [email protected]
--- target-arm/helper.c | 25 ++++++------------------- target-arm/translate.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 19 deletions(-)
target-arm/helper.c +6 -19
@@ -5585,28 +5585,15 @@ int arm_rmode_to_sf(int rmode)return rmode; } -static void crc_init_buffer (uint8_t *buf,uint32_t val,uint32_t bytes) -{ -memset (buf,0 ,4 ); - -if (bytes ==1 ) { - buf[0 ] = val &0xff ; - }else if (bytes ==2 ) { - buf[0 ] = val &0xff ; - buf[1 ] = (val >>8 ) &0xff ; - }else { - buf[0 ] = val &0xff ; - buf[1 ] = (val >>8 ) &0xff ; - buf[2 ] = (val >>16 ) &0xff ; - buf[3 ] = (val >>24 ) &0xff ; - } -} - +/* CRC helpers. +* The upper bytes of val (above the number specified by 'bytes') must have +* been zeroed out by the caller. +*/ uint32_t HELPER (crc32 )(uint32_t acc,uint32_t val,uint32_t bytes) {uint8_t buf[4 ]; -crc_init_buffer (buf, val, bytes); +stl_le_p (buf, val);/* zlib crc32 converts the accumulator and output to one's complement. */ return crc32 (acc ^0xffffffff , buf, bytes) ^0xffffffff ;
@@ -5616,7 +5603,7 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) {uint8_t buf[4 ]; -crc_init_buffer (buf, val, bytes); +stl_le_p (buf, val);/* Linux crc32c converts the output to one's complement. */ return crc32c (acc, buf, bytes) ^0xffffffff ;
target-arm/translate.c +10 -0
@@ -7806,6 +7806,11 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s) tmp =load_reg (s, rn); tmp2 =load_reg (s, rm); +if (op1 ==0 ) { +tcg_gen_andi_i32 (tmp2, tmp2,0xff ); + }else if (op1 ==1 ) { +tcg_gen_andi_i32 (tmp2, tmp2,0xffff ); + } tmp3 =tcg_const_i32 (1 << op1);if (c &0x2 ) {gen_helper_crc32c (tmp, tmp, tmp2, tmp3);
@@ -9438,6 +9443,11 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw } tmp2 =load_reg (s, rm); +if (sz ==0 ) { +tcg_gen_andi_i32 (tmp2, tmp2,0xff ); + }else if (sz ==1 ) { +tcg_gen_andi_i32 (tmp2, tmp2,0xffff ); + } tmp3 =tcg_const_i32 (1 << sz);if (c) {gen_helper_crc32c (tmp, tmp, tmp2, tmp3);
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 16/20] target-arm: A64: Implement AES instructions
In reply to Peter MaydellImplement the AES instructions from the optional Crypto Extensions.
Message-id: [email protected]
--- linux-user/elfload.c | 1 + target-arm/translate-a64.c | 51 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-)
linux-user/elfload.c +1 -0
@@ -539,6 +539,7 @@ static uint32_t get_elf_hwcap(void)/* probe for the extra features */ #define GET_FEATURE (feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) +GET_FEATURE (ARM_FEATURE_V8_AES ,ARM_HWCAP_A64_AES );GET_FEATURE (ARM_FEATURE_V8_PMULL ,ARM_HWCAP_A64_PMULL );GET_FEATURE (ARM_FEATURE_CRC ,ARM_HWCAP_A64_CRC32 );#undef GET_FEATURE
target-arm/translate-a64.c +50 -1
63 lines not on this page · raw message
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 18/20] target-arm: A64: Implement two-register SHA instructions
In reply to Peter MaydellImplement the two-register SHA instruction group from the optional Crypto Extensions.
Message-id: [email protected]
--- linux-user/elfload.c | 2 ++ target-arm/translate-a64.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-)
linux-user/elfload.c +2 -0
@@ -541,6 +541,8 @@ static uint32_t get_elf_hwcap(void) do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)GET_FEATURE (ARM_FEATURE_V8_AES ,ARM_HWCAP_A64_AES );GET_FEATURE (ARM_FEATURE_V8_PMULL ,ARM_HWCAP_A64_PMULL ); +GET_FEATURE (ARM_FEATURE_V8_SHA1 ,ARM_HWCAP_A64_SHA1 ); +GET_FEATURE (ARM_FEATURE_V8_SHA256 ,ARM_HWCAP_A64_SHA2 );GET_FEATURE (ARM_FEATURE_CRC ,ARM_HWCAP_A64_CRC32 );#undef GET_FEATURE
target-arm/translate-a64.c +44 -1
57 lines not on this page · raw message
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 19/20] target-arm: Fix errors in writes to generic timer control registers
In reply to Peter MaydellThe code for handling writes to the generic timer control registers had several bugs:
* ISTATUS (bit 2) is read-only but we forced it to zero on any write
* the check for "was IMASK (bit 1) toggled?" incorrectly used '&' where it should be '^'
* the handling of IMASK was inverted: we should set the IRQ if ISTATUS is set and IMASK is clear, not if both are set
The combination of these bugs meant that when running a Linux guest that uses the generic timers we would fairly quickly end up either forgetting that the timer output should be asserted, or failing to set the IRQ when the timer was unmasked. The result is that the guest never gets any more timer interrupts.
Message-id: [email protected]
Cc: [email protected]
--- target-arm/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-arm/helper.c +3 -3
@@ -1040,16 +1040,16 @@ static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,int timeridx = ri->crm &1 ;uint32_t oldval = env->cp15.c14_timer[timeridx].ctl; - env->cp15.c14_timer[timeridx].ctl = value &3 ; + env->cp15.c14_timer[timeridx].ctl =deposit64 (oldval,0 ,2 , value);if ((oldval ^ value) &1 ) {/* Enable toggled */ gt_recalc_timer (cpu, timeridx); - }else if ((oldval & value) &2 ) { + }else if ((oldval ^ value) &2 ) {/* IMASK toggled: don't need to recalculate, * just set the interrupt line based on ISTATUS */ qemu_set_irq (cpu->gt_timer_outputs[timeridx], - (oldval &4 ) && (value &2 )); + (oldval &4 ) && !(value &2 )); } }
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 09/20] target-arm: A64: Use PMULL feature bit for PMULL
In reply to Peter MaydellNow that we have a separate ARM_FEATURE_V8_PMULL bit, use it for the A64 PMULL, not the AES feature bit.
--- linux-user/elfload.c | 2 +- target-arm/translate-a64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
linux-user/elfload.c +1 -1
@@ -539,7 +539,7 @@ static uint32_t get_elf_hwcap(void)/* probe for the extra features */ #define GET_FEATURE (feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) -GET_FEATURE (ARM_FEATURE_V8_AES ,ARM_HWCAP_A64_PMULL ); +GET_FEATURE (ARM_FEATURE_V8_PMULL ,ARM_HWCAP_A64_PMULL );#undef GET_FEATUREreturn hwcaps;
target-arm/translate-a64.c +1 -1
@@ -8574,7 +8574,7 @@ static void disas_simd_three_reg_diff(DisasContext *s, uint32_t insn)return ; }if (size ==3 ) { -if (!arm_dc_feature (s,ARM_FEATURE_V8_AES )) { +if (!arm_dc_feature (s,ARM_FEATURE_V8_PMULL )) {unallocated_encoding (s);return ; }
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 10/20] target-arm: arm_any_initfn() should never set ARM_FEATURE_AARCH64
In reply to Peter MaydellThe arm_any_initfn() is used only for the 32-bit linux-user "cpu any", so it only gets called in builds where TARGET_AARCH64 is not defined. Remove the unreachable line which sets ARM_FEATURE_AARCH64.
Message-id: [email protected]
--- target-arm/cpu.c | 3 --- 1 file changed, 3 deletions(-)
target-arm/cpu.c +0 -3
@@ -963,9 +963,6 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_ARM_DIV );set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_CRC ); -#ifdef TARGET_AARCH64 -set_feature (&cpu->env,ARM_FEATURE_AARCH64 ); -#endif cpu->midr = 0xffffffff; }#endif
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 11/20] target-arm: Remove unnecessary setting of feature bits
In reply to Peter MaydellFEATURE_V8 implies both FEATURE_V7MP and FEATURE_ARM_DIV, so we don't need to set them explicitly in initfns which set the V8 feature bit.
Message-id: [email protected]
--- target-arm/cpu.c | 2 -- target-arm/cpu64.c | 2 -- 2 files changed, 4 deletions(-)
target-arm/cpu.c +0 -2
@@ -960,8 +960,6 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_THUMB2EE ); -set_feature (&cpu->env,ARM_FEATURE_ARM_DIV ); -set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_CRC ); cpu->midr =0xffffffff ; }
target-arm/cpu64.c +0 -2
@@ -140,8 +140,6 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP4 );set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON ); -set_feature (&cpu->env,ARM_FEATURE_ARM_DIV ); -set_feature (&cpu->env,ARM_FEATURE_V7MP );set_feature (&cpu->env,ARM_FEATURE_AARCH64 ); cpu->ctr =0x80030003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 13/20] target-arm: VFPv4 implies half-precision extension
In reply to Peter MaydellVFPv4 implies the presence of the half-precision floating point extension (which is optional in VFPv3). Add this implied rule to arm_cpu_realizefn() and remove some no-longer-needed explicit setting of the bit in initfns.
Message-id: [email protected]
--- target-arm/cpu.c | 3 +-- target-arm/cpu64.c | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-)
target-arm/cpu.c +1 -2
@@ -348,6 +348,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) }if (arm_feature (env,ARM_FEATURE_VFP4 )) {set_feature (env,ARM_FEATURE_VFP3 ); +set_feature (env,ARM_FEATURE_VFP_FP16 ); }if (arm_feature (env,ARM_FEATURE_VFP3 )) {set_feature (env,ARM_FEATURE_VFP );
@@ -744,7 +745,6 @@ static void cortex_a15_initfn(Object *obj) cpu->dtb_compatible ="arm,cortex-a15" ;set_feature (&cpu->env,ARM_FEATURE_V7 );set_feature (&cpu->env,ARM_FEATURE_VFP4 ); -set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_ARM_DIV );
@@ -953,7 +953,6 @@ static void arm_any_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);set_feature (&cpu->env,ARM_FEATURE_V8 );set_feature (&cpu->env,ARM_FEATURE_VFP4 ); -set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_THUMB2EE );set_feature (&cpu->env,ARM_FEATURE_V8_AES );
target-arm/cpu64.c +0 -2
@@ -93,7 +93,6 @@ static void aarch64_a57_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8 );set_feature (&cpu->env,ARM_FEATURE_VFP4 ); -set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_AARCH64 );
@@ -143,7 +142,6 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8 );set_feature (&cpu->env,ARM_FEATURE_VFP4 ); -set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_AARCH64 );set_feature (&cpu->env,ARM_FEATURE_V8_AES );
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 14/20] target-arm: A64: Implement CRC instructions
In reply to Peter MaydellImplement the optional A64 CRC instructions.
Message-id: [email protected]
--- linux-user/elfload.c | 1 + target-arm/helper-a64.c | 30 ++++++++++++++++++++++++++ target-arm/helper-a64.h | 2 ++ target-arm/translate-a64.c | 54 +++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 86 insertions(+), 1 deletion(-)
linux-user/elfload.c +1 -0
@@ -540,6 +540,7 @@ static uint32_t get_elf_hwcap(void)#define GET_FEATURE (feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)GET_FEATURE (ARM_FEATURE_V8_PMULL ,ARM_HWCAP_A64_PMULL ); +GET_FEATURE (ARM_FEATURE_CRC ,ARM_HWCAP_A64_CRC32 );#undef GET_FEATUREreturn hwcaps;
target-arm/helper-a64.c +30 -0
@@ -24,6 +24,8 @@#include "sysemu/sysemu.h" #include "qemu/bitops.h" #include "internals.h" +#include "qemu/crc32c.h" +#include <zlib.h> /* For crc32 */ /* C2.4.7 Multiply and divide */ /* special cases for 0 and LLONG_MIN are mandated by the standard */
@@ -408,6 +410,34 @@ float32 HELPER(fcvtx_f64_to_f32)(float64 a, CPUARMState *env)return r; } +/* 64-bit versions of the CRC helpers. Note that although the operation +* (and the prototypes of crc32c() and crc32() mean that only the bottom +* 32 bits of the accumulator and result are used, we pass and return +* uint64_t for convenience of the generated code. Unlike the 32-bit +* instruction set versions, val may genuinely have 64 bits of data in it. +* The upper bytes of val (above the number specified by 'bytes') must have +* been zeroed out by the caller. +*/ +uint64_t HELPER (crc32_64 )(uint64_t acc,uint64_t val,uint32_t bytes) +{ +uint8_t buf[8 ]; + +stq_le_p (buf, val); + +/* zlib crc32 converts the accumulator and output to one's complement. */ +return crc32 (acc ^0xffffffff , buf, bytes) ^0xffffffff ; +} + +uint64_t HELPER (crc32c_64 )(uint64_t acc,uint64_t val,uint32_t bytes) +{ +uint8_t buf[8 ]; + +stq_le_p (buf, val); + +/* Linux crc32c converts the output to one's complement. */ +return crc32c (acc, buf, bytes) ^0xffffffff ; +} +/* Handle a CPU exception. */ void aarch64_cpu_do_interrupt (CPUState *cs) {
target-arm/helper-a64.h +2 -0
@@ -44,3 +44,5 @@ DEF_HELPER_FLAGS_1(neon_addlp_u16, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(frecpx_f64, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(frecpx_f32, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(fcvtx_f64_to_f32, TCG_CALL_NO_RWG, f32, f64, env) +DEF_HELPER_FLAGS_3(crc32_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32) +DEF_HELPER_FLAGS_3 (crc32c_64,TCG_CALL_NO_RWG_SE , i64, i64, i64, i32)
target-arm/translate-a64.c +53 -1
67 lines not on this page · raw message
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 07/20] target-arm: Allow 3reg_wide undefreq to encode more bad size options
In reply to Peter MaydellThe current undefreq field in the neon_3reg_wide handling allows us to encode "UNDEF if size != 0" and "UNDEF if size == 0". This is no longer sufficient with the advent of 64-bit polynomial VMULL, which means we want to UNDEF if size == 1. Change the undefreq encoding to use separate bits for all of "UNDEF if size == 0", "UNDEF if size == 1" and "UNDEF if size == 2".
Message-id: [email protected]
--- target-arm/translate.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
target-arm/translate.c +12 -12
@@ -5954,10 +5954,11 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t insint src1_wide;int src2_wide;int prewiden; -/* undefreq: bit 0 : UNDEF if size != 0 -* bit 1 : UNDEF if size == 0 -* bit 2 : UNDEF if U == 1 -* Note that [1:0] set implies 'always UNDEF' +/* undefreq: bit 0 : UNDEF if size == 0 +* bit 1 : UNDEF if size == 1 +* bit 2 : UNDEF if size == 2 +* bit 3 : UNDEF if U == 1 +* Note that [2:0] set implies 'always UNDEF' */ int undefreq;/* prewiden, src1_wide, src2_wide, undefreq */
@@ -5971,13 +5972,13 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t ins {0, 1, 1, 0}, /* VSUBHN */ {0, 0, 0, 0}, /* VABDL */ {0, 0, 0, 0}, /* VMLAL */ - {0, 0, 0, 6}, /* VQDMLAL */ + {0, 0, 0, 9}, /* VQDMLAL */ {0, 0, 0, 0}, /* VMLSL */ - {0, 0, 0, 6}, /* VQDMLSL */ + {0, 0, 0, 9}, /* VQDMLSL */ {0, 0, 0, 0}, /* Integer VMULL */ - {0, 0, 0, 2}, /* VQDMULL */ - {0, 0, 0, 5}, /* Polynomial VMULL */ - {0, 0, 0, 3}, /* Reserved: always UNDEF */ + {0, 0, 0, 1}, /* VQDMULL */ + {0, 0, 0, 15}, /* Polynomial VMULL */ + {0, 0, 0, 7}, /* Reserved: always UNDEF */ }; prewiden = neon_3reg_wide[op][0 ];
@@ -5985,9 +5986,8 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t ins src2_wide = neon_3reg_wide[op][2 ]; undefreq = neon_3reg_wide[op][3 ]; -if (((undefreq &1 ) && (size !=0 )) || - ((undefreq &2 ) && (size ==0 )) || - ((undefreq &4 ) && u)) { +if ((undefreq & (1 << size)) || + ((undefreq &8 ) && u)) {return 1 ; } if ((src1_wide && (rn & 1)) ||
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 17/20] target-arm: A64: Implement 3-register SHA instructions
In reply to Peter MaydellImplement the 3-register SHA instruction group from the optional Crypto Extensions.
Message-id: [email protected]
--- target-arm/translate-a64.c | 59 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-)
target-arm/translate-a64.c +58 -1
@@ -10609,7 +10609,64 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn)*/ static void disas_crypto_three_reg_sha (DisasContext *s,uint32_t insn) { -unsupported_encoding (s, insn); +int size =extract32 (insn,22 ,2 ); +int opcode =extract32 (insn,12 ,3 ); +int rm =extract32 (insn,16 ,5 ); +int rn =extract32 (insn,5 ,5 ); +int rd =extract32 (insn,0 ,5 ); +CryptoThreeOpEnvFn *genfn; +TCGv_i32 tcg_rd_regno, tcg_rn_regno, tcg_rm_regno; +int feature =ARM_FEATURE_V8_SHA256 ; + +if (size !=0 ) { +unallocated_encoding (s); +return ; + } + +switch (opcode) { +case 0 :/* SHA1C */ +case 1 :/* SHA1P */ +case 2 :/* SHA1M */ +case 3 :/* SHA1SU0 */ + genfn =NULL ; + feature =ARM_FEATURE_V8_SHA1 ; +break ; +case 4 :/* SHA256H */ + genfn = gen_helper_crypto_sha256h; +break ; +case 5 :/* SHA256H2 */ + genfn = gen_helper_crypto_sha256h2; +break ; +case 6 :/* SHA256SU1 */ + genfn = gen_helper_crypto_sha256su1; +break ; +default : +unallocated_encoding (s); +return ; + } + +if (!arm_dc_feature (s, feature)) { +unallocated_encoding (s); +return ; + } + + tcg_rd_regno =tcg_const_i32 (rd <<1 ); + tcg_rn_regno =tcg_const_i32 (rn <<1 ); + tcg_rm_regno =tcg_const_i32 (rm <<1 ); + +if (genfn) { +genfn (cpu_env, tcg_rd_regno, tcg_rn_regno, tcg_rm_regno); + }else { +TCGv_i32 tcg_opcode =tcg_const_i32 (opcode); + +gen_helper_crypto_sha1_3reg (cpu_env, tcg_rd_regno, + tcg_rn_regno, tcg_rm_regno, tcg_opcode); +tcg_temp_free_i32 (tcg_opcode); + } + +tcg_temp_free_i32 (tcg_rd_regno); +tcg_temp_free_i32 (tcg_rn_regno); +tcg_temp_free_i32 (tcg_rm_regno); }/* C3.6.21 Crypto two-reg SHA
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 08/20] target-arm: add support for v8 VMULL.P64 instruction
In reply to Peter MaydellAdd support for the VMULL.P64 polynomial 64x64 to 128 bit multiplication instruction in the A32/T32 instruction sets; this is part of the v8 Crypto Extensions.
To do this we have to move the neon_pmull_64_{lo,hi} helpers from helper-a64.c into neon_helper.c so they can be used by the AArch32 translator.
Message-id: [email protected]
--- linux-user/elfload.c | 1 + target-arm/cpu.c | 1 + target-arm/cpu.h | 1 + target-arm/helper-a64.c | 30 ------------------------------ target-arm/helper-a64.h | 2 -- target-arm/helper.h | 3 +++ target-arm/neon_helper.c | 30 ++++++++++++++++++++++++++++++ target-arm/translate.c | 26 +++++++++++++++++++++++++- 8 files changed, 61 insertions(+), 33 deletions(-)
linux-user/elfload.c +1 -0
@@ -468,6 +468,7 @@ static uint32_t get_elf_hwcap2(void)uint32_t hwcaps =0 ;GET_FEATURE (ARM_FEATURE_V8_AES ,ARM_HWCAP2_ARM_AES ); +GET_FEATURE (ARM_FEATURE_V8_PMULL ,ARM_HWCAP2_ARM_PMULL );GET_FEATURE (ARM_FEATURE_V8_SHA1 ,ARM_HWCAP2_ARM_SHA1 );GET_FEATURE (ARM_FEATURE_V8_SHA256 ,ARM_HWCAP2_ARM_SHA2 );GET_FEATURE (ARM_FEATURE_CRC ,ARM_HWCAP2_ARM_CRC32 );
target-arm/cpu.c +1 -0
@@ -319,6 +319,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)set_feature (env,ARM_FEATURE_V8_AES );set_feature (env,ARM_FEATURE_V8_SHA1 );set_feature (env,ARM_FEATURE_V8_SHA256 ); +set_feature (env,ARM_FEATURE_V8_PMULL ); }if (arm_feature (env,ARM_FEATURE_V7 )) {set_feature (env,ARM_FEATURE_VAPA );
target-arm/cpu.h +1 -0
@@ -653,6 +653,7 @@ enum arm_features {ARM_FEATURE_EL3 ,/* has EL3 Secure monitor support */ ARM_FEATURE_V8_SHA1 ,/* implements SHA1 part of v8 Crypto Extensions */ ARM_FEATURE_V8_SHA256 ,/* implements SHA256 part of v8 Crypto Extensions */ + ARM_FEATURE_V8_PMULL, /* implements PMULL part of v8 Crypto Extensions */ };static inline int arm_feature (CPUARMState *env,int feature)
target-arm/helper-a64.c +0 -30
@@ -186,36 +186,6 @@ uint64_t HELPER(simd_tbl)(CPUARMState *env, uint64_t result, uint64_t indices,return result; } -/* Helper function for 64 bit polynomial multiply case: -* perform PolynomialMult(op1, op2) and return either the top or -* bottom half of the 128 bit result. -*/ -uint64_t HELPER (neon_pmull_64_lo )(uint64_t op1,uint64_t op2) -{ -int bitnum; -uint64_t res =0 ; - -for (bitnum =0 ; bitnum <64 ; bitnum++) { -if (op1 & (1ULL << bitnum)) { - res ^= op2 << bitnum; - } - } -return res; -} -uint64_t HELPER (neon_pmull_64_hi )(uint64_t op1,uint64_t op2) -{ -int bitnum; -uint64_t res =0 ; - -/* bit 0 of op1 can't influence the high 64 bits at all */ -for (bitnum =1 ; bitnum <64 ; bitnum++) { -if (op1 & (1ULL << bitnum)) { - res ^= op2 >> (64 - bitnum); - } - } -return res; -} -/* 64bit/double versions of the neon float compare functions */ uint64_t HELPER (neon_ceq_f64 )(float64 a,float64 b,void *fpstp) {
target-arm/helper-a64.h +0 -2
@@ -28,8 +28,6 @@ DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr) DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr) DEF_HELPER_3(vfp_cmped_a64, i64, f64, f64, ptr) DEF_HELPER_FLAGS_5(simd_tbl, TCG_CALL_NO_RWG_SE, i64, env, i64, i64, i32, i32) -DEF_HELPER_FLAGS_2(neon_pmull_64_lo, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_2(neon_pmull_64_hi, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_3(vfp_mulxs, TCG_CALL_NO_RWG, f32, f32, f32, ptr) DEF_HELPER_FLAGS_3(vfp_mulxd, TCG_CALL_NO_RWG, f64, f64, f64, ptr)DEF_HELPER_FLAGS_3 (neon_ceq_f64,TCG_CALL_NO_RWG , i64, i64, i64, ptr)
target-arm/helper.h +3 -0
@@ -525,6 +525,9 @@ DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_2(dc_zva, void, env, i64) +DEF_HELPER_FLAGS_2(neon_pmull_64_lo, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(neon_pmull_64_hi, TCG_CALL_NO_RWG_SE, i64, i64, i64) +#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif
target-arm/neon_helper.c +30 -0
@@ -2211,3 +2211,33 @@ void HELPER(neon_zip16)(CPUARMState *env, uint32_t rd, uint32_t rm) env->vfp.regs[rm] =make_float64 (m0); env->vfp.regs[rd] =make_float64 (d0); } + +/* Helper function for 64 bit polynomial multiply case: +* perform PolynomialMult(op1, op2) and return either the top or +* bottom half of the 128 bit result. +*/ +uint64_t HELPER (neon_pmull_64_lo )(uint64_t op1,uint64_t op2) +{ +int bitnum; +uint64_t res =0 ; + +for (bitnum =0 ; bitnum <64 ; bitnum++) { +if (op1 & (1ULL << bitnum)) { + res ^= op2 << bitnum; + } + } +return res; +} +uint64_t HELPER (neon_pmull_64_hi )(uint64_t op1,uint64_t op2) +{ +int bitnum; +uint64_t res =0 ; + +/* bit 0 of op1 can't influence the high 64 bits at all */ +for (bitnum =1 ; bitnum <64 ; bitnum++) { +if (op1 & (1ULL << bitnum)) { + res ^= op2 >> (64 - bitnum); + } + } +return res; +}
target-arm/translate.c +25 -1
@@ -5977,7 +5977,7 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t ins {0, 0, 0, 9}, /* VQDMLSL */ {0, 0, 0, 0}, /* Integer VMULL */ {0, 0, 0, 1}, /* VQDMULL */ - {0, 0, 0, 15}, /* Polynomial VMULL */ + {0, 0, 0, 0xa}, /* Polynomial VMULL */ {0, 0, 0, 7}, /* Reserved: always UNDEF */ };
@@ -5996,6 +5996,30 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t insreturn 1 ; } +/* Handle VMULL.P64 (Polynomial 64x64 to 128 bit multiply) +* outside the loop below as it only performs a single pass. +*/ +if (op ==14 && size ==2 ) { +TCGv_i64 tcg_rn, tcg_rm, tcg_rd; + +if (!arm_feature (env,ARM_FEATURE_V8_PMULL )) { +return 1 ; + } + tcg_rn =tcg_temp_new_i64 (); + tcg_rm =tcg_temp_new_i64 (); + tcg_rd =tcg_temp_new_i64 (); +neon_load_reg64 (tcg_rn, rn); +neon_load_reg64 (tcg_rm, rm); +gen_helper_neon_pmull_64_lo (tcg_rd, tcg_rn, tcg_rm); +neon_store_reg64 (tcg_rd, rd); +gen_helper_neon_pmull_64_hi (tcg_rd, tcg_rn, tcg_rm); +neon_store_reg64 (tcg_rd, rd +1 ); +tcg_temp_free_i64 (tcg_rn); +tcg_temp_free_i64 (tcg_rm); +tcg_temp_free_i64 (tcg_rd); +return 0 ; + } +/* Avoid overlapping operands. Wide source operands are always aligned so will never overlap with wide destinations in problematic ways. */
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 12/20] target-arm: Clean up handling of ARMv8 optional feature bits
In reply to Peter MaydellCRC and crypto are both optional v8 extensions, so FEATURE_V8 should not imply them. Instead we should set these bits in the initfns for the 32-bit and 64-bit "cpu any" and for the Cortex-A57.
Message-id: [email protected]
--- target-arm/cpu.c | 8 ++++---- target-arm/cpu64.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-)
target-arm/cpu.c +4 -4
@@ -316,10 +316,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)set_feature (env,ARM_FEATURE_V7 );set_feature (env,ARM_FEATURE_ARM_DIV );set_feature (env,ARM_FEATURE_LPAE ); -set_feature (env,ARM_FEATURE_V8_AES ); -set_feature (env,ARM_FEATURE_V8_SHA1 ); -set_feature (env,ARM_FEATURE_V8_SHA256 ); -set_feature (env,ARM_FEATURE_V8_PMULL ); }if (arm_feature (env,ARM_FEATURE_V7 )) {set_feature (env,ARM_FEATURE_VAPA );
@@ -960,6 +956,10 @@ static void arm_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_THUMB2EE ); +set_feature (&cpu->env,ARM_FEATURE_V8_AES ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); +set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); cpu->midr =0xffffffff ; }
target-arm/cpu64.c +10 -0
@@ -98,6 +98,11 @@ static void aarch64_a57_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_AARCH64 );set_feature (&cpu->env,ARM_FEATURE_CBAR_RO ); +set_feature (&cpu->env,ARM_FEATURE_V8_AES ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); +set_feature (&cpu->env,ARM_FEATURE_V8_PMULL ); +set_feature (&cpu->env,ARM_FEATURE_CRC ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; cpu->midr =0x411fd070 ; cpu->reset_fpsid =0x41034070 ;
@@ -141,6 +146,11 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_VFP_FP16 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_AARCH64 ); +set_feature (&cpu->env,ARM_FEATURE_V8_AES ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA1 ); +set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 ); +set_feature (&cpu->env,ARM_FEATURE_V8_PMULL ); +set_feature (&cpu->env,ARM_FEATURE_CRC ); cpu->ctr =0x80030003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize =7 ;/* 512 bytes */ }
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 02/20] target-arm/cpu64.c: Actually register Cortex-A57 impdef registers
In reply to Peter Maydellcpu64.c contains a reginfo list for the impdef registers on the Cortex-A57; however we forgot to actually call define_arm_cp_regs(), so it was sitting there doing nothing. Remedy this omission.
Message-id: [email protected]
--- target-arm/cpu64.c | 1 + 1 file changed, 1 insertion(+)
target-arm/cpu64.c +1 -0
@@ -128,6 +128,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->ccsidr[1 ] =0x201fe012 ;/* 48KB L1 icache */ cpu->ccsidr[2 ] =0x70ffe07a ;/* 2048KB L2 cache */ cpu->dcz_blocksize =4 ;/* 64 bytes */ +define_arm_cp_regs (cpu, cortexa57_cp_reginfo); }#ifdef CONFIG_USER_ONLY
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 05/20] target-arm: Correct handling of UXN bit in ARMv8 LPAE page tables
In reply to Peter MaydellFrom: Ian Campbell <[email protected]>
In v8 page tables bit 54 in the PTE is UXN in the EL0/EL1 translation regimes and XN elsewhere. In v7 the bit is always XN. Since we only emulate EL0/EL1 we can just treat this bit as UXN whenever we are in v8 mode.
Also correctly extract the upper attributes from the PTE entry, the v8 version tried to avoid extracting the CONTIG bit and ended up with the upper bits being off-by-one. Instead behave the same as v7 and extract (but ignore) the CONTIG bit.
This fixes "Bad mode in Synchronous Abort handler detected, code 0x8400000f" seen when modprobing modules under Linux.
--- target-arm/helper.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
target-arm/helper.c +8 -9
@@ -3955,13 +3955,8 @@ static int get_phys_addr_lpae(CPUARMState *env, target_ulong address, page_size = (1 << ((granule_sz * (4 - level)) +3 )); descaddr |= (address & (page_size -1 ));/* Extract attributes from the descriptor and merge with table attrs */ -if (arm_feature (env,ARM_FEATURE_V8 )) { - attrs =extract64 (descriptor,2 ,10 ) - | (extract64 (descriptor,53 ,11 ) <<10 ); - }else { - attrs =extract64 (descriptor,2 ,10 ) - | (extract64 (descriptor,52 ,12 ) <<10 ); - } + attrs =extract64 (descriptor,2 ,10 ) + | (extract64 (descriptor,52 ,12 ) <<10 ); attrs |=extract32 (tableattrs,0 ,2 ) <<11 ;/* XN, PXN */ attrs |=extract32 (tableattrs,3 ,1 ) <<5 ;/* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
@@ -3987,8 +3982,12 @@ static int get_phys_addr_lpae(CPUARMState *env, target_ulong address, goto do_fault; } *prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ; -if (attrs & (1 <<12 ) || (!is_user && (attrs & (1 <<11 )))) { -/* XN or PXN */ +if ((arm_feature (env,ARM_FEATURE_V8 ) && is_user && (attrs & (1 <<12 ))) || + (!arm_feature (env,ARM_FEATURE_V8 ) && (attrs & (1 <<12 ))) || + (!is_user && (attrs & (1 <<11 )))) { +/* XN/UXN or PXN. Since we only implement EL0/EL1 we unconditionally +* treat XN/UXN as UXN for v8. +*/ if (access_type ==2 ) { goto do_fault; }
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 01/20] vexpress: Add support for the -bios flag to provide firmware
In reply to Peter MaydellFrom: Grant Likely <[email protected]>
Right now to run firmware inside the QEMU VExpress model requires padding out the firmware image to the size of the virtual flash and passing it in via the -pflash argument. If the firmware image is passed without padding, then QEMU will fail. Also, when passed as a -pflash argument, QEMU treats the file as persistent storage and will modify the file.
The -bios flag provides the semantics that we want for providing a firmware image. This patch maps the contents of the -bios file into the address space at the boot flash location.
Tested with the vexpress-a15 model and the Tianocore port.
[PMM: folded long line, removed stray \n from error message,
use correct variable for printing image name, exit(1) rather than 0]
--- hw/arm/vexpress.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/arm/vexpress.c +13 -0
@@ -28,6 +28,7 @@#include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" +#include "hw/loader.h" #include "exec/address-spaces.h" #include "sysemu/blockdev.h" #include "hw/block/flash.h"
@@ -528,6 +529,18 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard, daughterboard->init (daughterboard, machine->ram_size, machine->cpu_model, pic); +/* +* If a bios file was provided, attempt to map it into memory +*/ +if (bios_name) { +const char *fn =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!fn ||load_image_targphys (fn, map[VE_NORFLASH0 ], +VEXPRESS_FLASH_SIZE ) <0 ) { +error_report ("Could not load ROM image '%s'" , bios_name); +exit (1 ); + } + } +/* Motherboard peripherals: the wiring is the same but the * addresses vary between the legacy and A-Series memory maps. */
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 04/20] target-arm: implement PD0/PD1 bits for TTBCR
In reply to Peter MaydellFrom: Fabian Aggeler <[email protected]>
Corrected handling of writes to TTBCR for ARMv8 (previously UNK/SBZP bits are not RES0) and ARMv7 (new bits PD0/PD1 for CPUs with Security Extensions).
Bits PD0/PD1 are now respected in get_phys_addr_v6/v5() and get_level1_table_address.
Message-id: [email protected] Reviewed by: Greg Bellows <[email protected]>
--- target-arm/cpu.h | 16 ++++++++++++++ target-arm/helper.c | 60 ++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 59 insertions(+), 17 deletions(-)
target-arm/cpu.h +16 -0
@@ -430,6 +430,22 @@ int arm_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw,/* Execution state bits. MRS read as zero, MSR writes ignored. */ #define CPSR_EXEC (CPSR_T | CPSR_IT | CPSR_J) +#define TTBCR_N (7U << 0)/* TTBCR.EAE==0 */ +#define TTBCR_T0SZ (7U << 0)/* TTBCR.EAE==1 */ +#define TTBCR_PD0 (1U << 4) +#define TTBCR_PD1 (1U << 5) +#define TTBCR_EPD0 (1U << 7) +#define TTBCR_IRGN0 (3U << 8) +#define TTBCR_ORGN0 (3U << 10) +#define TTBCR_SH0 (3U << 12) +#define TTBCR_T1SZ (3U << 16) +#define TTBCR_A1 (1U << 22) +#define TTBCR_EPD1 (1U << 23) +#define TTBCR_IRGN1 (3U << 24) +#define TTBCR_ORGN1 (3U << 26) +#define TTBCR_SH1 (1U << 28) +#define TTBCR_EAE (1U << 31) +/* Bit definitions for ARMv8 SPSR (PSTATE) format. * Only these are valid when in AArch64 mode; in * AArch32 mode SPSRs are basically CPSR-format.
target-arm/helper.c +43 -17
92 lines not on this page · raw message
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 06/20] target-arm: add support for v8 SHA1 and SHA256 instructions
In reply to Peter MaydellFrom: Ard Biesheuvel <[email protected]>
This adds support for the SHA1 and SHA256 instructions that are available on some v8 implementations of Aarch32.
Message-id: [email protected] [PMM:
* rebase
* fix bad indent
* add a missing UNDEF check for Q!=1 in the 3-reg SHA1/SHA256 case
* use g_assert_not_reached()
* don't re-extract bit 6 for the 2-reg-misc encodings
* set the ELF HWCAP2 bits for the new features
]
--- linux-user/elfload.c | 2 + target-arm/cpu.c | 2 + target-arm/cpu.h | 2 + target-arm/crypto_helper.c | 257 +++++++++++++++++++++++++++++++++++++++++++-- target-arm/helper.h | 9 ++ target-arm/translate.c | 84 +++++++++++++++ 6 files changed, 349 insertions(+), 7 deletions(-)
linux-user/elfload.c +2 -0
@@ -468,6 +468,8 @@ static uint32_t get_elf_hwcap2(void)uint32_t hwcaps =0 ;GET_FEATURE (ARM_FEATURE_V8_AES ,ARM_HWCAP2_ARM_AES ); +GET_FEATURE (ARM_FEATURE_V8_SHA1 ,ARM_HWCAP2_ARM_SHA1 ); +GET_FEATURE (ARM_FEATURE_V8_SHA256 ,ARM_HWCAP2_ARM_SHA2 );GET_FEATURE (ARM_FEATURE_CRC ,ARM_HWCAP2_ARM_CRC32 );return hwcaps; }
target-arm/cpu.c +2 -0
@@ -317,6 +317,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)set_feature (env,ARM_FEATURE_ARM_DIV );set_feature (env,ARM_FEATURE_LPAE );set_feature (env,ARM_FEATURE_V8_AES ); +set_feature (env,ARM_FEATURE_V8_SHA1 ); +set_feature (env,ARM_FEATURE_V8_SHA256 ); }if (arm_feature (env,ARM_FEATURE_V7 )) {set_feature (env,ARM_FEATURE_VAPA );
target-arm/cpu.h +2 -0
@@ -651,6 +651,8 @@ enum arm_features {ARM_FEATURE_CBAR_RO ,/* has cp15 CBAR and it is read-only */ ARM_FEATURE_EL2 ,/* has EL2 Virtualization support */ ARM_FEATURE_EL3 ,/* has EL3 Secure monitor support */ +ARM_FEATURE_V8_SHA1 ,/* implements SHA1 part of v8 Crypto Extensions */ + ARM_FEATURE_V8_SHA256, /* implements SHA256 part of v8 Crypto Extensions */ };static inline int arm_feature (CPUARMState *env,int feature)
target-arm/crypto_helper.c +250 -7
294 lines not on this page · raw message
target-arm/helper.h +9 -0
@@ -512,6 +512,15 @@ DEF_HELPER_3(neon_qzip32, void, env, i32, i32) DEF_HELPER_4(crypto_aese, void, env, i32, i32, i32) DEF_HELPER_4(crypto_aesmc, void, env, i32, i32, i32) +DEF_HELPER_5(crypto_sha1_3reg, void, env, i32, i32, i32, i32) +DEF_HELPER_3(crypto_sha1h, void, env, i32, i32) +DEF_HELPER_3(crypto_sha1su1, void, env, i32, i32) + +DEF_HELPER_4(crypto_sha256h, void, env, i32, i32, i32) +DEF_HELPER_4(crypto_sha256h2, void, env, i32, i32, i32) +DEF_HELPER_3(crypto_sha256su0, void, env, i32, i32) +DEF_HELPER_4(crypto_sha256su1, void, env, i32, i32, i32) + DEF_HELPER_FLAGS_3(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_FLAGS_3(crc32c, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32)DEF_HELPER_2 (dc_zva, void, env, i64)
target-arm/translate.c +84 -0
132 lines not on this page · raw message
Signature · 1 line
1.9.2
[Qemu-devel] [PULL 03/20] target-arm: Prepare cpreg writefns/readfns for EL3/SecExt
In reply to Peter MaydellFrom: Fabian Aggeler <[email protected]>
This patch changes some readfns/writefns to use raw_write and raw_read functions, which use the fieldoffset specified in ARMCPRegInfo instead of directly accessing the field. This will simplify patches for EL3 & Security Extensions.
Message-id: [email protected]
--- target-arm/helper.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
target-arm/helper.c +14 -14
@@ -319,7 +319,7 @@ static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) {ARMCPU *cpu =arm_env_get_cpu (env); - env->cp15.c3 = value; +raw_write (env, ri, value);tlb_flush (CPU (cpu),1 );/* Flush TLB as domain not tracked in TLB */ }
@@ -327,12 +327,12 @@ static void fcse_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) {ARMCPU *cpu =arm_env_get_cpu (env); -if (env->cp15.c13_fcse != value) { +if (raw_read (env, ri) != value) {/* Unlike real hardware the qemu TLB uses virtual addresses, * not modified virtual addresses, so this causes a TLB flush. */ tlb_flush (CPU (cpu),1 ); - env->cp15.c13_fcse = value; +raw_write (env, ri, value); } }
@@ -341,7 +341,7 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri, {ARMCPU *cpu =arm_env_get_cpu (env); -if (env->cp15.contextidr_el1 != value && !arm_feature (env,ARM_FEATURE_MPU ) +if (raw_read (env, ri) != value && !arm_feature (env,ARM_FEATURE_MPU ) && !extended_addresses_enabled (env)) {/* For VMSA (when not using the LPAE long descriptor page table * format) this register includes the ASID, so do a TLB flush.
@@ -349,7 +349,7 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,*/ tlb_flush (CPU (cpu),1 ); } - env->cp15.contextidr_el1 = value; +raw_write (env, ri, value); } static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -693,7 +693,7 @@ static uint64_t ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri)static void csselr_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) { - env->cp15.c0_cssel = value &0xf ; +raw_write (env, ri, value &0xf ); }static uint64_t isr_read (CPUARMState *env,const ARMCPRegInfo *ri)
@@ -1216,11 +1216,11 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {static void par_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) {if (arm_feature (env,ARM_FEATURE_LPAE )) { - env->cp15.par_el1 = value; +raw_write (env, ri, value); }else if (arm_feature (env,ARM_FEATURE_V7 )) { - env->cp15.par_el1 = value &0xfffff6ff ; +raw_write (env, ri, value &0xfffff6ff ); }else { - env->cp15.par_el1 = value &0xfffff1ff ; +raw_write (env, ri, value &0xfffff1ff ); } }
@@ -1423,7 +1423,7 @@ static void vmsa_ttbcr_raw_write(CPUARMState *env, const ARMCPRegInfo *ri,* for long-descriptor tables the TTBCR fields are used differently * and the c2_mask and c2_base_mask values are meaningless. */ - env->cp15.c2_control = value; +raw_write (env, ri, value); env->cp15.c2_mask = ~(((uint32_t )0xffffffffu ) >> maskshift); env->cp15.c2_base_mask = ~((uint32_t )0x3fffu >> maskshift); }
@@ -1445,7 +1445,7 @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,static void vmsa_ttbcr_reset (CPUARMState *env,const ARMCPRegInfo *ri) { env->cp15.c2_base_mask =0xffffc000u ; - env->cp15.c2_control =0 ; +raw_write (env, ri,0 ); env->cp15.c2_mask =0 ; }
@@ -1456,7 +1456,7 @@ static void vmsa_tcr_el1_write(CPUARMState *env, const ARMCPRegInfo *ri,/* For AArch64 the A1 bit could result in a change of ASID, so TLB flush. */ tlb_flush (CPU (cpu),1 ); - env->cp15.c2_control = value; +raw_write (env, ri, value); } static void vmsa_ttbr_write(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -2151,14 +2151,14 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, {ARMCPU *cpu =arm_env_get_cpu (env); -if (env->cp15.c1_sys == value) { +if (raw_read (env, ri) == value) {/* Skip the TLB flush if nothing actually changed; Linux likes * to do a lot of pointless SCTLR writes. */ return ; } - env->cp15.c1_sys = value; +raw_write (env, ri, value);/* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush (CPU (cpu),1 );
Signature · 1 line
1.9.2