PPC: Add FSL (e500) MMU emulation
PATCH 1/5 PPC: Make MPC8544DS obey -cpu switch
In reply to Alexander GrafThe MPC8544DS board emulation code ignored the user defined -cpu switch. This patch enables it to only provide a sane default, not force an e500v2 CPU inside.
--- hw/ppce500_mpc8544ds.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
hw/ppce500_mpc8544ds.c +5 -1
@@ -178,7 +178,11 @@ static void mpc8544ds_init(ram_addr_t ram_size,qemu_irq *irqs, *mpic, *pci_irqs;/* Setup CPU */ - env =cpu_ppc_init ("e500v2_v30" ); +if (cpu_model ==NULL ) { + cpu_model ="e500v2_v30" ; + } + + env =cpu_ppc_init (cpu_model);if (!env) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
Signature · 1 line
1.6.0.2
PATCH 3/5 PPC: Add GS MSR definition
In reply to Alexander GrafThe BookE specification defines MSR bit 28 as Guest State. Add it to the list of MSR macros.
--- target-ppc/cpu.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
target-ppc/cpu.h +2 -0
@@ -420,6 +420,7 @@ struct ppc_slb_t {#define MSR_CM 31/* Computation mode for BookE hflags */ #define MSR_ICM 30/* Interrupt computation mode for BookE */ #define MSR_THV 29/* hypervisor state for 32 bits PowerPC hflags */ +#define MSR_GS 28/* guest state for BookE */ #define MSR_UCLE 26/* User-mode cache lock enable for BookE */ #define MSR_VR 25/* altivec available x hflags */ #define MSR_SPE 25/* SPE enable for BookE x hflags */
@@ -457,6 +458,7 @@ struct ppc_slb_t {#define msr_cm ((env->msr >> MSR_CM) & 1)#define msr_icm ((env->msr >> MSR_ICM) & 1)#define msr_thv ((env->msr >> MSR_THV) & 1) +#define msr_gs ((env->msr >> MSR_GS) & 1)#define msr_ucle ((env->msr >> MSR_UCLE) & 1)#define msr_vr ((env->msr >> MSR_VR) & 1)#define msr_spe ((env->msr >> MSR_SPE) & 1)
Signature · 1 line
1.6.0.2
PATCH 2/5 PPC: Make MPC8544DS emulation work w/o KVM
In reply to Alexander GrafThe MPC8544DS board emulation was only used with KVM so far, so some parts of the code didn't provide proper values for non-KVM execution.
This patch makes the machine work without KVM enabled. To actually use this, you also need proper e500v2 MMU emulation.
--- hw/ppce500_mpc8544ds.c | 56 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 10 deletions(-)
hw/ppce500_mpc8544ds.c +46 -10
@@ -28,6 +28,7 @@#include "kvm_ppc.h" #include "device_tree.h" #include "openpic.h" +#include "ppc.h" #include "ppce500.h" #include "loader.h" #include "elf.h"
@@ -82,7 +83,7 @@ static int mpc8544_load_device_tree(target_phys_addr_t addr, {int ret =-1 ;#ifdef CONFIG_FDT -uint32_t mem_reg_property[] = {0 , ramsize}; +uint32_t mem_reg_property[] = {0 ,cpu_to_be32 (ramsize)};char *filename;int fdt_size;void *fdt;
@@ -103,15 +104,19 @@ static int mpc8544_load_device_tree(target_phys_addr_t addr,if (ret <0 )fprintf (stderr,"couldn't set /memory/reg\n" ); - ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , - initrd_base); -if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); +if (initrd_size) { + ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_base); +if (ret <0 ) { +fprintf (stderr,"couldn't set /chosen/linux,initrd-start\n" ); + } - ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , - (initrd_base + initrd_size)); -if (ret <0 ) -fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); + ret =qemu_devtree_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + (initrd_base + initrd_size)); +if (ret <0 ) { +fprintf (stderr,"couldn't set /chosen/linux,initrd-end\n" ); + } + } ret =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);
@@ -145,6 +150,13 @@ static int mpc8544_load_device_tree(target_phys_addr_t addr,mpc8544_copy_soc_cell (fdt, buf,"clock-frequency" );mpc8544_copy_soc_cell (fdt, buf,"timebase-frequency" ); + }else { +const uint32_t freq =400000000 ; + +qemu_devtree_setprop_cell (fdt,"/cpus/PowerPC,8544@0" , +"clock-frequency" , freq); +qemu_devtree_setprop_cell (fdt,"/cpus/PowerPC,8544@0" , +"timebase-frequency" , freq); } ret =rom_add_blob_fixed (BINARY_DEVICE_TREE_FILE , fdt, fdt_size, addr);
@@ -156,6 +168,21 @@ out:return ret; } +/* Create reset TLB entries for BookE, spanning the 32bit addr space. */ +static void mmubooke_create_initial_mapping (CPUState *env, +target_ulong va, +target_phys_addr_t pa) +{ +ppcemb_tlb_t *tlb = &env->tlb[512 ].tlbe; + + tlb->attr =0 ; + tlb->prot =PAGE_VALID | ((PAGE_READ |PAGE_WRITE |PAGE_EXEC ) <<4 ); + tlb->size =256 *1024 *1024 ; + tlb->EPN = va &TARGET_PAGE_MASK ; + tlb->RPN = pa &TARGET_PAGE_MASK ; + tlb->PID =0 ; +} + static void mpc8544ds_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename,
@@ -188,6 +215,10 @@ static void mpc8544ds_init(ram_addr_t ram_size,exit (1 ); } +/* XXX register timer? */ +ppc_emb_timers_init (env,400000000 ,PPC_INTERRUPT_DECR ); +ppc_dcr_init (env,NULL ,NULL ); +/* Fixup Memory size on a alignment boundary */ ram_size &= ~(RAM_SIZES_ALIGN -1 );
@@ -265,6 +296,9 @@ static void mpc8544ds_init(ram_addr_t ram_size,/* If we're loading a kernel directly, we must load the device tree too. */ if (kernel_filename) { +#ifndef CONFIG_FDT +cpu_abort (env,"Compiled without FDT support - can't load kernel\n" ); +#endif dt_base = (kernel_size +DTC_LOAD_PAD ) & ~DTC_PAD_MASK ;if (mpc8544_load_device_tree (dt_base, ram_size, initrd_base, initrd_size, kernel_cmdline) <0 ) {
@@ -272,11 +306,13 @@ static void mpc8544ds_init(ram_addr_t ram_size,exit (1 ); } +cpu_reset (env); +/* Set initial guest state. */ env->gpr[1 ] = (16 <<20 ) -8 ; env->gpr[3 ] = dt_base; env->nip = entry; -/* XXX we currently depend on KVM to create some initial TLB entries. */ +mmubooke_create_initial_mapping (env,0 ,0 ); }if (kvm_enabled ())
Signature · 1 line
1.6.0.2
cover PPC: Add FSL (e500) MMU emulation
In a global effort to get rid of KVM-only targets, this is the next important piece of the puzzle: e500 emulation :).
We had support for running an e500 KVM guest for a while now, but the code could not be tested without a real e500 machine, because it required KVM to work. This patchset adds emulation for the e500 MMU, enabling anyone to use the MPC8544DS emulation.
Edgar, please check that this patch set does not break 440 support.
Alexander Graf (5):
PPC: Make MPC8544DS obey -cpu switch
PPC: Make MPC8544DS emulation work w/o KVM
PPC: Add GS MSR definition
PPC: Add another 64 bits to instruction feature mask
PPC: Implement e500 (FSL) MMU
hw/ppce500_mpc8544ds.c | 62 ++++++-- target-ppc/cpu.h | 220 +++++++++++++++++++++++++- target-ppc/helper.c | 233 +++++++++++++++++++++------ target-ppc/helper.h | 5 + target-ppc/op_helper.c | 371 +++++++++++++++++++++++++++++++++++++++++++ target-ppc/translate.c | 116 ++++++++++++-- target-ppc/translate_init.c | 244 ++++++++++++++++++++--------- 7 files changed, 1106 insertions(+), 145 deletions(-)
PATCH 4/5 PPC: Add another 64 bits to instruction feature mask
To enable quick runtime detection of instruction groups to the currently selected CPU emulation, we have a feature mask of what exactly the respective instruction supports.
This feature mask is 64 bits long and we just successfully exceeded those 64 bits. To add more features, we need to think of something.
The easiest solution that came to my mind was to simply add another 64 bits that we can also match on. Since the comparison is only done on start of the qemu process to generate an internal opcode calling table, we should be fine on any performance penalties here.
--- target-ppc/cpu.h | 1 + target-ppc/translate.c | 25 +++++++-- target-ppc/translate_init.c | 123 +++++++++++++++++++++++++++++++------------ 3 files changed, 110 insertions(+), 39 deletions(-)
target-ppc/cpu.h +1 -0
@@ -722,6 +722,7 @@ struct CPUPPCState {int bfd_mach;uint32_t flags;uint64_t insns_flags; +uint64_t insns_flags2;#if defined(TARGET_PPC64 ) && !defined(CONFIG_USER_ONLY )target_phys_addr_t vpa;
target-ppc/translate.c +19 -6
@@ -200,6 +200,8 @@ struct opc_handler_t {uint32_t inval;/* instruction type */ uint64_t type; +/* extended instruction type */ +uint64_t type2;/* handler */ void (*handler)(DisasContext *ctx);#if defined(DO_PPC_STATISTICS ) || defined(PPC_DUMP_CPU )
@@ -313,10 +315,16 @@ static inline void gen_sync_exception(DisasContext *ctx) }#define GEN_HANDLER (name, opc1, opc2, opc3, inval, type) \ -GEN_OPCODE(name, opc1, opc2, opc3, inval, type) +GEN_OPCODE(name, opc1, opc2, opc3, inval, type, PPC_NONE) + +#define GEN_HANDLER_E (name, opc1, opc2, opc3, inval, type, type2) \ +GEN_OPCODE(name, opc1, opc2, opc3, inval, type, type2)#define GEN_HANDLER2 (name, onam, opc1, opc2, opc3, inval, type) \ -GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type) +GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type, PPC_NONE) + +#define GEN_HANDLER2_E (name, onam, opc1, opc2, opc3, inval, type, type2) \ +GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type, type2) typedef struct opcode_t { unsigned char opc1, opc2, opc3;
@@ -456,7 +464,7 @@ static inline target_ulong MASK(uint32_t start, uint32_t end)/* PowerPC instructions table */ #if defined(DO_PPC_STATISTICS ) -#define GEN_OPCODE (name, op1, op2, op3, invl, _typ) \ +#define GEN_OPCODE (name, op1, op2, op3, invl, _typ, _typ2) \ { \ .opc1 = op1, \ .opc2 = op2, \
@@ -465,12 +473,13 @@ static inline target_ulong MASK(uint32_t start, uint32_t end) .handler = { \ .inval = invl, \ .type = _typ, \ + .type2 = _typ2, \ .handler = &gen_##name, \ .oname = stringify(name), \ }, \ .oname = stringify(name), \ } -#define GEN_OPCODE2 (name, onam, op1, op2, op3, invl, _typ) \ +#define GEN_OPCODE2 (name, onam, op1, op2, op3, invl, _typ, _typ2) \ { \ .opc1 = op1, \ .opc2 = op2, \
@@ -479,13 +488,14 @@ static inline target_ulong MASK(uint32_t start, uint32_t end) .handler = { \ .inval = invl, \ .type = _typ, \ + .type2 = _typ2, \ .handler = &gen_##name, \ .oname = onam, \ }, \ .oname = onam, \ }#else -#define GEN_OPCODE (name, op1, op2, op3, invl, _typ) \ +#define GEN_OPCODE (name, op1, op2, op3, invl, _typ, _typ2) \ { \ .opc1 = op1, \ .opc2 = op2, \
@@ -494,11 +504,12 @@ static inline target_ulong MASK(uint32_t start, uint32_t end) .handler = { \ .inval = invl, \ .type = _typ, \ + .type2 = _typ2, \ .handler = &gen_##name, \ }, \ .oname = stringify(name), \ } -#define GEN_OPCODE2 (name, onam, op1, op2, op3, invl, _typ) \ +#define GEN_OPCODE2 (name, onam, op1, op2, op3, invl, _typ, _typ2) \ { \ .opc1 = op1, \ .opc2 = op2, \
@@ -507,6 +518,7 @@ static inline target_ulong MASK(uint32_t start, uint32_t end) .handler = { \ .inval = invl, \ .type = _typ, \ + .type2 = _typ2, \ .handler = &gen_##name, \ }, \ .oname = onam, \
@@ -533,6 +545,7 @@ static void gen_invalid(DisasContext *ctx)static opc_handler_t invalid_handler = { .inval =0xFFFFFFFF , .type =PPC_NONE , + .type2 =PPC_NONE , .handler = gen_invalid, };
target-ppc/translate_init.c +90 -33
460 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 5/5 PPC: Implement e500 (FSL) MMU
In reply to Alexander GrafMost of the code to support e500 style MMUs is already in place, but we're missing on some of the special TLB0-TLB1 handling code and slightly different TLB modification.
This patch adds support for the FSL style MMU.
--- target-ppc/cpu.h | 217 +++++++++++++++++++++++++- target-ppc/helper.c | 233 +++++++++++++++++++++------ target-ppc/helper.h | 5 + target-ppc/op_helper.c | 371 +++++++++++++++++++++++++++++++++++++++++++ target-ppc/translate.c | 91 ++++++++++- target-ppc/translate_init.c | 125 ++++++++++----- 6 files changed, 945 insertions(+), 97 deletions(-)
target-ppc/cpu.h +216 -1
@@ -608,6 +608,215 @@ enum {#define vscr_sat (((env->vscr) >> VSCR_SAT) & 0x1)/*****************************************************************************/ +/* BookE e500 MMU registers */ + +#define MAS0_NV_SHIFT 0 +#define MAS0_NV_MASK (0xfff << MAS0_NV_SHIFT) + +#define MAS0_WQ_SHIFT 12 +#define MAS0_WQ_MASK (3 << MAS0_WQ_SHIFT) +/* Write TLB entry regardless of reservation */ +#define MAS0_WQ_ALWAYS (0 << MAS0_WQ_SHIFT) +/* Write TLB entry only already in use */ +#define MAS0_WQ_COND (1 << MAS0_WQ_SHIFT) +/* Clear TLB entry */ +#define MAS0_WQ_CLR_RSRV (2 << MAS0_WQ_SHIFT) + +#define MAS0_HES_SHIFT 14 +#define MAS0_HES (1 << MAS0_HES_SHIFT) + +#define MAS0_ESEL_SHIFT 16 +#define MAS0_ESEL_MASK (0xfff << MAS0_ESEL_SHIFT) + +#define MAS0_TLBSEL_SHIFT 28 +#define MAS0_TLBSEL_MASK (3 << MAS0_TLBSEL_SHIFT) +#define MAS0_TLBSEL_TLB0 (0 << MAS0_TLBSEL_SHIFT) +#define MAS0_TLBSEL_TLB1 (1 << MAS0_TLBSEL_SHIFT) +#define MAS0_TLBSEL_TLB2 (2 << MAS0_TLBSEL_SHIFT) +#define MAS0_TLBSEL_TLB3 (3 << MAS0_TLBSEL_SHIFT) + +#define MAS0_ATSEL_SHIFT 31 +#define MAS0_ATSEL (1 << MAS0_ATSEL_SHIFT) +#define MAS0_ATSEL_TLB 0 +#define MAS0_ATSEL_LRAT MAS0_ATSEL + +#define MAS1_TSIZE_SHIFT 8 +#define MAS1_TSIZE_MASK (0xf << MAS1_TSIZE_SHIFT) + +#define MAS1_TS_SHIFT 12 +#define MAS1_TS (1 << MAS1_TS_SHIFT) + +#define MAS1_IND_SHIFT 13 +#define MAS1_IND (1 << MAS1_IND_SHIFT) + +#define MAS1_TID_SHIFT 16 +#define MAS1_TID_MASK (0x3fff << MAS1_TID_SHIFT) + +#define MAS1_IPROT_SHIFT 30 +#define MAS1_IPROT (1 << MAS1_IPROT_SHIFT) + +#define MAS1_VALID_SHIFT 31 +#define MAS1_VALID 0x80000000 + +#define MAS2_EPN_SHIFT 12 +#define MAS2_EPN_MASK (0xfffff << MAS2_EPN_SHIFT) + +#define MAS2_ACM_SHIFT 6 +#define MAS2_ACM (1 << MAS2_ACM_SHIFT) + +#define MAS2_VLE_SHIFT 5 +#define MAS2_VLE (1 << MAS2_VLE_SHIFT) + +#define MAS2_W_SHIFT 4 +#define MAS2_W (1 << MAS2_W_SHIFT) + +#define MAS2_I_SHIFT 3 +#define MAS2_I (1 << MAS2_I_SHIFT) + +#define MAS2_M_SHIFT 2 +#define MAS2_M (1 << MAS2_M_SHIFT) + +#define MAS2_G_SHIFT 1 +#define MAS2_G (1 << MAS2_G_SHIFT) + +#define MAS2_E_SHIFT 0 +#define MAS2_E (1 << MAS2_E_SHIFT) + +#define MAS3_RPN_SHIFT 12 +#define MAS3_RPN_MASK (0xfffff << MAS3_RPN_SHIFT) + +#define MAS3_U0 0x00000200 +#define MAS3_U1 0x00000100 +#define MAS3_U2 0x00000080 +#define MAS3_U3 0x00000040 +#define MAS3_UX 0x00000020 +#define MAS3_SX 0x00000010 +#define MAS3_UW 0x00000008 +#define MAS3_SW 0x00000004 +#define MAS3_UR 0x00000002 +#define MAS3_SR 0x00000001 +#define MAS3_SPSIZE_SHIFT 1 +#define MAS3_SPSIZE_MASK (0x3e << MAS3_SPSIZE_SHIFT) + +#define MAS4_TLBSELD_SHIFT MAS0_TLBSEL_SHIFT +#define MAS4_TLBSELD_MASK MAS0_TLBSEL_MASK +#define MAS4_TIDSELD_MASK 0x00030000 +#define MAS4_TIDSELD_PID0 0x00000000 +#define MAS4_TIDSELD_PID1 0x00010000 +#define MAS4_TIDSELD_PID2 0x00020000 +#define MAS4_TIDSELD_PIDZ 0x00030000 +#define MAS4_INDD 0x00008000/* Default IND */ +#define MAS4_TSIZED_SHIFT MAS1_TSIZE_SHIFT +#define MAS4_TSIZED_MASK MAS1_TSIZE_MASK +#define MAS4_ACMD 0x00000040 +#define MAS4_VLED 0x00000020 +#define MAS4_WD 0x00000010 +#define MAS4_ID 0x00000008 +#define MAS4_MD 0x00000004 +#define MAS4_GD 0x00000002 +#define MAS4_ED 0x00000001 +#define MAS4_WIMGED_MASK 0x0000001f/* Default WIMGE */ +#define MAS4_WIMGED_SHIFT 0 + +#define MAS5_SGS 0x80000000 +#define MAS5_SLPID_MASK 0x00000fff + +#define MAS6_SPID0 0x3fff0000 +#define MAS6_SPID1 0x00007ffe +#define MAS6_ISIZE (x) MAS1_TSIZE(x) +#define MAS6_SAS 0x00000001 +#define MAS6_SPID MAS6_SPID0 +#define MAS6_SIND 0x00000002/* Indirect page */ +#define MAS6_SIND_SHIFT 1 +#define MAS6_SPID_MASK 0x3fff0000 +#define MAS6_SPID_SHIFT 16 +#define MAS6_ISIZE_MASK 0x00000f80 +#define MAS6_ISIZE_SHIFT 7 + +#define MAS7_RPN 0xffffffff + +#define MAS8_TGS 0x80000000 +#define MAS8_VF 0x40000000 +#define MAS8_TLBPID 0x00000fff + +/* Bit definitions for MMUCFG */ +#define MMUCFG_MAVN 0x00000003/* MMU Architecture Version Number */ +#define MMUCFG_MAVN_V1 0x00000000/* v1.0 */ +#define MMUCFG_MAVN_V2 0x00000001/* v2.0 */ +#define MMUCFG_NTLBS 0x0000000c/* Number of TLBs */ +#define MMUCFG_PIDSIZE 0x000007c0/* PID Reg Size */ +#define MMUCFG_TWC 0x00008000/* TLB Write Conditional (v2.0) */ +#define MMUCFG_LRAT 0x00010000/* LRAT Supported (v2.0) */ +#define MMUCFG_RASIZE 0x00fe0000/* Real Addr Size */ +#define MMUCFG_LPIDSIZE 0x0f000000/* LPID Reg Size */ + +/* Bit definitions for MMUCSR0 */ +#define MMUCSR0_TLB1FI 0x00000002/* TLB1 Flash invalidate */ +#define MMUCSR0_TLB0FI 0x00000004/* TLB0 Flash invalidate */ +#define MMUCSR0_TLB2FI 0x00000040/* TLB2 Flash invalidate */ +#define MMUCSR0_TLB3FI 0x00000020/* TLB3 Flash invalidate */ +#define MMUCSR0_TLBFI (MMUCSR0_TLB0FI | MMUCSR0_TLB1FI | \ + MMUCSR0_TLB2FI | MMUCSR0_TLB3FI) +#define MMUCSR0_TLB0PS 0x00000780/* TLB0 Page Size */ +#define MMUCSR0_TLB1PS 0x00007800/* TLB1 Page Size */ +#define MMUCSR0_TLB2PS 0x00078000/* TLB2 Page Size */ +#define MMUCSR0_TLB3PS 0x00780000/* TLB3 Page Size */ + +/* TLBnCFG encoding */ +#define TLBnCFG_N_ENTRY 0x00000fff/* number of entries */ +#define TLBnCFG_HES 0x00002000/* HW select supported */ +#define TLBnCFG_AVAIL 0x00004000/* variable page size */ +#define TLBnCFG_IPROT 0x00008000/* IPROT supported */ +#define TLBnCFG_GTWE 0x00010000/* Guest can write */ +#define TLBnCFG_IND 0x00020000/* IND entries supported */ +#define TLBnCFG_PT 0x00040000/* Can load from page table */ +#define TLBnCFG_MINSIZE 0x00f00000/* Minimum Page Size (v1.0) */ +#define TLBnCFG_MINSIZE_SHIFT 20 +#define TLBnCFG_MAXSIZE 0x000f0000/* Maximum Page Size (v1.0) */ +#define TLBnCFG_MAXSIZE_SHIFT 16 +#define TLBnCFG_ASSOC 0xff000000/* Associativity */ +#define TLBnCFG_ASSOC_SHIFT 24 + +/* TLBnPS encoding */ +#define TLBnPS_4K 0x00000004 +#define TLBnPS_8K 0x00000008 +#define TLBnPS_16K 0x00000010 +#define TLBnPS_32K 0x00000020 +#define TLBnPS_64K 0x00000040 +#define TLBnPS_128K 0x00000080 +#define TLBnPS_256K 0x00000100 +#define TLBnPS_512K 0x00000200 +#define TLBnPS_1M 0x00000400 +#define TLBnPS_2M 0x00000800 +#define TLBnPS_4M 0x00001000 +#define TLBnPS_8M 0x00002000 +#define TLBnPS_16M 0x00004000 +#define TLBnPS_32M 0x00008000 +#define TLBnPS_64M 0x00010000 +#define TLBnPS_128M 0x00020000 +#define TLBnPS_256M 0x00040000 +#define TLBnPS_512M 0x00080000 +#define TLBnPS_1G 0x00100000 +#define TLBnPS_2G 0x00200000 +#define TLBnPS_4G 0x00400000 +#define TLBnPS_8G 0x00800000 +#define TLBnPS_16G 0x01000000 +#define TLBnPS_32G 0x02000000 +#define TLBnPS_64G 0x04000000 +#define TLBnPS_128G 0x08000000 +#define TLBnPS_256G 0x10000000 + +/* tlbilx action encoding */ +#define TLBILX_T_ALL 0 +#define TLBILX_T_TID 1 +#define TLBILX_T_FULLMATCH 3 +#define TLBILX_T_CLASS0 4 +#define TLBILX_T_CLASS1 5 +#define TLBILX_T_CLASS2 6 +#define TLBILX_T_CLASS3 7 + + +/*****************************************************************************/ /* The whole PowerPC CPU context */ #define NB_MMU_MODES 3
@@ -678,8 +887,9 @@ struct CPUPPCState {int nb_BATs;target_ulong DBAT [2 ][8 ];target_ulong IBAT [2 ][8 ]; -/* PowerPC TLB registers (for 4xx and 60x software driven TLBs) */ +/* PowerPC TLB registers (for 4xx, e500 and 60x software driven TLBs) */ int nb_tlb;/* Total number of TLB */ +int nb_tlbs[4 ];/* Number of respective TLB entries (e500) */ int tlb_per_way;/* Speed-up helper: used to avoid divisions at run time */ int nb_ways;/* Number of ways in the TLB set */ int last_way;/* Last used way used to allocate TLB in a LRU way */
@@ -1546,6 +1756,11 @@ enum {PPC_DCRUX =0x4000000000000000ULL ,/* popcntw and popcntd instructions */ PPC_POPCNTWD =0x8000000000000000ULL , + +/* extended type values */ + +/* BookE FSL (e500) PowerPC specification */ + PPC2_BOOKE_FSL = 0x0000000000000001ULL, };/*****************************************************************************/
target-ppc/helper.c +183 -50
329 lines not on this page · raw message
target-ppc/helper.h +5 -0
@@ -334,6 +334,11 @@ DEF_HELPER_1(4xx_tlbsx, tl, tl) DEF_HELPER_2(440_tlbre, tl, i32, tl) DEF_HELPER_3(440_tlbwe, void, i32, tl, tl) DEF_HELPER_1(440_tlbsx, tl, tl) +DEF_HELPER_0(e500_tlbre, void) +DEF_HELPER_0(e500_tlbwe, void) +DEF_HELPER_2(e500_tlbsx, void, tl, tl) +DEF_HELPER_1(e500_tlbivax, void, tl) +DEF_HELPER_1(e500_tlbflush, void, i32) DEF_HELPER_1(6xx_tlbd, void, tl) DEF_HELPER_1(6xx_tlbi, void, tl) DEF_HELPER_1(74xx_tlbd, void, tl)
target-ppc/op_helper.c +371 -0
375 lines not on this page · raw message
target-ppc/translate.c +87 -4
112 lines not on this page · raw message
target-ppc/translate_init.c +83 -42
245 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Quoted 9 lines · Alexander Graf
In a global effort to get rid of KVM-only targets, this is the next important piece of the puzzle: e500 emulation :).
We had support for running an e500 KVM guest for a while now, but the code could not be tested without a real e500 machine, because it required KVM to work. This patchset adds emulation for the e500 MMU, enabling anyone to use the MPC8544DS emulation.
Edgar, please check that this patch set does not break 440 support.
Hi Alex,
440 support seems OK in sysemulation but I I got the following error when building linux-user:
% make
make[1]: Nothing to be done for `all'.
CC ppc-linux-user/translate.o
cc1: warnings being treated as errors
In file included from /home/edgar/src/c/qemu/git/qemu/target-ppc/translate.c:9160:/home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c: In function 'spr_write_e500_mmucsr0':/home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c:1370: error: implicit declaration of function 'gen_helper_e500_tlbflush' /home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c:1370: error: nested extern declaration of 'gen_helper_e500_tlbflush' /home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c: In function 'spr_write_booke_pid':/home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c:1378: error: implicit declaration of function 'gen_helper_tlbia' /home/edgar/src/c/qemu/git/qemu/target-ppc/translate_init.c:1378: error: nested extern declaration of 'gen_helper_tlbia' make[1]: *** [translate.o] Error 1
make: *** [subdir-ppc-linux-user] Error 2
Cheers