aboutsummaryrefslogtreecommitdiff
path: root/target/microblaze/cpu.c
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@xilinx.com>2018-04-16 22:23:05 +0200
committerEdgar E. Iglesias <edgar.iglesias@xilinx.com>2018-05-29 09:33:40 +0200
commit4c8ac10737ae38256d59406801591d9dca2bd69b (patch)
tree4a2983a70e745d436be0a1ae5cfaf3fd6e2a3d86 /target/microblaze/cpu.c
parent0e9033c8c53c3839871c59ef431bcfdc9359d0c1 (diff)
downloadqemu-4c8ac10737ae38256d59406801591d9dca2bd69b.zip
qemu-4c8ac10737ae38256d59406801591d9dca2bd69b.tar.gz
qemu-4c8ac10737ae38256d59406801591d9dca2bd69b.tar.bz2
target-microblaze: Fallback to our latest CPU version
Today, when running QEMU in linux-user or with boards that don't select a specific CPU version, we treat it as an invalid version and log a message. Instead, if no specific version was selected, fallback to our latest CPU version. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Diffstat (limited to 'target/microblaze/cpu.c')
-rw-r--r--target/microblaze/cpu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 4dc1404..06476f6 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -72,6 +72,9 @@ static const struct {
{NULL, 0},
};
+/* If no specific version gets selected, default to the following. */
+#define DEFAULT_CPU_VERSION "10.0"
+
static void mb_cpu_set_pc(CPUState *cs, vaddr value)
{
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
@@ -141,6 +144,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
CPUMBState *env = &cpu->env;
uint8_t version_code = 0;
+ const char *version;
int i = 0;
Error *local_err = NULL;
@@ -162,8 +166,9 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
| PVR2_FPU_EXC_MASK \
| 0;
- for (i = 0; mb_cpu_lookup[i].name && cpu->cfg.version; i++) {
- if (strcmp(mb_cpu_lookup[i].name, cpu->cfg.version) == 0) {
+ version = cpu->cfg.version ? cpu->cfg.version : DEFAULT_CPU_VERSION;
+ for (i = 0; mb_cpu_lookup[i].name && version; i++) {
+ if (strcmp(mb_cpu_lookup[i].name, version) == 0) {
version_code = mb_cpu_lookup[i].version_id;
break;
}