Skip to content

Commit b27eda5

Browse files
committed
Merge tag 'icc-5.9-rc4' of https://git.linaro.org/people/georgi.djakov/linux into char-misc-linus
Georgi writes: interconnect fixes for v5.9 This contains two fixes: - Fix the core to show correctly the bandwidth for disabled paths. - Fix a driver to make sure small values are not truncated. Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> * tag 'icc-5.9-rc4' of https://git.linaro.org/people/georgi.djakov/linux: interconnect: qcom: Fix small BW votes being truncated to zero interconnect: Show bandwidth for disabled paths as zero in debugfs
2 parents e22a220 + 91e045b commit b27eda5

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

drivers/interconnect/core.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@ static int icc_summary_show(struct seq_file *s, void *data)
5555

5656
icc_summary_show_one(s, n);
5757
hlist_for_each_entry(r, &n->req_list, req_node) {
58+
u32 avg_bw = 0, peak_bw = 0;
59+
5860
if (!r->dev)
5961
continue;
6062

63+
if (r->enabled) {
64+
avg_bw = r->avg_bw;
65+
peak_bw = r->peak_bw;
66+
}
67+
6168
seq_printf(s, " %-27s %12u %12u %12u\n",
62-
dev_name(r->dev), r->tag, r->avg_bw,
63-
r->peak_bw);
69+
dev_name(r->dev), r->tag, avg_bw, peak_bw);
6470
}
6571
}
6672
}

drivers/interconnect/qcom/bcm-voter.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,42 @@ static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b)
5252
return 1;
5353
}
5454

55+
static u64 bcm_div(u64 num, u32 base)
56+
{
57+
/* Ensure that small votes aren't lost. */
58+
if (num && num < base)
59+
return 1;
60+
61+
do_div(num, base);
62+
63+
return num;
64+
}
65+
5566
static void bcm_aggregate(struct qcom_icc_bcm *bcm)
5667
{
68+
struct qcom_icc_node *node;
5769
size_t i, bucket;
5870
u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0};
5971
u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0};
6072
u64 temp;
6173

6274
for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
6375
for (i = 0; i < bcm->num_nodes; i++) {
64-
temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width;
65-
do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels);
76+
node = bcm->nodes[i];
77+
temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
78+
node->buswidth * node->channels);
6679
agg_avg[bucket] = max(agg_avg[bucket], temp);
6780

68-
temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width;
69-
do_div(temp, bcm->nodes[i]->buswidth);
81+
temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
82+
node->buswidth);
7083
agg_peak[bucket] = max(agg_peak[bucket], temp);
7184
}
7285

7386
temp = agg_avg[bucket] * 1000ULL;
74-
do_div(temp, bcm->aux_data.unit);
75-
bcm->vote_x[bucket] = temp;
87+
bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
7688

7789
temp = agg_peak[bucket] * 1000ULL;
78-
do_div(temp, bcm->aux_data.unit);
79-
bcm->vote_y[bucket] = temp;
90+
bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
8091
}
8192

8293
if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&

0 commit comments

Comments
 (0)