Re: [PATCH] MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling

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

 



Hi,
On Thu, Mar 04, 2021 at 02:40:54AM +0100, Maciej W. Rozycki wrote:
> On Thu, 4 Mar 2021, Huang Pei wrote:
> 
> > > > @@ -1164,8 +1165,8 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
> > > >  
> > > >  	if (pgd_reg == -1) {
> > > >  		vmalloc_branch_delay_filled = 1;
> > > > -		/* 1 0	1 0 1  << 6  xkphys cached */
> > > > -		uasm_i_ori(p, ptr, ptr, 0x540);
> > > > +		/* insert bit[63:59] of CAC_BASE into bit[11:6] of ptr */
> > > > +		uasm_i_ori(p, ptr, ptr, (CAC_BASE >> 53));
> > > 
> > >  Instead I'd paper the issue over by casting the constant to `s64'.
> > > 
> > >  Or better yet fixed it properly by defining CAC_BASE, etc. as `unsigned
> > > long long' long rather than `unsigned long' to stop all this nonsense 
> > > (e.g. PHYS_TO_XKPHYS already casts the result to `s64').  Thomas, WDYT?
> > Sorry, I do not get it , on MIPS32, how can CAC_BASE be unsigned long
> > long ?
> 
>  By using the `ULL' suffix with constants.  It won't change code produced, 
> because they are unsigned anyway and the compiler will truncate them with 
> no change to the actual value to fit in narrower data types as needed, but 
> it will silence the warnings.
> 
>   Maciej


On Linux 5.11 with this patch and **ONLY** attaching ULL to CAC_BASE in 
arch/mips/include/asm/mach-generic/space.h for CONFIG_32BIT, cross gcc
7.5 in Ubuntu 18.04, loongon1c_defconfig

..........

make[1]: Entering directory '/home/hp/projects/Linux/temp/out_stable'
  GEN     Makefile
  CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/atomic/check-atomics.sh
  CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/checksyscalls.sh
  CC      arch/mips/mm/cache.o
  CC      arch/mips/kernel/branch.o
  CC      arch/mips/mm/context.o
  CC      arch/mips/loongson32/common/time.o
  CC      arch/mips/loongson32/ls1c/board.o
  CHK     include/generated/compile.h
  CC      arch/mips/vdso/vgettimeofday.o
  HOSTCC  arch/mips/vdso/genvdso
  CC      kernel/sched/cputime.o
In file included from /home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/mmiowb.h:5:0,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/spinlock.h:61,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/wait.h:9,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/wait_bit.h:8,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/fs.h:6,
                 from /home/hp/projects/Linux/temp/linux-stable/arch/mips/mm/cache.c:9:
/home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/io.h: In function ‘phys_to_virt’:
/home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/io.h:122:9: error: cast to pointer 
from integer of different size [-Werror=int-to-pointer-cast]
  return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
         ^
In file included from /home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/mmiowb.h:5:0,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/spinlock.h:61,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/wait.h:9,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/pid.h:6,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/sched.h:14,
                 from /home/hp/projects/Linux/temp/linux-stable/include/linux/sched/signal.h:7,
                 from /home/hp/projects/Linux/temp/linux-stable/arch/mips/kernel/branch.c:10:
/home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/io.h: In function ‘phys_to_virt’:
/home/hp/projects/Linux/temp/linux-stable/arch/mips/include/asm/io.h:122:9: error: cast to pointer 
from integer of different size [-Werror=int-to-pointer-cast]
  return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);


.........

Only change CAC_BASE Does NOT work 


Huang Pei




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

  Powered by Linux