[PATCH RESEND v5 1/2] dmaengine: dw-edma: Enable Chan Separation via VSEC

From: Devendra K Verma

Date: Mon Sep 07 2026 - 06:22:36 EST


As per, 'Designware Cores PCI Express DM Controller - Reference
Manual', section 3.2.34.3, VSEC for DEVICE INFORMATION supports
the channel separation mechanisms. Basically, the HDMA IP allows
the user to configure the separation between DMA channel
registers and retrieve it via the VSEC capability mentioned
above.

HDMA IP supports the channel register space separation from
256B to 32KB. Default supported size is 256B.

Signed-off-by: Devendra K Verma <devverma@xxxxxxx>
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
---
Changes in v4:
o No change

Changes in v3:
o Reverted the trivial changes / typos.

Changes in v2:
o Replaced 'ch_sep_sz' with 'ch_space_sz' wherever
applicable upon reviewer recommendation.
o Dropped 1/3 patch of this series, after review,
now the 2/3 is 1/2 of the current patch series.

Changes in v1:
o Modified dw_edma_get_ch_sep_sz() as per review comment.
The function now supports ch_sep_sz up to 32KB.
o Updated to description to reflect the supported channel
separation sizes.
---
drivers/dma/dw-edma/dw-edma-pcie.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
index 9f237ba916de..07931b181785 100644
--- a/drivers/dma/dw-edma/dw-edma-pcie.c
+++ b/drivers/dma/dw-edma/dw-edma-pcie.c
@@ -33,6 +33,8 @@
#define DW_PCIE_XILINX_MDB_VSEC_ID 0x20
#define DW_PCIE_XILINX_MDB_VSEC_DMA_BAR GENMASK(10, 8)
#define DW_PCIE_XILINX_MDB_VSEC_DMA_MAP GENMASK(2, 0)
+/* AMD CPM6 (Xilinx) supported cap */
+#define DW_PCIE_XILINX_CPM6_VSEC_CH_SEP GENMASK(18, 16)
#define DW_PCIE_XILINX_MDB_VSEC_DMA_WR_CH GENMASK(9, 0)
#define DW_PCIE_XILINX_MDB_VSEC_DMA_RD_CH GENMASK(25, 16)

@@ -76,6 +78,7 @@ struct dw_edma_pcie_data {
u16 rd_ch_cnt;
u64 devmem_phys_off;
bool cfg_non_ll;
+ u32 ch_space_sz;
};

struct dw_edma_pcie_match_data {
@@ -208,6 +211,13 @@ static int dw_edma_pcie_irq_vector(struct device *dev, unsigned int nr)
return pci_irq_vector(to_pci_dev(dev), nr);
}

+static u32 dw_edma_get_ch_space_sz(u32 val)
+{
+ if (val > 0 && val <= 7)
+ return 256 << val;
+ return 256;
+}
+
static u64 dw_edma_pcie_address(struct device *dev, phys_addr_t cpu_addr)
{
struct pci_dev *pdev = to_pci_dev(dev);
@@ -298,6 +308,10 @@ static void dw_edma_pcie_get_xilinx_dma_data(struct pci_dev *pdev,
pdata->mf = map;
pdata->rg.bar = FIELD_GET(DW_PCIE_XILINX_MDB_VSEC_DMA_BAR, val);

+ if (pdev->device == PCI_DEVICE_ID_XILINX_B00F)
+ pdata->ch_space_sz = dw_edma_get_ch_space_sz
+ (FIELD_GET(DW_PCIE_XILINX_CPM6_VSEC_CH_SEP, val));
+
pci_read_config_dword(pdev, vsec + 0xc, &val);
pdata->wr_ch_cnt = min(pdata->wr_ch_cnt,
FIELD_GET(DW_PCIE_XILINX_MDB_VSEC_DMA_WR_CH, val));
--
2.43.0