Skip to contentSkip to conversation

accel/amd_vpci: Add new driver for AMD Versal PCI

PATCH Superseded David Zhang 2 participants 14 messages Nov 11, 2025 – Dec 27, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover accel/amd_vpci: Add new driver for AMD Versal PCI

This patchset introduces a new Linux Kernel Driver, *versal-pci*, for AMD Embedded+ platform.

The AMD Embedded+ platform integrates AMD Ryzen Embedded processors with AMD Versal AI Edge adaptive SoCs on a single PCB [1]. The AMD Ryzen Embedded processor is connected to the Versal AI Edge adaptive SoC via PCIe enabling a tightly coupled heterogeneous compute platform. AMD Embedded+ platform is used for sensor fusion, AI inferencing, industrial networking, control, and visualization.

AMD Versal PCI driver, versal-pci, is a host-side PCIe driver for AMD Embedded+ platform running on AMD Ryzen Embedded processor.

The versal-pci driver is responsible for the management-plane operations for the AMD Versal AI Edge adaptive SoC, including:

- Loading accelerator firmware images
- Reset and recovery
- Health monitoring

The driver is licensed under GPL-2.0.

The firmwares are distributed as closed binaries. Please see [1] for more information. Please see [2] for software architecture.

[1] https://www.amd.com/en/products/embedded/embedded-plus.html
[2] https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/3011838141/AMD+Embedded+Platforms

David Zhang (5):
accel/amd_vpci: Add documentation for AMD Versal PCI accelerator
management
accel/amd_vpci: Add new driver for AMD Versal PCI accelerator accel/amd_vpci: Add Remote Management(RM) queue infrastructure accel/amd_vpci: Add Remote Management (RM) queue service APIs accel/amd_vpci: Add communication channel service

 Documentation/accel/amd_vpci/amd_vpci.rst     | 122 +++++
 Documentation/accel/amd_vpci/index.rst        |  11 +
 Documentation/accel/index.rst                 |   1 +
 MAINTAINERS                                   |   5 +
 drivers/accel/Kconfig                         |   1 +
 drivers/accel/Makefile                        |   3 +-
 drivers/accel/amd_vpci/Kconfig                |  15 +
 drivers/accel/amd_vpci/Makefile               |   9 +
 drivers/accel/amd_vpci/versal-pci-comm-chan.c | 295 +++++++++++
 drivers/accel/amd_vpci/versal-pci-comm-chan.h |  14 +
 drivers/accel/amd_vpci/versal-pci-main.c      | 394 ++++++++++++++
 drivers/accel/amd_vpci/versal-pci-rm-queue.c  | 314 +++++++++++
 drivers/accel/amd_vpci/versal-pci-rm-queue.h  |  21 +
 .../accel/amd_vpci/versal-pci-rm-service.c    | 497 ++++++++++++++++++
 .../accel/amd_vpci/versal-pci-rm-service.h    | 229 ++++++++
 drivers/accel/amd_vpci/versal-pci.h           |  70 +++
 16 files changed, 2000 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/accel/amd_vpci/amd_vpci.rst
 create mode 100644 Documentation/accel/amd_vpci/index.rst
 create mode 100644 drivers/accel/amd_vpci/Kconfig
 create mode 100644 drivers/accel/amd_vpci/Makefile
 create mode 100644 drivers/accel/amd_vpci/versal-pci-comm-chan.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-comm-chan.h
 create mode 100644 drivers/accel/amd_vpci/versal-pci-main.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-queue.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-queue.h
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-service.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-service.h
 create mode 100644 drivers/accel/amd_vpci/versal-pci.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/5 accel/amd_vpci: Add documentation for AMD Versal PCI accelerator management

This patch introduces documentation for the AMD Versal PCI accelerator management driver. The driver runs on the host and manages the AMD Versal AI Edge SoC on the AMD Embedded+ platform. It handles management-plane operations including firmware image loading, reset, and health monitoring. This documentation also describes the firmware interface (VMR) and overall platform architecture.

---
 Documentation/accel/amd_vpci/amd_vpci.rst | 122 ++++++++++++++++++++++
 Documentation/accel/amd_vpci/index.rst    |  11 ++
 Documentation/accel/index.rst             |   1 +
 3 files changed, 134 insertions(+)
 create mode 100644 Documentation/accel/amd_vpci/amd_vpci.rst
 create mode 100644 Documentation/accel/amd_vpci/index.rst
