Skip to content

[26.04_linux-nvidia] NVIDIA: SAUCE: usb: misc: add LSTP adapter support - #530

Closed
nirmoy wants to merge 289 commits into
NVIDIA:26.04_linux-nvidiafrom
nirmoy:agent/lstp-driver-26.04
Closed

[26.04_linux-nvidia] NVIDIA: SAUCE: usb: misc: add LSTP adapter support#530
nirmoy wants to merge 289 commits into
NVIDIA:26.04_linux-nvidiafrom
nirmoy:agent/lstp-driver-26.04

Conversation

@nirmoy

@nirmoy nirmoy commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • import the LSTP USB multi-function driver from the LSTP GitLab source through main commit f662fa18e05d
  • adapt the out-of-tree source to the Linux 7.0 in-tree GPIO, I2C, allocation, and xarray APIs
  • include the firmware-provided I2C retry policy and combined SMBus block-read fixes
  • integrate lstp.ko under drivers/usb/misc/
  • enable CONFIG_USB_LSTP=m for amd64 and arm64 NVIDIA flavours
  • enable automatic spidev creation for SPI channels without firmware-described children
  • keep separate IPMI POST-code routing disabled by default

Motivation

The temporary DKMS delivery works for image enablement, but carrying LSTP in NV-Kernels lets the normal kernel packaging and signing pipeline produce a module that supports Secure Boot.

Platform software requires the LSTP SPI channels to expose spidev children, so CONFIG_USB_LSTP_SPI_SPIDEV=y enables this behavior without a separate modprobe configuration file.

This is the 26.04_linux-nvidia companion to BOS PR #524.

BugLink: https://jirasw.nvidia.com/browse/DGX-17400

Source and scope

The driver is synchronized through LSTP GitLab main commit f662fa18e05d8c4b5a2b0bc83acc4e8687c9a9fb. The latest source includes these kernel changes after the original c3e97053446a snapshot:

  • 4f28fdedaf85: use the firmware I2C configuration for bus retry policy
  • f662fa18e05d: fix combined userspace SMBus block reads

Out-of-tree packaging, CI, README, specification PDFs, and other repository-local files are not imported.

Device-tree schemas remain omitted because the released copies still need kernel-tree $id and maintainers normalization. They can follow with the upstream-oriented patch series.

The source exposes USB vendor ID 0x0955. The previously tested DKMS snapshot also exposed 0x0424; the LSTP owners should confirm whether that second alias is approved and required before this draft is marked ready.

Validation

  • based on the current 26.04_linux-nvidia tip
  • git diff --check: pass
  • driver commit has the same stable patch ID as BOS PR [26.04_linux-nvidia-bos] NVIDIA: SAUCE: usb: misc: add LSTP adapter support #524: 8a2f5316851f356d9e08ddacceeff7e05c4f7c1b
  • CONFIG_USB_LSTP=m resolves for amd64-nvidia, arm64-nvidia, and arm64-nvidia-64k
  • CONFIG_USB_LSTP_SPI_SPIDEV=y makes auto_bind_spidev default to true for all three flavours
  • CONFIG_SEPARATE_LSTP_IPMI_POSTCODES remains disabled for all three flavours
  • x86_64: all seven LSTP objects compile and link into lstp.o with W=1 against this branch

The matching BOS source has passed arm64 compilation and modprobe testing. Standard-kernel package builds and runtime testing remain required for this companion PR.

nvidia-bfigg and others added 30 commits July 21, 2026 16:52
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>
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.

