qcacmn: Fix perf cluster interrupt affinity

The number of perf CPU clusters can vary across
different targets. Currently only the second CPU
cluster is considered as the perf cluster, whereas
there can be more than 1 perf clusters.

Fix this perf cluster derivation for interrupt
affinity.

Change-Id: Ie4407064ac5124fc050715fd75400ca516c9c6b8
CRs-Fixed: 3498024
This commit is contained in:
Rakesh Pillai
2023-02-20 06:09:19 -08:00
committed by Rahul Choudhary
parent 30a6417487
commit 474298906b
4 changed files with 38 additions and 14 deletions

View File

@@ -395,6 +395,18 @@ struct hif_softc {
#endif
};
#if defined(NUM_SOC_PERF_CLUSTER) && (NUM_SOC_PERF_CLUSTER > 1)
static inline uint16_t hif_get_perf_cluster_bitmap(void)
{
return (BIT(CPU_CLUSTER_TYPE_PERF) | BIT(CPU_CLUSTER_TYPE_PERF2));
}
#else /* NUM_SOC_PERF_CLUSTER > 1 */
static inline uint16_t hif_get_perf_cluster_bitmap(void)
{
return BIT(CPU_CLUSTER_TYPE_PERF);
}
#endif /* NUM_SOC_PERF_CLUSTER > 1 */
static inline
void *hif_get_hal_handle(struct hif_opaque_softc *hif_hdl)
{

View File

@@ -557,16 +557,17 @@ void hif_ipci_irq_set_affinity_hint(struct hif_exec_context *hif_ext_group,
int i, ret;
unsigned int cpus;
bool mask_set = false;
int cpu_cluster = perf ? CPU_CLUSTER_TYPE_PERF :
CPU_CLUSTER_TYPE_LITTLE;
int package_id;
int cpu_cluster = perf ? hif_get_perf_cluster_bitmap() :
BIT(CPU_CLUSTER_TYPE_LITTLE);
for (i = 0; i < hif_ext_group->numirq; i++)
qdf_cpumask_clear(&hif_ext_group->new_cpu_mask[i]);
for (i = 0; i < hif_ext_group->numirq; i++) {
qdf_for_each_online_cpu(cpus) {
if (qdf_topology_physical_package_id(cpus) ==
cpu_cluster) {
package_id = qdf_topology_physical_package_id(cpus);
if (package_id >= 0 && BIT(package_id) & cpu_cluster) {
qdf_cpumask_set_cpu(cpus,
&hif_ext_group->
new_cpu_mask[i]);
@@ -624,13 +625,15 @@ static void hif_ipci_ce_irq_set_affinity_hint(struct hif_softc *scn)
struct CE_attr *host_ce_conf;
int ce_id;
qdf_cpu_mask ce_cpu_mask;
int perf_cpu_cluster = hif_get_perf_cluster_bitmap();
int package_id;
host_ce_conf = ce_sc->host_ce_config;
qdf_cpumask_clear(&ce_cpu_mask);
qdf_for_each_online_cpu(cpus) {
if (qdf_topology_physical_package_id(cpus) ==
CPU_CLUSTER_TYPE_PERF) {
package_id = qdf_topology_physical_package_id(cpus);
if (package_id >= 0 && BIT(package_id) & perf_cpu_cluster) {
qdf_cpumask_set_cpu(cpus,
&ce_cpu_mask);
}

View File

@@ -3214,16 +3214,17 @@ void hif_pci_irq_set_affinity_hint(struct hif_exec_context *hif_ext_group,
int i, ret;
unsigned int cpus;
bool mask_set = false;
int cpu_cluster = perf ? CPU_CLUSTER_TYPE_PERF :
CPU_CLUSTER_TYPE_LITTLE;
int package_id;
int cpu_cluster = perf ? hif_get_perf_cluster_bitmap() :
BIT(CPU_CLUSTER_TYPE_LITTLE);
for (i = 0; i < hif_ext_group->numirq; i++)
qdf_cpumask_clear(&hif_ext_group->new_cpu_mask[i]);
for (i = 0; i < hif_ext_group->numirq; i++) {
qdf_for_each_online_cpu(cpus) {
if (qdf_topology_physical_package_id(cpus) ==
cpu_cluster) {
package_id = qdf_topology_physical_package_id(cpus);
if (package_id >= 0 && BIT(package_id) & cpu_cluster) {
qdf_cpumask_set_cpu(cpus,
&hif_ext_group->
new_cpu_mask[i]);
@@ -3255,8 +3256,7 @@ void hif_pci_irq_set_affinity_hint(struct hif_exec_context *hif_ext_group,
#endif
#ifdef HIF_CPU_PERF_AFFINE_MASK
void hif_pci_ce_irq_set_affinity_hint(
struct hif_softc *scn)
void hif_pci_ce_irq_set_affinity_hint(struct hif_softc *scn)
{
int ret;
unsigned int cpus;
@@ -3265,13 +3265,15 @@ void hif_pci_ce_irq_set_affinity_hint(
struct CE_attr *host_ce_conf;
int ce_id;
qdf_cpu_mask ce_cpu_mask;
int perf_cpu_cluster = hif_get_perf_cluster_bitmap();
int package_id;
host_ce_conf = ce_sc->host_ce_config;
qdf_cpumask_clear(&ce_cpu_mask);
qdf_for_each_online_cpu(cpus) {
if (qdf_topology_physical_package_id(cpus) ==
CPU_CLUSTER_TYPE_PERF) {
package_id = qdf_topology_physical_package_id(cpus);
if (package_id >= 0 && BIT(package_id) & perf_cpu_cluster) {
qdf_cpumask_set_cpu(cpus,
&ce_cpu_mask);
} else {