diff options
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/arch_dump.c | 6 | ||||
-rw-r--r-- | target-ppc/cpu.h | 3 | ||||
-rw-r--r-- | target-ppc/int_helper.c | 2 | ||||
-rw-r--r-- | target-ppc/machine.c | 4 | ||||
-rw-r--r-- | target-ppc/translate_init.c | 23 |
5 files changed, 29 insertions, 9 deletions
diff --git a/target-ppc/arch_dump.c b/target-ppc/arch_dump.c index 17fd4c6fb1..9dccf1ae1f 100644 --- a/target-ppc/arch_dump.c +++ b/target-ppc/arch_dump.c @@ -164,7 +164,7 @@ static void ppc64_write_elf64_speregset(Note *note, PowerPCCPU *cpu) speregset->spe_fscr = cpu_to_be32(cpu->env.spe_fscr); } -struct NoteFuncDescStruct { +static const struct NoteFuncDescStruct { int contents_size; void (*note_contents_func)(Note *note, PowerPCCPU *cpu); } note_func[] = { @@ -196,7 +196,7 @@ ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) int name_size = 8; /* "CORE" or "QEMU" rounded */ size_t elf_note_size = 0; int note_head_size; - NoteFuncDesc *nf; + const NoteFuncDesc *nf; if (class != ELFCLASS64) { return -1; @@ -221,7 +221,7 @@ static int ppc64_write_all_elf64_notes(const char *note_name, Note note; int ret = -1; int note_size; - NoteFuncDesc *nf; + const NoteFuncDesc *nf; for (nf = note_func; nf->note_contents_func; nf++) { note.hdr.n_namesz = cpu_to_be32(sizeof(note.name)); diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 91b7ae5534..2719c08323 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -334,6 +334,7 @@ struct ppc_spr_t { void (*hea_write)(void *opaque, int spr_num, int gpr_num); #endif const char *name; + target_ulong default_value; #ifdef CONFIG_KVM /* We (ab)use the fact that all the SPRs will have ids for the * ONE_REG interface will have KVM_REG_PPC to use 0 as meaning, @@ -1900,6 +1901,8 @@ enum { PPC2_LSQ_ISA207 = 0x0000000000002000ULL, /* ISA 2.07 Altivec */ PPC2_ALTIVEC_207 = 0x0000000000004000ULL, + /* PowerISA 2.07 Book3s specification */ + PPC2_ISA207S = 0x0000000000008000ULL, #define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ PPC2_ISA205 | PPC2_VSX207 | PPC2_PERM_ISA206 | \ diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index e14e304457..18b54f060a 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -1075,7 +1075,7 @@ void helper_vbpermq(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) #undef VBPERMQ_INDEX #undef VBPERMQ_DW -uint64_t VGBBD_MASKS[256] = { +static const uint64_t VGBBD_MASKS[256] = { 0x0000000000000000ull, /* 00 */ 0x0000000000000080ull, /* 01 */ 0x0000000000008000ull, /* 02 */ diff --git a/target-ppc/machine.c b/target-ppc/machine.c index 2d46ceccca..063b379d90 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -114,7 +114,7 @@ static void put_avr(QEMUFile *f, void *pv, size_t size) qemu_put_be64(f, v->u64[1]); } -const VMStateInfo vmstate_info_avr = { +static const VMStateInfo vmstate_info_avr = { .name = "avr", .get = get_avr, .put = put_avr, @@ -288,7 +288,7 @@ static void put_slbe(QEMUFile *f, void *pv, size_t size) qemu_put_be64(f, v->vsid); } -const VMStateInfo vmstate_info_slbe = { +static const VMStateInfo vmstate_info_slbe = { .name = "slbe", .get = get_slbe, .put = put_slbe, diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 6084f40f28..7f53c33eaf 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -631,7 +631,7 @@ static inline void _spr_register(CPUPPCState *env, int num, #if defined(CONFIG_KVM) spr->one_reg_id = one_reg_id, #endif - env->spr[num] = initial_value; + env->spr[num] = spr->default_value = initial_value; } /* Generic PowerPC SPRs */ @@ -7173,7 +7173,8 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | - PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207; + PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | + PPC2_ISA205 | PPC2_ISA207S; pcc->msr_mask = 0x800000000284FF36ULL; pcc->mmu_model = POWERPC_MMU_2_06; #if defined(CONFIG_SOFTMMU) @@ -7434,7 +7435,7 @@ static int create_new_table (opc_handler_t **table, unsigned char idx) { opc_handler_t **tmp; - tmp = g_malloc(0x20 * sizeof(opc_handler_t)); + tmp = g_new(opc_handler_t *, 0x20); fill_new_table(tmp, 0x20); table[idx] = (opc_handler_t *)((uintptr_t)tmp | PPC_INDIRECT); @@ -7848,6 +7849,12 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp) max_smt, kvm_enabled() ? "KVM" : "TCG"); return; } + if (!is_power_of_2(smp_threads)) { + error_setg(errp, "Cannot support %d threads on PPC with %s, " + "threads count must be a power of 2.", + smp_threads, kvm_enabled() ? "KVM" : "TCG"); + return; + } cpu->cpu_dt_id = (cs->cpu_index / smp_threads) * max_smt + (cs->cpu_index % smp_threads); @@ -8381,6 +8388,7 @@ static void ppc_cpu_reset(CPUState *s) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); CPUPPCState *env = &cpu->env; target_ulong msr; + int i; pcc->parent_reset(s); @@ -8434,6 +8442,15 @@ static void ppc_cpu_reset(CPUState *s) env->dtl_size = 0; #endif /* TARGET_PPC64 */ + for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { + ppc_spr_t *spr = &env->spr_cb[i]; + + if (!spr->name) { + continue; + } + env->spr[i] = spr->default_value; + } + /* Flush all TLBs */ tlb_flush(s, 1); } |