Documentation/accel/amd_vpci/amd_vpci.rst new file +122 -0
new file mode 100644
index 000000000000..9159b89fa0b5
@@ -0,0 +1,122 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+.. include:: <isonum.txt>
+
+===============
+ AMD Versal PCI
+===============
+
+:Copyright: |copy| 2025 Advanced Micro Devices, Inc.
+:Authors: - Sonal Santan <[email protected]>
+	  - Yidong (David) Zhang <[email protected]>
+
+Overview
+========
+
+The AMD Embedded+ platform integrates AMD Ryzen Embedded processors with
+AMD Versal AI Edge adaptive System-on-Chip (SoC) on a single PCB. The AMD
+Ryzen Embedded processor is connected to the Versal AI Edge adaptive SoC
+via PCIe enabling a tightly coupled heterogeneous compute platform. AMD
+Embedded+ platform is commonly used for sensor fusion, AI inferencing,
+industrial networking, control, and visualization.
+
+AMD Versal PCI driver, versal-pci, is a host-side PCIe driver for AMD
+Embedded+ platform running on AMD Ryzen Embedded processor. The versal-pci
+driver is responsible for the **management-plane** operations for the AMD
+Versal AI Edge adaptive SoC, including:
+
+* Loading accelerator firmware images
+* Reset and recovery
+* Health monitoring
+
+Please note that the versal-pci driver does *not* participate in workload
+execution.
+
+Hardware Description
+====================
+
+AMD Versal AI SoCs boot from a dedicated flash device and presents two
+PCIe physical functions to the AMD Ryzen Embedded processor which acts as
+PCIe host.
+
+* Physical function 0 (PF0) is used for the management-plane to interact
+  with versal-pci driver.
+* Physical function 1 (PF1) is used for the execution-plane. In some cases
+  PF1 can be attached to a VM.
+
+Versal Management Runtime (VMR) Firmware
+----------------------------------------
+
+AMD Versal AI SoC runs Versal Management Runtime (VMR) firmware on a
+microcontroller. VMR is responsible for:
+
+* Low-level management of the AMD Versal AI SoC.
+* Loading accelerator images into a dedicated partition on the AMD Versal
+  AI SoC.
+
+The VMR communicates with the versal-pci driver via:
+
+* A command queue mapped to PCIe PF0 BAR.
+* A shared memory region in the PCIe PF0 BAR.
+
+Accelerator Image
+-----------------
+
+An AMD Embedded+ platform may store multiple *accelerator images*, each
+identified by a UUID in a secure location on the AMD Ryzen host file
+system. Each image enables a specific application like sensor fusion, AI
+inferencing, etc. A chosen accelerator image is sent to the VMR by the
+versal-pci driver. Once loaded, the accelerator image running in the
+dedicated partition of AMD Versal AI SoC interfaces with the AMD Ryzen host
+via PCIe PF1.
+
+Accelerator Image Loading Workflow
+----------------------------------
+
+1. A user application requests an image load by sending the UUID of the
+   desired image to the user driver attached to PF1.
+2. The user driver forwards the UUID to the versal-pci driver via a mailbox
+   channel which connects PF1 to PF0.
+3. The versal-pci driver on PF0 receives the UUID via the mailbox channel.
+4. The versal-pci driver on PF0 then requests the accelerator image change
+   by sending a message to the VMR.
+5. The versal-pci driver copies the accelerator image to the shared memory
+   region on the PF0 PCIe BAR. It then sends a message to the VMR via the
+   command queue.
+6. Upon receiving the request from versal-pci, the VMR programs dedicated
+   hardware in the AMD Versal AI SoC to perform image loading.
+7. The image is loaded over the dedicated partition which then starts
+   running.  The VMR sends success response to the versal-pci driver.
+8. The versal-pci driver then responds to the user PF driver over the
+   communication channel.
+9. The versal-pci driver begins monitoring the health of the AMD Versal
+   SoC.
+
+
+The Driver Architecture
+=======================
+
+.. code-block:: bash
+
+                          +------------+
+                          |            |
+                          |     VM     |
+       +------------+     |            |
+       | versal-pci |     |            |
+   +---+----o-------+-----+-----o------+-----+
+   |        |       Linux       |            |  AMD Ryzen Host
+   +--------|-------------------|------------+
+           PF0                 PF1
+            |                   |
+   +--------v--------+----------v------------+
+   |                 .                       |
+   |       VMR       .   Accelerator Image   | AMD Versal AI SoC
+   |                 .                       |
+   +-----------------+-----------------------+
+
+
+References
+==========
+
+* `AMD Embedded Plus <https://www.amd.com/en/products/embedded/embedded-plus.html>`_
+* `AMD Embedded Platform Architecture <https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/3011838141/AMD+Embedded+Platforms>`_
Documentation/accel/amd_vpci/index.rst new file +11 -0
new file mode 100644
index 000000000000..3ed4ab9e1332
@@ -0,0 +1,11 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+===========================================
+ accel/amd_vpci Versal Embedded Plus driver
+===========================================
+
+The accel/amd_vpci driver supports the AMD Versal Embedded Plus accelerator
+
+.. toctree::
+
+   amd_vpci
Documentation/accel/index.rst +1 -0
index d8fa332d60a8..30fed42e1686 100644
@@ -9,6 +9,7 @@ Compute Accelerators
 
    introduction
    amdxdna/index
+   amd_vpci/index
    qaic/index
    rocket/index
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/5 accel/amd_vpci: Add new driver for AMD Versal PCI accelerator

In reply to David Zhang

This patch introduces a new PCI driver for AMD Versal-based accelerator cards.

The driver provides basic module and PCI device initialization, based on BAR resources used to establish a hardware queue-based ring buffer between the PCIe host and the Versal Management Runtime (VMR) service running on the embedded SoC. This interface enables firmware management and board health monitoring.

Key features:
- PCI probe and BAR resource initialization.
- Integration with configfs for firmware management
- Compatibility check using firmware-reported UUIDs

The base firmware image is expected under /lib/firmware/xilinx/<fw_name> and can be programmed to the device through the configfs interface. Firmware transfer is handled via a remote queue service (added in a later patch).

---
 MAINTAINERS                              |   5 +
 drivers/accel/Kconfig                    |   1 +
 drivers/accel/Makefile                   |   3 +-
 drivers/accel/amd_vpci/Kconfig           |  15 ++
 drivers/accel/amd_vpci/Makefile          |   6 +
 drivers/accel/amd_vpci/versal-pci-main.c | 279 +++++++++++++++++++++++
 drivers/accel/amd_vpci/versal-pci.h      |  62 +++++
 7 files changed, 370 insertions(+), 1 deletion(-)
 create mode 100644 drivers/accel/amd_vpci/Kconfig
 create mode 100644 drivers/accel/amd_vpci/Makefile
 create mode 100644 drivers/accel/amd_vpci/versal-pci-main.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci.h
MAINTAINERS +5 -0
index ddecf1ef3bed..924a00c04646 100644
@@ -1257,6 +1257,11 @@ F:	drivers/spi/spi-amd-pci.c
 F:	drivers/spi/spi-amd.c
 F:	drivers/spi/spi-amd.h
 
+AMD VERSAL PCI DRIVER
+M:	Yidong Zhang <[email protected]>
+S:	Supported
+F:	drivers/accel/amd_vpci/
+
 AMD XDNA DRIVER
 M:	Min Ma <[email protected]>
 M:	Lizhi Hou <[email protected]>
drivers/accel/Kconfig +1 -0
index bb01cebc42bf..c82ebf9accfa 100644
@@ -25,6 +25,7 @@ menuconfig DRM_ACCEL
 	  and debugfs).
 
 source "drivers/accel/amdxdna/Kconfig"
+source "drivers/accel/amd_vpci/Kconfig"
 source "drivers/accel/habanalabs/Kconfig"
 source "drivers/accel/ivpu/Kconfig"
 source "drivers/accel/qaic/Kconfig"