1. We need to get virtual IDs which a EC service supports.
   In the FFA node, the _DSD object contains this information.
   If we look the sample from above document,

  Name(_DSD, Package() {
      ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), //Device Prop UUID
      Package() {
        Package(2) {
          "arm-arml0002-ffa-ntf-bind",
          Package() {
              1, // Revision
              2, // Count of following packages
              Package () {
                     ToUUID("330c1273-fde5-4757-9819-5b6539037502"), // Service1 UUID
                     Package () {
                          0x01,     //Cookie1 (UINT32)
                          0x07,     //Cookie2
                      }
              },
              Package () {
                     ToUUID("b510b3a3-59f6-4054-ba7a-ff2eb1eac765"), // Service2 UUID
                     Package () {
                          0x01,     //Cookie1
                          0x03,     //Cookie2
                      }
             }
         }
      }
    }
  }) // _DSD()

  Then it uses a nexted package structure.
  nvidia_ffa_fill_notification_map() added in this commit parses the _DSD
  object and fill the notification id map for that service.

2. Once the virtual ID is get then it needs to map to
   physical ID by invoking function 1 in the notify service.

3. The UUID for notification service is
   B510B3A3-59F6-4054-BA7A-FF2EB1EAC765.
   An FFA device will be created for this notification service
   by ffa_module. This notify service needs to be probed first.
   To make that happen, a separate ffa_driver instance is created
   and it is getting registered first.

4. We can do 1:1 mapping between virtual ID and hardware ID.

5. We need to invoke notify_request() with hardware notification ID.
   It registers callback function for notification.

6. Once notification comes then we need to evaluate _DSM method
   with virtual ID (which will be mapped same as hardware ID).

7. The function 2 in the notify service should destroy the mapping.
   But it is nither implemented in the firmware not its documentation
   is available. A TODO comment is added in
   nvidia_ffa_notification_destroy().

   Also, if we unload and reload the modules, the existing mapping
   still exists. In nvidia_ffa_notification_setup(), ignore the error
   for this case. When firmware is updated, then the error will be
   returned.

8. The notification service FFA device is needed by each EC secure
   services FFA device to get virtual notification list. Now following
   device dependency chain is created.

    FFA device <-  notification service FFA device <- EC secure services FFA device

    To satisfy this, call driver registration in its dependent driver probe routine.
    Similarly, do the driver registration in its dependent driver removed routine.

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 1287a1d noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

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

The NVIDIA FFA and EC secure services driver enables the communication
with EC (Embedded Controller). Make this driver built-in to enable EC
communication at early boot.

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 9ea0251)

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

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

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

Kernel GPIO subsystem mapping hardware pin number to a different
range of gpio number. Add gpio-range structure to hold
the mapped gpio range in pinctrl driver. That enables the kernel
to search a range of mapped gpio range against a pinctrl device.

Signed-off-by: Jonas Chen <yung-chi.chen@mediatek.com>
Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com>
Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Acked-by: nvmochs
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 1049985 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

Add acpi support in the shared part of pinctrl driver. Parsing
hardware base addresses and irq naumber to initialize eint
accroding to the acpi table data.

Signed-off-by: Jonas Chen <yung-chi.chen@mediatek.com>
Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com>
Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Acked-by: nvmochs
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 cdce65d noble:linux-nvidia-6.14)
[maskedarray: context adjusted due to commit 86dee87: "pinctrl:
mediatek: Fix the invalid conditions"]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

Add mt8901 pinctrl, gpio and eint driver implementation.

Signed-off-by: Jonas Chen <yung-chi.chen@mediatek.com>
Signed-off-by: Yenchia Chen <yenchia.chen@mediatek.com>
Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Acked-by: nvmochs
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 1fc7a58 noble:linux-nvidia-6.14)
[maskedarray: context adjusted for missing commit a3fe132: "pinctrl:
mediatek: Add pinctrl driver for mt8189"]
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(backported from commit 81bfb06 noble:linux-nvidia-6.17)
[jacobmartin: context adjusted for new pinctrl-mt8901 driver from
upstream]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…MT8901

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

Signed-off-by: Abhishek Sahu <abhsahu@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Acked-by: nvmochs
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 0bd85d0)

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

