2
0

0510-MIPS-Fix-SMP-core-calculations-when-using-MT-support.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From c4d621e75e865fa5374946515ad0c5e060b9c446 Mon Sep 17 00:00:00 2001
  2. From: Leonid Yegoshin <[email protected]>
  3. Date: Wed, 11 Sep 2013 14:17:47 -0500
  4. Subject: [PATCH 056/105] MIPS: Fix SMP core calculations when using MT
  5. support.
  6. The TCBIND register is only available if the core has MT support. It
  7. should not be read otherwise. Secondly, the number of TCs (siblings)
  8. are calculated differently depending on if the kernel is configured
  9. as SMVP or SMTC.
  10. Signed-off-by: Leonid Yegoshin <[email protected]>
  11. Signed-off-by: Steven J. Hill <[email protected]>
  12. Cc: [email protected]
  13. Patchwork: https://patchwork.linux-mips.org/patch/5822/
  14. Signed-off-by: Ralf Baechle <[email protected]>
  15. (cherry picked from commit 670bac3a8c201fc1f5f92ac6b4a8b42dc8172937)
  16. ---
  17. arch/mips/kernel/smp-cmp.c | 13 +++++++++++--
  18. 1 file changed, 11 insertions(+), 2 deletions(-)
  19. --- a/arch/mips/kernel/smp-cmp.c
  20. +++ b/arch/mips/kernel/smp-cmp.c
  21. @@ -99,7 +99,9 @@ static void cmp_init_secondary(void)
  22. c->core = (read_c0_ebase() >> 1) & 0x1ff;
  23. #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
  24. - c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE;
  25. + if (cpu_has_mipsmt)
  26. + c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
  27. + TCBIND_CURVPE;
  28. #endif
  29. #ifdef CONFIG_MIPS_MT_SMTC
  30. c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT;
  31. @@ -177,9 +179,16 @@ void __init cmp_smp_setup(void)
  32. }
  33. if (cpu_has_mipsmt) {
  34. - unsigned int nvpe, mvpconf0 = read_c0_mvpconf0();
  35. + unsigned int nvpe = 1;
  36. +#ifdef CONFIG_MIPS_MT_SMP
  37. + unsigned int mvpconf0 = read_c0_mvpconf0();
  38. +
  39. + nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
  40. +#elif defined(CONFIG_MIPS_MT_SMTC)
  41. + unsigned int mvpconf0 = read_c0_mvpconf0();
  42. nvpe = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
  43. +#endif
  44. smp_num_siblings = nvpe;
  45. }
  46. pr_info("Detected %i available secondary CPU(s)\n", ncpu);