drivers/accel/Makefile +2 -1
index ffc3fa588666..92906c9cf3d9 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_DRM_ACCEL_AMDXDNA)		+= amdxdna/
+obj-$(CONFIG_DRM_ACCEL_AMD_VPCI)	+= amd_vpci/
 obj-$(CONFIG_DRM_ACCEL_HABANALABS)	+= habanalabs/
 obj-$(CONFIG_DRM_ACCEL_IVPU)		+= ivpu/
 obj-$(CONFIG_DRM_ACCEL_QAIC)		+= qaic/
-obj-$(CONFIG_DRM_ACCEL_ROCKET)		+= rocket/
\ No newline at end of file
+obj-$(CONFIG_DRM_ACCEL_ROCKET)		+= rocket/
drivers/accel/amd_vpci/Kconfig new file +15 -0
new file mode 100644
index 000000000000..dcf83bf3d8e6
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config DRM_ACCEL_AMD_VPCI
+	tristate "AMD Versal PCIe Management Driver"
+	depends on DRM_ACCEL
+	depends on PCI && HAS_IOMEM
+	select FW_LOADER
+	select CONFIGFS_FS
+	default m
+	help
+	  AMD Versal PCIe Management Driver provides management services,
+	  including download firmware, program bitstream, and communicate with
+	  the User function.
+
+	  If "M" is selected, the driver module will be versal-pci
drivers/accel/amd_vpci/Makefile new file +6 -0
new file mode 100644
index 000000000000..03849875ad0b
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-$(CONFIG_DRM_ACCEL_AMD_VPCI) := versal-pci.o
+
+versal-pci-y := \
+	versal-pci-main.o
drivers/accel/amd_vpci/versal-pci-main.c new file +279 -0

279 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH V1 2/5] accel/amd_vpci: Add new driver for AMD Versal PCI accelerator

Le 11/11/2025 à 02:15, David Zhang a écrit :

Quoted 25 lines

This patch introduces a new PCI driver for AMD Versal-based accelerator cards.

The driver provides basic module and PCI device initialization, based on BAR resources used to establish a hardware queue-based ring buffer between the PCIe host and the Versal Management Runtime (VMR) service running on the embedded SoC. This interface enables firmware management and board health monitoring.

Key features:
- PCI probe and BAR resource initialization.
- Integration with configfs for firmware management
- Compatibility check using firmware-reported UUIDs

The base firmware image is expected under /lib/firmware/xilinx/<fw_name> and can be programmed to the device through the configfs interface. Firmware transfer is handled via a remote queue service (added in a later patch).

---

...

drivers/accel/amd_vpci/versal-pci-main.c line 208

Quoted 12 lines
drivers/accel/amd_vpci/versal-pci-main.c new file +12 -0
+static int versal_pci_device_setup(struct versal_pci_device *vdev)
+{
+	int ret;
+
+	ret = versal_pci_fw_init(vdev);
+	if (ret) {
+		vdev_err(vdev, "Failed to init fw, err %d", ret);
+		goto comm_chan_fini;
+	}
+
+	ret = versal_pci_cfs_init(vdev);
+	if (ret) {

Do we need to call versal_pci_fw_fini()?
(here or in the error handling path to be future proof)

Quoted 10 lines
drivers/accel/amd_vpci/versal-pci-main.c new file +10 -0
+		vdev_err(vdev, "Failed to init configfs subsys, err %d", ret);
+		goto comm_chan_fini;
+	}
+
+	return 0;
+
+comm_chan_fini:
+
+	return ret;
+}

...

Quoted 13 lines
drivers/accel/amd_vpci/versal-pci.h new file +7 -0
new file mode 100644
index 000000000000..ca309aee87ad
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver for Versal PCIe device
+ *
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ */
+

drivers/accel/amd_vpci/versal-pci.h line 17

Quoted 10 lines
drivers/accel/amd_vpci/versal-pci.h new file +10 -0
+#ifndef __VERSAL_PCI_H
+#define __VERSAL_PCI_H
+
+#include <linux/configfs.h>
+#include <linux/firmware.h>
+
+#define MGMT_BAR		0
+
+#define vdev_info(vdev, fmt, args...)					\
+	dev_info(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)

\n could be added after fmt, as it is not included in the messages themselves, when used.

Same for the other macro below.

drivers/accel/amd_vpci/versal-pci.h line 26

Quoted 9 lines
drivers/accel/amd_vpci/versal-pci.h new file +9 -0
+
+#define vdev_warn(vdev, fmt, args...)					\
+	dev_warn(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)
+
+#define vdev_err(vdev, fmt, args...)					\
+	dev_err(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)
+
+#define vdev_dbg(vdev, fmt, args...)					\
+	dev_dbg(&(vdev)->pdev->dev, fmt, ##args)

...

CJ

#4 lore raw

Re: [PATCH V1 2/5] accel/amd_vpci: Add new driver for AMD Versal PCI accelerator

Hi Chris,

Quoted 81 lines · Christophe JAILLET

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 25 lines · David Zhang

This patch introduces a new PCI driver for AMD Versal-based accelerator cards.

The driver provides basic module and PCI device initialization, based on BAR resources used to establish a hardware queue-based ring buffer between the PCIe host and the Versal Management Runtime (VMR) service running on the embedded SoC. This interface enables firmware management and board health monitoring.

Key features:
    - PCI probe and BAR resource initialization.
    - Integration with configfs for firmware management
    - Compatibility check using firmware-reported UUIDs

The base firmware image is expected under /lib/firmware/xilinx/<fw_name> and can be programmed to the device through the configfs interface. Firmware transfer is handled via a remote queue service (added in a later patch).

---

...

drivers/accel/amd_vpci/versal-pci-main.c line 208

Quoted 12 lines
drivers/accel/amd_vpci/versal-pci-main.c new file +12 -0
+static int versal_pci_device_setup(struct versal_pci_device *vdev)
+{
+     int ret;
+
+     ret = versal_pci_fw_init(vdev);
+     if (ret) {
+             vdev_err(vdev, "Failed to init fw, err %d", ret);
+             goto comm_chan_fini;
+     }
+
+     ret = versal_pci_cfs_init(vdev);
+     if (ret) {

Do we need to call versal_pci_fw_fini()?
(here or in the error handling path to be future proof)

Quoted 11 lines

+             vdev_err(vdev, "Failed to init configfs subsys, err %d", ret);
+             goto comm_chan_fini;
+     }

drivers/accel/amd_vpci/versal-pci-main.c new file +7 -0
+
+     return 0;
+
+comm_chan_fini:
+
+     return ret;
+}

...

Quoted 19 lines
drivers/accel/amd_vpci/versal-pci.h new file +13 -0
new file mode 100644
index 000000000000..ca309aee87ad
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver for Versal PCIe device
+ *
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ */
+
+#ifndef __VERSAL_PCI_H
+#define __VERSAL_PCI_H
+
+#include <linux/configfs.h>
+#include <linux/firmware.h>
+
Quoted 8 lines
Quoted 5 lines
drivers/accel/amd_vpci/versal-pci.h new file +3 -0
+#define MGMT_BAR             0
+
+#define vdev_info(vdev, fmt, 

args...)                                        \
+     dev_info(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)

