/** * mips_cps_numclusters - return the number of clusters present in the system * * Returns the number of clusters in the system.
*/ staticinlineunsignedint mips_cps_numclusters(void)
{ if (mips_cm_revision() < CM_REV_CM3_5) return 1;
/** * mips_cps_cluster_config - return (GCR|CPC)_CONFIG from a cluster * @cluster: the ID of the cluster whose config we want * * Read the value of GCR_CONFIG (or its CPC_CONFIG mirror) from a @cluster. * * Returns the value of GCR_CONFIG.
*/ staticinline uint64_t mips_cps_cluster_config(unsignedint cluster)
{
uint64_t config;
if (mips_cm_revision() < CM_REV_CM3_5) { /* * Prior to CM 3.5 we don't have the notion of multiple * clusters so we can trivially read the GCR_CONFIG register * within this cluster.
*/
WARN_ON(cluster != 0);
config = read_gcr_config();
} else { /* * From CM 3.5 onwards we read the CPC_CONFIG mirror of * GCR_CONFIG via the redirect region, since the CPC is always * powered up allowing us not to need to power up the CM.
*/
mips_cm_lock_other(cluster, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);
config = read_cpc_redir_config();
mips_cm_unlock_other();
}
return config;
}
/** * mips_cps_numcores - return the number of cores present in a cluster * @cluster: the ID of the cluster whose core count we want * * Returns the value of the PCORES field of the GCR_CONFIG register plus 1, or * zero if no Coherence Manager is present.
*/ staticinlineunsignedint mips_cps_numcores(unsignedint cluster)
{ if (!mips_cm_present()) return 0;
/* Add one before masking to handle 0xff indicating no cores */ return FIELD_GET(CM_GCR_CONFIG_PCORES,
mips_cps_cluster_config(cluster) + 1);
}
/** * mips_cps_numiocu - return the number of IOCUs present in a cluster * @cluster: the ID of the cluster whose IOCU count we want * * Returns the value of the NUMIOCU field of the GCR_CONFIG register, or zero * if no Coherence Manager is present.
*/ staticinlineunsignedint mips_cps_numiocu(unsignedint cluster)
{ if (!mips_cm_present()) return 0;
/** * mips_cps_numvps - return the number of VPs (threads) supported by a core * @cluster: the ID of the cluster containing the core we want to examine * @core: the ID of the core whose VP count we want * * Returns the number of Virtual Processors (VPs, ie. hardware threads) that * are supported by the given @core in the given @cluster. If the core or the * kernel do not support hardware mutlti-threading this returns 1.
*/ staticinlineunsignedint mips_cps_numvps(unsignedint cluster, unsignedint core)
{ unsignedint cfg;
if (!mips_cm_present()) return 1;
if ((!IS_ENABLED(CONFIG_MIPS_MT_SMP) || !cpu_has_mipsmt)
&& (!IS_ENABLED(CONFIG_CPU_MIPSR6) || !cpu_has_vp)) return 1;
if (mips_cm_revision() < CM_REV_CM3_5) { /* * Prior to CM 3.5 we can only have one cluster & don't have * CPC_Cx_CONFIG, so we read GCR_Cx_CONFIG.
*/
cfg = read_gcr_co_config();
} else { /* * From CM 3.5 onwards we read CPC_Cx_CONFIG because the CPC is * always powered, which allows us to not worry about powering * up the cluster's CM here.
*/
cfg = read_cpc_co_config();
}
/** * mips_cps_multicluster_cpus() - Detect whether CPUs are in multiple clusters * * Determine whether the system includes CPUs in multiple clusters - ie. * whether we can treat the system as single or multi-cluster as far as CPUs * are concerned. Note that this is slightly different to simply checking * whether multiple clusters are present - it is possible for there to be * clusters which contain no CPUs, which this function will effectively ignore. * * Returns true if CPUs are spread across multiple clusters, else false.
*/ staticinlinebool mips_cps_multicluster_cpus(void)
{ unsignedint first_cl, last_cl;
/* * CPUs are numbered sequentially by cluster - ie. CPUs 0..X will be in * cluster 0, CPUs X+1..Y in cluster 1, CPUs Y+1..Z in cluster 2 etc. * * Thus we can detect multiple clusters trivially by checking whether * the first & last CPUs belong to the same cluster.
*/
first_cl = cpu_cluster(&boot_cpu_data);
last_cl = cpu_cluster(&cpu_data[nr_cpu_ids - 1]); return first_cl != last_cl;
}
/** * mips_cps_first_online_in_cluster() - Detect if CPU is first online in cluster * @first_cpu: The first other online CPU in cluster, or nr_cpu_ids if * the function returns true. * * Determine whether the local CPU is the first to be brought online in its * cluster - that is, whether there are any other online CPUs in the local * cluster. * * Returns true if this CPU is first online, else false.
*/ externunsignedint mips_cps_first_online_in_cluster(int *first_cpu);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.