linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] MIPS: Fix kernel in XKPHYS
@ 2023-10-23 19:13 Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 1/5] MIPS: Export higher/highest relocation functions in uasm Jiaxun Yang
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:13 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

Hi all,

This series fixes support for loading kernel to XKPHYS space.
It is derived from "MIPS: use virtual addresses from xkphys for MIPS64" [1].

Boot tested on boston and QEMU with loading address set to 0xa800000090000000.
QEMU patch on the way.

Gregory and Vladimir, do let me know if I missed anything.

Thanks
- Jiaxun

[1]: https://lore.kernel.org/lkml/20231004161038.2818327-3-gregory.clement@bootlin.com/

Jiaxun Yang (5):
  MIPS: Export higher/highest relocation functions in uasm
  MIPS: genex: Fix except_vec_vi for kernel in XKPHYS
  MIPS: Fix set_uncached_handler for ebase in XKPHYS
  MIPS: Handle mips_cps_core_entry within lower 4G
  MIPS: Allow kernel base to be set from Kconfig for all platforms

 arch/mips/Kconfig               | 18 +++++++++++++----
 arch/mips/include/asm/mips-cm.h |  1 +
 arch/mips/include/asm/uasm.h    |  2 ++
 arch/mips/kernel/genex.S        | 19 +++++++++++++----
 arch/mips/kernel/smp-cps.c      | 27 +++++++++++++++++++------
 arch/mips/kernel/traps.c        | 36 +++++++++++++++++++++++----------
 arch/mips/mm/uasm.c             |  6 ++++--
 7 files changed, 82 insertions(+), 27 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] MIPS: Export higher/highest relocation functions in uasm
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
@ 2023-10-23 19:13 ` Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 2/5] MIPS: genex: Fix except_vec_vi for kernel in XKPHYS Jiaxun Yang
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:13 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

Export uasm_rel_{higher,highest} functions.
Those functions can be helpful in dealing with 64bit immediates.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/include/asm/uasm.h | 2 ++
 arch/mips/mm/uasm.c          | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 296bcf31abb5..12db6d2fca07 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -196,6 +196,8 @@ void uasm_build_label(struct uasm_label **lab, u32 *addr,
 #ifdef CONFIG_64BIT
 int uasm_in_compat_space_p(long addr);
 #endif
+int uasm_rel_highest(long val);
+int uasm_rel_higher(long val);
 int uasm_rel_hi(long val);
 int uasm_rel_lo(long val);
 void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 125140979d62..6846bf2084c5 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -425,7 +425,7 @@ int uasm_in_compat_space_p(long addr)
 }
 UASM_EXPORT_SYMBOL(uasm_in_compat_space_p);
 
-static int uasm_rel_highest(long val)
+int uasm_rel_highest(long val)
 {
 #ifdef CONFIG_64BIT
 	return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
@@ -433,8 +433,9 @@ static int uasm_rel_highest(long val)
 	return 0;
 #endif
 }
+UASM_EXPORT_SYMBOL(uasm_rel_highest);
 
-static int uasm_rel_higher(long val)
+int uasm_rel_higher(long val)
 {
 #ifdef CONFIG_64BIT
 	return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
@@ -442,6 +443,7 @@ static int uasm_rel_higher(long val)
 	return 0;
 #endif
 }
+UASM_EXPORT_SYMBOL(uasm_rel_higher);
 
 int uasm_rel_hi(long val)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] MIPS: genex: Fix except_vec_vi for kernel in XKPHYS
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 1/5] MIPS: Export higher/highest relocation functions in uasm Jiaxun Yang
@ 2023-10-23 19:13 ` Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase " Jiaxun Yang
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:13 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

Use {highest, higher, hi, lo} immediate loading sequence
to load 64 bit jump address for handler when kernel is
loaded to XKPHYS.

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/genex.S | 19 +++++++++++++++----
 arch/mips/kernel/traps.c | 34 ++++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index b6de8e88c1bd..fd765ad9ecac 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -272,11 +272,22 @@ NESTED(except_vec_vi, 0, sp)
 	.set	push
 	.set	noreorder
 	PTR_LA	v1, except_vec_vi_handler
