Re: [PATCH] MIPS: Fix strnlen_user access check

2021-04-12 Thread Jinyang He
On 04/12/2021 10:27 PM, Thomas Bogendoerfer wrote: On Mon, Apr 12, 2021 at 11:02:19AM +0800, Tiezhu Yang wrote: On 04/11/2021 07:04 PM, Jinyang He wrote: Commit 04324f44cb69 ("MIPS: Remove get_fs/set_fs") brought a problem for strnlen_user(). Jump out when checking access_ok() with

Re: [PATCH] MIPS: Fix strnlen_user access check

2021-04-12 Thread Jinyang He
On 04/11/2021 07:04 PM, Jinyang He wrote: Commit 04324f44cb69 ("MIPS: Remove get_fs/set_fs") brought a problem for strnlen_user(). Jump out when checking access_ok() with condition that (s + strlen(s)) < __UA_LIMIT <= (s + n). The old __strnlen_user_asm() just checked (ua_li

[PATCH v2 4/5] MIPS: cavium-octeon: Execute the smp handle after jumping to kernel linked address

2021-04-12 Thread Jinyang He
: Jinyang He --- arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h | 7 +++ arch/mips/kernel/head.S | 4 2 files changed, 11 insertions(+) diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach

[PATCH v2 2/5] MIPS: relocate: Use CONFIG_RANDOMIZE_BASE to enable kaslr

2021-04-12 Thread Jinyang He
() if CONFIG_RELOCATABLE. Rename relocate.c to kaslr.c and use CONFIG_RANDOMIZE_BASE to enable the kaslr function. Signed-off-by: Jinyang He --- arch/mips/cavium-octeon/smp.c | 8 arch/mips/generic/init.c | 4 ++-- arch/mips

[PATCH v2 5/5] MIPS: relocate: Add support to auto relocate kernel

2021-04-12 Thread Jinyang He
mp; 0x) << 16 + offset) >> 16 = (insn & 0x) + offset >> 16 7, Complete! And flush i-cache 8, Restore args All relocate process did 3 things in short, relocate ex_table, relocate insructions and flush i-cache. Signed-off-by: Jinyang He --- arch

[PATCH v2 1/5] MIPS: relocate: Only compile relocs when CONFIG_RELOCATABLE is enabled

2021-04-12 Thread Jinyang He
Relocs is used for create relocate information, only CONFIG_RELOCATABLE is enabled can it be used. Signed-off-by: Jinyang He --- arch/mips/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index e71d587..cb54d86 100644 --- a/arch/mips

[PATCH v2 3/5] MIPS: Jump to kernel linked address by PC relative way

2021-04-12 Thread Jinyang He
etermines the offset relative to the PC Region. Signed-off-by: Jinyang He --- arch/mips/kernel/head.S | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index a25af1d..0186285 100644 --- a/arch/mips/kernel/head

[PATCH v2 0/5] MIPS: relocate: Add automatic relocation to CONFIG_RELOCATABLE

2021-04-12 Thread Jinyang He
] Jinyang He (5): MIPS: relocate: Only compile relocs when CONFIG_RELOCATABLE is enabled MIPS: relocate: Use CONFIG_RANDOMIZE_BASE to enable kaslr MIPS: Jump to kernel linked address by PC relative way MIPS: cavium-octeon: Execute the smp handle after jumping to kernel linked address

Re: [PATCH] MIPS: Fix strnlen_user access check

2021-04-11 Thread Jinyang He
On 04/12/2021 11:02 AM, Tiezhu Yang wrote: On 04/11/2021 07:04 PM, Jinyang He wrote: Commit 04324f44cb69 ("MIPS: Remove get_fs/set_fs") brought a problem for strnlen_user(). Jump out when checking access_ok() with condition that (s + strlen(s)) < __UA_LIMIT <=

[PATCH] MIPS: Fix strnlen_user access check

2021-04-11 Thread Jinyang He
s + n)). Therefore, find strlen form s to __UA_LIMIT - 1 in that condition. Signed-off-by: Jinyang He --- arch/mips/include/asm/uaccess.h | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 91bc7

[PATCH RFC 0/3] Some update for relocate

2021-04-01 Thread Jinyang He
795d0a..36c5809 100644 --- a/arch/mips/boot/compressed/head.S +++ b/arch/mips/boot/compressed/head.S @@ -40,8 +40,7 @@ movea1, s1 movea2, s2 move a3, s3 - PTR_LI t9, KERNEL_ENTRY - jalrt9 + jalrv0 3: b 3b Jinyang He (3): MI

[PATCH RFC 1/3] MIPS: relocate: Only compile relocs when CONFIG_RELOCATABLE is enabled

2021-04-01 Thread Jinyang He
Relocs is used for create relocate information, only CONFIG_RELOCATABLE is enabled can it be used. Signed-off-by: Jinyang He --- arch/mips/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index e71d587..cb54d86 100644 --- a/arch/mips

[PATCH RFC 2/3] MIPS: relocate: Use CONFIG_RANDOMIZE_BASE to configure kaslr

2021-04-01 Thread Jinyang He
determine_relocation_address() on CONFIG_RELOCATABLE. Rename relocate.c to kaslr.c and use CONFIG_RANDOMIZE_BASE to configure the kaslr function. Signed-off-by: Jinyang He --- arch/mips/cavium-octeon/smp.c | 8 arch/mips/generic/init.c | 4

[PATCH RFC 3/3] MIPS: relocate: Add support to relocate kernel auto

2021-04-01 Thread Jinyang He
These asm code is based on relocate.c. And in this stage, only do relocate for _text and ex_table. Signed-off-by: Jinyang He --- arch/mips/kernel/head.S | 149 1 file changed, 149 insertions(+) diff --git a/arch/mips/kernel/head.S b/arch/mips

Re: [PATCH RFC] MIPS: livepatch: Add LIVEPATCH basic code

2021-03-10 Thread Jinyang He
On 03/10/2021 04:18 PM, Miroslav Benes wrote: Hi, I cannot really comment on mips arch specifics but few words from the live patching perspective. Thanks for your reply. :-) On Mon, 1 Mar 2021, Jinyang He wrote: Add the basic code of livepatch. livepatch is temporarily unavailable. Two

[PATCH RFC] MIPS: livepatch: Add LIVEPATCH basic code

2021-03-01 Thread Jinyang He
. save_stack_trace_tsk_reliable() currently has difficulties. This function may be improved in the future, but that seems to be a long time away. This is also the reason for delivering this RFC. Hope to get any help. Signed-off-by: Jinyang He --- arch/mips/Kconfig | 1 + arch/mips

Re: [PATCH RFC] MIPS: Remove detect_memory_region()

2021-02-25 Thread Jinyang He
On 02/26/2021 02:52 PM, Jiaxun Yang wrote: 在 2021/2/26 上午9:37, Jinyang He 写道: On 02/24/2021 11:40 PM, Jiaxun Yang wrote: On Wed, Feb 24, 2021, at 9:02 PM, Jinyang He wrote: detect_memory_region() was committed by Commit 4d9f77d25268 ("MIPS: add detect_memory_region()"). T

Re: [PATCH RFC] MIPS: Remove detect_memory_region()

