[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240626063321.3x4cvyj7yiks5f3p@vireshk-i7>
Date: Wed, 26 Jun 2024 12:03:21 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Nikunj Kela <nkela@...cinc.com>,
Prasad Sodagudi <psodagud@...cinc.com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/7] OPP: Rework _set_required_devs() to manage a single
device per call
On 19-06-24, 16:08, Ulf Hansson wrote:
> @@ -2494,36 +2495,68 @@ static int _opp_set_required_devs(struct opp_table *opp_table,
> return -EINVAL;
> }
>
> - /* Another device that shares the OPP table has set the required devs ? */
> - if (opp_table->required_devs[0])
> - return 0;
> + /* Genpd core takes care of propagation to parent genpd */
> + if (opp_table->is_genpd) {
A genpd can have non-genpd devices in the required OPPs and so this
isn't sufficient. What we were ignoring earlier was genpd having
another genpd as required opp.
> + dev_err(dev, "%s: Operation not supported for genpds\n", __func__);
> + return -EOPNOTSUPP;
> + }
>
> for (i = 0; i < opp_table->required_opp_count; i++) {
> - /* Genpd core takes care of propagation to parent genpd */
> - if (required_devs[i] && opp_table->is_genpd &&
> - opp_table->required_opp_tables[i]->is_genpd) {
> - dev_err(dev, "%s: Operation not supported for genpds\n", __func__);
> - return -EOPNOTSUPP;
> - }
> + struct opp_table *table = opp_table->required_opp_tables[i];
> +
> + /*
> + * The OPP table should be available at this point. If not, it's
> + * not the one we are looking for.
> + */
> + if (IS_ERR(table))
> + continue;
> +
> + /* Move to the next available index. */
> + if (opp_table->required_devs[i])
> + continue;
>
> - opp_table->required_devs[i] = required_devs[i];
> + /*
> + * We need to compare the nodes for the OPP tables, rather than
> + * the OPP tables themselves, as we may have separate instances.
> + */
> + if (required_opp_table->np == table->np) {
> +
We don't keep such empty lines in OPP core generally at this place.
> + /* Cross check the OPP tables and fix it if needed. */
Copy the bigger comment from_opp_attach_genpd() here too. It helps
understanding why required_opp_tables entry is getting replaced.
> + if (required_opp_table != table) {
> + dev_pm_opp_put_opp_table(table);
> + _get_opp_table_kref(required_opp_table);
> + opp_table->required_opp_tables[i] = required_opp_table;
> + }
> +
> + opp_table->required_devs[i] = required_dev;
> +
> + /*
> + * Add the required_dev as a user of the OPP table, so
> + * we can call dev_pm_opp_set_opp() on it directly.
> + */
> + if (!_add_opp_dev(required_dev, required_opp_table)) {
> + dev_err(dev, "Failed to add the device to the required OPP table\n");
> + return -ENOMEM;
> + }
> +
> + return i;
> + }
> }
--
viresh
Powered by blists - more mailing lists