\n could be added after fmt, as it is not included in the messages themselves, when used.

I tested this with "\n" on latest linux kernel, it will give us one extra line. I think latest linux has no need to add this extra "\n" anymore.

Meanwhile, I will address all your other comments and also update the copyright to 2026.

Happy new year to everyone!

Thanks,
David

Quoted 17 lines

Same for the other macro below.

drivers/accel/amd_vpci/versal-pci.h line 26

Quoted 10 lines
drivers/accel/amd_vpci/versal-pci.h new file +2 -0
+
+#define vdev_warn(vdev, fmt, 

args...)                                        \
+     dev_warn(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)

drivers/accel/amd_vpci/versal-pci.h new file +6 -0
+
+#define vdev_err(vdev, fmt, args...)                                 \
+     dev_err(&(vdev)->pdev->dev, "%s: "fmt, __func__, ##args)
+
+#define vdev_dbg(vdev, fmt, args...)                                 \
+     dev_dbg(&(vdev)->pdev->dev, fmt, ##args)

...

CJ

#5 lore raw

PATCH 3/5 accel/amd_vpci: Add Remote Management(RM) queue infrastructure

In reply to David Zhang

This patch introduces a Remote Management (RM) queue service, which provides a way to communicate between the management PCIe function (PF0) and the embedded firmware running on AMD Versal SoCs.

The RM service implements a hardware-based ring buffer for bidirectional command and response exchange between the host driver and the firmware.

This patch adds the core infrastructure for:
- Initializing and managing the RM queue
- Submitting commands to the embedded firmware
- Polling for command completion

Subsequent patches will integrate the infrastructure with the firmware management logic to enable firmware download, status query, and other control operations.

---
 drivers/accel/amd_vpci/Makefile               |   3 +-
 drivers/accel/amd_vpci/versal-pci-rm-queue.c  | 316 ++++++++++++++++++
 drivers/accel/amd_vpci/versal-pci-rm-queue.h  |  21 ++
 .../accel/amd_vpci/versal-pci-rm-service.h    | 209 ++++++++++++
 drivers/accel/amd_vpci/versal-pci.h           |   1 +
 5 files changed, 549 insertions(+), 1 deletion(-)
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-queue.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-queue.h
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-service.h
drivers/accel/amd_vpci/Makefile +2 -1
index 03849875ad0b..9e4e56ac2dee 100644
@@ -3,4 +3,5 @@
 obj-$(CONFIG_DRM_ACCEL_AMD_VPCI) := versal-pci.o
 
 versal-pci-y := \
-	versal-pci-main.o
+	versal-pci-main.o \
+	versal-pci-rm-queue.o
drivers/accel/amd_vpci/versal-pci-rm-queue.c new file +316 -0

316 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci-rm-queue.h new file +21 -0
new file mode 100644
index 000000000000..d5d991704d5c
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver for Versal PCIe device
+ *
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ */
+
+#ifndef __RM_QUEUE_H
+#define __RM_QUEUE_H
+
+struct rm_device;
+
+/* rm queue hardware setup */
+int rm_queue_init(struct rm_device *rdev);
+void rm_queue_fini(struct rm_device *rdev);
+
+/* rm queue common API */
+int rm_queue_send_cmd(struct rm_cmd *cmd, unsigned long timeout);
+void rm_queue_withdraw_cmd(struct rm_cmd *cmd);
+
+#endif	/* __RM_QUEUE_H */
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +209 -0

209 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci.h +1 -0
index ca309aee87ad..33f0ef881a33 100644
@@ -26,6 +26,7 @@
 	dev_dbg(&(vdev)->pdev->dev, fmt, ##args)
 
 struct versal_pci_device;
+struct rm_cmd;
 
 struct axlf_header {
 	__u64				length;
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH V1 3/5] accel/amd_vpci: Add Remote Management(RM) queue infrastructure

Le 11/11/2025 à 02:15, David Zhang a écrit :

Quoted 19 lines

This patch introduces a Remote Management (RM) queue service, which provides a way to communicate between the management PCIe function (PF0) and the embedded firmware running on AMD Versal SoCs.

The RM service implements a hardware-based ring buffer for bidirectional command and response exchange between the host driver and the firmware.

This patch adds the core infrastructure for:
- Initializing and managing the RM queue
- Submitting commands to the embedded firmware
- Polling for command completion

Subsequent patches will integrate the infrastructure with the firmware management logic to enable firmware download, status query, and other control operations.

...

Quoted 5 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +0 -0
new file mode 100644
index 000000000000..d2397a1a672c

...

drivers/accel/amd_vpci/versal-pci-rm-service.h line 30

Quoted 7 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +7 -0
+#define RM_CMD_ID_MIN			1
+#define RM_CMD_ID_MAX			(BIT(17) - 1)
+#define RM_CMD_SQ_HDR_OPS_MSK		GENMASK(15, 0)
+#define RM_CMD_SQ_HDR_SIZE_MSK		GENMASK(14, 0)
+#define RM_CMD_SQ_SLOT_SIZE		SZ_512
+#define RM_CMD_CQ_SLOT_SIZE		SZ_16
+#define RM_CMD_CQ_BUFFER_SIZE		(1024 * 1024)

SZ_1M to be consistent with other xx_SIZE macro?

drivers/accel/amd_vpci/versal-pci-rm-service.h line 37

Quoted 7 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +7 -0
+#define RM_CMD_CQ_BUFFER_OFFSET		0x0
+#define RM_CMD_LOG_PAGE_TYPE_MASK	GENMASK(15, 0)
+#define RM_CMD_VMR_CONTROL_MSK		GENMASK(10, 8)
+#define RM_CMD_VMR_CONTROL_PS_MASK	BIT(9)
+
+#define RM_CMD_WAIT_CONFIG_TIMEOUT	msecs_to_jiffies(10 * 1000)
+#define RM_CMD_WAIT_DOWNLOAD_TIMEOUT	msecs_to_jiffies(300 * 1000)

secs_to_jiffies() maybe to be less verbose?

drivers/accel/amd_vpci/versal-pci-rm-service.h line 40

Quoted 3 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +3 -0
+
+#define RM_COMPLETION_TIMER		(HZ / 10)
+#define RM_HEALTH_CHECK_TIMER		(HZ)

...

CJ

#7 lore raw

Re: [PATCH V1 3/5] accel/amd_vpci: Add Remote Management(RM) queue infrastructure

Quoted 34 lines · Christophe JAILLET

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 19 lines · David Zhang

This patch introduces a Remote Management (RM) queue service, which provides a way to communicate between the management PCIe function (PF0) and the embedded firmware running on AMD Versal SoCs.

The RM service implements a hardware-based ring buffer for bidirectional command and response exchange between the host driver and the firmware.

This patch adds the core infrastructure for:
   - Initializing and managing the RM queue
   - Submitting commands to the embedded firmware
   - Polling for command completion

Subsequent patches will integrate the infrastructure with the firmware management logic to enable firmware download, status query, and other control operations.

...

Quoted 5 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +0 -0
new file mode 100644
index 000000000000..d2397a1a672c

...

Quoted 9 lines

drivers/accel/amd_vpci/versal-pci-rm-service.h line 30

Quoted 7 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +7 -0
+#define RM_CMD_ID_MIN                        1
+#define RM_CMD_ID_MAX                        (BIT(17) - 1)
+#define RM_CMD_SQ_HDR_OPS_MSK                GENMASK(15, 0)
+#define RM_CMD_SQ_HDR_SIZE_MSK               GENMASK(14, 0)
+#define RM_CMD_SQ_SLOT_SIZE          SZ_512
+#define RM_CMD_CQ_SLOT_SIZE          SZ_16
+#define RM_CMD_CQ_BUFFER_SIZE                (1024 * 1024)

SZ_1M to be consistent with other xx_SIZE macro?

Thank you so much. I will fix this.

Quoted 10 lines

drivers/accel/amd_vpci/versal-pci-rm-service.h line 37

Quoted 8 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +7 -0
+#define RM_CMD_CQ_BUFFER_OFFSET              0x0
+#define RM_CMD_LOG_PAGE_TYPE_MASK    GENMASK(15, 0)
+#define RM_CMD_VMR_CONTROL_MSK               GENMASK(10, 8)
+#define RM_CMD_VMR_CONTROL_PS_MASK   BIT(9)
+
+#define RM_CMD_WAIT_CONFIG_TIMEOUT   msecs_to_jiffies(10 * 1000)
+#define RM_CMD_WAIT_DOWNLOAD_TIMEOUT msecs_to_jiffies(300 * 1000)

secs_to_jiffies() maybe to be less verbose?

I will fix this.

Quoted 8 lines

drivers/accel/amd_vpci/versal-pci-rm-service.h line 40

Quoted 4 lines
drivers/accel/amd_vpci/versal-pci-rm-service.h new file +3 -0
+
+#define RM_COMPLETION_TIMER          (HZ / 10)
+#define RM_HEALTH_CHECK_TIMER                (HZ)

...

CJ

#8 lore raw

PATCH 4/5 accel/amd_vpci: Add Remote Management (RM) queue service APIs

In reply to David Zhang

This patch introduces a set of APIs for allowing the PCIe driver submit commands, transfer binary payloads and retrieve firmware metadata.

Key features:
- RM queue command APIs:
- create and destroy RM queue commands
- Initialized command data payloads
- Send and poll for command completion
- Service-level operations:
- Retrieve firmware ID
- Program accelerator and APU firmware images
- Periodic health monitoring

---
 drivers/accel/amd_vpci/Makefile               |   3 +-
 drivers/accel/amd_vpci/versal-pci-main.c      |  43 +-
 drivers/accel/amd_vpci/versal-pci-rm-queue.c  |  14 +-
 .../accel/amd_vpci/versal-pci-rm-service.c    | 497 ++++++++++++++++++
 .../accel/amd_vpci/versal-pci-rm-service.h    |  20 +
 drivers/accel/amd_vpci/versal-pci.h           |   1 +
 6 files changed, 567 insertions(+), 11 deletions(-)
 create mode 100644 drivers/accel/amd_vpci/versal-pci-rm-service.c
drivers/accel/amd_vpci/Makefile +2 -1
index 9e4e56ac2dee..bacd305783dd 100644
@@ -4,4 +4,5 @@ obj-$(CONFIG_DRM_ACCEL_AMD_VPCI) := versal-pci.o
 
 versal-pci-y := \
 	versal-pci-main.o \
-	versal-pci-rm-queue.o
+	versal-pci-rm-queue.o \
+	versal-pci-rm-service.o
drivers/accel/amd_vpci/versal-pci-main.c +41 -2

85 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci-rm-queue.c +6 -8
index e67c506af752..623ec4472f17 100644
@@ -23,37 +23,35 @@ static inline struct rm_device *to_rdev_msg_timer(struct timer_list *t)
 
 static inline u32 rm_io_read(struct rm_device *rdev, u32 offset)
 {
-	/* TODO */
-	return 0;
+	return rm_reg_read(rdev, RM_PCI_IO_BAR_OFF + offset);
 }
 
 static inline int rm_io_write(struct rm_device *rdev, u32 offset, u32 value)
 {
-	/* TODO */
+	rm_reg_write(rdev, RM_PCI_IO_BAR_OFF + offset, value);
 	return 0;
 }
 
 static inline u32 rm_queue_read(struct rm_device *rdev, u32 offset)
 {
-	/* TODO */
-	return 0;
+	return rm_reg_read(rdev, RM_PCI_SHMEM_BAR_OFF + rdev->queue_base + offset);
 }
 
 static inline void rm_queue_write(struct rm_device *rdev, u32 offset, u32 value)
 {
-	/* TODO */
+	rm_reg_write(rdev, RM_PCI_SHMEM_BAR_OFF + rdev->queue_base + offset, value);
 }
 
 static inline void rm_queue_bulk_read(struct rm_device *rdev, u32 offset,
 				      u32 *value, u32 size)
 {
-	/* TODO */
+	rm_bulk_reg_read(rdev, RM_PCI_SHMEM_BAR_OFF + rdev->queue_base + offset, value, size);
 }
 
 static inline void rm_queue_bulk_write(struct rm_device *rdev, u32 offset,
 				       u32 *value, u32 size)
 {
-	/* TODO */
+	rm_bulk_reg_write(rdev, RM_PCI_SHMEM_BAR_OFF + rdev->queue_base + offset, value, size);
 }
 
 static inline u32 rm_queue_get_cidx(struct rm_device *rdev, enum rm_queue_type type)
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +497 -0

497 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci-rm-service.h +20 -0
index d2397a1a672c..57333bb1443c 100644
@@ -206,4 +206,24 @@ struct rm_device {
 	__u32			firewall_tripped;
 };
 
+/* rm service init api */
+struct rm_device *versal_pci_rm_init(struct versal_pci_device *vdev);
+void versal_pci_rm_fini(struct rm_device *rdev);
+
+/* rm services APIs */
+int rm_queue_create_cmd(struct rm_device *rdev, enum rm_queue_opcode opcode,
+			struct rm_cmd **cmd_ptr);
+void rm_queue_destroy_cmd(struct rm_cmd *cmd);
+
+int rm_queue_data_init(struct rm_cmd *cmd, const char *buffer, ssize_t size);
+void rm_queue_data_fini(struct rm_cmd *cmd);
+int rm_queue_get_fw_id(struct rm_device *rdev);
+int rm_queue_boot_apu(struct rm_device *rdev);
+
+/* rm bar register operation APIs */
+u32 rm_reg_read(struct rm_device *rdev, u32 offset);
+void rm_reg_write(struct rm_device *rdev, u32 offset, const u32 value);
+void rm_bulk_reg_read(struct rm_device *rdev, u32 offset, u32 *value, size_t size);
+void rm_bulk_reg_write(struct rm_device *rdev, u32 offset, const void *value, size_t size);
+
 #endif	/* __RM_SERVICE_H */
drivers/accel/amd_vpci/versal-pci.h +1 -0
index 33f0ef881a33..89f3590137ce 100644
@@ -51,6 +51,7 @@ struct fw_info {
 struct versal_pci_device {
 	struct pci_dev			*pdev;
 
+	struct rm_device		*rdev;
 	struct fw_info			fw;
 
 	void __iomem			*io_regs;
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH V1 4/5] accel/amd_vpci: Add Remote Management (RM) queue service APIs

Le 11/11/2025 à 02:15, David Zhang a écrit :

Quoted 16 lines

This patch introduces a set of APIs for allowing the PCIe driver submit commands, transfer binary payloads and retrieve firmware metadata.

Key features:
- RM queue command APIs:
- create and destroy RM queue commands
- Initialized command data payloads
- Send and poll for command completion
- Service-level operations:
- Retrieve firmware ID
- Program accelerator and APU firmware images
- Periodic health monitoring

...

Quoted 31 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +31 -0
+static void rm_check_health(struct work_struct *w)
+{
+	struct rm_device *rdev = to_rdev_health_monitor(w);
+	u32 max_len = PAGE_SIZE;
+	struct rm_cmd *cmd;
+	int ret;
+
+	ret = rm_queue_create_cmd(rdev, RM_QUEUE_OP_GET_LOG_PAGE, &cmd);
+	if (ret)
+		return;
+
+	ret = rm_queue_payload_init(cmd, RM_CMD_LOG_PAGE_AXI_TRIP_STATUS);
+	if (ret)
+		goto destroy_cmd;
+
+	ret = rm_queue_send_cmd(cmd, RM_CMD_WAIT_CONFIG_TIMEOUT);
+	if (ret == -ETIME || ret == -EINVAL)
+		goto payload_fini;
+
+	if (ret) {
+		u32 log_len = cmd->cq_msg.data.page.len;
+
+		if (log_len > max_len) {
+			vdev_warn(rdev->vdev, "msg size %d is greater than requested %d",
+				  log_len, max_len);
+			log_len = max_len;
+		}
+
+		if (log_len) {
+			char *buffer = vzalloc(log_len);
+

drivers/accel/amd_vpci/versal-pci-rm-service.c line 355

Quoted 10 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +10 -0
+			if (!buffer)
+				goto payload_fini;
+
+			ret = rm_queue_copy_response(cmd, buffer, log_len);
+			if (ret) {
+				vfree(buffer);
+				goto payload_fini;
+			}
+
+			vdev_err(rdev->vdev, "%s", buffer);

This looks like the normal path. is vdev_err() expected here?

Quoted 16 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +16 -0
+			vfree(buffer);
+
+		} else {
+			vdev_err(rdev->vdev, "firewall check ret%d", ret);
+		}
+
+		rdev->firewall_tripped = 1;
+	}
+
+payload_fini:
+	rm_queue_payload_fini(cmd);
+destroy_cmd:
+	rm_queue_destroy_cmd(cmd);
+
+	vdev_dbg(rdev->vdev, "check result: %d", ret);
+}

...

Quoted 14 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +14 -0
+struct rm_device *versal_pci_rm_init(struct versal_pci_device *vdev)
+{
+	struct rm_header *header;
+	struct rm_device *rdev;
+	u32 status;
+	int ret;
+
+	rdev = devm_kzalloc(&vdev->pdev->dev, sizeof(*rdev), GFP_KERNEL);
+	if (!rdev)
+		return ERR_PTR(-ENOMEM);
+
+	rdev->vdev = vdev;
+	header = &rdev->rm_metadata;
+

drivers/accel/amd_vpci/versal-pci-rm-service.c line 429

Quoted 10 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +10 -0
+	rm_shmem_bulk_read(rdev, RM_HDR_OFF, (u32 *)header, sizeof(*header));
+	if (header->magic != RM_HDR_MAGIC_NUM) {
+		vdev_err(vdev, "Invalid RM header 0x%x", header->magic);
+		ret = -ENODEV;
+		goto err;
+	}
+
+	status = rm_shmem_read(rdev, header->status_off);
+	if (!status) {
+		vdev_err(vdev, "RM status %d is not ready", status);

This can be simplified, status is knwon to be 0.

drivers/accel/amd_vpci/versal-pci-rm-service.c line 425

Quoted 3 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +3 -0
+		ret = -ENODEV;
+		goto err;
+	}

...

CJ

#10 lore raw

Re: [PATCH V1 4/5] accel/amd_vpci: Add Remote Management (RM) queue service APIs

Quoted 59 lines · Christophe JAILLET

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 16 lines · David Zhang

This patch introduces a set of APIs for allowing the PCIe driver submit commands, transfer binary payloads and retrieve firmware metadata.

Key features:
- RM queue command APIs:
   - create and destroy RM queue commands
   - Initialized command data payloads
   - Send and poll for command completion
- Service-level operations:
   - Retrieve firmware ID
   - Program accelerator and APU firmware images
   - Periodic health monitoring

...

Quoted 36 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +24 -0
+static void rm_check_health(struct work_struct *w)
+{
+     struct rm_device *rdev = to_rdev_health_monitor(w);
+     u32 max_len = PAGE_SIZE;
+     struct rm_cmd *cmd;
+     int ret;
+
+     ret = rm_queue_create_cmd(rdev, RM_QUEUE_OP_GET_LOG_PAGE, &cmd);
+     if (ret)
+             return;
+
+     ret = rm_queue_payload_init(cmd, RM_CMD_LOG_PAGE_AXI_TRIP_STATUS);
+     if (ret)
+             goto destroy_cmd;
+
+     ret = rm_queue_send_cmd(cmd, RM_CMD_WAIT_CONFIG_TIMEOUT);
+     if (ret == -ETIME || ret == -EINVAL)
+             goto payload_fini;
+
+     if (ret) {
+             u32 log_len = cmd->cq_msg.data.page.len;
+
+             if (log_len > max_len) {
+                     vdev_warn(rdev->vdev, "msg size %d is greater 

than requested %d",
+                               log_len, max_len); +                     log_len = max_len;
+             }

drivers/accel/amd_vpci/versal-pci-rm-service.c new file +8 -0
+
+             if (log_len) {
+                     char *buffer = vzalloc(log_len);
+
+                     if (!buffer)
+                             goto payload_fini;
+
+                     ret = rm_queue_copy_response(cmd, buffer, log_len);
Quoted 8 lines
Quoted 6 lines

+                     if (ret) {
+                             vfree(buffer);
+                             goto payload_fini; +                     }
+
+                     vdev_err(rdev->vdev, "%s", buffer);

This looks like the normal path. is vdev_err() expected here?

This is the detail info when log_len is not 0, thus err log is expected.

Quoted 39 lines
Quoted 17 lines

+                     vfree(buffer);

drivers/accel/amd_vpci/versal-pci-rm-service.c new file +15 -0
+
+             } else {
+                     vdev_err(rdev->vdev, "firewall check ret%d", ret);
+             }
+
+             rdev->firewall_tripped = 1;
+     }
+
+payload_fini:
+     rm_queue_payload_fini(cmd);
+destroy_cmd:
+     rm_queue_destroy_cmd(cmd);
+
+     vdev_dbg(rdev->vdev, "check result: %d", ret);
+}

...

Quoted 19 lines
drivers/accel/amd_vpci/versal-pci-rm-service.c new file +15 -0
+struct rm_device *versal_pci_rm_init(struct versal_pci_device *vdev)
+{
+     struct rm_header *header;
+     struct rm_device *rdev;
+     u32 status;
+     int ret;
+
+     rdev = devm_kzalloc(&vdev->pdev->dev, sizeof(*rdev), GFP_KERNEL);
+     if (!rdev)
+             return ERR_PTR(-ENOMEM);
+
+     rdev->vdev = vdev;
+     header = &rdev->rm_metadata;
+
+     rm_shmem_bulk_read(rdev, RM_HDR_OFF, (u32 *)header, 

sizeof(*header));
+     if (header->magic != RM_HDR_MAGIC_NUM) {
+             vdev_err(vdev, "Invalid RM header 0x%x", header->magic); +             ret = -ENODEV;

Quoted 8 lines
Quoted 6 lines

+             goto err;
+     }
+
+     status = rm_shmem_read(rdev, header->status_off); +     if (!status) {
+             vdev_err(vdev, "RM status %d is not ready", status);

This can be simplified, status is knwon to be 0.

Yes, I will fix this.

Quoted 8 lines
Quoted 4 lines

+             ret = -ENODEV;
+             goto err;
+     }

...

CJ

#11 lore raw

PATCH 5/5 accel/amd_vpci: Add communication channel service

In reply to David Zhang

This patch introduces the communication channel (comm_chan) service, which enables communication between the management PF driver and the user PF driver.

The comm_chan service provides a shared-memory-based command channel located in a BAR-mapped region. The user PF driver issues requests by writing command messages into this region. The management PF driver periodically polls the region and process any pending requests.

Supported operations include firmware (xclbin) reloads, where the management PF invokes 'versal_pci_load_xclbin' to reprogram the embedded firmware through the remote management queue service.

This service provides the foundation for dynamic firmware updates and other management requests from the user PFs.

---
 drivers/accel/amd_vpci/Makefile               |   3 +-
 drivers/accel/amd_vpci/versal-pci-comm-chan.c | 295 ++++++++++++++++++
 drivers/accel/amd_vpci/versal-pci-comm-chan.h |  14 +
 drivers/accel/amd_vpci/versal-pci-main.c      |  78 ++++-
 drivers/accel/amd_vpci/versal-pci.h           |   6 +
 5 files changed, 394 insertions(+), 2 deletions(-)
 create mode 100644 drivers/accel/amd_vpci/versal-pci-comm-chan.c
 create mode 100644 drivers/accel/amd_vpci/versal-pci-comm-chan.h
drivers/accel/amd_vpci/Makefile +2 -1
index bacd305783dd..8adfde3490fd 100644
@@ -5,4 +5,5 @@ obj-$(CONFIG_DRM_ACCEL_AMD_VPCI) := versal-pci.o
 versal-pci-y := \
 	versal-pci-main.o \
 	versal-pci-rm-queue.o \
-	versal-pci-rm-service.o
+	versal-pci-rm-service.o \
+	versal-pci-comm-chan.o
drivers/accel/amd_vpci/versal-pci-comm-chan.c new file +295 -0

295 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci-comm-chan.h new file +14 -0
new file mode 100644
index 000000000000..6699c337901b
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Driver for Versal PCIe device
+ *
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ */
+
+#ifndef __VERSAL_PCI_COMM_CHAN_H
+#define __VERSAL_PCI_COMM_CHAN_H
+
+struct comm_chan_device *versal_pci_comm_chan_init(struct versal_pci_device *vdev);
+void versal_pci_comm_chan_fini(struct comm_chan_device *ccdev);
+
+#endif	/* __VERSAL_PCI_COMM_CHAN_H */
drivers/accel/amd_vpci/versal-pci-main.c +77 -1

117 lines not on this page · raw message

drivers/accel/amd_vpci/versal-pci.h +6 -0
index 89f3590137ce..a9b55b2759a7 100644
@@ -26,6 +26,7 @@
 	dev_dbg(&(vdev)->pdev->dev, fmt, ##args)
 
 struct versal_pci_device;
+struct comm_chan_device;
 struct rm_cmd;
 
 struct axlf_header {
@@ -52,13 +53,18 @@ struct versal_pci_device {
 	struct pci_dev			*pdev;
 
 	struct rm_device		*rdev;
+	struct comm_chan_device         *ccdev;
 	struct fw_info			fw;
 
 	void __iomem			*io_regs;
+	uuid_t				xclbin_uuid;
 	uuid_t				intf_uuid;
 	__u8				fw_id[UUID_STRING_LEN + 1];
 
 	struct configfs_subsystem	cfs_subsys;
 };
 
+/* versal pci driver APIs */
+int versal_pci_load_xclbin(struct versal_pci_device *vdev, uuid_t *xclbin_uuid);
+
 #endif	/* __VERSAL_PCI_H */
Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH V1 5/5] accel/amd_vpci: Add communication channel service

Le 11/11/2025 à 02:15, David Zhang a écrit :

Quoted 19 lines

This patch introduces the communication channel (comm_chan) service, which enables communication between the management PF driver and the user PF driver.

The comm_chan service provides a shared-memory-based command channel located in a BAR-mapped region. The user PF driver issues requests by writing command messages into this region. The management PF driver periodically polls the region and process any pending requests.

Supported operations include firmware (xclbin) reloads, where the management PF invokes 'versal_pci_load_xclbin' to reprogram the embedded firmware through the remote management queue service.

This service provides the foundation for dynamic firmware updates and other management requests from the user PFs.

...

drivers/accel/amd_vpci/versal-pci-main.c static const struct config_item_type versal_pci_cfs_table = { · line 225

Quoted 5 lines
drivers/accel/amd_vpci/versal-pci-main.c +1 -0
@@ -160,10 +222,13 @@ static const struct config_item_type versal_pci_cfs_table = {
  static int versal_pci_cfs_init(struct versal_pci_device *vdev)
  {
  	struct configfs_subsystem *subsys = &vdev->cfs_subsys;
+	char dev_name[64] = "";

No need to init I think.

drivers/accel/amd_vpci/versal-pci-main.c static const struct config_item_type versal_pci_cfs_table = { · line 227

Quoted 2 lines
drivers/accel/amd_vpci/versal-pci-main.c +2 -0
+
+	snprintf(dev_name, sizeof(dev_name), "%s%x", DRV_NAME, versal_pci_devid(vdev));

This hunk could already be in patch 1. This would make this patch smaller.

Quoted 8 lines
drivers/accel/amd_vpci/versal-pci-main.c +1 -1
  	snprintf(subsys->su_group.cg_item.ci_namebuf,
  		 sizeof(subsys->su_group.cg_item.ci_namebuf),
-		 "%s%x", DRV_NAME, versal_pci_devid(vdev));
+		 "%s", dev_name);
 
  	subsys->su_group.cg_item.ci_type = &versal_pci_cfs_table;
 

...

#13 lore raw

Re: [PATCH V1 5/5] accel/amd_vpci: Add communication channel service

Quoted 26 lines · Christophe JAILLET

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 19 lines · David Zhang

This patch introduces the communication channel (comm_chan) service, which enables communication between the management PF driver and the user PF driver.

The comm_chan service provides a shared-memory-based command channel located in a BAR-mapped region. The user PF driver issues requests by writing command messages into this region. The management PF driver periodically polls the region and process any pending requests.

Supported operations include firmware (xclbin) reloads, where the management PF invokes 'versal_pci_load_xclbin' to reprogram the embedded firmware through the remote management queue service.

This service provides the foundation for dynamic firmware updates and other management requests from the user PFs.

...

Quoted 9 lines

drivers/accel/amd_vpci/versal-pci-main.c static const struct config_item_type · line 226

Quoted 6 lines
drivers/accel/amd_vpci/versal-pci-main.c +1 -0
@@ -160,10 +222,13 @@ static const struct config_item_type 
 versal_pci_cfs_table = {
   static int versal_pci_cfs_init(struct versal_pci_device *vdev)
   {
       struct configfs_subsystem *subsys = &vdev->cfs_subsys;
+     char dev_name[64] = "";

No need to init I think.

Ok, I will fix this.

Quoted 16 lines

Review static const struct config_item_type · line 229

Quoted 3 lines
(quoted diff) +2 -0
+
+     snprintf(dev_name, sizeof(dev_name), "%s%x", DRV_NAME, 
 versal_pci_devid(vdev));

This hunk could already be in patch 1. This would make this patch smaller.

Quoted 8 lines
drivers/accel/amd_vpci/versal-pci-main.c +1 -1
       snprintf(subsys->su_group.cg_item.ci_namebuf,
                sizeof(subsys->su_group.cg_item.ci_namebuf),
-              "%s%x", DRV_NAME, versal_pci_devid(vdev));
+              "%s", dev_name);
 
       subsys->su_group.cg_item.ci_type = &versal_pci_cfs_table;

...