2021-02-25 Thread Jinyang He
On 02/24/2021 11:40 PM, Jiaxun Yang wrote: On Wed, Feb 24, 2021, at 9:02 PM, Jinyang He wrote: detect_memory_region() was committed by Commit 4d9f77d25268 ("MIPS: add detect_memory_region()"). Then it was equipped by Commit dd63b00804a5 ("MIPS: ralink: make use of the new m

[PATCH RFC] MIPS: Remove detect_memory_region()

2021-02-24 Thread Jinyang He
used several years and seems no error occur. Maybe it's a fallback way. Signed-off-by: Jinyang He --- arch/mips/ath79/setup.c | 2 +- arch/mips/include/asm/bootinfo.h | 2 -- arch/mips/kernel/setup.c | 21 - arch/mips/ralink/of.c| 5 +

Re: [PATCH v2 2/4] MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op

2021-02-07 Thread Jinyang He
On 02/08/2021 05:31 AM, Maciej W. Rozycki wrote: On Thu, 21 Jan 2021, Jinyang He wrote: mm16_r5_format.rt is 5 bits, so directly judge the value if equal or not. mm_jalr_op requires 7th to 16th bits. These 10 which bits generated by The minor opcode extension field is comprised of bits 15

[PATCH] MIPS: process: Fix no previous prototype warning

2021-02-07 Thread Jinyang He
ned-off-by: Jinyang He --- arch/mips/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 0c5bc06..2e591df 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -26,6 +26,7 @@ #include #include

Re: [PATCH] mips: kernel: setup: fix crash kernel resource allocation

2021-02-06 Thread Jinyang He
On 02/06/2021 08:59 PM, Ivan Khoronzhuk wrote: In order to avoid crash kernel corruption, its memory is reserved early in memblock and as result, in time when resources are inited it's not present in memblock.memory, so crash kernel memory is out of ranges listed with for_each_mem_range(). To av

[PATCH v3 1/2] MIPS: relocatable: Provide kaslr_offset() to get the kernel offset

2021-02-05 Thread Jinyang He
Provide kaslr_offset() to get the kernel offset when KASLR is enabled. Error may occur before update_kaslr_offset(), so put it at the end of the offset branch. Fixes: a307a4ce9ecd ("MIPS: Loongson64: Add KASLR support") Reported-by: kernel test robot Signed-off-by: Jinyang He ---

[PATCH v3 2/2] MIPS: relocatable: Use __kaslr_offset in show_kernel_relocation

2021-02-05 Thread Jinyang He
The type of the VMLINUX_LOAD_ADDRESS macro is the (unsigned long long) in 32bits kernel but (unsigned long) in the 64-bit kernel. Although there is no error here, avoid using it to calculate kaslr_offset. Signed-off-by: Jinyang He --- arch/mips/kernel/relocate.c | 8 ++-- 1 file changed, 2

Re: [PATCH v2 2/2] MIPS: relocatable: Use __kaslr_offset in show_kernel_relocation

2021-02-04 Thread Jinyang He
On 02/04/2021 11:36 PM, Thomas Bogendoerfer wrote: On Wed, Feb 03, 2021 at 06:35:10PM +0800, Jinyang He wrote: The type of the VMLINUX_LOAD_ADDRESS macro is the (unsigned long long) in 32bits kernel but (unsigned long) in the 64-bit kernel. Although there is no error here, avoid using it to

Re: [PATCH] MIPS: Use common way to parse elfcorehdr

2021-02-03 Thread Jinyang He
On 02/04/2021 11:28 AM, Randy Dunlap wrote: On 2/3/21 7:07 PM, Jinyang He wrote: "elfcorehdr" can be parsed at kernel/crash_dump.c Signed-off-by: Jinyang He Hm, looks like that would require CONFIG_CRASH_DUMP? Hi, I don't think so. We expect to generate a /proc/vmcore w

[PATCH] ftrace: Remove unused ftrace_force_update()

2021-02-03 Thread Jinyang He
ftrace_force_update() is committed by Commit e1c08bdd9fa7 ("ftrace: force recording") and removed by Commit cb7be3b2fc2c ("ftrace: remove daemon"). Remove it in header file. Signed-off-by: Jinyang He --- include/linux/ftrace.h | 2 -- 1 file changed, 2 deletions(-) diff -

[PATCH] MIPS: Use common way to parse elfcorehdr

2021-02-03 Thread Jinyang He
"elfcorehdr" can be parsed at kernel/crash_dump.c Signed-off-by: Jinyang He --- arch/mips/kernel/setup.c | 49 +--- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c ind

[PATCH v2 2/2] MIPS: relocatable: Use __kaslr_offset in show_kernel_relocation

2021-02-03 Thread Jinyang He
. Signed-off-by: Jinyang He --- arch/mips/kernel/relocate.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index 95abb9c..52018a3 100644 --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/kernel/relocate.c @@ -430,13

[PATCH v2 1/2] MIPS: relocatable: Provide kaslr_offset() to get the kernel offset

2021-02-03 Thread Jinyang He
Provide kaslr_offset() to get the kernel offset when KASLR is enabled. Error may occur before update_kaslr_offset(), so put it at the end of the offset branch. Fixes: a307a4ce9ecd ("MIPS: Loongson64: Add KASLR support") Reported-by: kernel test robot Signed-off-by: Jinyang He ---

Re: [PATCH 3/3] MIPS: ftrace: Add DYNAMIC_FTRACE_WITH_REGS support

2021-02-02 Thread Jinyang He
On 02/01/2021 10:56 PM, Steven Rostedt wrote: On Sun, 31 Jan 2021 16:14:38 +0800 Jinyang He wrote: In the past, we have always used the address of _mcount as the address of ftrace_caller. It reduces one ftrace_modify_code operation when do ftrace on modules on 64Bit platform in this way. In

Re: [PATCH] MIPS: relocatable: Provide kaslr_offset() to get the kernel offset

2021-02-01 Thread Jinyang He
On 02/01/2021 08:50 PM, Thomas Bogendoerfer wrote: On Wed, Jan 27, 2021 at 12:12:25PM +0800, Jinyang He wrote: Use kimage_vaddr to indicate kernel start address. Provide kaslr_offset() to get the kernel offset when KASLR is enabled. Error may occur before update_kimage_vaddr(), so put it at

Re: [PATCH 1/3] MIPS: ftrace: Fix N32 save registers

2021-01-31 Thread Jinyang He
On 01/31/2021 06:38 PM, Jiaxun Yang wrote: On Sun, Jan 31, 2021, at 4:14 PM, Jinyang He wrote: CONFIG_64BIT is confusing. N32 also pass parameters by a0~a7. Do we have NEW kernel build? CONFIG_64BIT assumed N64 as kernel ABI. -Jiaxun Hi, Jiaxun, Thank you for your reply, and now I know

[PATCH 2/3] MIPS: ftrace: Combine ftrace_modify_code* into one function

2021-01-31 Thread Jinyang He
. Signed-off-by: Jinyang He --- arch/mips/include/asm/ftrace.h | 3 + arch/mips/kernel/ftrace.c | 157 + 2 files changed, 68 insertions(+), 92 deletions(-) diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h index b463f2a

[PATCH 3/3] MIPS: ftrace: Add DYNAMIC_FTRACE_WITH_REGS support

2021-01-31 Thread Jinyang He
ftrace_regs_caller. Signed-off-by: Jinyang He --- arch/mips/Kconfig | 1 + arch/mips/include/asm/ftrace.h | 5 ++ arch/mips/kernel/ftrace.c | 159 - arch/mips/kernel/mcount.S | 137 +-- 4 files

[PATCH 1/3] MIPS: ftrace: Fix N32 save registers

2021-01-31 Thread Jinyang He
CONFIG_64BIT is confusing. N32 also pass parameters by a0~a7. Signed-off-by: Jinyang He --- arch/mips/kernel/mcount.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index cff52b2..808257a 100644 --- a/arch/mips

[PATCH] MIPS: relocatable: Provide kaslr_offset() to get the kernel offset

2021-01-26 Thread Jinyang He
ernel test robot Signed-off-by: Jinyang He --- arch/mips/include/asm/page.h | 6 ++ arch/mips/kernel/relocate.c | 12 arch/mips/kernel/setup.c | 3 +++ 3 files changed, 21 insertions(+) diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 6a77bc

[PATCH v2 1/4] MIPS: process: Remove unnecessary headers inclusion

2021-01-20 Thread Jinyang He
Some headers are not necessary, remove them and sort includes. Signed-off-by: Jinyang He --- v2: - Remove useless header inclusion. arch/mips/kernel/process.c | 39 ++- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/arch/mips/kernel

[PATCH v2 0/4] MIPS: process: Some fixes and improvements about get_frame_info()

2021-01-20 Thread Jinyang He
are the same. See [PATCH 4/4] for details. Jinyang He (4): MIPS: process: Remove unnecessary headers inclusion MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op MIPS: Fix get_frame_info() handing of function size MIPS: Add is_jr_ra_ins() to end the loop early arch/mips

[PATCH v2 3/4] MIPS: Fix get_frame_info() handing of function size

2021-01-20 Thread Jinyang He
be the sum of ip and a constant (512) if func_size is equal to 0. Otherwise make ip_end be the sum of ip and func_size. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/

[PATCH v2 4/4] MIPS: Add is_jr_ra_ins() to end the loop early

2021-01-20 Thread Jinyang He
-by: Jinyang He --- v2: - microMIPS: ip->r_format.rs -> ip->r_format.rt arch/mips/kernel/process.c | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index adf29f7..592f02e 100644 -

[PATCH v2 2/4] MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op

2021-01-20 Thread Jinyang He
, such as these bits are all ones. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index d737234..74d7fd8 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips

Re: [PATCH 0/4] MIPS: process: Some fixes and improvements about get_frame_info()

2021-01-18 Thread Jinyang He
On 01/18/2021 09:51 AM, Jiaxun Yang wrote: 在 2021/1/12 下午8:29, Jinyang He 写道: Not familiar with microMIPS. Not test on microMIPS. Hi Jinyang, I was messing around QEMU microMIPS and found kernel stuck at loading init process after applied your patches :-( Thanks. - Jiaxun Hi, Jiaxun

Re: [PATCH 1/4] MIPS: process: Reorder header files

2021-01-18 Thread Jinyang He
On 01/15/2021 10:46 PM, Thomas Bogendoerfer wrote: On Tue, Jan 12, 2021 at 08:29:14PM +0800, Jinyang He wrote: Just reorder the header files. This alone isn't worth a commit, IMHO. I bet there are lots of includes no longer needed, so removing and sorting them is ok for me. Thomas.

Re: [PATCH 1/4] MIPS: process: Reorder header files

2021-01-18 Thread Jinyang He
Ping? On 01/18/2021 06:02 PM, Jinyang He wrote: On 01/15/2021 10:46 PM, Thomas Bogendoerfer wrote: On Tue, Jan 12, 2021 at 08:29:14PM +0800, Jinyang He wrote: Just reorder the header files. This alone isn't worth a commit, IMHO. I bet there are lots of includes no longer needed, so rem

[PATCH 4/4] MIPS: Add is_jr_ra_ins() to end the loop early

2021-01-12 Thread Jinyang He
-off-by: Jinyang He --- arch/mips/kernel/process.c | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index bef8f8d..9e6f194 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel

[PATCH 0/4] MIPS: process: Some fixes and improvements about get_frame_info()

2021-01-12 Thread Jinyang He
Not familiar with microMIPS. Not test on microMIPS. Jinyang He (4): MIPS: process: Reorder header files MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op MIPS: Fix get_frame_info() handing of function size MIPS: Add is_jr_ra_ins() to end the loop early arch/mips/kernel

[PATCH 1/4] MIPS: process: Reorder header files

2021-01-12 Thread Jinyang He
Just reorder the header files. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index d7e288f..361bd28 100644 --- a

[PATCH 2/4] MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_op

2021-01-12 Thread Jinyang He
, such as these bits are all ones. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 361bd28..94dfdf4 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips

[PATCH 3/4] MIPS: Fix get_frame_info() handing of function size

2021-01-12 Thread Jinyang He
be the sum of ip and a constant (512) if func_size is equal to 0. Otherwise make ip_end be the sum of ip and func_size. Signed-off-by: Jinyang He --- arch/mips/kernel/process.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/

[PATCH] MIPS: zboot: Avoid endless loop in clear BSS.

2021-01-05 Thread Jinyang He
Commit 2ee1503e546f ("MIPS: zboot: head.S clean up"). After .noreorder removed, clear BSS fall into endless loop. The bne instruction will add nop to the delay slot at compile time. So a0 register will not increment by 4. Fix it and clear BSS from _edata to (_end - 1). Signed-off-by:

[PATCH v2] MIPS: KASLR: Avoid endless loop in sync_icache when synci_step is zero

2020-12-03 Thread Jinyang He
implementations on synci, so add judgment conditions in `while` to ensure that at least all platforms perform synci operations once. For those platforms that do not need synci, they just do one more operation similar to nop. Signed-off-by: Jinyang He --- arch/mips/kernel/relocate.c | 2 +- 1 file changed, 1

Re: [PATCH 2/2] MIPS: Add fix_range_node after parse "mem=" parameter

2020-12-03 Thread Jinyang He
On 12/03/2020 05:27 PM, Jiaxun Yang wrote: 于 2020年12月3日 GMT+08:00 下午4:57:47, Jinyang He 写到: This problem may only occur on NUMA platforms. When machine start with the "mem=" parameter on Loongson64, it cannot boot. When parsing the "mem=" parameter, first all the RAM w

[PATCH 1/2] MIPS: Remove unused memblock_set_node

2020-12-03 Thread Jinyang He
Seting node for platforms which not need multiple nodes make no sence after we abandoning DISCONTIGMEM. Signed-off-by: Jinyang He --- arch/mips/kernel/setup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ca579de..b3a711e 100644

[PATCH 2/2] MIPS: Add fix_range_node after parse "mem=" parameter

2020-12-03 Thread Jinyang He
the kernel. If this fix is added after that, it will do a redundant memblock_add operation. Adding the fixup_region_node() function can also provide a reference for future platforms using NUMA when encountering such problems. Signed-off-by: Jinyang He --- arch/mips/include/asm/bootinfo.h | 1

[PATCH 0/2] memory node

2020-12-03 Thread Jinyang He
*** BLURB HERE *** Jinyang He (2): MIPS: Remove unused memblock_set_node MIPS: Add fix_range_node after parse "mem=" parameter arch/mips/include/asm/bootinfo.h | 1 + arch/mips/kernel/setup.c | 9 + arch/mips/loongson64/numa.c | 11 +++ 3 files c

Re: [PATCH] MIPS: KASLR: Fix sync_icache() trapped in loop when synci_step is zero

2020-12-02 Thread Jinyang He
Hi, Thomas, On 12/02/2020 06:39 PM, Thomas Bogendoerfer wrote: On Wed, Dec 02, 2020 at 11:00:05AM +0800, Jinyang He wrote: Reading synci_step by using rdhwr instruction may return zero if no cache need be synchronized. On the one hand, to make sure all load operation and store operation

[PATCH] MIPS: KASLR: Fix sync_icache() trapped in loop when synci_step is zero

2020-12-01 Thread Jinyang He
. Signed-off-by: Jinyang He --- arch/mips/kernel/relocate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index 57bdd276..47aeb33 100644 --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/kernel/relocate.c @@ -64,7 +64,7

[PATCH] MIPS: Loongson64: Fix up reserving kernel memory range

2020-11-25 Thread Jinyang He
Reserve memory from &_text to &_end. Otherwise if kernel address was modified, the memory range of start_pfn to kernel_start_pfn would be reserved. Then we could not use this range. Signed-off-by: Jinyang He --- arch/mips/loongson64/numa.c | 7 +-- 1 file changed, 5 insertio

[PATCH v2 1/2] MIPS: KASLR: Correcte valid bits in apply_r_mips_26_rel()

2020-11-25 Thread Jinyang He
off-by: Jinyang He --- v2: Replace ~0x0fff with 0xf000 arch/mips/kernel/relocate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index 3d80a51..8561c7a 100644 --- a/arch/mips/kernel/relocate.c +++ b/arc

[PATCH v2 2/2] MIPS: Loongson64: Add KASLR support

2020-11-25 Thread Jinyang He
, data and bss sections become randomize. Signed-off-by: Jinyang He --- v2: - Define weak plat_get_fdt() in relocate.c - Add default RELOCATION_TABLE_SIZE for Loongson64 arch/mips/Kconfig | 5 - arch/mips/kernel/relocate.c | 7 +++ 2 files changed, 11 insertions(+), 1 deletion

[PATCH v2 0/2] IPS: Fix up apply_r_mips_26_rel and add KASLR support for Loongson64

2020-11-25 Thread Jinyang He
Abandon the third patch in v1. There are many other factors that should be considered. If possible, I'll fix it later. Jinyang He (2): MIPS: KASLR: Correcte valid bits in apply_r_mips_26_rel() MIPS: Loongson64: Add KASLR support arch/mips/Kconfig | 5 - arch/mips/k

Re: [PATCH 1/3] MIPS: KASLR: Correcte valid bits in apply_r_mips_26_rel

2020-11-19 Thread Jinyang He
Hi, On 11/19/2020 08:36 PM, Thomas Bogendoerfer wrote: On Thu, Nov 19, 2020 at 10:29:12AM +0800, Jinyang He wrote: Apply_r_mips_26_rel() relocates instructions like j, jal and etc. These instructions consist of 6bits function field and 26bits address field. The value of target_addr as follows

Re: [PATCH 3/3] MIPS: KASLR: Make relocation_address can be configured

2020-11-19 Thread Jinyang He
Hi, On 11/19/2020 08:45 PM, Thomas Bogendoerfer wrote: On Thu, Nov 19, 2020 at 10:29:14AM +0800, Jinyang He wrote: When CONFIG_RANDOMIZE_BASE is not set, determine_relocation_address() always returns a constant. It is not friendly to users if the address cannot be used. Make it can be

Re: [PATCH 3/3] MIPS: KASLR: Make relocation_address can be configured

2020-11-19 Thread Jinyang He
Hi, On 11/19/2020 04:06 PM, Sergei Shtylyov wrote: Hello! On 19.11.2020 5:29, Jinyang He wrote: When CONFIG_RANDOMIZE_BASE is not set, determine_relocation_address() always returns a constant. It is not friendly to users if the address cannot be used. Make it can be configured at Kconfig

[PATCH 3/3] MIPS: KASLR: Make relocation_address can be configured

2020-11-18 Thread Jinyang He
When CONFIG_RANDOMIZE_BASE is not set, determine_relocation_address() always returns a constant. It is not friendly to users if the address cannot be used. Make it can be configured at Kconfig. Signed-off-by: Jinyang He --- arch/mips/Kconfig | 5 + arch/mips/kernel/relocate.c | 2

[PATCH 1/3] MIPS: KASLR: Correcte valid bits in apply_r_mips_26_rel

2020-11-18 Thread Jinyang He
eplace 0x3ff with 0xfff. Signed-off-by: Jinyang He --- arch/mips/kernel/relocate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c index 3d80a51..709cfa0 100644 --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/

[PATCH 2/3] MIPS: Loongson64: Add KASLR support

2020-11-18 Thread Jinyang He
Provide null return plat_get_fdt(). Loongson64 start supporting KASLR. Signed-off-by: Jinyang He --- arch/mips/Kconfig| 4 +++- arch/mips/loongson64/setup.c | 7 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index

Re: [PATCH] MIPS: reserve the memblock right after the kernel

2020-11-12 Thread Jinyang He
Hi, Jiaxun, On 11/13/2020 10:30 AM, Jiaxun Yang wrote: Hi all, 在 2020/11/11 22:52, Serge Semin 写道: Hello Alexander On Tue, Nov 10, 2020 at 11:29:50AM +0100, Alexander Sverdlin wrote: 2) The check_kernel_sections_mem() method can be removed. But it should be done carefully. We at least need to

Re: [PATCH v3 5/6] MIPS: Loongson64: SMP: Fix up play_dead jump indicator

2020-11-03 Thread Jinyang He
On 11/04/2020 03:04 PM, Jiaxun Yang wrote: 在 2020/11/4 14:31, Jinyang He 写道: Hi, all, On 11/03/2020 03:12 PM, Tiezhu Yang wrote: In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we

Re: [PATCH v3 5/6] MIPS: Loongson64: SMP: Fix up play_dead jump indicator

2020-11-03 Thread Jinyang He
Hi, all, On 11/03/2020 03:12 PM, Tiezhu Yang wrote: In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we introduced CSR mailsend, the hardware will not guarante an atomic write for the 64-

[PATCH] MIPS: Add set_memory_node()

2020-10-12 Thread Jinyang He
] [0x0020-0x0ddf], 0x0dc0 bytes on node 0 flags: 0x0 ... and started well. Signed-off-by: Jinyang He --- arch/mips/include/asm/bootinfo.h | 4 arch/mips/kernel/setup.c | 12 arch/mips/loongson64/numa.c | 8 arch/mi

[PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro

2020-10-11 Thread Jinyang He
Fixes: e1cc9d8d596e ("sh: switch to copy_thread_tls()") Signed-off-by: Jinyang He --- arch/sh/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index d209271..165f291 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -30,7 +30,6 @@ con

[PATCH] MIPS: Loongson64: Fix cmdline parsing "mem=" and "memmap="

2020-09-21 Thread Jinyang He
64 always enable NUMA and need memblock_add_node(). Replace add_memory_rigion(start, size, BOOT_MEM_RAM) with a weak function which named mips_memblock_add. For Loongson64, override mips_memblock_add at loongson64/numa.c. "memmap=" is similar to "mem=", replace it too. Signed-off-by: Jin

Re: [PATCH] MIPS: Loongson64: Add kexec/kdump support

2020-09-17 Thread Jinyang He
On 09/17/2020 10:21 PM, Jiaxun Yang wrote: 在 2020/9/17 20:41, Jinyang He 写道: Hi, Huacai, On 09/16/2020 01:39 PM, Huacai Chen wrote: Hi, Jinyang, On Tue, Sep 15, 2020 at 10:17 PM Jinyang He wrote: On 09/16/2020 09:33 AM, Jiaxun Yang wrote: 于 2020年9月15日 GMT+08:00 下午9:07:43, Jinyang He

Re: [PATCH] MIPS: Loongson64: Add kexec/kdump support

2020-09-17 Thread Jinyang He
On 09/17/2020 09:52 PM, Zhou Yanjie wrote: Hello, 在 2020/9/17 下午8:41, Jinyang He 写道: Hi, Huacai, On 09/16/2020 01:39 PM, Huacai Chen wrote: Hi, Jinyang, On Tue, Sep 15, 2020 at 10:17 PM Jinyang He wrote: On 09/16/2020 09:33 AM, Jiaxun Yang wrote: 于 2020年9月15日 GMT+08:00 下午9:07:43

Re: [PATCH] MIPS: Loongson64: Add kexec/kdump support

2020-09-17 Thread Jinyang He
Hi, Huacai, On 09/16/2020 01:39 PM, Huacai Chen wrote: Hi, Jinyang, On Tue, Sep 15, 2020 at 10:17 PM Jinyang He wrote: On 09/16/2020 09:33 AM, Jiaxun Yang wrote: 于 2020年9月15日 GMT+08:00 下午9:07:43, Jinyang He 写到: Add loongson_kexec_prepare(), loongson_kexec_shutdown() and

Re: [PATCH] MIPS: Loongson64: Add kexec/kdump support

2020-09-15 Thread Jinyang He
On 09/16/2020 09:33 AM, Jiaxun Yang wrote: 于 2020年9月15日 GMT+08:00 下午9:07:43, Jinyang He 写到: Add loongson_kexec_prepare(), loongson_kexec_shutdown() and loongson_kexec_crashdown() for passing the parameters of kexec_args. To start loongson64, CPU0 needs 3 parameters: fw_arg0: the number of

[PATCH] MIPS: Loongson64: Add kexec/kdump support

2020-09-15 Thread Jinyang He
ondary CPUs in a querying loop. This patch referenced [1][2][3]. [1] arch/mips/cavium-octeon/setup.c [2] https://patchwork.kernel.org/patch/10799217/ [3] https://gitee.com/loongsonlab/qemu/blob/master/hw/mips/loongson3a_rom.h Co-developed-by: Youling Tang Signed-off-by: Youling Tang Signed-of

[PATCH] MIPS: Loongson64: Simplify ipi_regs_init

2020-09-04 Thread Jinyang He
Delete unused macro. Combine ipi_*_regs_init and mailbox_buf_init as ipi_init to avoid redundant codes. Signed-off-by: Jinyang He --- arch/mips/loongson64/smp.c | 227 +++-- arch/mips/loongson64/smp.h | 31 --- 2 files changed, 36 insertions(+), 222

[PATCH] MIPS: Loongson64: Remove unused loongson_reboot.

2020-09-04 Thread Jinyang He
Commit 1bdb7b76705a ("MIPS: Loongson64: Cleanup unused code") left the loongson_reboot unused, delete it. Signed-off-by: Jinyang He --- arch/mips/loongson64/reset.c | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/mips/loongson64/reset.c b/arch/mips/loongson64/reset.c ind

[PATCH] MIPS: Make NUMA select SMP

2020-09-04 Thread Jinyang He
While it does make sense to allow CONFIG_NUMA and !CONFIG_SMP in theory, it doesn't make much sense in practice. Follow other architectures and make CONFIG_NUMA select CONFIG_SMP. Signed-off-by: Jinyang He --- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch

[PATCH] MIPS: Loongson: Fix complie errors without CONFIG_SMP

2020-08-26 Thread Jinyang He
1 On-line CPU(s) list: 0 Thread(s) per core:1 Core(s) per socket:1 Socket(s): 1 NUMA node(s): 1 L1d cache: 64K L1i cache: 64K L2 cache: 2048K NUMA node0 CPU(s): 0 Signed-off-by: Jinyang He --- arch/mips/Kconfig

[PATCH] MIPS: Fix unable to allocate memory for crashkernel

2020-07-22 Thread Jinyang He
om_up │ └── round_down └── __memblock_find_range_top_down └── round_down However, the round_down's second parameter must be a power of 2. The author mean not align. So change it from 0 to 1. Signed-off-by: Jinyang He --- arch/mips/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+),