Message ID | 20230320182441.11904-1-sumitg@nvidia.com |
---|---|
Headers | show |
Series | Tegra234 Memory interconnect support | expand |
On Mon, Mar 20, 2023 at 11:54:32PM +0530, Sumit Gupta wrote: [...] > diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c [...] > +static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst) > +{ > + struct tegra_mc *mc = icc_provider_to_tegra_mc(dst->provider); > + struct mrq_bwmgr_int_request bwmgr_req = { 0 }; > + struct mrq_bwmgr_int_response bwmgr_resp = { 0 }; > + const struct tegra_mc_client *pclient = src->data; > + struct tegra_bpmp_message msg; > + struct tegra_bpmp *bpmp; > + int ret; > + > + /* > + * Same Src and Dst node will happen during boot from icc_node_add(). > + * This can be used to pre-initialize and set bandwidth for all clients > + * before their drivers are loaded. We are skipping this case as for us, > + * the pre-initialization already happened in Bootloader(MB2) and BPMP-FW. > + */ > + if (src->id == dst->id) > + return 0; > + > + bpmp = of_tegra_bpmp_get(); > + if (IS_ERR(bpmp)) { > + ret = PTR_ERR(bpmp); > + return ret; > + } Irrespective of Whether we end up doing the BPMP lookup via tegra_bpmp_get() or of_tegra_bpmp_get(), I think we should resolve at probe time and cache the result, since this function can get called multiple times and the lookup is a rather heavy operation. Thierry