History

MIPS: CM: Fix mips_cm_max_vp_width for non-MT kernels on MT systems

When discovering the number of VPEs per core, smp_num_siblings will be incorrect for kernels built without support for the MIPS MultiThreading (MT) ASE running on systems which implement said ASE. This leads to accesses to VPEs in secondary cores being performed incorrectly since mips_cm_vp_id calculates the wrong ID to write to the local "other" registers. Fix this by examining the number of VPEs in the core as reported by the CM. This patch presumes that the number of VPEs will be the same in each core of the system. As this path only applies to systems with CM version 2.5 or lower, and this property is true of all such known systems, this is likely to be fine but is described in a comment for good measure.

Paul Burton committed 10 years ago

Commit 6605d151 parent 058effe1 file · +11 −0Browse files

Unified · Split

arch/mips/include/asm/mips-cm.h+11−0
@@ -458,10 +458,21 @@ static inline int mips_cm_revision(void) · 457 unmodified lines
458static inline unsigned int mips_cm_max_vp_width(void)458static inline unsigned int mips_cm_max_vp_width(void)
459{459{
460 extern int smp_num_siblings;460 extern int smp_num_siblings;
461 uint32_t cfg;
461 462
462 if (mips_cm_revision() >= CM_REV_CM3)463 if (mips_cm_revision() >= CM_REV_CM3)
463 return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK;464 return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK;
464 465
466 if (mips_cm_present()) {
467 /*
468 * We presume that all cores in the system will have the same
469 * number of VP(E)s, and if that ever changes then this will
470 * need revisiting.
471 */
472 cfg = read_gcr_cl_config() & CM_GCR_Cx_CONFIG_PVPE_MSK;
473 return (cfg >> CM_GCR_Cx_CONFIG_PVPE_SHF) + 1;
474 }
475
465 if (IS_ENABLED(CONFIG_SMP))476 if (IS_ENABLED(CONFIG_SMP))
466 return smp_num_siblings;477 return smp_num_siblings;
467 478

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t