target-arm queue
Just a collection of bug fixes this time around...
thanks
-- PMM
The following changes since commit 2a6ae69154542caa91dd17c40fd3f5ffbec300de:
Merge tag 'pull-maintainer-ominbus-030723-1' of https://gitlab.com/stsquad/qemu into staging (2023-07-04 08:36:44 +0200)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230704
for you to fetch changes up to 86a78272f094857b4eda79d721c116e93942aa9a:
target/xtensa: Assert that interrupt level is within bounds (2023-07-04 14:27:08 +0100)
----------------------------------------------------------------
target-arm queue:
* Add raw_writes ops for register whose write induce TLB maintenance
* hw/arm/sbsa-ref: use XHCI to replace EHCI
* Avoid splitting Zregs across lines in dump
* Dump ZA[] when active
* Fix SME full tile indexing
* Handle IC IVAU to improve compatibility with JITs
* xlnx-canfd-test: Fix code coverity issues
* gdbstub: Guard M-profile code with CONFIG_TCG
* allwinner-sramc: Set class_size
* target/xtensa: Assert that interrupt level is within bounds
----------------------------------------------------------------
Akihiko Odaki (1):
hw: arm: allwinner-sramc: Set class_size
Eric Auger (1):
target/arm: Add raw_writes ops for register whose write induce TLB maintenance
Fabiano Rosas (1):
target/arm: gdbstub: Guard M-profile code with CONFIG_TCG
John Högberg (2):
target/arm: Handle IC IVAU to improve compatibility with JITs tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Peter Maydell (1):
target/xtensa: Assert that interrupt level is within bounds
Richard Henderson (3):
target/arm: Avoid splitting Zregs across lines in dump target/arm: Dump ZA[] when active target/arm: Fix SME full tile indexing
Vikram Garhwal (1):
tests/qtest: xlnx-canfd-test: Fix code coverity issues
Yuquan Wang (1):
hw/arm/sbsa-ref: use XHCI to replace EHCI
docs/system/arm/sbsa.rst | 5 +- hw/arm/sbsa-ref.c | 23 +++-- hw/misc/allwinner-sramc.c | 1 + target/arm/cpu.c | 65 ++++++++----- target/arm/gdbstub.c | 4 + target/arm/helper.c | 70 +++++++++++--- target/arm/tcg/translate-sme.c | 24 +++-- target/xtensa/exc_helper.c | 3 + tests/qtest/xlnx-canfd-test.c | 33 +++---- tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++++++++++ tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++ hw/arm/Kconfig | 2 +- tests/tcg/aarch64/Makefile.target | 13 ++- 13 files changed, 436 insertions(+), 79 deletions(-) create mode 100644 tests/tcg/aarch64/icivau.c create mode 100644 tests/tcg/aarch64/sme-outprod1.c
[PULL 08/11] tests/qtest: xlnx-canfd-test: Fix code coverity issues
From: Vikram Garhwal <[email protected]>
Following are done to fix the coverity issues:
1. Change read_data to fix the CID 1512899: Out-of-bounds access (OVERRUN)
2. Fix match_rx_tx_data to fix CID 1512900: Logically dead code (DEADCODE)
3. Replace rand() in generate_random_data() with g_rand_int()
Message-id: [email protected]
--- tests/qtest/xlnx-canfd-test.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-)
tests/qtest/xlnx-canfd-test.c +11 -22
@@ -170,23 +170,23 @@ static void generate_random_data(uint32_t *buf_tx, bool is_canfd_frame)/* Generate random TX data for CANFD frame. */ if (is_canfd_frame) {for (int i =0 ; i <CANFD_FRAME_SIZE -2 ; i++) { - buf_tx[2 + i] =rand (); + buf_tx[2 + i] =g_random_int (); } }else {/* Generate random TX data for CAN frame. */ for (int i =0 ; i <CAN_FRAME_SIZE -2 ; i++) { - buf_tx[2 + i] =rand (); + buf_tx[2 + i] =g_random_int (); } } } -static void read_data (QTestState *qts,uint64_t can_base_addr,uint32_t *buf_rx) +static void read_data (QTestState *qts,uint64_t can_base_addr,uint32_t *buf_rx, +uint32_t frame_size) {uint32_t int_status;uint32_t fifo_status_reg_value;/* At which RX FIFO the received data is stored. */ uint8_t store_ind =0 ; -bool is_canfd_frame = false;/* Read the interrupt on CANFD rx. */ int_status =qtest_readl (qts, can_base_addr +R_ISR_OFFSET ) &ISR_RXOK ;
@@ -207,16 +207,9 @@ static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx) buf_rx[0 ] =qtest_readl (qts, can_base_addr +R_RX0_ID_OFFSET ); buf_rx[1 ] =qtest_readl (qts, can_base_addr +R_RX0_DLC_OFFSET ); - is_canfd_frame = (buf_rx[1 ] >>DLC_FD_BIT_SHIFT ) &1 ; - -if (is_canfd_frame) { -for (int i =0 ; i <CANFD_FRAME_SIZE -2 ; i++) { - buf_rx[i +2 ] =qtest_readl (qts, - can_base_addr +R_RX0_DATA1_OFFSET +4 * i); - } - }else { - buf_rx[2 ] =qtest_readl (qts, can_base_addr +R_RX0_DATA1_OFFSET ); - buf_rx[3 ] =qtest_readl (qts, can_base_addr +R_RX0_DATA2_OFFSET ); +for (int i =0 ; i < frame_size -2 ; i++) { + buf_rx[i +2 ] =qtest_readl (qts, + can_base_addr +R_RX0_DATA1_OFFSET +4 * i); }/* Clear the RX interrupt. */
@@ -272,10 +265,6 @@ static void match_rx_tx_data(const uint32_t *buf_tx, const uint32_t *buf_rx, g_assert_cmpint((buf_rx[size] & DLC_FD_BIT_MASK), ==, (buf_tx[size] &DLC_FD_BIT_MASK )); }else { -if (!is_canfd_frame && size ==4 ) { -break ; - } - g_assert_cmpint(buf_rx[size], ==, buf_tx[size]); }
@@ -318,7 +307,7 @@ static void test_can_data_transfer(void)write_data (qts,CANFD0_BASE_ADDR , buf_tx, false);send_data (qts,CANFD0_BASE_ADDR ); -read_data (qts,CANFD1_BASE_ADDR , buf_rx); +read_data (qts,CANFD1_BASE_ADDR , buf_rx,CAN_FRAME_SIZE );match_rx_tx_data (buf_tx, buf_rx, false);qtest_quit (qts);
@@ -358,7 +347,7 @@ static void test_canfd_data_transfer(void)write_data (qts,CANFD0_BASE_ADDR , buf_tx, true);send_data (qts,CANFD0_BASE_ADDR ); -read_data (qts,CANFD1_BASE_ADDR , buf_rx); +read_data (qts,CANFD1_BASE_ADDR , buf_rx,CANFD_FRAME_SIZE );match_rx_tx_data (buf_tx, buf_rx, true);qtest_quit (qts);
@@ -397,7 +386,7 @@ static void test_can_loopback(void)write_data (qts,CANFD0_BASE_ADDR , buf_tx, true);send_data (qts,CANFD0_BASE_ADDR ); -read_data (qts,CANFD0_BASE_ADDR , buf_rx); +read_data (qts,CANFD0_BASE_ADDR , buf_rx,CANFD_FRAME_SIZE );match_rx_tx_data (buf_tx, buf_rx, true);generate_random_data (buf_tx, true);
@@ -405,7 +394,7 @@ static void test_can_loopback(void)write_data (qts,CANFD1_BASE_ADDR , buf_tx, true);send_data (qts,CANFD1_BASE_ADDR ); -read_data (qts,CANFD1_BASE_ADDR , buf_rx); +read_data (qts,CANFD1_BASE_ADDR , buf_rx,CANFD_FRAME_SIZE );match_rx_tx_data (buf_tx, buf_rx, true);qtest_quit (qts);
Signature · 1 line
2.34.1
[PULL 01/11] target/arm: Add raw_writes ops for register whose write induce TLB maintenance
In reply to Peter MaydellFrom: Eric Auger <[email protected]>
Some registers whose 'cooked' writefns induce TLB maintenance do not have raw_writefn ops defined. If only the writefn ops is set (ie. no raw_writefn is provided), it is assumed the cooked also work as the raw one. For those registers it is not obvious the tlb_flush works on KVM mode so better/safer setting the raw write.
--- target/arm/helper.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
target/arm/helper.c +13 -10
@@ -4189,14 +4189,14 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, .access = PL1_RW, .accessfn = access_tvm_trvm, .fgt = FGT_TTBR0_EL1, - .writefn = vmsa_ttbr_write, .resetvalue = 0, + .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), offsetof(CPUARMState, cp15.ttbr0_ns) } }, { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, .fgt = FGT_TTBR1_EL1, - .writefn = vmsa_ttbr_write, .resetvalue = 0, + .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), offsetof(CPUARMState, cp15.ttbr1_ns) } }, { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64,
@@ -4456,13 +4456,13 @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { .type = ARM_CP_64BIT | ARM_CP_ALIAS, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), offsetof(CPUARMState, cp15.ttbr0_ns) }, - .writefn = vmsa_ttbr_write, }, + .writefn = vmsa_ttbr_write, .raw_writefn = raw_write }, { .name = "TTBR1", .cp = 15, .crm = 2, .opc1 = 1, .access = PL1_RW, .accessfn = access_tvm_trvm, .type = ARM_CP_64BIT | ARM_CP_ALIAS, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), offsetof(CPUARMState, cp15.ttbr1_ns) }, - .writefn = vmsa_ttbr_write, }, + .writefn = vmsa_ttbr_write, .raw_writefn = raw_write }, };static uint64_t aa64_fpcr_read (CPUARMState *env,const ARMCPRegInfo *ri)
@@ -5911,7 +5911,7 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .type = ARM_CP_IO, .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2), - .writefn = hcr_write }, + .writefn = hcr_write, .raw_writefn = raw_write }, { .name = "HCR", .state = ARM_CP_STATE_AA32, .type = ARM_CP_ALIAS | ARM_CP_IO, .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
@@ -5983,6 +5983,7 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { { .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2, .access = PL2_RW, .writefn = vmsa_tcr_el12_write, + .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.tcr_el[2]) }, { .name = "VTCR", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2,
@@ -5999,10 +6000,10 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .type = ARM_CP_64BIT | ARM_CP_ALIAS, .access = PL2_RW, .accessfn = access_el3_aa32ns, .fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2), - .writefn = vttbr_write }, + .writefn = vttbr_write, .raw_writefn = raw_write }, { .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0, - .access = PL2_RW, .writefn = vttbr_write, + .access = PL2_RW, .writefn = vttbr_write, .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2) }, { .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0,
@@ -6014,7 +6015,8 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[2]) }, { .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0, - .access = PL2_RW, .resetvalue = 0, .writefn = vmsa_tcr_ttbr_el2_write, + .access = PL2_RW, .resetvalue = 0, + .writefn = vmsa_tcr_ttbr_el2_write, .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.ttbr0_el[2]) }, { .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2, .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_ALIAS,
@@ -6201,12 +6203,12 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { { .name = "SCR_EL3", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 0, .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.scr_el3), - .resetfn = scr_reset, .writefn = scr_write }, + .resetfn = scr_reset, .writefn = scr_write, .raw_writefn = raw_write }, { .name = "SCR", .type = ARM_CP_ALIAS | ARM_CP_NEWEL, .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 0, .access = PL1_RW, .accessfn = access_trap_aa32s_el1, .fieldoffset = offsetoflow32(CPUARMState, cp15.scr_el3), - .writefn = scr_write }, + .writefn = scr_write, .raw_writefn = raw_write }, { .name = "SDER32_EL3", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 1, .access = PL3_RW, .resetvalue = 0,
@@ -7927,6 +7929,7 @@ static const ARMCPRegInfo vhe_reginfo[] = { { .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1, .access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write, + .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.ttbr1_el[2]) },#ifndef CONFIG_USER_ONLY { .name = "CNTHV_CVAL_EL2", .state = ARM_CP_STATE_AA64,
Signature · 1 line
2.34.1
[PULL 03/11] target/arm: Avoid splitting Zregs across lines in dump
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Allow the line length to extend to 548 columns. While annoyingly wide, it's still less confusing than the continuations we print. Also, the default VL used by Linux (and max for A64FX) uses only 140 columns.
Message-id: [email protected]
--- target/arm/cpu.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-)
target/arm/cpu.c +14 -22
@@ -955,7 +955,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env;uint32_t psr =pstate_read (env); -int i; +int i, j;int el =arm_current_el (env);const char *ns_status;bool sve;
@@ -1014,7 +1014,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) }if (sve) { -int j, zcr_len =sve_vqm1_for_el (env, el); +int zcr_len =sve_vqm1_for_el (env, el);for (i =0 ; i <=FFR_PRED_NUM ; i++) {bool eol;
@@ -1054,32 +1054,24 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) } } -for (i =0 ; i <32 ; i++) { -if (zcr_len ==0 ) { +if (zcr_len ==0 ) { +/* +* With vl=16, there are only 37 columns per register, +* so output two registers per line. +*/ +for (i =0 ; i <32 ; i++) {qemu_fprintf (f,"Z%02d=%016" PRIx64":%016" PRIx64"%s" , i, env->vfp.zregs[i].d[1 ], env->vfp.zregs[i].d[0 ], i &1 ?"\n" :" " ); - }else if (zcr_len ==1 ) { -qemu_fprintf (f,"Z%02d=%016" PRIx64":%016" PRIx64 -":%016" PRIx64":%016" PRIx64"\n" , - i, env->vfp.zregs[i].d[3 ], env->vfp.zregs[i].d[2 ], - env->vfp.zregs[i].d[1 ], env->vfp.zregs[i].d[0 ]); - }else { + } + }else { +for (i =0 ; i <32 ; i++) { +qemu_fprintf (f,"Z%02d=" , i);for (j = zcr_len; j >=0 ; j--) { -bool odd = (zcr_len - j) %2 !=0 ; -if (j == zcr_len) { -qemu_fprintf (f,"Z%02d[%x-%x]=" , i, j, j -1 ); - }else if (!odd) { -if (j >0 ) { -qemu_fprintf (f," [%x-%x]=" , j, j -1 ); - }else { -qemu_fprintf (f," [%x]=" , j); - } - }qemu_fprintf (f,"%016" PRIx64":%016" PRIx64"%s" , env->vfp.zregs[i].d[j *2 +1 ], - env->vfp.zregs[i].d[j *2 ], - odd || j ==0 ?"\n" :":" ); + env->vfp.zregs[i].d[j *2 +0 ], + j ?":" :"\n" ); } } }
Signature · 1 line
2.34.1
[PULL 05/11] target/arm: Fix SME full tile indexing
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
For the outer product set of insns, which take an entire matrix tile as output, the argument is not a combined tile+column. Therefore using get_tile_rowcol was incorrect, as we extracted the tile number from itself.
The test case relies only on assembler support for SME, since no release of GCC recognizes -march=armv9-a+sme yet.
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1620
Message-id: [email protected]
--- target/arm/tcg/translate-sme.c | 24 ++++++--- tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 10 ++-- 3 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 tests/tcg/aarch64/sme-outprod1.c
target/arm/tcg/translate-sme.c +18 -6
@@ -95,6 +95,21 @@ static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs,return addr; } +/* +* Resolve tile.size[0] to a host pointer. +* Used by e.g. outer product insns where we require the entire tile. +*/ +static TCGv_ptr get_tile (DisasContext *s,int esz,int tile) +{ +TCGv_ptr addr =tcg_temp_new_ptr (); +int offset; + + offset = tile *sizeof (ARMVectorReg) + offsetof(CPUARMState , zarray); + +tcg_gen_addi_ptr (addr, cpu_env, offset); +return addr; +} +static bool trans_ZERO (DisasContext *s,arg_ZERO *a) {if (!dc_isar_feature (aa64_sme, s)) {
@@ -260,8 +275,7 @@ static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz,return true; } -/* Sum XZR+zad to find ZAd. */ - za =get_tile_rowcol (s, esz,31 , a->zad, false); + za =get_tile (s, esz, a->zad); zn =vec_full_reg_ptr (s, a->zn); pn =pred_full_reg_ptr (s, a->pn); pm =pred_full_reg_ptr (s, a->pm);
@@ -286,8 +300,7 @@ static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz,return true; } -/* Sum XZR+zad to find ZAd. */ - za =get_tile_rowcol (s, esz,31 , a->zad, false); + za =get_tile (s, esz, a->zad); zn =vec_full_reg_ptr (s, a->zn); zm =vec_full_reg_ptr (s, a->zm); pn =pred_full_reg_ptr (s, a->pn);
@@ -308,8 +321,7 @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,return true; } -/* Sum XZR+zad to find ZAd. */ - za =get_tile_rowcol (s, esz,31 , a->zad, false); + za =get_tile (s, esz, a->zad); zn =vec_full_reg_ptr (s, a->zn); zm =vec_full_reg_ptr (s, a->zm); pn =pred_full_reg_ptr (s, a->pn);
tests/tcg/aarch64/sme-outprod1.c new file +83 -0
83 lines not on this page · raw message
tests/tcg/aarch64/Makefile.target +7 -3
@@ -26,7 +26,7 @@ config-cc.mak: Makefile $(call cc-option,-march=armv8.5-a, CROSS_CC_HAS_ARMV8_5); \ $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \ $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE); \ - $(call cc-option,-march=armv9-a+sme, CROSS_CC_HAS_ARMV9_SME)) 3> config-cc.mak + $(call cc-option,-Wa$(COMMA)-march=armv9-a+sme, CROSS_AS_HAS_ARMV9_SME)) 3> config-cc.mak -include config-cc.mak ifneq ($(CROSS_CC_HAS_ARMV8_2),)
@@ -61,11 +61,15 @@ AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-7 mte-%: CFLAGS += -march=armv8.5-a+memtag endif +ifneq ($(CROSS_AS_HAS_ARMV9_SME),) +AARCH64_TESTS += sme-outprod1 +endif + ifneq ($(CROSS_CC_HAS_SVE),) # System Registers Tests AARCH64_TESTS += sysregs -ifneq ($(CROSS_CC_HAS_ARMV9_SME),) -sysregs: CFLAGS+=-march=armv9-a+sme -DHAS_ARMV9_SME +ifneq ($(CROSS_AS_HAS_ARMV9_SME),) +sysregs: CFLAGS+=-Wa,-march=armv9-a+sme -DHAS_ARMV9_SME else sysregs: CFLAGS+=-march=armv8.1-a+sve endif
Signature · 1 line
2.34.1
[PULL 11/11] target/xtensa: Assert that interrupt level is within bounds
In reply to Peter MaydellIn handle_interrupt() we use level as an index into the interrupt_vector[] array. This is safe because we have checked it against env->config->nlevel, but Coverity can't see that (and it is only true because each CPU config sets its XCHAL_NUM_INTLEVELS to something less than MAX_NLEVELS), so it complains about a possible array overrun (CID 1507131)
Add an assert() which will make Coverity happy and catch the unlikely case of a mis-set XCHAL_NUM_INTLEVELS in future.
Message-id: [email protected]
--- target/xtensa/exc_helper.c | 3 +++ 1 file changed, 3 insertions(+)
target/xtensa/exc_helper.c +3 -0
@@ -169,6 +169,9 @@ static void handle_interrupt(CPUXtensaState *env)CPUState *cs =env_cpu (env);if (level >1 ) { +/* env->config->nlevel check should have ensured this */ +assert (level <sizeof (env->config->interrupt_vector)); + env->sregs[EPC1 + level -1 ] = env->pc; env->sregs[EPS2 + level -2 ] = env->sregs[PS ]; env->sregs[PS] =
Signature · 1 line
2.34.1
[PULL 10/11] hw: arm: allwinner-sramc: Set class_size
In reply to Peter MaydellFrom: Akihiko Odaki <[email protected]>
AwSRAMCClass is larger than SysBusDeviceClass so the class size must be advertised accordingly.
Message-id: [email protected]
--- hw/misc/allwinner-sramc.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/allwinner-sramc.c +1 -0
@@ -159,6 +159,7 @@ static const TypeInfo allwinner_sramc_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_init = allwinner_sramc_init, .instance_size = sizeof(AwSRAMCState), + .class_size = sizeof(AwSRAMCClass), .class_init = allwinner_sramc_class_init, };
Signature · 1 line
2.34.1
[PULL 09/11] target/arm: gdbstub: Guard M-profile code with CONFIG_TCG
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
This code is only relevant when TCG is present in the build. Building with --disable-tcg --enable-xen on an x86 host we get:
$ ../configure --target-list=x86_64-softmmu,aarch64-softmmu --disable-tcg --enable-xen $ make -j$(nproc) ... libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `m_sysreg_ptr': ../target/arm/gdbstub.c:358: undefined reference to `arm_v7m_get_sp_ptr' ../target/arm/gdbstub.c:361: undefined reference to `arm_v7m_get_sp_ptr'
libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `arm_gdb_get_m_systemreg':../target/arm/gdbstub.c:405: undefined reference to `arm_v7m_mrs_control'
Message-id: [email protected]
--- target/arm/gdbstub.c | 4 ++++ 1 file changed, 4 insertions(+)
target/arm/gdbstub.c +4 -0
@@ -324,6 +324,7 @@ static int arm_gen_dynamic_sysreg_xml(CPUState *cs, int base_reg)return cpu->dyn_sysreg_xml.num; } +#ifdef CONFIG_TCG typedef enum { M_SYSREG_MSP, M_SYSREG_PSP,
@@ -481,6 +482,7 @@ static int arm_gen_dynamic_m_secextreg_xml(CPUState *cs, int orig_base_reg)return cpu->dyn_m_secextreg_xml.num; }#endif +#endif /* CONFIG_TCG */ const char *arm_gdb_get_dynamic_xml (CPUState *cs,const char *xmlname) {
@@ -561,6 +563,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs), "system-registers.xml", 0); +#ifdef CONFIG_TCG if (arm_feature (env,ARM_FEATURE_M ) &&tcg_enabled ()) { gdb_register_coprocessor(cs, arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg,
@@ -575,4 +578,5 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) }#endif } +#endif /* CONFIG_TCG */ }
Signature · 1 line
2.34.1
[PULL 04/11] target/arm: Dump ZA[] when active
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Always print each matrix row whole, one per line, so that we get the entire matrix in the proper shape.
Message-id: [email protected]
--- target/arm/cpu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
target/arm/cpu.c +18 -0
@@ -1082,6 +1082,24 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) i, q[1], q[0], (i & 1 ? "\n" : " ")); } } + +if (cpu_isar_feature (aa64_sme, cpu) && +FIELD_EX64 (env->svcr,SVCR ,ZA ) && +sme_exception_el (env, el) ==0 ) { +int zcr_len =sve_vqm1_for_el_sm (env, el, true); +int svl = (zcr_len +1 ) *16 ; +int svl_lg10 = svl <100 ?2 :3 ; + +for (i =0 ; i < svl; i++) { +qemu_fprintf (f,"ZA[%0*d]=" , svl_lg10, i); +for (j = zcr_len; j >=0 ; --j) { +qemu_fprintf (f,"%016" PRIx64":%016" PRIx64"%c" , + env->zarray[i].d[2 * j +1 ], + env->zarray[i].d[2 * j], + j ?':' :'\n' ); + } + } + } }#else
Signature · 1 line
2.34.1
[PULL 06/11] target/arm: Handle IC IVAU to improve compatibility with JITs
In reply to Peter MaydellFrom: John Högberg <[email protected]>
Unlike architectures with precise self-modifying code semantics (e.g. x86) ARM processors do not maintain coherency for instruction execution and memory, requiring an instruction synchronization barrier on every core that will execute the new code, and on many models also the explicit use of cache management instructions.
While this is required to make JITs work on actual hardware, QEMU has gotten away with not handling this since it does not emulate caches, and unconditionally invalidates code whenever the softmmu or the user-mode page protection logic detects that code has been modified.
Unfortunately the latter does not work in the face of dual-mapped code (a common W^X workaround), where one page is executable and the other is writable: user-mode has no way to connect one with the other as that is only known to the kernel and the emulated application.
This commit works around the issue by telling software that instruction cache invalidation is required by clearing the CPR_EL0.DIC flag (regardless of whether the emulated processor needs it), and then invalidating code in IC IVAU instructions.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1034
Message-id: [email protected] [PMM: removed unnecessary AArch64 feature check; moved
"clear CTR_EL1.DIC" code up a bit so it's not in the middle of the vfp/neon related tests]
--- target/arm/cpu.c | 11 +++++++++++ target/arm/helper.c | 47 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 3 deletions(-)
target/arm/cpu.c +11 -0
@@ -1694,6 +1694,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)return ; } +#ifdef CONFIG_USER_ONLY +/* +* User mode relies on IC IVAU instructions to catch modification of +* dual-mapped code. +* +* Clear CTR_EL0.DIC to ensure that software that honors these flags uses +* IC IVAU even if the emulated processor does not normally require it. +*/ + cpu->ctr =FIELD_DP64 (cpu->ctr,CTR_EL0 ,DIC ,0 ); +#endif +if (arm_feature (env,ARM_FEATURE_AARCH64 ) && cpu->has_vfp != cpu->has_neon) {/*
target/arm/helper.c +44 -3
66 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
In reply to Peter MaydellFrom: John Högberg <[email protected]>
https://gitlab.com/qemu-project/qemu/-/issues/1034
Message-id: [email protected]
--- tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 3 +- 2 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/icivau.c
tests/tcg/aarch64/icivau.c new file +189 -0
@@ -0,0 +1,189 @@ +/* +* Tests the IC IVAU-driven workaround for catching changes made to dual-mapped +* code that would otherwise go unnoticed in user mode. +* +* Copyright (c) 2023 Ericsson AB +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include <sys/mman.h> +#include <sys/stat.h> +#include <string.h> +#include <stdint.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> + +#define MAX_CODE_SIZE 128 + +typedef int (SelfModTest )(uint32_t ,uint32_t *); +typedef int (BasicTest )(int ); + +static void mark_code_modified (const uint32_t *exec_data,size_t length) +{ +int dc_required, ic_required; +unsigned long ctr_el0; + +/* +* Clear the data/instruction cache, as indicated by the CTR_ELO.{DIC,IDC} +* flags. +* +* For completeness we might be tempted to assert that we should fail when +* the whole code update sequence is omitted, but that would make the test +* flaky as it can succeed by coincidence on actual hardware. +*/ + asm ("mrs %0, ctr_el0\n" :"=r" (ctr_el0)); + +/* CTR_EL0.IDC */ + dc_required = !((ctr_el0 >>28 ) &1 ); + +/* CTR_EL0.DIC */ + ic_required = !((ctr_el0 >>29 ) &1 ); + +if (dc_required) { +size_t dcache_stride, i; + +/* +* Step according to the minimum cache size, as the cache maintenance +* instructions operate on the cache line of the given address. +* +* We assume that exec_data is properly aligned. +*/ + dcache_stride = (4 << ((ctr_el0 >>16 ) &0xF )); + +for (i =0 ; i < length; i += dcache_stride) { +const char *dc_addr = &((const char *)exec_data)[i]; + asmvolatile ("dc cvau, %x[dc_addr]\n" + :/* no outputs */ + : [dc_addr]"r" (dc_addr) + :"memory" ); + } + + asmvolatile ("dmb ish\n" ); + } + +if (ic_required) { +size_t icache_stride, i; + + icache_stride = (4 << (ctr_el0 &0xF )); + +for (i =0 ; i < length; i += icache_stride) { +const char *ic_addr = &((const char *)exec_data)[i]; + asmvolatile ("ic ivau, %x[ic_addr]\n" + :/* no outputs */ + : [ic_addr]"r" (ic_addr) + :"memory" ); + } + + asmvolatile ("dmb ish\n" ); + } + + asmvolatile ("isb sy\n" ); +} + +static int basic_test (uint32_t *rw_data,const uint32_t *exec_data) +{ +/* +* As user mode only misbehaved for dual-mapped code when previously +* translated code had been changed, we'll start off with this basic test +* function to ensure that there's already some translated code at +* exec_data before the next test. This should cause the next test to fail +* if `mark_code_modified` fails to invalidate the code. +* +* Note that the payload is in binary form instead of inline assembler +* because we cannot use __attribute__((naked)) on this platform and the +* workarounds are at least as ugly as this is. +*/ +static const uint32_t basic_payload[] = { +0xD65F03C0 /* 0x00: RET */ + }; + +BasicTest *copied_ptr = (BasicTest *)exec_data; + +memcpy (rw_data, basic_payload,sizeof (basic_payload)); +mark_code_modified (exec_data,sizeof (basic_payload)); + +return copied_ptr (1234 ) ==1234 ; +} + +static int self_modification_test (uint32_t *rw_data,const uint32_t *exec_data) +{ +/* +* This test is self-modifying in an attempt to cover an edge case where +* the IC IVAU instruction invalidates itself. +* +* Note that the IC IVAU instruction is 16 bytes into the function, in what +* will be the same cache line as the modified instruction on machines with +* a cache line size >= 16 bytes. +*/ +static const uint32_t self_mod_payload[] = { +/* Overwrite the placeholder instruction with the new one. */ +0xB9001C20 ,/* 0x00: STR w0, [x1, 0x1C] */ + +/* Get the executable address of the modified instruction. */ +0x100000A8 ,/* 0x04: ADR x8, <0x1C> */ + +/* Mark the modified instruction as updated. */ +0xD50B7B28 ,/* 0x08: DC CVAU x8 */ +0xD5033BBF ,/* 0x0C: DMB ISH */ +0xD50B7528 ,/* 0x10: IC IVAU x8 */ +0xD5033BBF ,/* 0x14: DMB ISH */ +0xD5033FDF ,/* 0x18: ISB */ + +/* Placeholder instruction, overwritten above. */ +0x52800000 ,/* 0x1C: MOV w0, 0 */ + +0xD65F03C0 /* 0x20: RET */ + }; + +SelfModTest *copied_ptr = (SelfModTest *)exec_data; +int i; + +memcpy (rw_data, self_mod_payload,sizeof (self_mod_payload)); +mark_code_modified (exec_data,sizeof (self_mod_payload)); + +for (i =1 ; i <10 ; i++) { +/* Replace the placeholder instruction with `MOV w0, i` */ +uint32_t new_instr =0x52800000 | (i <<5 ); + +if (copied_ptr (new_instr, rw_data) != i) { +return 0 ; + } + } + +return 1 ; +} + +int main (int argc,char **argv) +{ +const char *shm_name ="qemu-test-tcg-aarch64-icivau" ; +int fd; + + fd =shm_open (shm_name,O_CREAT |O_RDWR ,S_IRUSR |S_IWUSR ); + +if (fd <0 ) { +return EXIT_FAILURE ; + } + +/* Unlink early to avoid leaving garbage in case the test crashes. */ +shm_unlink (shm_name); + +if (ftruncate (fd,MAX_CODE_SIZE ) ==0 ) { +const uint32_t *exec_data; +uint32_t *rw_data; + + rw_data =mmap (0 ,MAX_CODE_SIZE ,PROT_READ |PROT_WRITE , +MAP_SHARED , fd,0 ); + exec_data =mmap (0 ,MAX_CODE_SIZE ,PROT_READ |PROT_EXEC , +MAP_SHARED , fd,0 ); + +if (rw_data && exec_data) { +if (basic_test (rw_data, exec_data) && +self_modification_test (rw_data, exec_data)) { +return EXIT_SUCCESS ; + } + } + } + +return EXIT_FAILURE ; +}
tests/tcg/aarch64/Makefile.target +2 -1
@@ -9,9 +9,10 @@ AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 VPATH += $(AARCH64_SRC) # Base architecture tests -AARCH64_TESTS=fcvt pcalign-a64 +AARCH64_TESTS=fcvt pcalign-a64 icivau fcvt: LDFLAGS+=-lm +icivau: LDFLAGS+=-lrt run-fcvt: fcvt $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
Signature · 1 line
2.34.1
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
tests/tcg/aarch64/icivau.c line 162
Quoted 6 lines · Peter Maydell
tests/tcg/aarch64/icivau.c new file +6
-0+int main (int argc,char **argv) +{ +const char *shm_name ="qemu-test-tcg-aarch64-icivau" ; +int fd; + + fd =shm_open (shm_name,O_CREAT |O_RDWR ,S_IRUSR |S_IWUSR );
Build failures:
https://gitlab.com/qemu-project/qemu/-/jobs/4592433393#L3958
https://gitlab.com/qemu-project/qemu/-/jobs/4592433395#L4149
https://gitlab.com/qemu-project/qemu/-/jobs/4592433400#L3694
/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_open.o): in function `shm_open':
(.text+0x3c): undefined reference to `__shm_directory'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xcc): undefined reference to pthread_setcancelstate' /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xfc): undefined reference to pthread_setcancelstate' /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_unlink.o): in function `shm_unlink':
(.text+0x30): undefined reference to `__shm_directory'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:119: icivau] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/qemu-project/qemu/tests/Makefile.include:50: build-tcg-tests-aarch64-linux-user] Error 2
It looks like this test needs something else.
r~
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Cc'ing John.
Quoted 26 lines · Richard Henderson
tests/tcg/aarch64/icivau.c line 162
Quoted 6 lines · Peter Maydell
tests/tcg/aarch64/icivau.c new file +6
-0+int main (int argc,char **argv) +{ + const char *shm_name = "qemu-test-tcg-aarch64-icivau"; + int fd; + + fd = shm_open(shm_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);Build failures:
https://gitlab.com/qemu-project/qemu/-/jobs/4592433393#L3958
https://gitlab.com/qemu-project/qemu/-/jobs/4592433395#L4149
https://gitlab.com/qemu-project/qemu/-/jobs/4592433400#L3694
/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_open.o): in function `shm_open':
(.text+0x3c): undefined reference to `__shm_directory'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xcc): undefined reference topthread_setcancelstate' /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xfc): undefined reference topthread_setcancelstate'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_unlink.o): in function `shm_unlink':
(.text+0x30): undefined reference to `__shm_directory'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:119: icivau] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/qemu-project/qemu/tests/Makefile.include:50: build-tcg-tests-aarch64-linux-user] Error 2
Quoted 1 line
It looks like this test needs something else.
Maybe:
icivau: LDFLAGS+=-lrt -pthread
?
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 11 lines
/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_open.o): in function `shm_open':
(.text+0x3c): undefined reference to `__shm_directory'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xcc): undefined reference topthread_setcancelstate' /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xfc): undefined reference topthread_setcancelstate'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_unlink.o): in function `shm_unlink':
(.text+0x30): undefined reference to `__shm_directory'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:119: icivau] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/qemu-project/qemu/tests/Makefile.include:50: build-tcg-tests-aarch64-linux-user] Error 2
Quoted 5 lines
Quoted 1 line
It looks like this test needs something else.
Maybe:
icivau: LDFLAGS+=-lrt -pthread
Yes, that's the ticket I'm sure.
Today is a travel day, so I'll still let someone else re-test.
r~
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
In reply to Philippe Mathieu-DaudéQuoted 31 lines · Philippe Mathieu-Daudé
Cc'ing John.
Quoted 27 lines · Richard Henderson
tests/tcg/aarch64/icivau.c line 162
Quoted 6 lines · Peter Maydell
tests/tcg/aarch64/icivau.c new file +6
-0+int main (int argc,char **argv) +{ +const char *shm_name ="qemu-test-tcg-aarch64-icivau" ; +int fd; + + fd =shm_open (shm_name,O_CREAT |O_RDWR ,S_IRUSR |S_IWUSR );Build failures:
https://gitlab.com/qemu-project/qemu/-/jobs/4592433393#L3958
https://gitlab.com/qemu-project/qemu/-/jobs/4592433395#L4149
https://gitlab.com/qemu-project/qemu/-/jobs/4592433400#L3694
/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_open.o): in function `shm_open':
(.text+0x3c): undefined reference to `__shm_directory'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xcc): undefined reference topthread_setcancelstate' /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: (.text+0xfc): undefined reference topthread_setcancelstate'/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/lib/../lib/librt.a(shm_unlink.o): in function `shm_unlink':
(.text+0x30): undefined reference to `__shm_directory'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:119: icivau] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/builds/qemu-project/qemu/tests/Makefile.include:50:
build-tcg-tests-aarch64-linux-user] Error 2
Quoted 5 lines
Quoted 1 line
It looks like this test needs something else.
Maybe:
icivau: LDFLAGS+=-lrt -pthread
That is enough to get it to build, but then in the CI the test consistently fails:
https://gitlab.com/pm215/qemu/-/jobs/4606447875
TEST icivau on aarch64
make[1]: *** [Makefile:178: run-icivau] Error 1
I'm going to drop this patch from the pullreq until we can figure out what's going on...
thanks
-- PMM
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Quoted 10 lines
That is enough to get it to build, but then in the CI the test consistently fails:
https://gitlab.com/pm215/qemu/-/jobs/4606447875
TEST icivau on aarch64
make[1]: *** [Makefile:178: run-icivau] Error 1I'm going to drop this patch from the pullreq until we can figure out what's going on...
Oops, -pthread wasn't required on my machine.
I'm unable to reproduce the failure locally. Is it possible to strace it and see whether it was caused by failing to set up dual-mapped code?
/John
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Quoted 9 lines · John Högberg
Quoted 9 lines
That is enough to get it to build, but then in the CI the test consistently fails:
https://gitlab.com/pm215/qemu/-/jobs/4606447875
TEST icivau on aarch64
make[1]: *** [Makefile:178: run-icivau] Error 1
Quoted 7 lines
Quoted 2 lines
I'm going to drop this patch from the pullreq until we can figure out what's going on...
Oops, -pthread wasn't required on my machine.
I'm unable to reproduce the failure locally. Is it possible to strace it and see whether it was caused by failing to set up dual-mapped code?
On the CI machines all you get is what the test case (and whatever the makefile chooses to wrap it in) writes to stdout/stderr.
thanks
-- PMM
Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Alright, thanks. Where should I go from here? Should I send in another patch that tries to debug this?
/John
-----Original Message-----
From: Peter Maydell <[email protected]>
To: John Högberg <[email protected]>
Cc: [email protected] <[email protected]>, [email protected] <[email protected]>, [email protected] <[email protected]>
Subject: Re: [PULL 07/11] tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
Date: Thu, 06 Jul 2023 13:54:35 +0100
Quoted 9 lines · John Högberg
Quoted 9 lines
That is enough to get it to build, but then in the CI the test consistently fails:
https://gitlab.com/pm215/qemu/-/jobs/4606447875
TEST icivau on aarch64
make[1]: *** [Makefile:178: run-icivau] Error 1
Quoted 8 lines
Quoted 2 lines
I'm going to drop this patch from the pullreq until we can figure out what's going on...
Oops, -pthread wasn't required on my machine.
I'm unable to reproduce the failure locally. Is it possible to strace it
and see whether it was caused by failing to set up dual-mapped code?
On the CI machines all you get is what the test case (and whatever the makefile chooses to wrap it in) writes to stdout/stderr.
thanks
-- PMM
[PULL 02/11] hw/arm/sbsa-ref: use XHCI to replace EHCI
In reply to Peter MaydellFrom: Yuquan Wang <[email protected]>
The current sbsa-ref cannot use EHCI controller which is only able to do 32-bit DMA, since sbsa-ref doesn't have RAM below 4GB. Hence, this uses XHCI to provide a usb controller with 64-bit DMA capablity instead of EHCI.
We bump the platform version to 0.3 with this change. Although the hardware at the USB controller address changes, the firmware and Linux can both cope with this -- on an older non-XHCI-aware firmware/kernel setup the probe routine simply fails and the guest proceeds without any USB. (This isn't a loss of functionality, because the old USB controller never worked in the first place.) So we can call this a backwards-compatible change and only bump the minor version.
Message-id: [email protected] [PMM: tweaked commit message; add line to docs about what
changes in platform version 0.3]
--- docs/system/arm/sbsa.rst | 5 ++++- hw/arm/sbsa-ref.c | 23 +++++++++++++---------- hw/arm/Kconfig | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-)
docs/system/arm/sbsa.rst +4 -1
@@ -19,7 +19,7 @@ The ``sbsa-ref`` board supports: - A configurable number of AArch64 CPUs - GIC version 3 - System bus AHCI controller - - System bus EHCI controller + - System bus XHCI controller - CDROM and hard disc on AHCI bus - E1000E ethernet card on PCIe bus - Bochs display adapter on PCIe bus
@@ -68,3 +68,6 @@ Platform version changes: 0.2 GIC ITS information is present in devicetree. + +0.3 + The USB controller is an XHCI device, not EHCI
hw/arm/sbsa-ref.c +13 -10
@@ -42,6 +42,7 @@#include "hw/pci-host/gpex.h" #include "hw/qdev-properties.h" #include "hw/usb.h" +#include "hw/usb/xhci.h" #include "hw/char/pl011.h" #include "hw/watchdog/sbsa_gwdt.h" #include "net/net.h"
@@ -85,7 +86,7 @@ enum {SBSA_SECURE_UART_MM ,SBSA_SECURE_MEM ,SBSA_AHCI , - SBSA_EHCI, + SBSA_XHCI, }; struct SBSAMachineState {
@@ -123,7 +124,7 @@ static const MemMapEntry sbsa_ref_memmap[] = { [SBSA_SMMU] = { 0x60050000, 0x00020000 }, /* Space here reserved for more SMMUs */ [SBSA_AHCI] = { 0x60100000, 0x00010000 }, - [SBSA_EHCI] = { 0x60110000, 0x00010000 }, + [SBSA_XHCI] = { 0x60110000, 0x00010000 }, /* Space here reserved for other devices */ [SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },/* 32-bit address PCIE MMIO space */
@@ -143,7 +144,7 @@ static const int sbsa_ref_irqmap[] = { [SBSA_SECURE_UART] = 8, [SBSA_SECURE_UART_MM] = 9, [SBSA_AHCI] = 10, - [SBSA_EHCI] = 11, + [SBSA_XHCI] = 11, [SBSA_SMMU] = 12, /* ... to 15 */ [SBSA_GWDT_WS0] = 16, };
@@ -230,7 +231,7 @@ static void create_fdt(SBSAMachineState *sms)* fw compatibility. */ qemu_fdt_setprop_cell (fdt,"/" ,"machine-version-major" ,0 ); -qemu_fdt_setprop_cell (fdt,"/" ,"machine-version-minor" ,2 ); +qemu_fdt_setprop_cell (fdt,"/" ,"machine-version-minor" ,3 );if (ms->numa_state->have_numa_distance) {int size = nb_numa_nodes * nb_numa_nodes *3 *sizeof (uint32_t );
@@ -604,13 +605,15 @@ static void create_ahci(const SBSAMachineState *sms) } } -static void create_ehci (const SBSAMachineState *sms) +static void create_xhci (const SBSAMachineState *sms) { -hwaddr base = sbsa_ref_memmap[SBSA_EHCI ].base; -int irq = sbsa_ref_irqmap[SBSA_EHCI ]; +hwaddr base = sbsa_ref_memmap[SBSA_XHCI ].base; +int irq = sbsa_ref_irqmap[SBSA_XHCI ]; +DeviceState *dev =qdev_new (TYPE_XHCI_SYSBUS ); -sysbus_create_simple ("platform-ehci-usb" , base, -qdev_get_gpio_in (sms->gic, irq)); +sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , base); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 ,qdev_get_gpio_in (sms->gic, irq)); }static void create_smmu (const SBSAMachineState *sms,PCIBus *bus)
@@ -832,7 +835,7 @@ static void sbsa_ref_init(MachineState *machine)create_ahci (sms); -create_ehci (sms); +create_xhci (sms);create_pcie (sms);
hw/arm/Kconfig +1 -1
@@ -266,7 +266,7 @@ config SBSA_REF select PL011 # UART select PL031 # RTC select PL061 # GPIO - select USB_EHCI_SYSBUS + select USB_XHCI_SYSBUS select WDT_SBSA select BOCHS_DISPLAY
Signature · 1 line
2.34.1
Quoted 6 lines · Peter Maydell
docs/system/arm/sbsa.rst | 5 +- hw/arm/sbsa-ref.c | 23 +++-- hw/misc/allwinner-sramc.c | 1 + target/arm/cpu.c | 65 ++++++++----- target/arm/gdbstub.c | 4 + target/arm/helper.c | 70 +++++++++++---
Quoted 8 lines
target/arm/tcg/translate-sme.c | 24 +++-- target/xtensa/exc_helper.c | 3 + tests/qtest/xlnx-canfd-test.c | 33 +++---- tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++++++++++ tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++ hw/arm/Kconfig | 2 +- tests/tcg/aarch64/Makefile.target | 13 ++- 13 files changed, 436 insertions(+), 79 deletions(-)
There's one more failure:
https://gitlab.com/qemu-project/qemu/-/jobs/4592433432#L3723
Quoted 4 lines
/tmp/ccASXpLo.s: Assembler messages:/tmp/ccASXpLo.s:782: Error: selected processor does not support system register name 'id_aa64zfr0_el1'/tmp/ccASXpLo.s:829: Error: selected processor does not support system register name 'id_aa64smfr0_el1' make[1]: *** [Makefile:119: sysregs] Error 1
I guess it's the change to Makefile.target, as I don't see any other likely candidates.
r~
Quoted 18 lines · Richard Henderson
Quoted 13 lines · Peter Maydell
docs/system/arm/sbsa.rst | 5 +-
hw/arm/sbsa-ref.c | 23 +++-- hw/misc/allwinner-sramc.c | 1 +
target/arm/cpu.c | 65 ++++++++----- target/arm/gdbstub.c | 4 +
target/arm/helper.c | 70 +++++++++++--- target/arm/tcg/translate-sme.c | 24 +++-- target/xtensa/exc_helper.c | 3 + tests/qtest/xlnx-canfd-test.c | 33 +++---- tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++++++++++ tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++ hw/arm/Kconfig | 2 +- tests/tcg/aarch64/Makefile.target | 13 ++-Quoted 1 line
13 files changed, 436 insertions(+), 79 deletions(-)There's one more failure:
Quoted 8 lines
https://gitlab.com/qemu-project/qemu/-/jobs/4592433432#L3723
Quoted 4 lines
/tmp/ccASXpLo.s: Assembler messages:/tmp/ccASXpLo.s:782: Error: selected processor does not support system register name 'id_aa64zfr0_el1'/tmp/ccASXpLo.s:829: Error: selected processor does not support system register name 'id_aa64smfr0_el1' make[1]: *** [Makefile:119: sysregs] Error 1I guess it's the change to Makefile.target, as I don't see any other likely candidates.
Ho hum, that's *my* patch 5, "Fix SME full tile indexing". I'll have a closer look tomorrow. Sorry about that.
r~
Quoted 11 lines · Richard Henderson
Quoted 9 lines · Richard Henderson
https://gitlab.com/qemu-project/qemu/-/jobs/4592433432#L3723
Quoted 6 lines
/tmp/ccASXpLo.s: Assembler messages:/tmp/ccASXpLo.s:782: Error: selected processor does not support system register name 'id_aa64zfr0_el1'/tmp/ccASXpLo.s:829: Error: selected processor does not support system register name 'id_aa64smfr0_el1'
make[1]: *** [Makefile:119: sysregs] Error 1
Quoted 4 lines
Quoted 1 line
I guess it's the change to Makefile.target, as I don't see any other likely candidates.
Ho hum, that's *my* patch 5, "Fix SME full tile indexing". I'll have a closer look tomorrow. Sorry about that.
I think we can fix this by using the S3_.... syntax instead, and we can drop the #ifdef HAS_ARMV9_SME entirely:
these registers are in the ID register space so they will read-as-zero and pass the test regardless of guest CPU type. However, it doesn't look like I can run this CI job under my personal gitlab account, so I'll have to do a blind attempt at a fix and resubmit the pullreq for you to see...
thanks
-- PMM