Message ID | 54194BF9.7010102@redhat.com |
---|---|
State | New |
Headers | show |
On 09/17/2014 01:53 AM, Paolo Bonzini wrote: > +/* All the TLBs together must be smaller than 64k on RISC machines */ > +#if !defined(__i386__) && !defined(__x86_64__) && !defined(__aarch64__) \ > + && !defined(__sparc__) && !defined(CONFIG_TCG_INTERPRETER) > +#define CPU_TLB_BITS (NB_MMU_MODES < 8 ? 8 : 12 - CPU_TLB_ENTRY_BITS) > +#else > +#define CPU_TLB_BITS 8 > +#endif Hum. Well, it's not that all the tlbs together that must be less than 64k, it's the addend of the first entry of the last tlb that must be within 64k of the start of env. Nit picking, but perhaps we can word the comment better. And if we choose to do something like this, this is where I'd prefer a define in the relevant tcg-target.h. Because you've missed ia64 and s390 that have positive offsets larger than 64k (21 and 19 bits, respectively). But otherwise I'm ok with this as a solution. r~
Il 17/09/2014 17:33, Richard Henderson ha scritto: > Hum. Well, it's not that all the tlbs together that must be less than 64k, > it's the addend of the first entry of the last tlb that must be within 64k of > the start of env. Nit picking, but perhaps we can word the comment better. Indeed. > And if we choose to do something like this, this is where I'd prefer a define > in the relevant tcg-target.h. Because you've missed ia64 and s390 that have > positive offsets larger than 64k (21 and 19 bits, respectively). Right, but with 16 MMU modes the maximum size is 128k, well within s390 and ia64's limits. > But otherwise I'm ok with this as a solution. Thanks! Paolo
On 09/17/2014 08:50 AM, Paolo Bonzini wrote: >> > And if we choose to do something like this, this is where I'd prefer a define >> > in the relevant tcg-target.h. Because you've missed ia64 and s390 that have >> > positive offsets larger than 64k (21 and 19 bits, respectively). > Right, but with 16 MMU modes the maximum size is 128k, well within s390 > and ia64's limits. > My point exactly -- they weren't listed in your set of !defined conditionals, so they'd use the reduced tlb size. r~
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 0ca6f0b..ed78884 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -69,8 +69,6 @@ typedef uint64_t target_ulong; #define TB_JMP_PAGE_MASK (TB_JMP_CACHE_SIZE - TB_JMP_PAGE_SIZE) #if !defined(CONFIG_USER_ONLY) -#define CPU_TLB_BITS 8 -#define CPU_TLB_SIZE (1 << CPU_TLB_BITS) /* use a fully associative victim tlb of 8 entries */ #define CPU_VTLB_SIZE 8 @@ -80,6 +78,16 @@ typedef uint64_t target_ulong; #define CPU_TLB_ENTRY_BITS 5 #endif +/* All the TLBs together must be smaller than 64k on RISC machines */ +#if !defined(__i386__) && !defined(__x86_64__) && !defined(__aarch64__) \ + && !defined(__sparc__) && !defined(CONFIG_TCG_INTERPRETER) +#define CPU_TLB_BITS (NB_MMU_MODES < 8 ? 8 : 12 - CPU_TLB_ENTRY_BITS) +#else +#define CPU_TLB_BITS 8 +#endif + +#define CPU_TLB_SIZE (1 << CPU_TLB_BITS) + typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not