All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Support MT SMP on generic MIPS kernel
@ 2021-12-18 10:05 Sander Vanheule
  2021-12-18 10:05 ` [PATCH v2 1/2] MIPS: only register MT SMP ops if MT is supported Sander Vanheule
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sander Vanheule @ 2021-12-18 10:05 UTC (permalink / raw)
  To: linux-mips
  Cc: INAGAKI Hiroshi, Jiaxun Yang, Paul Burton, Thomas Bogendoerfer,
	linux-kernel, Sander Vanheule

These patches should allow a generic kernel to enable MT SMP, if
supported by the current CPU.

Changes since v1:
Link: https://lore.kernel.org/all/20211217183930.16192-1-sander@svanheule.net/
- Add patch suggested by Jiaxun

Sander Vanheule (2):
  MIPS: only register MT SMP ops if MT is supported
  MIPS: generic: enable SMP on SMVP systems

 arch/mips/generic/init.c        | 11 ++++++-----
 arch/mips/include/asm/smp-ops.h |  3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.33.1


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

* [PATCH v2 1/2] MIPS: only register MT SMP ops if MT is supported
  2021-12-18 10:05 [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Sander Vanheule
@ 2021-12-18 10:05 ` Sander Vanheule
  2021-12-18 10:05 ` [PATCH v2 2/2] MIPS: generic: enable SMP on SMVP systems Sander Vanheule
  2021-12-21 13:56 ` [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Sander Vanheule @ 2021-12-18 10:05 UTC (permalink / raw)
  To: linux-mips
  Cc: INAGAKI Hiroshi, Jiaxun Yang, Paul Burton, Thomas Bogendoerfer,
	linux-kernel, Sander Vanheule

Verify that the current CPU actually supports multi-threading before
registering MT SMP ops, instead of unconditionally registering them if
the kernel is compiled with CONFIG_MIPS_MT_SMP.

Suggested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
 arch/mips/include/asm/smp-ops.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
index 65618ff1280c..864aea803984 100644
--- a/arch/mips/include/asm/smp-ops.h
+++ b/arch/mips/include/asm/smp-ops.h
@@ -101,6 +101,9 @@ static inline int register_vsmp_smp_ops(void)
 #ifdef CONFIG_MIPS_MT_SMP
 	extern const struct plat_smp_ops vsmp_smp_ops;
 
+	if (!cpu_has_mipsmt)
+		return -ENODEV;
+
 	register_smp_ops(&vsmp_smp_ops);
 
 	return 0;
-- 
2.33.1


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

* [PATCH v2 2/2] MIPS: generic: enable SMP on SMVP systems
  2021-12-18 10:05 [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Sander Vanheule
  2021-12-18 10:05 ` [PATCH v2 1/2] MIPS: only register MT SMP ops if MT is supported Sander Vanheule
@ 2021-12-18 10:05 ` Sander Vanheule
  2021-12-21 13:56 ` [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Sander Vanheule @ 2021-12-18 10:05 UTC (permalink / raw)
  To: linux-mips
  Cc: INAGAKI Hiroshi, Jiaxun Yang, Paul Burton, Thomas Bogendoerfer,
	linux-kernel, Sander Vanheule

In addition to CPS SMP setups, also try to initialise MT SMP setups with
multiple VPEs per CPU core. CMP SMP support is not provided as it is
considered deprecated.

Additionally, rework the code by dropping the err variable and make it
similar to how other platforms perform this initialisation.

Co-developed-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
 arch/mips/generic/init.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 1842cddd8356..1d712eac1617 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -110,14 +110,15 @@ void __init plat_mem_setup(void)
 
 void __init device_tree_init(void)
 {
-	int err;
-
 	unflatten_and_copy_device_tree();
 	mips_cpc_probe();
 
-	err = register_cps_smp_ops();
-	if (err)
-		err = register_up_smp_ops();
+	if (!register_cps_smp_ops())
+		return;
+	if (!register_vsmp_smp_ops())
+		return;
+
+	register_up_smp_ops();
 }
 
 int __init apply_mips_fdt_fixups(void *fdt_out, size_t fdt_out_size,
-- 
2.33.1


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

* Re: [PATCH v2 0/2] Support MT SMP on generic MIPS kernel
  2021-12-18 10:05 [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Sander Vanheule
  2021-12-18 10:05 ` [PATCH v2 1/2] MIPS: only register MT SMP ops if MT is supported Sander Vanheule
  2021-12-18 10:05 ` [PATCH v2 2/2] MIPS: generic: enable SMP on SMVP systems Sander Vanheule
@ 2021-12-21 13:56 ` Thomas Bogendoerfer
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-12-21 13:56 UTC (permalink / raw)
  To: Sander Vanheule
  Cc: linux-mips, INAGAKI Hiroshi, Jiaxun Yang, Paul Burton, linux-kernel

On Sat, Dec 18, 2021 at 11:05:09AM +0100, Sander Vanheule wrote:
> These patches should allow a generic kernel to enable MT SMP, if
> supported by the current CPU.
> 
> Changes since v1:
> Link: https://lore.kernel.org/all/20211217183930.16192-1-sander@svanheule.net/
> - Add patch suggested by Jiaxun
> 
> Sander Vanheule (2):
>   MIPS: only register MT SMP ops if MT is supported
>   MIPS: generic: enable SMP on SMVP systems
> 
>  arch/mips/generic/init.c        | 11 ++++++-----
>  arch/mips/include/asm/smp-ops.h |  3 +++
>  2 files changed, 9 insertions(+), 5 deletions(-)

series applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2021-12-21 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 10:05 [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Sander Vanheule
2021-12-18 10:05 ` [PATCH v2 1/2] MIPS: only register MT SMP ops if MT is supported Sander Vanheule
2021-12-18 10:05 ` [PATCH v2 2/2] MIPS: generic: enable SMP on SMVP systems Sander Vanheule
2021-12-21 13:56 ` [PATCH v2 0/2] Support MT SMP on generic MIPS kernel Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.