Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@kernel.org>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: jonathanh@nvidia.com, Aniruddha Rao <anrao@nvidia.com>,
	 linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] firmware: tegra: bpmp: Add MBWT BPMP helpers
Date: Wed, 12 Aug 2026 11:43:12 +0200	[thread overview]
Message-ID: <anw-YlHY09qFlzKB@orome> (raw)
In-Reply-To: <aso9tq6bS9iLGL62qG0U8A@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

On Thu, Jul 23, 2026 at 02:15:50PM +0900, Mikko Perttunen wrote:
> On Wednesday, July 22, 2026 8:05 PM Aniruddha Rao wrote:
[...]
> > diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
[...]
> > +int tegra_bpmp_mbwt_set(struct tegra_bpmp *bpmp, unsigned int instance,
> > +			unsigned int vc_type, unsigned int bandwidth)
> > +{
> > +	struct mrq_sochub_mbwt_request request = {
> > +		.cmd = CMD_SOCHUB_MBWT_SET_BW,
> > +		.set_bw = {
> > +			.instance = instance,
> > +			.vc_type = vc_type,
> > +			.bw = bandwidth,
> > +		},
> > +	};
> > +	struct tegra_bpmp_message msg = {
> > +		.mrq = MRQ_SOCHUB_MBWT,
> > +		.tx = {
> > +			.data = &request,
> > +			.size = sizeof(request),
> > +		},
> > +	};
> > +	int err;
> > +
> > +	err = tegra_bpmp_transfer(bpmp, &msg);
> > +	if (err) {
> > +		dev_err(bpmp->dev, "MBWT set bandwidth transfer failed: %d\n",
> > +			err);
> > +		return err;
> > +	}
> > +
> > +	if (msg.rx.ret)
> > +		return msg.rx.ret;
> > +
> > +	return 0;
> > +}
> > +
> >  static void tegra_bpmp_mrq_handle_ping(unsigned int mrq,
> >  				       struct tegra_bpmp_channel *channel,
> >  				       void *data)
> > -- 
> > 2.43.0
> > 
> 
> Since these are only used by the sysfs code, I would squash this patch 
> into the sysfs patch and move these functions into the sysfs file.

I don't mind having this in bpmp.c. It's a fairly small file and this
isn't a lot of code, so it doesn't have much of an impact either way.
Adding an extra file is a bit of extra overhead and it would make more
sense if we had a separate symbol to configure this out.

Putting it alongside the sysfs code is bad if there's only even an
inkling of a chance that we might want to call this from somewhere else,
like maybe setting some default policy during boot or something.

That said, I would place this somewhere different within bpmp.c. Maybe
atop the probe function would be more appropriate instead of in the
middle of these other utility functions, maybe slap a multi-line comment
on top and describe what these new functions do.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-08-12  9:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 11:05 [PATCH v2 0/5] firmware: tegra: bpmp: Add ACPI and MBWT support Aniruddha Rao
2026-07-22 11:05 ` [PATCH v2 1/5] firmware: tegra: bpmp: Move channel initialization to helper Aniruddha Rao
2026-07-22 11:05 ` [PATCH v2 2/5] firmware: tegra: bpmp: Add ACPI support Aniruddha Rao
2026-07-23  5:10   ` Mikko Perttunen
2026-08-12  9:30     ` Thierry Reding
2026-07-22 11:05 ` [PATCH v2 3/5] firmware: tegra: bpmp: Add the Memory Bandwidth Throttler ABI definitions Aniruddha Rao
2026-07-22 11:05 ` [PATCH v2 4/5] firmware: tegra: bpmp: Add MBWT BPMP helpers Aniruddha Rao
2026-07-23  5:15   ` Mikko Perttunen
2026-08-12  9:43     ` Thierry Reding [this message]
2026-07-22 11:05 ` [PATCH v2 5/5] firmware: tegra: bpmp: Add MBWT sysfs interface Aniruddha Rao
2026-07-23  5:21   ` Mikko Perttunen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anw-YlHY09qFlzKB@orome \
    --to=thierry.reding@kernel.org \
    --cc=anrao@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox