Skip to content

Commit 704a746

Browse files
kobak2026nvidia-bfigg
authored andcommitted
NVIDIA: VR: SAUCE: tegra: bpmp: Add sysfs for memory bandwidth QoS
BugLink: https://bugs.launchpad.net/bugs/2147212 Tegra410 exposes memory bandwidth QoS for PCIe and GPU UPHY traffic on the path to DRAM. Each bandwidth group can cap PCIe read, PCIe write, or combined GPU UPHY read and write traffic, with target limits. The memory bandwidth QoS is not exposed as ordinary host MMIO and cannot be controlled from the kernel. The bandwidth limits can be programmed by sending the corresponding requests (MBWT MRQ) to the BPMP. On Tegra410, an ACPI-based platform, Linux BPMP driver does not use the device-tree mailbox path for communicating with the BPMP firmware. As a result, there is no existing client driver or interface that can be used to send the memory bandwidth requests to the BPMP. This patch exposes a sysfs directory mbwt_control on the tegra-bpmp platform device with pcie_instance_id, vc_type, and bandwidth. Writing bandwidth issues an MBWT_SET for the selected group (pcie_instance_id) and traffic class (vc_type). A read issues MBWT_GET and returns the bandwidth value reported by firmware. These attributes are exposed only if MBWT QUERY probe reports both MBWT_SET and MBWT_GET commands as supported. ABI documented in Documentation/ABI/testing/sys-platform-tegra-bpmp Signed-off-by: Aniruddha Rao <anrao@nvidia.com> (backported from V4 internal mail <20260423140823.2848045-4-anrao@nvidia.com>) [kobak: Keep functional MRQ_SOCHUB_MBWT ABI definitions and sysfs interface from V4; condense verbose per-field ABI comments while preserving enum/struct layout and Documentation/ABI coverage; use refcounted kobject allocation for mbwt_control; validate pcie_instance_id/vc_type before staging; return only the bandwidth value from bandwidth reads; report BPMP SET rejections to userspace; fail BPMP probe on mbwt_control sysfs registration failure so 7.0-bos does not silently boot without the requested MBWT interface.] Signed-off-by: Koba Ko <kobak@nvidia.com> Acked-by: Carol L Soto <csoto@nvidia.com> Acked-by: Matthew R. Ochs <mochs@nvidia.com> Signed-off-by: Brad Figg <bfigg@nvidia.com>
1 parent 285736f commit 704a746

6 files changed

Lines changed: 479 additions & 1 deletion

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
What: /sys/bus/platform/devices/<bpmp-device>/mbwt_control/pcie_instance_id
2+
What: /sys/bus/platform/devices/<bpmp-device>/mbwt_control/vc_type
3+
What: /sys/bus/platform/devices/<bpmp-device>/mbwt_control/bandwidth
4+
Date: March 2026
5+
KernelVersion: 6.18
6+
Contact: Aniruddha TVS Rao <anrao@nvidia.com>
7+
Description:
8+
On ACPI-based Tegra systems the BPMP driver does not use the
9+
device-tree mailbox path; firmware interaction is via AML. This sysfs
10+
interface is a userspace tuning knob for memory bandwidth throttler
11+
(MBWT) settings.
12+
13+
On Tegra410, the PCIe bandwidth control path exposes QoS that caps
14+
aggregate bandwidth for PCIe and for GPU traffic over UPHY. Each PCIe
15+
bandwidth group has a single shared cap for all traffic in that group.
16+
A group may contain only PCIe devices, only a GPU on UPHY, or PCIe and
17+
GPU together in a bifurcated topology.
18+
19+
Following attributes appear under a kobject named mbwt_control on the
20+
tegra-bpmp platform device (the same struct device as the driver
21+
binds to), only when that device has an ACPI companion and BPMP
22+
firmware reports support for both MBWT_GET and MBWT_SET via the MBWT
23+
QUERY probe.
24+
25+
pcie_instance_id (RW):
26+
PCIe bandwidth group index: 0 = pcie0, 1 = pcie1, ..., 5 = pcie5.
27+
28+
vc_type (RW):
29+
Traffic type to cap for that group:
30+
0 = PCIe read
31+
1 = PCIe write
32+
2 = GPU UPHY read plus write (combined)
33+
34+
bandwidth (RW):
35+
Target bandwidth cap in GB/s for the pcie_instance_id and vc_type
36+
currently stored in the other two attributes. Intended range is
37+
1-110 GB/s; firmware validates the request (via MRQ MBWT_SET).
38+
39+
When read, issues a MBWT_GET for that same pcie_instance_id and vc_type
40+
and returns the bandwidth value in GB/s returned by firmware.
41+
42+
Example:
43+
echo 0 > .../mbwt_control/pcie_instance_id
44+
echo 1 > .../mbwt_control/vc_type
45+
echo 100 > .../mbwt_control/bandwidth
46+
cat .../mbwt_control/bandwidth
47+
48+
Users: Customer tuning of PCIe and GPU UPHY bandwidth caps on
49+
ACPI-based Tegra410 systems.

drivers/firmware/tegra/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ tegra-bpmp-$(CONFIG_ARCH_TEGRA_234_SOC) += bpmp-tegra186.o
77
tegra-bpmp-$(CONFIG_ARCH_TEGRA_264_SOC) += bpmp-tegra186.o
88
tegra-bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o
99
obj-$(CONFIG_TEGRA_BPMP) += tegra-bpmp.o
10+
obj-$(CONFIG_TEGRA_BPMP) += bpmp-tegra-sysfs.o
1011
obj-$(CONFIG_TEGRA_IVC) += ivc.o

0 commit comments

Comments
 (0)