Received: from eggs.gnu.org ([2001:4830:134:3::10]:41942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6e4D-0005Re-II for qemu-devel@nongnu.org; Sun, 21 Jun 2015 08:09:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6e4B-0005CU-Cp for qemu-devel@nongnu.org; Sun, 21 Jun 2015 08:09:41 -0400 Received: from mail-ob0-x234.google.com ([2607:f8b0:4003:c01::234]:34427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6e4B-0005CM-7a for qemu-devel@nongnu.org; Sun, 21 Jun 2015 08:09:39 -0400 Received: by obbkm3 with SMTP id km3so5566113obb.1 for ; Sun, 21 Jun 2015 05:09:39 -0700 (PDT) Received: from localhost ([203.126.243.116]) by mx.google.com with ESMTPSA id os15sm8865888oeb.8.2015.06.21.05.09.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 21 Jun 2015 05:09:38 -0700 (PDT) From: "Edgar E. Iglesias" Date: Sun, 21 Jun 2015 21:56:24 +1000 Message-Id: <1434887787-4188-14-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1434887787-4188-1-git-send-email-edgar.iglesias@gmail.com> References: <1434887787-4188-1-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH v1 13/16] target-microblaze: Convert pvr-full to a CPU property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Alistair Francis Originally the pvr-full PVR bits were manually set for each machine. This is a hassle and difficult to read, instead set them based on the CPU properties. Signed-off-by: Alistair Francis Reviewed-by: Peter Crosthwaite Signed-off-by: Edgar E. Iglesias --- target-microblaze/cpu-qom.h | 1 + target-microblaze/cpu.c | 7 ++++--- target-microblaze/cpu.h | 4 +++- target-microblaze/helper.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h index 7da25fa..34f6273 100644 --- a/target-microblaze/cpu-qom.h +++ b/target-microblaze/cpu-qom.h @@ -68,6 +68,7 @@ typedef struct MicroBlazeCPU { bool dcache_writeback; bool endi; char *version; + uint8_t pvr; } cfg; CPUMBState env; diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index df3dd89..ac390ce 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -130,8 +130,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(cs); - env->pvr.regs[0] = PVR0_PVR_FULL_MASK \ - | PVR0_USE_BARREL_MASK \ + env->pvr.regs[0] = PVR0_USE_BARREL_MASK \ | PVR0_USE_DIV_MASK \ | PVR0_USE_HW_MUL_MASK \ | PVR0_USE_EXC_MASK \ @@ -166,7 +165,8 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp) (cpu->cfg.use_fpu ? PVR0_USE_FPU_MASK : 0) | (cpu->cfg.use_mmu ? PVR0_USE_MMU_MASK : 0) | (cpu->cfg.endi ? PVR0_ENDI_MASK : 0) | - (version_code << 16); + (version_code << 16) | + (cpu->cfg.pvr == C_PVR_FULL ? PVR0_PVR_FULL_MASK : 0); env->pvr.regs[2] |= (cpu->cfg.use_fpu ? PVR2_USE_FPU_MASK : 0) | (cpu->cfg.use_fpu > 1 ? PVR2_USE_FPU2_MASK : 0); @@ -228,6 +228,7 @@ static Property mb_properties[] = { false), DEFINE_PROP_BOOL("endianness", MicroBlazeCPU, cfg.endi, false), DEFINE_PROP_STRING("version", MicroBlazeCPU, cfg.version), + DEFINE_PROP_UINT8("pvr", MicroBlazeCPU, cfg.pvr, C_PVR_FULL), DEFINE_PROP_END_OF_LIST(), }; diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 0f82abd..0dd164f 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -212,7 +212,9 @@ typedef struct CPUMBState CPUMBState; /* MSR Reset value PVR mask */ #define PVR11_MSR_RESET_VALUE_MASK 0x000007FF - +#define C_PVR_NONE 0 +#define C_PVR_BASIC 1 +#define C_PVR_FULL 2 /* CPU flags. */ diff --git a/target-microblaze/helper.c b/target-microblaze/helper.c index 5156c12..8257b0e 100644 --- a/target-microblaze/helper.c +++ b/target-microblaze/helper.c @@ -58,8 +58,8 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw, mmu_available = 0; if (cpu->cfg.use_mmu) { mmu_available = 1; - if ((env->pvr.regs[0] & PVR0_PVR_FULL_MASK) - && (env->pvr.regs[11] & PVR11_USE_MMU) != PVR11_USE_MMU) { + if ((cpu->cfg.pvr == C_PVR_FULL) && + (env->pvr.regs[11] & PVR11_USE_MMU) != PVR11_USE_MMU) { mmu_available = 0; } } -- 1.9.1