commit d0038ee ("NVIDIA: SAUCE: Add support for EC
secure service communication") added nvidia_ffh_handler()
function. While copying the data back into ACPI FFH packet,
it uses the request length. The response data can be larger
than request length. The response length can't be fetched in the
linux FFH handler function. We can copy all the bytes from
ffa_data.data. The ACPI AML code will only use the required
number bytes from this.

Normally we don't need response length to be known.
The ACPI table are not using that. It is parsing response
data directly. In the latest revision of spec, the length
field itself has been removed

https://github.com/OpenDevicePartnership/documentation/blob/b23acb09f7cf03a5c3167509533f396d547e6291/guide_book/src/specs/ec_interface/secure-ec-services-overview.md#operation-region-definition

For DIGITS GB10, it is using older revision of spec and the launch is
planned with older revision of spec. When we move to latest revision,
then we need to copy all data bytes for both request and response.

The info->length is corresponding to FFH buffer length in ACPI table.
Following is the code in ACPI table

  Name (_HID, "MSFT000C")  // _HID: Hardware ID
  OperationRegion (AFFH, FFixedHW, 0x04, 0x90)

info->length will be 0x90 (144) bytes.
ffa_packet->length in the older revision is valid data bytes
(https://github.com/OpenDevicePartnership/documentation/blob/45ad9b30be0f40e229deed2fef7a60d0b0b591f5/bookshelf/Shelf%204%20Specifications/EC%20Interface/src/secure-ec-services-overview.md)

struct nvidia_ec_ffa_packet *ffa_packet = (struct nvidia_ec_ffa_packet *)value;

This value buffer length should be info->length.
We are taking minimum of sizeof(ffa_data.data) = 112 and
(info->length = 144) - (offsetof(struct nvidia_ec_ffa_packet, rawdata) = 18) = 126,
so ffh_copy_len will be 112 for the current DIGITS ACPI implementation.

In the latest revision, this length mismatch is also fixed. Raw data will
start at offset 32, so there both will come as 112.

Fixes: d0038ee ("NVIDIA: SAUCE: Add support for EC secure service communication")
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: 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 141bd56 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
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>
(cherry picked from commit 9433fd4 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit a1bdf88 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 60f9b04 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
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>
(cherry picked from commit 3eff6df https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit 6c6e893 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 a6a3ccc noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

The Extended GPU Memory (EGM) feature enables the GPU access to
the system memory across sockets and nodes. In this mode, the
physical memory can be allocated for GPU usage from anywhere
in a multi-node system. The feature is being extended to
virtualization.

EGM when enabled in the virtualization stack, the host memory
is partitioned into 2: One partition for the Host OS usage, and
a second EGM region. The EGM region essentially becomes the
system memory of the VM. The following figure shows the memory map
in the virtualization environment.

|---- Sysmem ----|                  |--- GPU mem ---|  VM Memory Map
|                |                  |               |
|                |                  |               |
|------ EGM -----|--Host Mem----|   |--- GPU mem ---|  Host Memory Map

The EGM region is not available to the host memory for its usage as it
is not added to the kernel. Its base HPA and the length is communicated
through the DSDT entries. A linear mapping between the VM IPA and system
HPA is a requirement for EGM support. The EGM region is thus assigned to
a VM by mapping the QEMU VMA to a linearly increasing HPA of the EGM
region using remap_pfn_range().

Introduce a new nvgrace-egm helper module to nvgrace-gpu to manage the
EGM/VM region for the VM.

nvgrace-egm module handles the following:
1. Fetch the EGM memory properties (base HPA, length, proximity domain).
2. Create a char device that can be used as memory-backend-file by Qemu
for the VM and implement file operations. The char device is /dev/egmX,
where X is the PXM node ID of the EGM being mapped fetched in 1.
3. Zero the EGM memory on first device open().
4. Map the QEMU VMA to the EGM region using remap_pfn_range.
5. Cleaning up state and destroying the chardev on device unbind.

Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
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>
(cherry picked from commit 892ac24 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit 3a1b819 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 8807f4b noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(backported from commit fa30498 noble:linux-nvidia-6.17)
[jacobmartin: adjust patch context to align with upstream commit
e5f19b6 ("vfio/nvgrace-gpu: register device memory for poison
handling"), as opposed to the original SAUCE version of the
same patch.]
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2119656

It is possible for some system memory pages on the EGM to
have uncorrectable ECC errors. A list of pages known with such
errors (referred as retired pages) are maintained by the Host
UEFI. The Host UEFI populates such list in a reserved region.
It communicates the SPA of this region through a ACPI DSDT property.

nvgrace-egm module is responsible to store the list of retired page
offsets to be made available for usermode processes. The module:
1. Get the reserved memory region SPA and maps to it to fetch
the list of bad pages.
2. Calculate the retired page offsets in the EGM and stores it.
3. Expose an ioctl to allow querying of the offsets.

The ioctl is called by usermode apps such as QEMU to get the
retired page offsets. The usermode apps are expected to take
appropriate action to communicate the list to the VM.

Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
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>
(cherry picked from commit be54641 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit c4cb193 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 6b0a6d6 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

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>
(cherry picked from commit 5bb23c1 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit 7d2ea55 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 077c834 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

nvgrace-egm exposes the API register_egm_node & unregister_egm_node
to manage EGM (Extended GPU Memory) present on the system.

To allow out-of-tree driver such as nvidia-vgpu-vfio make use of them,
move the declaration to a new nvgrace-egm.h in include.

Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
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>
(cherry picked from commit bed340f https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit a961663 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 020c46c noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>
(cherry picked from commit 739457a noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
…tion

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

Free the kmalloc'd region when the EGM is unregistered.

Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Acked-by: Koba Ko <kobak@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit fc592b9 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit f24760c https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 374b166 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

Move region hash initiaization alongside the other region initialization
statements to avoid situations where the hash table was not properly
initialized.

Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Acked-by: Koba Ko <kobak@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit 8021c1d https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit e1264a6 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 0f8a098 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

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

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

Update error handling within EGM regiration routine to catch and
return errors to the caller.

Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Acked-by: Koba Ko <kobak@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit a57210c https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.8-next)
Signed-off-by: Koba Ko <kobak@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Carol L. Soto <csoto@nvidia.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
(cherry picked from commit a706ff8 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Matt Ochs <mochs@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 edc0ac0 noble:linux-nvidia-6.14)
Signed-off-by: Abdur Rahman <abdur.rahman@canonical.com>

(cherry picked from commit e7a177e noble:linux-nvidia-6.17)
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
jacobmartin0 and others added 13 commits July 21, 2026 17:10
Signed-off-by: Jacob Martin <jacob.martin@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2156928

This patch updates the lan743x driver to prevent the use of netdev-based
logging APIs (such as netdev_dbg) before the network device has been
successfully registered. Using netdev-based logging prior to registration
results in log messages referencing "(unnamed net_device) (uninitialized)",
which can be confusing and less informative.

The driver must use netif_msg_ APIs and device-based logging (e.g. dev_dbg)
until netdev registration is complete. This ensures log entries are
associated with the correct device context and improves log clarity. After
registration, netdev-based logging APIs can be used safely.

Signed-off-by: David Thompson <davthompson@nvidia.com>
Link: https://patch.msgid.link/20260528165017.421576-1-davthompson@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit e3c6508)
Signed-off-by: David Thompson <davthompson@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Nirmoy Das <nirmoyd@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2156928

VLAN-tagged interfaces on lan743x devices were previously unreachable via
SSH and failed to respond to large ping packets (e.g. "ping -s 1469" given
MTU=1500). In these scenarios, "ethtool -S" reports non-zero "RX Oversize
Frame Errors". According to Microchip AN2948, the MAC_RX FSE (VLAN field
size enforcement) bit determines whether frames with VLAN tags exceeding
the base MTU plus tag length are discarded.

The driver must set the MAC_RX.FSE bit before setting MAC_RX.RXEN to allow
VLAN-tagged frames up to the interface MTU, preventing them from being
treated as oversized. As a result, both the base and VLAN-tagged interfaces
can use the same MTU without receive errors.

Fixes: 23f0703 ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: David Thompson <davthompson@nvidia.com>
Reviewed-by: Thangaraj Samynathan <Thangaraj.s@microchip.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # lan7430 on arm64 (RevPi
Link: https://patch.msgid.link/20260529210300.433135-1-davthompson@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 8173d22)
Signed-off-by: David Thompson <davthompson@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Nirmoy Das <nirmoyd@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2160654

These helpers are static inline in <linux/perf_event.h> and reach
into sysctl_perf_event_paranoid and security_perf_event_open(),
neither of which is itself exported. The perf_allow_* trio is
therefore asymmetric: built-in callers can use any of the three, but
modular code can only call perf_allow_kernel().

Move both bodies into kernel/events/core.c next to perf_allow_kernel()
and export them with EXPORT_SYMBOL_GPL, following the shape of
commit 5e9629d ("drivers/perf: arm_spe: Use perf_allow_kernel()
for permissions"). Existing in-tree callers live in built-in arch and
tracing code, so the change is invisible to them.

Provide !CONFIG_PERF_EVENTS stubs that fall back to perfmon_capable(),
so the helpers stay callable when perf is compiled out.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patch.msgid.link/20260527225507.2044027-2-ashutosh.dixit@intel.com
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
(cherry picked from commit d32bf87 linux-next)
Signed-off-by: Kelsey Steele <kelseys@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2160654

xe OA and EU-stall paths open-code a partial copy of the system-wide
perf CPU-event permission check:

    if (xe_observation_paranoid && !perfmon_capable())
            return -EACCES;

This open-coded check skips two things perf_allow_cpu() handles: the
graduated kernel.perf_event_paranoid policy that an administrator
may have tuned, and the security_perf_event_open() LSM hook.

Introduce xe_observation_paranoid_check() to wrap perf_allow_cpu(),
and convert the open-coded sites in xe_oa.c and xe_eu_stall.c. The
dev.xe.observation_paranoid sysctl still acts as an escape hatch
when cleared.

xe observation now consults kernel.perf_event_paranoid and the LSM
perf hook on every open. Sites that have already configured an LSM
perf policy or tuned the paranoid sysctl will see those settings
extend to xe.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patch.msgid.link/20260527225507.2044027-3-ashutosh.dixit@intel.com
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
(backported from commit 6680bf0 linux-next)
[kelseys: Drop the new int ret declaration and initialize the existing ret
 variable used by remap_pfn_range() instead. This tree does not contain
 commit 41255b2 ("drm/xe/oa: Use drm_gem_mmap_obj for OA buffer
 mmap"), which removed the legacy mapping loop and its ret variable.]
Signed-off-by: Kelsey Steele <kelseys@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2158449

Plumb a bool value throughout the various nexthop removal functions,
determined in the innermost __remove_nexthop_fib() (which still does the
FIB flushing) and propagated up all callers.

The next patch will make use of this signal to optimize the removal of
multiple nexthops by moving the FIB flushing up the call hierarchy.

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20260507075606.322405-2-cratiu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 31c777b)
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Acked-by: Omer Barak <obarak@nvidia.com>
Acked-by: Aya Levin <ayal@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2158449

When a device is going down or when a net namespace is deleted, all
nexthops on it are removed, and for each nexthop being removed the FIB
table is flushed, which does a full trie traversal looking for entries
marked RTNH_F_DEAD and removing them. This is O(N x R), with N being
number of dev nexthops and R being number of IPv4 routes.

The RTNL is held the entire time.

When there are many nexthops to be removed and many routing entries,
this can result in the RTNL being held for multiple minutes, which
causes unhappiness in other processes trying to acquire the RTNL (e.g.
systemd-networkd for DHCP renewals).

In a complicated deployment with multiple vxlan devices, each having
16K nexthops and a total of 128K ipv4 routes, this is exactly what
happens:

nexthop_flush_dev()                # loops over 16K nexthops
  -> remove_nexthop()
    -> __remove_nexthop()
      -> __remove_nexthop_fib()    # marks fi->fib_flags |= RTNH_F_DEAD
        -> fib_flush()             # for EACH nexthop!
	  -> fib_table_flush()     # walks the ENTIRE FIB, 128K entries

This patch makes use of the previously added FIB flushing signal to only
do a single FIB flush after all nexthops to be removed are marked as
RTNH_F_DEAD:
- __remove_nexthop_fib() no longer flushes the FIB.
- nexthop_flush_dev() and flush_all_nexthops() now keep track whether
  any nexthop was removed and trigger a FIB flush at the end.
- a new wrapper is defined, remove_one_nexthop() which calls
  remove_nexthop() and flushes if necessary. This is intended for places
  which must remove a single nexthop and shouldn't worry about the need
  to trigger a FIB flush. For now, the only caller is rtm_del_nexthop().
- The two direct callers of __remove_nexthop() get a WARN_ON_ONCE, since
  the nh about to be removed should not have any FIB entries referencing
  it when replacing or inserting a new one.

This dramatically improves performance from O(N x R) to O(N + R).

Releasing a nexthop reference in remove_nexthop() now no longer frees
it. Instead, it is deleted when the last fib_info pointing to it gets
freed via free_fib_info_rcu(). All routing code is already careful not
to take into consideration routes marked with RTNH_F_DEAD.

Tested with:
DEV=eth2
ip link set up dev $DEV
ip link add testnh0 link $DEV type macvlan mode bridge
ip addr add 198.51.100.1/24 dev testnh0
ip link set testnh0 up

seq 1 65536 | \
sed 's/.*/nexthop add id & via 198.51.100.2 dev testnh0/' | \
ip -batch -

i=1
for a in $(seq 0 255); do
  for b in $(seq 0 255); do
    echo "route add 10.${a}.${b}.0/32 nhid $i"
    i=$((i + 1))
  done
done | ip -batch -

time ip link set testnh0 down
ip link del testnh0

Without this patch:
real	0m32.601s
user	0m0.000s
sys	0m32.511s

With this patch:
real	0m0.209s
user	0m0.000s
sys	0m0.153s

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20260507075606.322405-3-cratiu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 35ce551)
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Acked-by: Omer Barak <obarak@nvidia.com>
Acked-by: Aya Levin <ayal@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2158449

These functions return a signal whether FIB flushing is required which
must not be ignored. Use the compiler to help with enforcing this
requirement in the future.

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20260507075606.322405-4-cratiu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 5dcbd64)
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Acked-by: Omer Barak <obarak@nvidia.com>
Acked-by: Aya Levin <ayal@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2162012

FFA_FEATURES reports the minimum size and alignment boundary required
for RXTX_MAP. In FF-A v1.2 and later it can also report a maximum buffer
size, with zero meaning that no maximum is enforced.

The driver only used the minimum value and then rounded it up to PAGE_SIZE
before invoking RXTX_MAP after commit 8321025 ("firmware: arm_ffa:
Use the correct buffer size during RXTX_MAP"). On systems where PAGE_SIZE
is larger than the advertised minimum, this can exceed a non-zero maximum
reported by firmware. Older implementations do not advertise a maximum and
may also reject the rounded-up size.

Decode the maximum size and clamp the page-aligned minimum to it when it
is present. If no maximum is advertised and RXTX_MAP rejects the rounded
size with INVALID_PARAMETERS, retry with the advertised minimum size.
Record drv_info->rxtx_bufsz only after RXTX_MAP succeeds so it reflects
the size registered with firmware.

While there, also update RXTX_MAP_MIN_BUFSZ() to use FIELD_GET() for
consistency.

Fixes: 8321025 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP")
Suggested-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Seth Forshee <sforshee@nvidia.com>
Link: https://patch.msgid.link/20260602-b4-ffa-rxtx-map-fixes-v2-1-7cb06508da84@nvidia.com
(sudeep.holla: Minor rewording subject and commit message)
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
(backported from commit 53716a4)
[jamien: applied to ffa_init() rather than ffa_probe(); this tree predates
 the FF-A platform driver conversion, so the hunks needed context fixups.]
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Matthew R. Ochs <mochs@nvidia.com>
Acked-by: Seth Forshee <sforshee@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2161703

While building the kernel, the following warning is emitted:

security/apparmor/Kconfig:120:warning: multi-line strings not supported

Also, a minor typo has been fixed s/defauit/default.

Bug: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia-6.17/+bug/2161703

Signed-off-by: Kaushal Rajeev Butala <kbutala@nvidia.com>
Acked-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2161742

loopy_wait() expects millisecond timestamps. However, Ubuntu Resolute
can use uutils date, where `date -u +%s%3N` returns seconds plus full
nanoseconds instead of a 3-digit millisecond field. This makes
busywait expire too early and can make vlan_bridge_binding.sh read a
stale operstate.

Fixes: 25ae948 ("selftests/net: add lib.sh")
Cc: stable@vger.kernel.org # 6.8+
Link: uutils/coreutils#11658
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Link: https://patch.msgid.link/20260630165157.3814871-1-nirmoyd@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
(cherry picked from commit dd6a23b)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2161742

splice_short grows its pipe with (MAX_FRAGS + 1) * 0x1000 so it can
queue one short vmsplice() buffer for each fragment before draining the
pipe. That assumes 4K pipe buffers.

On 64K-page kernels the request is rounded to 262144 bytes, which
provides only four pipe buffers. The fifth one-byte vmsplice() blocks in
pipe_wait_writable and the test times out before it reaches the TLS path.

Request enough bytes for the same number of pipe buffers using the
runtime page size, and assert that the kernel granted at least that much.
If an unprivileged run cannot raise the pipe above the system
pipe-max-size limit, skip the test because it cannot exercise the
intended path.

Fixes: 3667e9b ("selftests: tls: add test for short splice due to full skmsg")
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260624134416.3235403-1-nirmoyd@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 3e52f56)
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2162767

Add settings to support more base clock frequency on different platform.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://patch.msgid.link/20260716061536.1563252-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(backported from commit ef9c8eb sound.git)
Signed-off-by: Kaushal Rajeev Butala <kbutala@nvidia.com>
Acked-by: Carol L Soto <csoto@nvidia.com>
Acked-by: Jamie Nguyen <jamien@nvidia.com>
Signed-off-by: Brad Figg <bfigg@nvidia.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ❌ Errors found

Details
Checking 9 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2c5024fd9196 │ [SAUCE] usb: lstp: roll back failed spi startup                  │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 95a561534950 │ [SAUCE] usb: lstp: skip zero-length mmio commands                │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 195fa574470a │ [SAUCE] usb: lstp: preserve unread ipmi requests                 │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5271494ae3cc │ [SAUCE] usb: lstp: recover chip select after errors              │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e4f8b9ac8cf1 │ [SAUCE] usb: lstp: auto-bind empty spi firmware nodes            │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7b3293eb6fb2 │ [SAUCE] usb: lstp: advertise fixed spi settings                  │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c41554d1d6dd │ [SAUCE] usb: lstp: bind auto-created spi devices                 │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 50fafedb229d │ [SAUCE] [config] enable usb_lstp as a module                     │ N/A        │ N/A     │ nirmoyd                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2f317e05648f │ [SAUCE] usb: misc: add lstp adapter support                      │ N/A        │ N/A     │ aambroze, nirmoyd         │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint: all checks passed.

PR metadata:
E: PR targets 26.04_linux-nvidia but body has no https://bugs.launchpad.net/... link

The Low-Speed Transport Protocol (LSTP) adapter exposes
firmware-configured I2C, SPI, GPIO, UART, IPMI, and MMIO channels over a
single USB interface.

Add the driver as a downstream patch and integrate it with Kconfig,
Kbuild, and MAINTAINERS. Adapt the GPIO, I2C, memory-allocation, and
UART interfaces to the APIs available in this kernel.

Use the configured I2C retry count and avoid a spurious zero-length
write before a userspace SMBus block read.

(backported from
 https://gitlab-master.nvidia.com/spt-firmware-taskforce/lstp/lstp_module)

Signed-off-by: Adrian Ambrozewicz <aambrozewicz@nvidia.com>
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
@nirmoy
nirmoy force-pushed the agent/lstp-driver-26.04 branch from f0b9473 to 2aa061d Compare August 5, 2026 11:27
Enable CONFIG_USB_LSTP=m for the amd64 and arm64 NVIDIA flavours.
Building lstp.ko through the kernel packaging pipeline also allows the
module to be signed for Secure Boot.

Enable CONFIG_USB_LSTP_SPI_SPIDEV so auto_bind_spidev defaults to true
and LSTP SPI channels without firmware-described children create
spidev devices. Keep separate IPMI POST-code routing disabled.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
@nirmoy
nirmoy force-pushed the agent/lstp-driver-26.04 branch from 2aa061d to 50fafed Compare August 5, 2026 15:34
nirmoy added 6 commits August 5, 2026 11:08
The generic spidev modalias is not present in the spidev device ID table,
so dynamically created LSTP SPI devices remain unbound.

Load spidev before creating the devices and set its name as a driver
override before registration. Fail channel startup if a child cannot
be created or bound.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
LSTP firmware supplies one clock rate for each SPI channel and supports
only 8-bit words, but the controller currently accepts other settings
and silently ignores them during transfers.

Publish the firmware rate as both the minimum and maximum controller
speed and restrict the word-size mask to 8 bits so the SPI core rejects
unsupported requests.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
A channel fwnode may be present without describing any available
SPI child devices. Treat that case like a missing fwnode so the
auto_bind_spidev option creates the fallback devices it promises.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
A failed transfer can leave chip select asserted in the adapter. Send a
best-effort zero-length write with the deassert flag before completing
the failed message, while preserving the original transfer error.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Removing a FIFO record before checking the userspace buffer loses the
request on a short read or copy fault. Serialize readers and retain
one dequeued record until copy_to_user() succeeds.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Zero-length read and write calls must complete without issuing hardware
operations. Return immediately after validating the file offset instead
of sending empty LSTP commands.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
@nirmoy

nirmoy commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

BaseOS Kernel Review

Summary

LSTP UART success leaves NACK set, repeating every accepted write five times. SPI startup can leave a controller and children registered after failure, while IPMI O_NONBLOCK reads may block indefinitely on rx_mutex.

Findings: Critical: 0, High: 1, Medium: 6, Low: 2

Latest watcher review: open review

Generated test plan: open test plan

Kernel deb build: successful (download debs, 4 files)

Head: 2c5024fd9196

This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher publishes a newer review.

Channel startup failures do not abort USB probe. If fallback spidev
creation fails after controller registration, the controller and any
children created before the failure otherwise remain registered.

Group controller registration and child creation under devres so the
complete SPI channel is rolled back on an error.

Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
@nirmoy

nirmoy commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Closing because host-OS LSTP support is no longer required by the product and is not needed to provide Secure Boot.

@nirmoy nirmoy closed this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.