Skip to content

Please pull 26.04 linux nvidia.glue#428

Open
fyu1 wants to merge 214 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue
Open

Please pull 26.04 linux nvidia.glue#428
fyu1 wants to merge 214 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue

Conversation

@fyu1
Copy link
Copy Markdown
Collaborator

@fyu1 fyu1 commented May 18, 2026

This MPAM PR has 4 parts:

1-47: backported from upstream
48: enable RESCTRL_FS
49-52: forward ported from 6.17 hwe
53: fix issues on Grace
Please review and merge to 7.0 hwe.

jacobmartin0 and others added 30 commits April 14, 2026 11:27
Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…idia

Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit 1a32c7f noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit 0d1a2de noble:linux-nvidia-6.17)
[jacobmartin: dropped uses of CONFIG_PREEMPT_NONE /
CONFIG_PREEMPT_VOLUNTARY, these have been disabled upstream for arm64
and amd64 arches by commit 7dadeaa ("sched: Further restrict the
preemption modes") in favor of CONFIG_PREEMPT_LAZY, which is default in
the parent kernel.]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
Add support for exposing rprovides data for standalone modules
too. Switch to exposing provides as a shared debian/substvar file
and use that in the templates.

Ignore: yes
Signed-off-by: Brad Figg <bfigg@nvidia.com>
Signed-off-by: Ian May <ian.may@canonical.com>
(cherry picked from commit afacdda noble:linux-nvidia/main-next)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit 52ba185)

(cherry picked from commit 52ba185 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 8f0710a noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
This reverts commit 7a51fff.

This stale debian/dkms-versions scripting is still used for derivatives
of linux without a linux-main-modules package to parse the main
package's dkms-versions file for out-of-tree module builds.

Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
When nvidia-fs-dkms is available as a dkms package, we want to
default to using the signed modules if possible.  Adding
a version number for the nvidia-fs modules package enables the inbox
modules to be selected over an equivalent dkms version.

Ignore: yes
Signed-off-by: Ian May <ian.may@canonical.com>
(cherry picked from commit 607379d noble:linux-nvidia/main-next)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit f6927df)

(cherry picked from commit f6927df noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 750ba56 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…nvidia kernels

BugLink: https://bugs.launchpad.net/bugs/2060327

Signed-off-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Signed-off-by: Ian May <ian.may@canonical.com>
[jacobmartin: Add note to changed configs]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 9b2615a noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit e3b5061 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…ations

BugLink: https://bugs.launchpad.net/bugs/2060327

Signed-off-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Signed-off-by: Ian May <ian.may@canonical.com>
[jacobmartin: Add annotations note for changed configs]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 3d31ea0 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit 6de4075 noble:linux-nvidia-6.17)
[jacobmartin: set new CoreSight configs:
  - CONFIG_CORESIGHT_TNOC=m
  - CONFIG_CORESIGHT_CTCU=m]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
Ignore: yes
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit 448ddcb)

