qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

Merge remote-tracking branch 'remotes/xtensa/tags/20200407-xtensa' into staging

target/xtensa fixes for 5.0:

- fix pasto in pfwait.r opcode name;
- fix memory leak with dynamically allocated xtensa_insnbufs in
DisasContext.

# gpg: Signature made Wed 08 Apr 2020 00:58:05 BST
# gpg: using RSA key 2B67854B98E5327DCDEB17D851F9CC91F83FA044
# gpg: issuer "jcmvbkbc@gmail.com"
# gpg: Good signature from "Max Filippov <filippov@cadence.com>" [unknown]
# gpg: aka "Max Filippov <max.filippov@cogentembedded.com>" [full]
# gpg: aka "Max Filippov <jcmvbkbc@gmail.com>" [full]
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB 17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20200407-xtensa:
target/xtensa: statically allocate xtensa_insnbufs in DisasContext
target/xtensa: fix pasto in pfwait.r opcode name

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

+7 -17
+3
target/xtensa/cpu.h
··· 213 213 #define MEMCTL_IL0EN 0x1 214 214 215 215 #define MAX_INSN_LENGTH 64 216 + #define MAX_INSNBUF_LENGTH \ 217 + ((MAX_INSN_LENGTH + sizeof(xtensa_insnbuf_word) - 1) / \ 218 + sizeof(xtensa_insnbuf_word)) 216 219 #define MAX_INSN_SLOTS 32 217 220 #define MAX_OPCODE_ARGS 16 218 221 #define MAX_NAREG 64
+1
target/xtensa/helper.c
··· 96 96 97 97 config->isa = xtensa_isa_init(config->isa_internal, NULL, NULL); 98 98 assert(xtensa_isa_maxlength(config->isa) <= MAX_INSN_LENGTH); 99 + assert(xtensa_insnbuf_size(config->isa) <= MAX_INSNBUF_LENGTH); 99 100 opcodes = xtensa_isa_num_opcodes(config->isa); 100 101 formats = xtensa_isa_num_formats(config->isa); 101 102 regfiles = xtensa_isa_num_regfiles(config->isa);
+3 -17
target/xtensa/translate.c
··· 72 72 unsigned cpenable; 73 73 74 74 uint32_t op_flags; 75 - xtensa_insnbuf insnbuf; 76 - xtensa_insnbuf slotbuf; 75 + xtensa_insnbuf_word insnbuf[MAX_INSNBUF_LENGTH]; 76 + xtensa_insnbuf_word slotbuf[MAX_INSNBUF_LENGTH]; 77 77 }; 78 78 79 79 static TCGv_i32 cpu_pc; ··· 1173 1173 dc->cwoe = tb_flags & XTENSA_TBFLAG_CWOE; 1174 1174 dc->callinc = ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> 1175 1175 XTENSA_TBFLAG_CALLINC_SHIFT); 1176 - 1177 - /* 1178 - * FIXME: This will leak when a failed instruction load or similar 1179 - * event causes us to longjump out of the translation loop and 1180 - * hence not clean-up in xtensa_tr_tb_stop 1181 - */ 1182 - if (dc->config->isa) { 1183 - dc->insnbuf = xtensa_insnbuf_alloc(dc->config->isa); 1184 - dc->slotbuf = xtensa_insnbuf_alloc(dc->config->isa); 1185 - } 1186 1176 init_sar_tracker(dc); 1187 1177 } 1188 1178 ··· 1272 1262 DisasContext *dc = container_of(dcbase, DisasContext, base); 1273 1263 1274 1264 reset_sar_tracker(dc); 1275 - if (dc->config->isa) { 1276 - xtensa_insnbuf_free(dc->config->isa, dc->insnbuf); 1277 - xtensa_insnbuf_free(dc->config->isa, dc->slotbuf); 1278 - } 1279 1265 if (dc->icount) { 1280 1266 tcg_temp_free(dc->next_icount); 1281 1267 } ··· 3746 3732 .name = "pfwait.a", 3747 3733 .translate = translate_nop, 3748 3734 }, { 3749 - .name = "pfwait.o", 3735 + .name = "pfwait.r", 3750 3736 .translate = translate_nop, 3751 3737 }, { 3752 3738 .name = "pitlb",