Fix dynamic tlb resize
Fix x86 host vector saturation Diagnose missing tcg labels -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJcYamQAAoJEGTfOOivfiFfNb4H/3DiEHDTfai7VJTuSvYWeS2M gS2UEpHoSTgqf/QFEv2OdHRynm3lzrOaYluiKnN67EThbvqKAz2dDfqjh1FuEs6i YnWnvFvZlw6ABoCgZugXdmCVVzn4OrOy2Pdu/YjKVaLwwfRbjWgDVDlJpnIBagsi ItAGvbEyAXUAxXTDP+hvmGS4V6MwQBzMyLhzaoUOTaF9lmb2JDMteYYxCWCP9gfS ApISkm8/+OulBR26DA4gPt6C4URk+7M3QeVf9ApANTkgrk9ikrTiShs5QxgO3hme +MzCP/vjvSLzbQt67eQ1JXVYiKs3ZSGY6o+mzIThmd4zKQWveys1QEPgGQ1l+jU= =yJ4z -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190211' into staging Fix dynamic tlb resize Fix x86 host vector saturation Diagnose missing tcg labels # gpg: Signature made Mon 11 Feb 2019 16:57:52 GMT # gpg: using RSA key 64DF38E8AF7E215F # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth/tags/pull-tcg-20190211: cputlb: update TLB entry/index after tlb_fill exec-all: document that tlb_fill can trigger a TLB resize tcg/i386: fix unsigned vector saturating arithmetic tcg: Diagnose referenced labels that have not been emitted Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
22c5f44651
@ -1045,6 +1045,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
|
|||||||
if (unlikely(!tlb_hit(entry->addr_code, addr))) {
|
if (unlikely(!tlb_hit(entry->addr_code, addr))) {
|
||||||
if (!VICTIM_TLB_HIT(addr_code, addr)) {
|
if (!VICTIM_TLB_HIT(addr_code, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0);
|
tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
entry = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
assert(tlb_hit(entry->addr_code, addr));
|
assert(tlb_hit(entry->addr_code, addr));
|
||||||
}
|
}
|
||||||
@ -1125,6 +1127,8 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
|
|||||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, 1 << s_bits, MMU_DATA_STORE,
|
tlb_fill(ENV_GET_CPU(env), addr, 1 << s_bits, MMU_DATA_STORE,
|
||||||
mmu_idx, retaddr);
|
mmu_idx, retaddr);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
tlbe = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
tlb_addr = tlb_addr_write(tlbe) & ~TLB_INVALID_MASK;
|
tlb_addr = tlb_addr_write(tlbe) & ~TLB_INVALID_MASK;
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr,
|
|||||||
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
|
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
|
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
|
||||||
mmu_idx, retaddr);
|
mmu_idx, retaddr);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
entry = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
tlb_addr = entry->ADDR_READ;
|
tlb_addr = entry->ADDR_READ;
|
||||||
}
|
}
|
||||||
@ -198,6 +200,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr,
|
|||||||
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
|
if (!VICTIM_TLB_HIT(ADDR_READ, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
|
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, READ_ACCESS_TYPE,
|
||||||
mmu_idx, retaddr);
|
mmu_idx, retaddr);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
entry = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
tlb_addr = entry->ADDR_READ;
|
tlb_addr = entry->ADDR_READ;
|
||||||
}
|
}
|
||||||
@ -294,6 +298,8 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
|
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
|
||||||
mmu_idx, retaddr);
|
mmu_idx, retaddr);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
entry = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
|
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
|
||||||
}
|
}
|
||||||
@ -372,6 +378,8 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||||
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
|
tlb_fill(ENV_GET_CPU(env), addr, DATA_SIZE, MMU_DATA_STORE,
|
||||||
mmu_idx, retaddr);
|
mmu_idx, retaddr);
|
||||||
|
index = tlb_index(env, mmu_idx, addr);
|
||||||
|
entry = tlb_entry(env, mmu_idx, addr);
|
||||||
}
|
}
|
||||||
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
|
tlb_addr = tlb_addr_write(entry) & ~TLB_INVALID_MASK;
|
||||||
}
|
}
|
||||||
|
@ -475,6 +475,11 @@ static inline void assert_no_pages_locked(void)
|
|||||||
struct MemoryRegionSection *iotlb_to_section(CPUState *cpu,
|
struct MemoryRegionSection *iotlb_to_section(CPUState *cpu,
|
||||||
hwaddr index, MemTxAttrs attrs);
|
hwaddr index, MemTxAttrs attrs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: tlb_fill() can trigger a resize of the TLB. This means that all of the
|
||||||
|
* caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must
|
||||||
|
* be discarded and looked up again (e.g. via tlb_entry()).
|
||||||
|
*/
|
||||||
void tlb_fill(CPUState *cpu, target_ulong addr, int size,
|
void tlb_fill(CPUState *cpu, target_ulong addr, int size,
|
||||||
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr);
|
MMUAccessType access_type, int mmu_idx, uintptr_t retaddr);
|
||||||
|
|
||||||
|
@ -2615,7 +2615,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
|
|||||||
OPC_PADDSB, OPC_PADDSW, OPC_UD2, OPC_UD2
|
OPC_PADDSB, OPC_PADDSW, OPC_UD2, OPC_UD2
|
||||||
};
|
};
|
||||||
static int const usadd_insn[4] = {
|
static int const usadd_insn[4] = {
|
||||||
OPC_PADDSB, OPC_PADDSW, OPC_UD2, OPC_UD2
|
OPC_PADDUB, OPC_PADDUW, OPC_UD2, OPC_UD2
|
||||||
};
|
};
|
||||||
static int const sub_insn[4] = {
|
static int const sub_insn[4] = {
|
||||||
OPC_PSUBB, OPC_PSUBW, OPC_PSUBD, OPC_PSUBQ
|
OPC_PSUBB, OPC_PSUBW, OPC_PSUBD, OPC_PSUBQ
|
||||||
@ -2624,7 +2624,7 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
|
|||||||
OPC_PSUBSB, OPC_PSUBSW, OPC_UD2, OPC_UD2
|
OPC_PSUBSB, OPC_PSUBSW, OPC_UD2, OPC_UD2
|
||||||
};
|
};
|
||||||
static int const ussub_insn[4] = {
|
static int const ussub_insn[4] = {
|
||||||
OPC_PSUBSB, OPC_PSUBSW, OPC_UD2, OPC_UD2
|
OPC_PSUBUB, OPC_PSUBUW, OPC_UD2, OPC_UD2
|
||||||
};
|
};
|
||||||
static int const mul_insn[4] = {
|
static int const mul_insn[4] = {
|
||||||
OPC_UD2, OPC_PMULLW, OPC_PMULLD, OPC_UD2
|
OPC_UD2, OPC_PMULLW, OPC_PMULLD, OPC_UD2
|
||||||
|
@ -255,6 +255,7 @@ static inline void tcg_gen_op6ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2,
|
|||||||
|
|
||||||
static inline void gen_set_label(TCGLabel *l)
|
static inline void gen_set_label(TCGLabel *l)
|
||||||
{
|
{
|
||||||
|
l->present = 1;
|
||||||
tcg_gen_op1(INDEX_op_set_label, label_arg(l));
|
tcg_gen_op1(INDEX_op_set_label, label_arg(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
tcg/tcg.c
23
tcg/tcg.c
@ -305,6 +305,9 @@ TCGLabel *gen_new_label(void)
|
|||||||
*l = (TCGLabel){
|
*l = (TCGLabel){
|
||||||
.id = s->nb_labels++
|
.id = s->nb_labels++
|
||||||
};
|
};
|
||||||
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
QSIMPLEQ_INSERT_TAIL(&s->labels, l, next);
|
||||||
|
#endif
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
@ -1092,6 +1095,9 @@ void tcg_func_start(TCGContext *s)
|
|||||||
|
|
||||||
QTAILQ_INIT(&s->ops);
|
QTAILQ_INIT(&s->ops);
|
||||||
QTAILQ_INIT(&s->free_ops);
|
QTAILQ_INIT(&s->free_ops);
|
||||||
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
QSIMPLEQ_INIT(&s->labels);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TCGTemp *tcg_temp_alloc(TCGContext *s)
|
static inline TCGTemp *tcg_temp_alloc(TCGContext *s)
|
||||||
@ -3841,6 +3847,23 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
/* Ensure all labels referenced have been emitted. */
|
||||||
|
{
|
||||||
|
TCGLabel *l;
|
||||||
|
bool error = false;
|
||||||
|
|
||||||
|
QSIMPLEQ_FOREACH(l, &s->labels, next) {
|
||||||
|
if (unlikely(!l->present) && l->refs) {
|
||||||
|
qemu_log_mask(CPU_LOG_TB_OP,
|
||||||
|
"$L%d referenced but not present.\n", l->id);
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(!error);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
atomic_set(&prof->opt_time, prof->opt_time - profile_getclock());
|
atomic_set(&prof->opt_time, prof->opt_time - profile_getclock());
|
||||||
#endif
|
#endif
|
||||||
|
12
tcg/tcg.h
12
tcg/tcg.h
@ -244,16 +244,21 @@ typedef struct TCGRelocation {
|
|||||||
intptr_t addend;
|
intptr_t addend;
|
||||||
} TCGRelocation;
|
} TCGRelocation;
|
||||||
|
|
||||||
typedef struct TCGLabel {
|
typedef struct TCGLabel TCGLabel;
|
||||||
|
struct TCGLabel {
|
||||||
|
unsigned present : 1;
|
||||||
unsigned has_value : 1;
|
unsigned has_value : 1;
|
||||||
unsigned id : 15;
|
unsigned id : 14;
|
||||||
unsigned refs : 16;
|
unsigned refs : 16;
|
||||||
union {
|
union {
|
||||||
uintptr_t value;
|
uintptr_t value;
|
||||||
tcg_insn_unit *value_ptr;
|
tcg_insn_unit *value_ptr;
|
||||||
TCGRelocation *first_reloc;
|
TCGRelocation *first_reloc;
|
||||||
} u;
|
} u;
|
||||||
} TCGLabel;
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
QSIMPLEQ_ENTRY(TCGLabel) next;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct TCGPool {
|
typedef struct TCGPool {
|
||||||
struct TCGPool *next;
|
struct TCGPool *next;
|
||||||
@ -685,6 +690,7 @@ struct TCGContext {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_TCG
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
QSIMPLEQ_HEAD(, TCGLabel) labels;
|
||||||
int temps_in_use;
|
int temps_in_use;
|
||||||
int goto_tb_issue_mask;
|
int goto_tb_issue_mask;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user