(cherry picked from commit 448ddcb noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit b4e9b91 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2061930
BugLink: https://bugs.launchpad.net/bugs/2067106

There are systems in production that don't have
firmware that supports coresight_etm4x.  Instead of
removing completely, blacklist coresight_etm4x so
systems with the correct firmware can use the module.

Signed-off-by: Ian May <ian.may@canonical.com>
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(backported from commit 217d1ae
noble:linux-nvidia-6.14)
[maskedarray: adjusted context]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 3f7d900 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2067111

Nvidia provide a way to flash the UEFI via capsule loader in arm64.
CAPSULE_LOADER is also built-in in L4T kernel so for the easy use,
need to make CAPSULE_LOADER as built-in in arm64.

Nvidia-BugLink: https://nvbugspro.nvidia.com/bug/4601764

Signed-off-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
(cherry picked from commit efbc80a noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit 58d6077)

(cherry picked from commit 58d6077 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 812ae1e noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2095028

This is used for GPU memory mapping. The solution is a WAR while waiting
for the upstream solution that would use dmabuf to map the entire range
in a single sequence.

Related topics:
https://lore.kernel.org/kvm/20240624065552.1572580-1-vivek.kasireddy@intel.com/
https://lore.kernel.org/kvm/cover.1719909395.git.leon@kernel.org/

Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
(cherry picked from commit d3d7b64f1a3274e5df04dee1a8062f54a3fa1116 nvidia/kstable/dev/nic/iommufd_vsmmu-12122024)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(cherry picked from commit 15e066a noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 8fcaed8 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit ef306c8 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…ualization

BugLink: https://bugs.launchpad.net/bugs/2095028

This adds the following config options to annotations:

            CONFIG_ARM_SMMU_V3_IOMMUFD=y
            CONFIG_IOMMUFD_DRIVER_CORE=y
            CONFIG_IOMMUFD_VFIO_CONTAINER=y
            CONFIG_NVGRACE_GPU_VFIO_PCI=m
            CONFIG_VFIO_CONTAINER=n
            CONFIG_VFIO_IOMMU_TYPE1=-

For CMA size requirements, the 64K kernel configuration needs 640MB
in the worst-case scenario, while the 4K kernel configuration requires 40MB.
Due to the current CMA alignment requirement of 512MB on 64k kernel and
128MB on 4k kernel, use each as default
            For 64k kernel, CONFIG_CMA_SIZE_MBYTES=1024
            For 4k kernel, CONFIG_CMA_SIZE_MBYTES=128

These config options has been defined in debian.master
            CONFIG_IOMMUFD=m
            CONFIG_IOMMU_IOPF=y

Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Koba Ko <kobak@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(backported from commit 35a55f3 24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(backported from commit 1314cf0 noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit d09b7e2 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(backported from commit 3660ee5 noble:linux-nvidia-6.17)
[mochs: Removed CONFIG_TEGRA241_CMDQV=n; we want it =y from debian.master]
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2096888

Add ACPI support to 8250_mtk driver. This makes it possible to
use UART on ARM-based desktops with EDK2 UEFI firmware.

Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(cherry picked from commit 4647186 noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit d73760e noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 072848c noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2096882

Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(backported from commit a99eb0f noble:linux-nvidia-6.11)
[jacobmartin: Drop addition of 13d3:3604 already added by upstream
commit f9685f3 ("Bluetooth: btusb: Add MediaTek MT7925-B22M support
ID 0x13d3:0x3604"). Drop driver_info flag "BTUSB_VALID_LE_STATES" as it
was inverted by upstream commit 0fec656 ("Bluetooth: btusb: Invert
LE State flag to set invalid rather then valid")]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(backported from commit a1d77cd
noble:linux-nvidia-6.14)
[maskedarray: adjusted context]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit f79eaa9 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…eam low power

BugLink: https://bugs.launchpad.net/bugs/2107509

Add a quirk to avoid U1 and U2 low power state operations
during bulk stream transfers.

Change-Id: Iaff484625eca6708713d0c2acaeddfc1103ac7d2
Signed-off-by: Us Chien <us.chien@mediatek.com>
Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com>
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Acked-by: Brad Figg <bfigg@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(cherry picked from commit 07399e8 noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(backported from commit e521e80)
[maskedarray: changed the XHCI_NVIDIA_MT8901_HOST quirk bit value
to 51]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 08ca4af noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2109730

Realtek R8127 driver can be downloaded from
https://www.realtek.com/Download/List?cate_id=584

Where it is maintained as out of tree module.

This patch adds the extracted content of r8127-11.014.00.tar.bz2 in
the folder drivers/net/ethernet/realtek/r8127.

4bd62fc87de32760fb1f3b9cd3ec14e933035623  r8127-11.014.00.tar.bz2

All the clean-up, makefile and Kconfig related changes will be
done in the subsequent commits. The source code contains a GPL2
compatible license. All the license information and Realtek
copyright notice will be maintained in each file and newly added files.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Ian May <ianm@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Ian May <ianm@nvidia.com>
(cherry picked from commit 7faf7ac noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit e45f1b7 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 24068b2 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2109730

These files are not needed to build r8127 as part of kernel
source code build, so removed these non required files.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Ian May <ianm@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Ian May <ianm@nvidia.com>
(cherry picked from commit 063d338 noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 712fc60 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit ee5f3b0 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2109730

This commit moved all files from src folder to parent folder itself.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Ian May <ianm@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Ian May <ianm@nvidia.com>
(cherry picked from commit a5fe39b noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 1802cd3 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit f83397f noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2109730

In the original code, r8127 driver was build as out of tree module.
This commit adds Kconfig and updates Makefile for building it
with kernel build.

r8127 driver internally uses different config flags and these are set
through EXTRA_CFLAGS.  These config flags are now set in the Makefile
with ccflags-y. All the flags, that were getting enabled by default in
the original code, have been enabled in ccflags-y. This commit is not
enabling any extra flags.

Some of the files compilation are dependent upon a particular flag.
Now, only default flags are set, so these files will become unused,
This commit has removed these files.

Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Ian May <ianm@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Ian May <ianm@nvidia.com>
(backported from commit 04ea6d0 noble:linux-nvidia-6.11)
[jacobmartin: adjust context around RTASE definitions introduced in
K6.14]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>

(cherry picked from commit 6217fea noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit d423ea7 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…127 module

BugLink: https://bugs.launchpad.net/bugs/2109730

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matt Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Ian May <ianm@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Ian May <ianm@nvidia.com>
(cherry picked from commit 59db394 noble:linux-nvidia-6.11)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
(cherry picked from commit aaa5490)

(cherry picked from commit aaa5490 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit 1edd05e noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2111511

- crb_acpi_add() checks for start method
- If start method is ACPI_TPM2_CRB_WITH_ARM_FFA, then
  it invokes tpm_crb_ffa_init().
- The tpm_crb_ffa_init() uses IS_REACHABLE()

    #if IS_REACHABLE(CONFIG_TCG_ARM_CRB_FFA)
    int tpm_crb_ffa_init(void);
    #else
    static inline int tpm_crb_ffa_init(void) { return 0; }
    #endif

  So, either tpm_crb (configured with CONFIG_TCG_CRB)
  should be module or we need to make
  tpm_crb_ffa (CONFIG_TCG_ARM_CRB_FFA) built-in.

- CONFIG_TCG_CRB is selected by other configs so making
  it module won't be feasible. We can
  enable CONFIG_TCG_ARM_CRB_FFA to make tpm_crb_ffa
  built-in.

- This also requires to select CONFIG_ARM_FFA_TRANSPORT=y

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
(cherry picked from commit 60809f8)

(cherry picked from commit 60809f8 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit b054f0b noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

The FFH (Functional Fixed Hardware) operation region is maintained by
ARM in https://developer.arm.com/documentation/den0048/latest/

OperationRegion (RegionName, RegionSpace, Offset, Length)

For ARM FFH, Offset is used to identify the functionality offered by
this FFH address space. It must be set to one of the following values:

- 0x0 to indicate usage of 32-bit calling convention
- 0x1 to indicate usage of 64-bit calling convention.
- All other values are reserved.

For GB10 and other similar SOC’s, to communicate with embedded controller,
a new specification is being defined. It is currently in draft stage and
maintained in

https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/README.md
https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md

Offset 4 section:

https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md#operation-region-definition

This specification internally uses offset 0x4 which is not defined in
published ARM specification. So, when ACPI request comes with offset 0x4,
then it will fail due to missing support. This commit adds support for
custom offset handler. A new EC interface driver will be added in
subsequent patches which will registers it callback function.
When FFH operation region will be executed with offsets other
than 0x0 and 0x1, then it will be forwarded to custom handler.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>

(cherry picked from commit 89b7d03 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit df76ec3 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

Please refer

https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md
for details regarding FFA device details for secure EC
services communication.

The HID 'MSFT000C' is reserved for FFA devices.
This HID is documented in

https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md#hid-definition

This commit adds a platform driver which binds with FFA device.
In its probe routine, it executes the AVAL method to check
if FFA can be used for secure EC services communication.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>

(cherry picked from commit 555e41e noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit bdd6ed0 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

Please refer
https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md
for details regarding FFA device details for secure
EC services communication.

Each secure EC service is identified by separate UUID.
When generic FFA module loads (ffa_module), then it gets the list of
partitions. Each EC service is a FFA partition and ffa_module creates
a device for each partition. These devices will be added in
arm_ffa bus type. The device will be named as arm-ffa-<number>.
For binding with these devices, a driver needs to be registered in
arm_ffa bus type. This driver uses structure ‘struct ffa_driver’ where
it uses UUID as ID table. The binding of the driver to device
happens on basis of UUID.

The secure EC services FFA driver is dependent upon main FFA
device to be created (which uses ACPI ID MSFT000C), so
ffa_driver_register()/ffa_driver_unregister() is invoked from
nvidia_ffa_probe()/nvidia_ffa_remove().

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>

(cherry picked from commit 9613a5c noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 5ede0e8 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

Please refer

https://github.com/OpenDevicePartnership/documentation/blob/main/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md

for details regarding FFA device details for secure EC
services communication.

When ACPI interpreter runs code with FFH operation region offset 4,
then this data is meant for EC secure services. The FFH buffer has
data in FFA_REQ_PACKET format. In this packet, it has UUID for EC
service and then the service specific raw data. This commit adds
a custom FFH offset handler. When request comes with custom offset
then it will be handled by nvdia FFA EC driver. Inside the custom
ffh callback, it extracts the UUID and gets the ffa_device for it.
Then it fills raw data in ffa_send_direct_data2 and
invoke sync_send_receive2() routine for that ffa_device.
Once it gets the response back, then it fill data in
FFA_RESP_PACKET format and ACPI interpreter passes that data to
upper layer.

NOTE: In the above document, the FFA_REQ_PACKET and FFA_RESP_PACKET
uses different format. But in latest firmware code, the ACPI implementation
is done using same format for both request and response
(follows the FFA_REQ_PACKET format). The status bit will be updated
in the response (0 for success and 1 for failure).

This mixed endian is documented in
https://cdrdv2-public.intel.com/772722/asl-tutorial-v20190625.pdf

  In addition to Concatenate, there are several useful macros that generate
  buffers from strings. For example, the ToUUID macro takes a string of the
  form aabbccdd-eeff-gghh-iijj-kkllmmnnoopp where aa through pp represent
  one byte values encoded with hexadecimal characters. This string gets
  converted to a 16-byte buffer that looks like the following:
  Buffer()
  {
  dd, cc, bb, aa,
  ff, ee,
  hh, gg,
  ii, jj, kk, ll, mm, nn, oo, pp
  }

  This mixture of little endian and big-endian encoding UUID is called
  a mixed-endian format. The use of strings and the ToUUID macro is a
  convenient way to avoid having to manually encode the mixed-endian
  format. There are many other macros that provide similar
  conveniences, such as EISAID. In kernel, it is represented with guid_t.

Inside nvidia_ffh_handler(), we need to covert buffer of 16
bytes from FFA UUID to AML UUID format. nvidia_get_uuid_from_aml_buf()
converts the AML UUID buffer into FFA UUID format.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>

(cherry picked from commit 40ca7bc noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit 613505b noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

- During boot time, ACPI probe happens first. It calls _STA method for
  each added device.

- Inside _STA method for device managed by EC, it uses FFH offset 4.

- The request will fail since there is no custom handler registered
  for offset 0x4 and device will be disabled.

- If rescan happens on acpi bus, then device _STA method will be
  called again.

This commit adds support to get acpi id from UUID and
invokes acpi_bus_scan().

NOTE: nvidia_get_acpi_id_from_uuid() returns ACPI ID only
for few services. We don't have a corresponding driver available
for all the services in the current code. For few services only,
its node uses generic ACPI ID and has driver available.
For rest of the service, the driver is not yet available,
or the published spec is not updated with full ACPI sample code.
Once we have driver available for that, then we can add
those ACPI IDs in this list.

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>

(cherry picked from commit 971a25e noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit e4ec414 noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114230

The commit 897e9e6 ("firmware: arm_ffa: Initial support for scheduler
receiver interrupt") adds support for SGI interrupts in the FFA driver.
However, the validation for SGIs in the GICv3 is too strict, causing the
driver probe to fail.

This patch relaxes the SGI validation check, allowing callers to use SGIs
if the requested SGI number is greater than or equal to MAX_IPI, which
fixes the TFA driver probe failure.

This issue is observed on NVIDIA server platform with FFA-v1.1.

 PTP clock support registered
 EDAC MC: Ver: 3.0.0
 ARM FF-A: Driver version 1.1
 ARM FF-A: Firmware version 1.1 found
 GICv3: [Firmware Bug]: Illegal GSI8 translation request
 ARM FF-A: Failed to create IRQ mapping!
 ARM FF-A: Notification setup failed -61, not enabled
 ARM FF-A: Failed to register driver sched callback -95
 scmi_core: SCMI protocol bus registered

This patch was sent in arm mailing list for upstream but it got
rejected.

https://patchwork.kernel.org/project/linux-arm-kernel/patch/20240813033925.925947-1-sdonthineni@nvidia.com/

The proper fix requires some kind of mechanism by which a
SGI can be requested by module but that needs discussion with arm and
it will take time. This patch will break only if MAX_IPI value gets
changed. This patch adds a BUILD_BUG_ON() to catch that situation.
Once proper solution is concluded then this patch will be reverted.

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off--by: Brad Figg <bfigg@nvidia.com>
(backported from commit fd136cf)
[maskedarray: removed enum ipi_msg_type definition as it appears in
upstream commit "irqchip/gic-v5: Add GICv5 LPI/IPI support"]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit df84d5d noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
James Morse and others added 27 commits May 26, 2026 01:36
When there are enough monitors, the resctrl mbm local and total
files can be exposed. These need all the monitors that resctrl
may use to be allocated up front.
Add helpers to do this.
If a different candidate class is discovered, the old array
should be free'd and the allocated monitors returned to the
driver.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 355bc5f https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
When there are not enough monitors, MPAM is able to emulate ABMC by making
a smaller number of monitors assignable. These monitors still need to be
allocated from the driver, and mapped to whichever control/monitor group
resctrl wants to use them with.
Add a second array to hold the monitor values indexed by resctrl's
cntr_id.
When CDP is in use, two monitors are needed so the available number of
counters halves. Platforms witih one monitor will have zero monitors
when CDP is in use.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit d8a0ad3 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…ABMC use

ABMC has a helper resctrl_arch_config_cntr() for changing the mapping
between 'cntr_id' and a CLOSID/RMID pair.
Add the helper.
For MPAM this is done by updating the mon->mbwu_idx_to_mon[] array,
and as usual CDP means it needs doing in three different ways.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit ce6ad9d https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
- Remove empty definition of resctrl_arch_config_cntr()
- Resolve struct rdt_l3_mon_domain parameter in resctrl_arch_config_cntr()
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…sctrl_arch_reset_rmid()

resctrl uses resctrl_arch_rmid_read() to read counters. CDP emulation
means the counter may need reading in three different ways. The same
goes for reset.
The helpers behind the resctrl_arch_ functions will be re-used for the
ABMC equivalent functions.
Add the rounding helper for checking monitor values while we're here.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit d45ffcb https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - resctrl_arch_round_mon_val() has been defined in upstream. No need to re-define it here;
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…trl_arch_reset_cntr()

When used in ABMC mode, resctrl uses a different set of helpers to
read and reset the counters.
Add these.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 81af700 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
- Remove empty definitions of resctrl_arch_cntr_read() and
  resctrl_arch_reset_cntr()
- Resolve struct rdt_l3_mon_domain parameter in resctrl_arch_cntr_read() and
  resctrl_arch_reset_cntr()
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Add the required hook to pre-round a userspace memory bandwidth
allocation percentage value to a value acceptable to the driver backend.
For MPAM, no rounding is needed because the driver has all the
information necessary for rounding the value when
resctrl_arch_update_one() is called.
So, just "round" the value to itself here.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 935611d https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `include/linux/arm_mpam.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…arch

The control value parser for the MB resource currently coerces the
memory bandwidth percentage value from userspace to be an exact
multiple of the bw_gran parameter.
On MPAM systems, this results in somewhat worse-than-worst-case
rounding, since bw_gran is in general only an approximation to the
actual hardware granularity, and the hardware bandwidth allocation
control value is not natively a percentage.
Allow the arch to provide its own conversion that is appropriate for
the hardware, and move the existing conversion to x86.  This will avoid
accumulated error from rounding the value twice on MPAM systems.
Clarify the documentation, but avoid overly exact promises.
Clamping to bw_min and bw_max still feels generic: leave it in the core
code, for now.
No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit cabdc68 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…isable monitor overflow

Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
To allow other architectures to disable this, add a helper that reports
whether counters can overflow.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 6a4360b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…n overflow

Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
To allow the overflow handler to be disabled, determine if an overflow
can happen. If a class is not implemented, or has the 63bit counter,
it can't overflow.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 0f6aefd https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
Call the new arch helpers to determine this.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 72e375a https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
mpam_reprogram_ris_partid() always resets the CMAX/CMIN controls to their
'unrestricted' value.
This prevents the controls from being configured.
Add fields in struct mpam_config, and program these values when they
are set in the features bitmask.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit e701b28 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
  - Resolve minor conflicts in `drivers/resctrl/mpam_internal.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…re-use

Functions like mbw_max_to_percent() convert a value into MPAMs 16 bit
fixed point fraction format. These are not only used for memory
bandwidth, but cache capcity controls too.
Rename these functions to convert to/from a 'fract16', and add
helpers for the specific mbw_max/cmax controls.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 738f160 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
  - Resolve minor conflicts in `drivers/resctrl/test_mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
… separate struct

struct resctrl_membw combines parameters that are related to the control
value, and parameters that are specific to the MBA resource.
To allow the control value parsing and management code to be re-used for
other resources, it needs to be separated from the MBA resource.
Add struct resctrl_mba that holds all the parameters that are specific
to the MBA resource.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit c113346 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
parse_cbm() and parse_bw() both test the staged config for an existing
entry. These would indicate user-space has provided a schema with a
duplicate domain entry. e.g:
| L3:0=ffff;1=f00f;0=f00f
If new parsers are added this duplicate domain test has to be duplicated.
Move it to the caller.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 827c80b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/ctrlmondata.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…nstead of parse_bw()

MBA is only supported on platforms where the delay inserted by the control
is linear. Resctrl checks the two properties provided by the arch code
match each time it parses part of a new control value.
This doesn't need to be done so frequently, and obscures changes to
parse_bw() to abstract it for use with other control types.
Move this check to the parse_line() caller so it only happens once.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 85be43b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…de resource

resctrl_get_default_ctrl() is called by both the architecture code and
filesystem code to return the default value for a control. This depends
on the schema format.
parse_bw() doesn't bother checking the bounds it is given if the
resource is in use by mba_sc. This is because the values parsed from
user-space are not the same as those the control should take.
To make this disparity easier to work with, a second different copy
of the schema format is needed, which would need a version of
resctrl_get_default_ctrl(). This would let the resctrl change the
schema format presented to user-space, provided it converts it to match
what the architecture code expects.
Rename resctrl_get_default_ctrl() to make it clear it returns the
resource default.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit a4ba73c https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…g it to be different

parse_bw() doesn't bother checking the bounds it is given if the
resource is in use by mba_sc. This is because the values parsed from
user-space are not the same as those the control should take.
To make this disparity easier to work with, a second different copy
of the schema format is needed, which would need a version of
resctrl_get_default_ctrl(). This would let the resctrl change the
schema format presented to user-space, provided it converts it to match
what the architecture code expects.
Add a second schema format for use with mba_sc. The membw properties
are copied and the schema version is used. When mba_sc is enabled
the schema copy of these properties is modified.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 225d28e https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/ctrlmondata.c`;
  - Resolve minor conflicts in `include/linux/arm_mpam.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl allows the architecture code to specify the schema format for a
control. Controls can either take a bitmap, or some kind of number.
If user-space doesn't know what a control is by its name, it could be
told the schema format. 'Some kind of number' isn't useful as the
difference between a percentage and a value in MB/s affects how these
would be programmed, even if resctrl's parsing code doesn't need to
care.
Add the types resctrl already has in addition to 'range'. This
allows architectures to move over before 'range' is removed. These
new schema formats are parsed the same, but will additionally affect
which files are visible.
Schema formats with a double underscore should not be considered
portable between architectures, and are likely to be described to
user-space as 'platform defined'. AMDs MBA resource is configured
with an absolute bandwidth measured in multiples of one eighth of
a GB per second. resctrl needs to be aware of this platform
defined format to ensure the existing 'MB' files continue to be
shown.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit bb81e48 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl specifies the schema format for MB and SMBA in rdt_resources_all[].
Intel platforms take a percentage for MB, AMD platforms take an absolute
value which isn't MB/s. Currently these are both treated as a 'range'.
Adding support for additional types of control shows that user-space
needs to be told what the control formats are. Today users of resctrl
must already know if their platform is Intel or AMD to know how the
MB resource will behave.
The MPAM support exposes new control types that take a 'percentage'.
The Intel MB resource is also configured by a percentage, so should be
able to expose this to user-space.
Remove the static configuration for schema_fmt in rdt_resources_all[]
and specify it with the other control properties in
__get_mem_config_intel() or __get_mem_config_amd().

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 3323499 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `arch/x86/kernel/cpu/resctrl/core.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…tmap controls

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource.
To find the minimum granularity of the percentage cache capacity controls,
user-space is expected to rad the banwdidth_gran file, and know this has
nothing to do with bandwidth.
The only problem here is the name of the file. Add duplicates of these
properties with percentage and bitmap in the name. These will be exposed
based on the schema format.
The existing files must remain tied to the specific resources so that
they remain visible to user-space. Using the same helpers ensures the
values will always be the same regardless of the file used.
These files are not exposed until the new RFTYPE schema flags are
set on a resource 'fflags'.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit a38c116 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/internal.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…n schema format

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource. New files
have been added that are selected based on the schema format.
Apply the flags to enable these files based on the schema format.
Add a new fflags_from_schema() that is used for controls.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit db00568 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
If more schemas are added to resctrl, user-space needs to know how to
configure them. To allow user-space to configure schema it doesn't know
about, it would be helpful to tell user-space the format, e.g. percentage.
Add a file under info that describes the schema format.
Percentages and 'mbps' are implicitly decimal, bitmaps are expected to be
in hex.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit f0ae691 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
MPAM can have both cache portion and cache capacity controls on any cache
that supports MPAM. Cache portion bitmaps can be exposed via resctrl if
they are implemented on L2 or L3.
The cache capacity controls can not be used to isolate portions, which is
in implicit in the L2 or L3 bitmap provided by user-space. These controls
need to be configured with something more like a percentage.
Add the resource enum entries for these two resources. No additional
resctrl code is needed because the architecture code will specify this
resource takes a 'percentage', re-using the support previously used only
for the MB resource.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 2e9f961 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `include/linux/resctrl.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…m cmax

MPAM's maximum cache-capacity controls take a fixed point fraction format.
Instead of dumping this on user-space, convert it to a percentage.
User-space using resctrl already knows how to handle percentages.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 10caa12 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
The current MPAM driver only considers the first component associated
with an online/offline CPU during domain creation and teardown. This
is insufficient, as CPU-initiated traffic may traverse multiple MSCs
before reaching the target, and each MSC must be programmed consistently
for proper resource partitioning.

Update the MPAM driver to include all components associated with a
given CPU during domain setup/teardown to expose expected schemata
to userspace for effective resource control.

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
(forward ported from commit ac1e5be https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Leaves drivers/resctrl/mpam_internal.h untouched; mpam_resctrl_offline_cpu()
    is already void in the baseline used here.
  - Tightens callers (mpam_resctrl_pick_mba, mpam_resctrl_pick_counters) around
    traffic_matches_l3() together with topology_matches_l3() and
    cpumask_equal(&class->affinity, cpu_possible_mask) and does not add a
    traffic_matches_l3() function body here, which is already defined in
    upstream.
  - Omits any edit to exposed_alloc_capable or exposed_mon_capable; those
    symbols are already absent from the baseline in favor of
    resctrl_arch_alloc_capable() / resctrl_arch_mon_capable().
  - Adds for_each_mpam_resctrl_control() only; does not add MPAM_MAX_EVENT or a
    new for_each_mpam_resctrl_mon() / mpam_resctrl_counters[] sizing hunk
    because that monitor macro and array shape are already in the baseline.
  - Omits INIT_LIST_HEAD_RCU() on res->resctrl_res.ctrl_domains and
    mon_domains, omits moving mpam_resctrl_domain_insert() after
    resctrl_online_*(), and omits adding static void
    mpam_resctrl_online_domain_hdr(); that list setup and insert ordering are
    already in the baseline.
  - Does not replay a void→int conversion for mpam_resctrl_monitor_init() or a
    mpam_pmg_max + 1 num_rmid path; the baseline already has int-returning
    mpam_resctrl_monitor_init() and resctrl_arch_system_num_rmid_idx() for
    num_rmid, so only surrounding line context shifts in this file.
  - Adds for_each_mpam_resctrl_control(), mpam_resctrl_mon_from_res() /
    mpam_resctrl_res_from_mon(), mpam_resctrl_monitor_sync_abmc_vals(struct
    rdt_resource *r), extends mpam_resctrl_alloc_domain() /
    mpam_resctrl_get_domain_from_cpu() / mpam_resctrl_get_mon_domain_from_cpu()
    with struct mpam_component *comp, hardens topology_matches_l3() with
    matched_once, switches resctrl_arch_mbm_cntr_assign_enabled() to use
    mon->assigned_counters, and extends mpam_resctrl_pick_domain_id() so
    memory level > 3 uses component IDs like cache-backed classes]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…onfig

Reset an RIS by building a default mpam_config and applying it via
mpam_reprogram_ris_partid(), like any other config.

- mpam_init_reset_cfg(): set features and default values only for
  controls supported by the RIS (cpor_part, mbw_part, mbw_max,
  mbw_prop, cmax_cmax, cmax_cmin). Use full masks for CPBM/MBW_PBM
  and MPAMCFG_* defaults for MBW_MAX, CMAX, CMIN.
- mpam_reprogram_ris_partid(): apply cfg for all supported controls
  (no separate reset path).

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
(forward ported from commit e0b6de0 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - reset_cpbm and reset_mbw_pbm are not used. no need to define them;
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
  - Since mpam_init_reset_cfg() has been removed from upstream,
    reset_cfg is init in mpam_reprogram_ris_partid(&reset_cfg);
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Add local bytes counter in mpam_resctrl_counters[] to fix missing
mbm_local_bytes monitoring on Grace.

Add mon->assigned_counters check to enable mbm_L3_assignments config
file on Grace.

Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
@fyu1 fyu1 force-pushed the 26.04_linux-nvidia.glue branch from c9f54eb to 3889fc6 Compare May 26, 2026 02:27
@nirmoy nirmoy added pending_review_comment and removed question Further information is requested labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed pending_review_comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.