diff mbox series

[3/5] MIPS: Fix set_uncached_handler for ebase in XKPHYS

Message ID 20231023191400.170052-4-jiaxun.yang@flygoat.com (mailing list archive)
State Superseded
Headers show
Series MIPS: Fix kernel in XKPHYS | expand

Commit Message

Jiaxun Yang Oct. 23, 2023, 7:13 p.m. UTC
ebase may be in XKPHYS if memblock unable to allocate memory
within KSEG0 physical range.

To map ebase into uncached space we just convert it back to
physical address and then use platform's TO_UNCAC helper
to create mapping.

Co-developed-by: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Co-developed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Oct. 25, 2023, 2:48 a.m. UTC | #1
Hi Jiaxun,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6-rc7 next-20231024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jiaxun-Yang/MIPS-Export-higher-highest-relocation-functions-in-uasm/20231024-034657
base:   linus/master
patch link:    https://lore.kernel.org/r/20231023191400.170052-4-jiaxun.yang%40flygoat.com
patch subject: [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase in XKPHYS
config: mips-loongson1c_defconfig (https://download.01.org/0day-ci/archive/20231025/202310251032.BvEIZ6Xk-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231025/202310251032.BvEIZ6Xk-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310251032.BvEIZ6Xk-lkp@intel.com/

All errors (new ones prefixed by >>):

    1402 | asmlinkage void do_cpu(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1402:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1402 | asmlinkage void do_cpu(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1507:17: warning: no previous prototype for function 'do_msa_fpe' [-Wmissing-prototypes]
    1507 | asmlinkage void do_msa_fpe(struct pt_regs *regs, unsigned int msacsr)
         |                 ^
   arch/mips/kernel/traps.c:1507:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1507 | asmlinkage void do_msa_fpe(struct pt_regs *regs, unsigned int msacsr)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1527:17: warning: no previous prototype for function 'do_msa' [-Wmissing-prototypes]
    1527 | asmlinkage void do_msa(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1527:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1527 | asmlinkage void do_msa(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1548:17: warning: no previous prototype for function 'do_mdmx' [-Wmissing-prototypes]
    1548 | asmlinkage void do_mdmx(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1548:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1548 | asmlinkage void do_mdmx(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1560:17: warning: no previous prototype for function 'do_watch' [-Wmissing-prototypes]
    1560 | asmlinkage void do_watch(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1560:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1560 | asmlinkage void do_watch(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1590:17: warning: variable 'prev_state' set but not used [-Wunused-but-set-variable]
    1590 |         enum ctx_state prev_state;
         |                        ^
   arch/mips/kernel/traps.c:1587:17: warning: no previous prototype for function 'do_mcheck' [-Wmissing-prototypes]
    1587 | asmlinkage void do_mcheck(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1587:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1587 | asmlinkage void do_mcheck(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1612:17: warning: no previous prototype for function 'do_mt' [-Wmissing-prototypes]
    1612 | asmlinkage void do_mt(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1612:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1612 | asmlinkage void do_mt(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1648:17: warning: no previous prototype for function 'do_dsp' [-Wmissing-prototypes]
    1648 | asmlinkage void do_dsp(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1648:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1648 | asmlinkage void do_dsp(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1656:17: warning: no previous prototype for function 'do_reserved' [-Wmissing-prototypes]
    1656 | asmlinkage void do_reserved(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1656:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1656 | asmlinkage void do_reserved(struct pt_regs *regs)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1832:17: warning: no previous prototype for function 'cache_parity_error' [-Wmissing-prototypes]
    1832 | asmlinkage void cache_parity_error(void)
         |                 ^
   arch/mips/kernel/traps.c:1832:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1832 | asmlinkage void cache_parity_error(void)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1880:17: warning: no previous prototype for function 'do_ftlb' [-Wmissing-prototypes]
    1880 | asmlinkage void do_ftlb(void)
         |                 ^
   arch/mips/kernel/traps.c:1880:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1880 | asmlinkage void do_ftlb(void)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1909:17: warning: no previous prototype for function 'do_gsexc' [-Wmissing-prototypes]
    1909 | asmlinkage void do_gsexc(struct pt_regs *regs, u32 diag1)
         |                 ^
   arch/mips/kernel/traps.c:1909:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1909 | asmlinkage void do_gsexc(struct pt_regs *regs, u32 diag1)
         |            ^
         |            static 
   arch/mips/kernel/traps.c:1944:6: warning: no previous prototype for function 'ejtag_exception_handler' [-Wmissing-prototypes]
    1944 | void ejtag_exception_handler(struct pt_regs *regs)
         |      ^
   arch/mips/kernel/traps.c:1944:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1944 | void ejtag_exception_handler(struct pt_regs *regs)
         | ^
         | static 
   arch/mips/kernel/traps.c:1989:17: warning: no previous prototype for function 'nmi_exception_handler' [-Wmissing-prototypes]
    1989 | void __noreturn nmi_exception_handler(struct pt_regs *regs)
         |                 ^
   arch/mips/kernel/traps.c:1989:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1989 | void __noreturn nmi_exception_handler(struct pt_regs *regs)
         | ^
         | static 
>> arch/mips/kernel/traps.c:2349:33: error: call to undeclared function 'TO_UNCAC'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2349 |         unsigned long uncached_ebase = TO_UNCAC(__pa(ebase));
         |                                        ^
   22 warnings and 1 error generated.


vim +/TO_UNCAC +2349 arch/mips/kernel/traps.c

  2337	
  2338	static const char panic_null_cerr[] =
  2339		"Trying to set NULL cache error exception handler\n";
  2340	
  2341	/*
  2342	 * Install uncached CPU exception handler.
  2343	 * This is suitable only for the cache error exception which is the only
  2344	 * exception handler that is being run uncached.
  2345	 */
  2346	void set_uncached_handler(unsigned long offset, void *addr,
  2347		unsigned long size)
  2348	{
> 2349		unsigned long uncached_ebase = TO_UNCAC(__pa(ebase));
  2350	
  2351		if (!addr)
  2352			panic(panic_null_cerr);
  2353	
  2354		memcpy((void *)(uncached_ebase + offset), addr, size);
  2355	}
  2356
diff mbox series

Patch

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 60c513c51684..230728d76d11 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -2346,7 +2346,7 @@  static const char panic_null_cerr[] =
 void set_uncached_handler(unsigned long offset, void *addr,
 	unsigned long size)
 {
-	unsigned long uncached_ebase = CKSEG1ADDR(ebase);
+	unsigned long uncached_ebase = TO_UNCAC(__pa(ebase));
 
 	if (!addr)
 		panic(panic_null_cerr);