Re: [PATCH 05/15] MIPS: Don't build fast TLB refill handler with 32-bit kernels.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 21, 2014 at 03:04:20PM +0200, Ralf Baechle wrote:
> On Wed, May 21, 2014 at 10:38:39AM +0100, James Hogan wrote:
> 
> > On 20/05/14 15:47, Andreas Herrmann wrote:
> > > From: David Daney <david.daney@xxxxxxxxxx>
> > > 
> > > The fast handler only supports 64-bit kernels.
> > > 
> > > Signed-off-by: David Daney <david.daney@xxxxxxxxxx>
> > > Signed-off-by: Andreas Herrmann <andreas.herrmann@xxxxxxxxxxxxxxxxxx>
> > > ---
> > >  arch/mips/mm/tlbex.c |    8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
> > > index ee88367..781e183 100644
> > > --- a/arch/mips/mm/tlbex.c
> > > +++ b/arch/mips/mm/tlbex.c
> > > @@ -1250,13 +1250,17 @@ static void build_r4000_tlb_refill_handler(void)
> > >  	unsigned int final_len;
> > >  	struct mips_huge_tlb_info htlb_info __maybe_unused;
> > >  	enum vmalloc64_mode vmalloc_mode __maybe_unused;
> > > -
> > > +#ifdef CONFIG_64BIT
> > > +	bool is64bit = true;
> > > +#else
> > > +	bool is64bit = false;
> > > +#endif
> > >  	memset(tlb_handler, 0, sizeof(tlb_handler));
> > >  	memset(labels, 0, sizeof(labels));
> > >  	memset(relocs, 0, sizeof(relocs));
> > >  	memset(final_handler, 0, sizeof(final_handler));
> > >  
> > > -	if ((scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
> > > +	if (is64bit && (scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
> > >  		htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
> > >  							  scratch_reg);
> > >  		vmalloc_mode = refill_scratch;
> > > 
> > 
> > This looks like a good place to use IS_ENABLED(CONFIG_64BIT) to reduce
> > ifdefery.
> 
> Or even the classic "if (sizeof(unsigned long) == 8)" which is a little less
> expressive but more portable.

Ok, makes sense.
(Will use one of the two suggestions.)


Thanks,

Andreas


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux