From: Mikko Perttunen <mperttunen@nvidia.com>
To: thierry.reding@kernel.org, jonathanh@nvidia.com,
Aniruddha Rao <anrao@nvidia.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
Aniruddha Rao <anrao@nvidia.com>
Subject: Re: [PATCH v2 5/5] firmware: tegra: bpmp: Add MBWT sysfs interface
Date: Thu, 23 Jul 2026 14:21:37 +0900 [thread overview]
Message-ID: <g7OOz68bQqOVx48MGjK0ug@nvidia.com> (raw)
In-Reply-To: <20260722110544.193551-6-anrao@nvidia.com>
On Wednesday, July 22, 2026 8:05 PM Aniruddha Rao wrote:
> Different workloads can place different memory-bandwidth demands on the
> system. Selecting an appropriate bandwidth limit depends on the runtime
> workload mix and on the devices carrying that traffic, such as PCIe
> traffic or GPU traffic connected over the chip-to-chip link (NVCLINK).
> That information is not available to the kernel.
>
> BPMP firmware of some Tegra platforms provides Memory Bandwidth
> Throttler (MBWT) controls for PCIe and GPU traffic connected over
> NVCLINK on the path to DRAM. Each PCIe bandwidth group has a single
> shared cap for all traffic in that group. Bandwidth for a group can be
> set per traffic type.
>
> Add sysfs attributes on the tegra-bpmp platform device to expose a
> narrow userspace interface for MBWT control. The attributes are arranged
> as mbwt/pcie0..pcie5/pcie_read/bandwidth,
> pcie_write/bandwidth and nvclink/bandwidth files. Each pcieN directory
> identifies a PCIe bandwidth group and each traffic directory identifies
> the traffic type.
>
> Reading a bandwidth attribute queries firmware for the selected bandwidth
> group and traffic type. Writing an integer programs the target bandwidth
> cap in GB/s for that bandwidth group and traffic type.
>
> Register the attributes only when BPMP firmware reports support for the
> MBWT GET_BW and SET_BW requests through its query ABI.
>
> Signed-off-by: Aniruddha Rao <anrao@nvidia.com>
> ---
> Changes since v1:
> - Register the interface based on MBWT firmware support, not ACPI.
> - Replace the stateful tuple attribute with per-traffic bandwidth files.
> - Remove software bandwidth range checks.
> - Build the sysfs interface under CONFIG_SYSFS.
> - Rename the registration helper to tegra_bpmp_init_sysfs().
> - Avoid platform-specific or transport-specific MBWT wording.
>
> .../ABI/testing/sysfs-platform-tegra-bpmp | 48 ++++
> drivers/firmware/tegra/Makefile | 1 +
> drivers/firmware/tegra/bpmp-private.h | 9 +
> drivers/firmware/tegra/bpmp-tegra-sysfs.c | 205 ++++++++++++++++++
> drivers/firmware/tegra/bpmp.c | 4 +
> 5 files changed, 267 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-platform-tegra-bpmp
> create mode 100644 drivers/firmware/tegra/bpmp-tegra-sysfs.c
>
> diff --git a/Documentation/ABI/testing/sysfs-platform-tegra-bpmp b/Documentation/ABI/testing/sysfs-platform-tegra-bpmp
> new file mode 100644
> index 000000000000..36440e696e7d
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-platform-tegra-bpmp
> @@ -0,0 +1,48 @@
> +What: /sys/bus/platform/devices/<bpmp-device>/mbwt/pcie[0-5]/pcie_read/bandwidth
> +What: /sys/bus/platform/devices/<bpmp-device>/mbwt/pcie[0-5]/pcie_write/bandwidth
> +What: /sys/bus/platform/devices/<bpmp-device>/mbwt/pcie[0-5]/nvclink/bandwidth
> +Date: July 2026
> +KernelVersion: 7.2
> +Contact: Aniruddha TVS Rao <anrao@nvidia.com>
> +Description:
> + Provides access to Memory Bandwidth Throttler (MBWT)
> + controls exposed by BPMP firmware for PCIe traffic and GPU
> + traffic connected over the chip-to-chip link (NVCLINK) on
> + the path to DRAM.
> +
> + The attributes are present only when BPMP firmware reports
> + support for the MBWT GET_BW and SET_BW requests through the
> + MBWT query ABI.
> +
> + Each pcieN directory identifies one PCIe bandwidth group.
> + Each bandwidth group has a single shared cap for all traffic
> + in that group. A group may contain only PCIe devices, only a
> + GPU connected over NVCLINK, or both PCIe and GPU traffic in a
> + bifurcated topology.
> +
> + The pcie_read, pcie_write and nvclink directories select the
> + traffic type for the selected group:
> +
> + pcie_read
> + PCIe read traffic
> +
> + pcie_write
> + PCIe write traffic
> +
> + nvclink
> + GPU traffic connected over NVCLINK
> +
> + Reading a bandwidth attribute returns the bandwidth cap in GB/s
> + reported by firmware for that bandwidth group and traffic
> + type.
> +
> + Writing an integer to a bandwidth attribute programs the target
> + bandwidth cap in GB/s for that bandwidth group and traffic
> + type.
> +
> + Examples:
> + cat .../mbwt/pcie0/pcie_write/bandwidth
> + echo 100 > .../mbwt/pcie0/pcie_write/bandwidth
> +
> +Users: Platform integration and bandwidth tuning on systems with BPMP
> + firmware MBWT support.
> diff --git a/drivers/firmware/tegra/Makefile b/drivers/firmware/tegra/Makefile
> index 41e2e4dc31d6..59085e183fbd 100644
> --- a/drivers/firmware/tegra/Makefile
> +++ b/drivers/firmware/tegra/Makefile
> @@ -6,5 +6,6 @@ tegra-bpmp-$(CONFIG_ARCH_TEGRA_194_SOC) += bpmp-tegra186.o
> tegra-bpmp-$(CONFIG_ARCH_TEGRA_234_SOC) += bpmp-tegra186.o
> tegra-bpmp-$(CONFIG_ARCH_TEGRA_264_SOC) += bpmp-tegra186.o
> tegra-bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o
> +tegra-bpmp-$(CONFIG_SYSFS) += bpmp-tegra-sysfs.o
> obj-$(CONFIG_TEGRA_BPMP) += tegra-bpmp.o
> obj-$(CONFIG_TEGRA_IVC) += ivc.o
> diff --git a/drivers/firmware/tegra/bpmp-private.h b/drivers/firmware/tegra/bpmp-private.h
> index b3770e71020e..3a15a7aa0ffc 100644
> --- a/drivers/firmware/tegra/bpmp-private.h
> +++ b/drivers/firmware/tegra/bpmp-private.h
> @@ -33,4 +33,13 @@ int tegra_bpmp_mbwt_get(struct tegra_bpmp *bpmp, unsigned int instance,
> int tegra_bpmp_mbwt_set(struct tegra_bpmp *bpmp, unsigned int instance,
> unsigned int vc_type, unsigned int bandwidth);
>
> +#ifdef CONFIG_SYSFS
> +int tegra_bpmp_init_sysfs(struct tegra_bpmp *bpmp);
> +#else
> +static inline int tegra_bpmp_init_sysfs(struct tegra_bpmp *bpmp)
> +{
> + return 0;
> +}
> +#endif
> +
> #endif
> diff --git a/drivers/firmware/tegra/bpmp-tegra-sysfs.c b/drivers/firmware/tegra/bpmp-tegra-sysfs.c
The directory already says 'tegra', so the file can be just
'bpmp-sysfs.c'. That matches the existing 'bpmp-debugfs.c' as well.
prev parent reply other threads:[~2026-07-23 5:21 UTC|newest]
Thread overview: 9+ 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-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-07-22 11:05 ` [PATCH v2 5/5] firmware: tegra: bpmp: Add MBWT sysfs interface Aniruddha Rao
2026-07-23 5:21 ` Mikko Perttunen [this message]
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=g7OOz68bQqOVx48MGjK0ug@nvidia.com \
--to=mperttunen@nvidia.com \
--cc=anrao@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.