-FEXPORT(except_vec_vi_lui)
-	lui	v0, 0		/* Patched */
+#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
+FEXPORT(except_vec_vi_hi)
+	lui	v0, 0			/* Patched */
+#else
+FEXPORT(except_vec_vi_highest)
+	lui	v0, 0			/* Patched */
+FEXPORT(except_vec_vi_higher)
+	daddiu	v0, 0			/* Patched */
+	dsll	v0, 16
+FEXPORT(except_vec_vi_hi)
+	daddiu	v0, 0			/* Patched */
+	dsll	v0, 16
+#endif
 	jr	v1
-FEXPORT(except_vec_vi_ori)
-	 ori	v0, 0		/* Patched */
+FEXPORT(except_vec_vi_lo)
+	PTR_ADDIU	v0, 0		/* Patched */
 	.set	pop
 	END(except_vec_vi)
 EXPORT(except_vec_vi_end)
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 246c6a6b0261..60c513c51684 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -2091,18 +2091,26 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 		 * If no shadow set is selected then use the default handler
 		 * that does normal register saving and standard interrupt exit
 		 */
-		extern const u8 except_vec_vi[], except_vec_vi_lui[];
-		extern const u8 except_vec_vi_ori[], except_vec_vi_end[];
+		extern const u8 except_vec_vi[], except_vec_vi_hi[];
+		extern const u8 except_vec_vi_lo[], except_vec_vi_end[];
+#if defined(CONFIG_64BIT) && !defined(KBUILD_64BIT_SYM32)
+		extern const u8 except_vec_vi_highest[], except_vec_vi_higher[];
+#endif
 		extern const u8 rollback_except_vec_vi[];
 		const u8 *vec_start = using_rollback_handler() ?
 				      rollback_except_vec_vi : except_vec_vi;
 #if defined(CONFIG_CPU_MICROMIPS) || defined(CONFIG_CPU_BIG_ENDIAN)
-		const int lui_offset = except_vec_vi_lui - vec_start + 2;
-		const int ori_offset = except_vec_vi_ori - vec_start + 2;
+		const int imm_offset = 2;
 #else
-		const int lui_offset = except_vec_vi_lui - vec_start;
-		const int ori_offset = except_vec_vi_ori - vec_start;
+		const int imm_offset = 0;
+#endif
+#if defined(CONFIG_64BIT) && !defined(KBUILD_64BIT_SYM32)
+		const int highest_offset = except_vec_vi_highest - vec_start + imm_offset;
+		const int higher_offset = except_vec_vi_higher - vec_start + imm_offset;
 #endif
+		const int hi_offset = except_vec_vi_hi - vec_start + imm_offset;
+		const int lo_offset = except_vec_vi_lo - vec_start + imm_offset;
+
 		const int handler_len = except_vec_vi_end - vec_start;
 
 		if (handler_len > VECTORSPACING) {
@@ -2119,10 +2127,16 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 #else
 				handler_len);
 #endif
-		h = (u16 *)(b + lui_offset);
-		*h = (handler >> 16) & 0xffff;
-		h = (u16 *)(b + ori_offset);
-		*h = (handler & 0xffff);
+#if defined(CONFIG_64BIT) && !defined(KBUILD_64BIT_SYM32)
+		h = (u16 *)(b + highest_offset);
+		*h = uasm_rel_highest(handler);
+		h = (u16 *)(b + higher_offset);
+		*h = uasm_rel_higher(handler);
+#endif
+		h = (u16 *)(b + hi_offset);
+		*h = uasm_rel_hi(handler);
+		h = (u16 *)(b + lo_offset);
+		*h = uasm_rel_lo(handler);
 		local_flush_icache_range((unsigned long)b,
 					 (unsigned long)(b+handler_len));
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase in XKPHYS
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 1/5] MIPS: Export higher/highest relocation functions in uasm Jiaxun Yang
  2023-10-23 19:13 ` [PATCH 2/5] MIPS: genex: Fix except_vec_vi for kernel in XKPHYS Jiaxun Yang
@ 2023-10-23 19:13 ` Jiaxun Yang
  2023-10-25  2:48   ` kernel test robot
  2023-10-23 19:13 ` [PATCH 4/5] MIPS: Handle mips_cps_core_entry within lower 4G Jiaxun Yang
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:13 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

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(-)

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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] MIPS: Handle mips_cps_core_entry within lower 4G
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
                   ` (2 preceding siblings ...)
  2023-10-23 19:13 ` [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase " Jiaxun Yang
@ 2023-10-23 19:13 ` Jiaxun Yang
  2023-10-23 19:14 ` [PATCH 5/5] MIPS: Allow kernel base to be set from Kconfig for all platforms Jiaxun Yang
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:13 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

Set CM_GCR_Cx_RESET_BASE_MODE and use XKPHYS base address for
core_entry for 64bit CM when mips_cps_core_entry is beyond
KSEG1.

Also disable SMP and warn user if mips_cps_core_entry is
unsuitable as reset vector.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
Note: IMO it does not solve the problem of MobileEye,
which have mips_cps_core_entry beyond lower 4G,
it just enables me to test kernel in XKPHYS on boston.
---
 arch/mips/include/asm/mips-cm.h |  1 +
 arch/mips/kernel/smp-cps.c      | 27 +++++++++++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index 23c67c0871b1..15d8d69de455 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -311,6 +311,7 @@ GCR_CX_ACCESSOR_RW(32, 0x018, other)
 /* GCR_Cx_RESET_BASE - Configure where powered up cores will fetch from */
 GCR_CX_ACCESSOR_RW(32, 0x020, reset_base)
 #define CM_GCR_Cx_RESET_BASE_BEVEXCBASE		GENMASK(31, 12)
+#define CM_GCR_Cx_RESET_BASE_MODE		BIT(1)
 
 /* GCR_Cx_ID - Identify the current core */
 GCR_CX_ACCESSOR_RO(32, 0x028, id)
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index dd55d59b88db..623dfd05585b 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -26,6 +26,7 @@
 #include <asm/uasm.h>
 
 static DECLARE_BITMAP(core_power, NR_CPUS);
+static uint32_t core_entry_reg;
 
 struct core_boot_config *mips_cps_core_bootcfg;
 
@@ -37,7 +38,6 @@ static unsigned __init core_vpe_count(unsigned int cluster, unsigned core)
 static void __init cps_smp_setup(void)
 {
 	unsigned int nclusters, ncores, nvpes, core_vpes;
-	unsigned long core_entry;
 	int cl, c, v;
 
 	/* Detect & record VPE topology */
@@ -94,10 +94,20 @@ static void __init cps_smp_setup(void)
 	/* Make core 0 coherent with everything */
 	write_gcr_cl_coherence(0xff);
 
-	if (mips_cm_revision() >= CM_REV_CM3) {
-		core_entry = CKSEG1ADDR((unsigned long)mips_cps_core_entry);
-		write_gcr_bev_base(core_entry);
-	}
+	/*
+	 * Set up the core entry address
+	 * If accessible in KSEG1 just use KSEG1
+	 */
+	if (__pa_symbol(mips_cps_core_entry) < SZ_512M)
+		core_entry_reg =  CKSEG1ADDR(__pa_symbol(mips_cps_core_entry));
+
+	/* If CM is 64bit and with-in low 4G just use XKPHYS */
+	if (mips_cm_is64 && __pa_symbol(mips_cps_core_entry) < SZ_4G)
+		core_entry_reg =  __pa_symbol(mips_cps_core_entry) |
+					CM_GCR_Cx_RESET_BASE_MODE;
+
+	if (core_entry_reg && mips_cm_revision() >= CM_REV_CM3)
+		write_gcr_bev_base(core_entry_reg);
 
 #ifdef CONFIG_MIPS_MT_FPAFF
 	/* If we have an FPU, enroll ourselves in the FPU-full mask */
@@ -114,6 +124,11 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
 
 	mips_mt_set_cpuoptions();
 
+	if (!core_entry_reg) {
+		pr_err("core_entry address unsuitable, disabling smp-cps\n");
+		goto err_out;
+	}
+
 	/* Detect whether the CCA is unsuited to multi-core SMP */
 	cca = read_c0_config() & CONF_CM_CMASK;
 	switch (cca) {
@@ -213,7 +228,7 @@ static void boot_core(unsigned int core, unsigned int vpe_id)
 	mips_cm_lock_other(0, core, 0, CM_GCR_Cx_OTHER_BLOCK_LOCAL);
 
 	/* Set its reset vector */
-	write_gcr_co_reset_base(CKSEG1ADDR((unsigned long)mips_cps_core_entry));
+	write_gcr_co_reset_base(core_entry_reg);
 
 	/* Ensure its coherency is disabled */
 	write_gcr_co_coherence(0);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] MIPS: Allow kernel base to be set from Kconfig for all platforms
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
                   ` (3 preceding siblings ...)
  2023-10-23 19:13 ` [PATCH 4/5] MIPS: Handle mips_cps_core_entry within lower 4G Jiaxun Yang
@ 2023-10-23 19:14 ` Jiaxun Yang
  2023-10-25 18:09 ` [PATCH 0/5] MIPS: Fix kernel in XKPHYS Florian Fainelli
       [not found] ` <875y2s81lx.fsf@BL-laptop>
  6 siblings, 0 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-23 19:14 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev,
	Jiaxun Yang

There are some platforms in wild that generic loading address won't
work with them due to memory layout.

Allow PHYSICAL_START to be override from Kconfig, introduce
PHYSICAL_START_BOOL symbol as powerpc did.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/Kconfig | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bc8421859006..bfedc8b48a81 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2884,12 +2884,22 @@ config ARCH_SUPPORTS_KEXEC
 config ARCH_SUPPORTS_CRASH_DUMP
 	def_bool y
 
+config PHYSICAL_START_BOOL
+	bool "Set physical address where the kernel is loaded"
+	default y if CRASH_DUMP
+	help
+	  This gives the CKSEG0, KSEG0 or XKPHYS address where the kernel
+	  is loaded.
+
+	  Say N here unless you know what you are doing.
+
 config PHYSICAL_START
-	hex "Physical address where the kernel is loaded"
-	default "0xffffffff84000000"
-	depends on CRASH_DUMP
+	hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL
+	default "0xffffffff84000000" if CRASH_DUMP
+	default "0xffffffff80100000"
 	help
-	  This gives the CKSEG0 or KSEG0 address where the kernel is loaded.
+	  This gives the CKSEG0, KSEG0 or XKPHYS address where the kernel
+	  is loaded.
 	  If you plan to use kernel for capturing the crash dump change
 	  this value to start of the reserved region (the "X" value as
 	  specified in the "crashkernel=YM@XM" command line boot parameter
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase in XKPHYS
  2023-10-23 19:13 ` [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase " Jiaxun Yang
@ 2023-10-25  2:48   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-10-25  2:48 UTC (permalink / raw)
  To: Jiaxun Yang, linux-mips
  Cc: llvm, oe-kbuild-all, linux-kernel, tsbogend, gregory.clement,
	vladimir.kondratiev, Jiaxun Yang

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	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] MIPS: Fix kernel in XKPHYS
  2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
                   ` (4 preceding siblings ...)
  2023-10-23 19:14 ` [PATCH 5/5] MIPS: Allow kernel base to be set from Kconfig for all platforms Jiaxun Yang
@ 2023-10-25 18:09 ` Florian Fainelli
       [not found] ` <875y2s81lx.fsf@BL-laptop>
  6 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2023-10-25 18:09 UTC (permalink / raw)
  To: Jiaxun Yang, linux-mips
  Cc: linux-kernel, tsbogend, gregory.clement, vladimir.kondratiev

On 10/23/23 12:13, Jiaxun Yang wrote:
> Hi all,
> 
> This series fixes support for loading kernel to XKPHYS space.
> It is derived from "MIPS: use virtual addresses from xkphys for MIPS64" [1].
> 
> Boot tested on boston and QEMU with loading address set to 0xa800000090000000.
> QEMU patch on the way.
> 
> Gregory and Vladimir, do let me know if I missed anything.
> 
> Thanks
> - Jiaxun
> 
> [1]: https://lore.kernel.org/lkml/20231004161038.2818327-3-gregory.clement@bootlin.com/

FWIW, tested on a Cobalt Qube 2 (RM5231):

Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] MIPS: Fix kernel in XKPHYS
       [not found] ` <875y2s81lx.fsf@BL-laptop>
@ 2023-10-27 20:47   ` Jiaxun Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Jiaxun Yang @ 2023-10-27 20:47 UTC (permalink / raw)
  To: Gregory CLEMENT, linux-mips@vger.kernel.org
  Cc: linux-kernel, Thomas Bogendoerfer, vladimir.kondratiev



在2023年10月27日十月 下午5:35,Gregory CLEMENT写道:
> Hello Jiaxun,
>
>
>> Hi all,
>>
>> This series fixes support for loading kernel to XKPHYS space.
>> It is derived from "MIPS: use virtual addresses from xkphys for MIPS64" [1].
>>
>> Boot tested on boston and QEMU with loading address set to 0xa800000090000000.
>> QEMU patch on the way.
>>
>> Gregory and Vladimir, do let me know if I missed anything.
>
> Thanks for this series, I reviewed it and tested it on my platform, so
> you can add for all the patches:
>
> Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
>
> However I add to fix the patch " MIPS: Handle mips_cps_core_entry within
> lower 4G", I think you missed a case. I will comment on it.

I found a better solution for CPS handling, will send v2 later together with
fixes to bring TO_CAC to 32bit.

Thanks.
- Jiaxun

>
> Gregory
>
>
>>
>> Thanks
>> - Jiaxun
>>
>> [1]: https://lore.kernel.org/lkml/20231004161038.2818327-3-gregory.clement@bootlin.com/
>>
>> Jiaxun Yang (5):
>>   MIPS: Export higher/highest relocation functions in uasm
>>   MIPS: genex: Fix except_vec_vi for kernel in XKPHYS
>>   MIPS: Fix set_uncached_handler for ebase in XKPHYS
>>   MIPS: Handle mips_cps_core_entry within lower 4G
>>   MIPS: Allow kernel base to be set from Kconfig for all platforms
>>
>>  arch/mips/Kconfig               | 18 +++++++++++++----
>>  arch/mips/include/asm/mips-cm.h |  1 +
>>  arch/mips/include/asm/uasm.h    |  2 ++
>>  arch/mips/kernel/genex.S        | 19 +++++++++++++----
>>  arch/mips/kernel/smp-cps.c      | 27 +++++++++++++++++++------
>>  arch/mips/kernel/traps.c        | 36 +++++++++++++++++++++++----------
>>  arch/mips/mm/uasm.c             |  6 ++++--
>>  7 files changed, 82 insertions(+), 27 deletions(-)
>>
>> -- 
>> 2.34.1
>>
>
> -- 
> Gregory Clement, Bootlin
> Embedded Linux and Kernel engineering
> http://bootlin.com

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-27 20:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-23 19:13 [PATCH 0/5] MIPS: Fix kernel in XKPHYS Jiaxun Yang
2023-10-23 19:13 ` [PATCH 1/5] MIPS: Export higher/highest relocation functions in uasm Jiaxun Yang
2023-10-23 19:13 ` [PATCH 2/5] MIPS: genex: Fix except_vec_vi for kernel in XKPHYS Jiaxun Yang
2023-10-23 19:13 ` [PATCH 3/5] MIPS: Fix set_uncached_handler for ebase " Jiaxun Yang
2023-10-25  2:48   ` kernel test robot
2023-10-23 19:13 ` [PATCH 4/5] MIPS: Handle mips_cps_core_entry within lower 4G Jiaxun Yang
2023-10-23 19:14 ` [PATCH 5/5] MIPS: Allow kernel base to be set from Kconfig for all platforms Jiaxun Yang
2023-10-25 18:09 ` [PATCH 0/5] MIPS: Fix kernel in XKPHYS Florian Fainelli
     [not found] ` <875y2s81lx.fsf@BL-laptop>
2023-10-27 20:47   ` Jiaxun Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).