The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: "Verma, Devendra" <devverma@amd.com>
Cc: mani@kernel.org, vkoul@kernel.org, frank.li@kernel.org,
	den@valinux.co.jp, dmaengine@vger.kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	michal.simek@amd.com
Subject: Re: [PATCH v2 1/3] dmaengine: dw-edma: Make Xilinx Macros Dev Name Agnostic
Date: Tue, 4 Aug 2026 17:43:14 -0500	[thread overview]
Message-ID: <anJrAuO4Kh2Q2L9B@SMW015318> (raw)
In-Reply-To: <c771a891-8924-410c-8495-eb91304531c2@amd.com>

On Mon, Aug 03, 2026 at 05:45:14PM +0530, Verma, Devendra wrote:
>
> On 01-Aug-26 00:50, Frank Li wrote:
> > On Fri, Jul 31, 2026 at 09:54:01PM +0530, Verma, Devendra wrote:
> > >
> > >
> > > On 28-Jul-26 21:01, Frank Li wrote:
> > > > On Tue, Jul 28, 2026 at 02:47:42PM +0530, Devendra K Verma wrote:
> > > > > Xilinx specific macros for MDB device can be reused for the
> > > > > Xilinx supported other similar IP such as CPM6.
> > > > > Renamed the Xilinx specific macros in a way that can be
> > > > > reused for Xilinx supported upcoming IP, CPM6.
> > > > > Naming is in accordance with the naming done for Synopsys macros.
> > > > >
> > > > > Signed-off-by: Devendra K Verma <devverma@amd.com>
> > > > > ---
> > > > > Changes in v1:
> > > > >      o No change
> > > > > ---
> > > > >    drivers/dma/dw-edma/dw-edma-pcie.c | 58 +++++++++++++++---------------
> > > > >    1 file changed, 29 insertions(+), 29 deletions(-)
> > > > >
> > > > > diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c
> > > > > index 791c46e8ae4c..ec5e057a0f11 100644
> > > > > --- a/drivers/dma/dw-edma/dw-edma-pcie.c
> > > > > +++ b/drivers/dma/dw-edma/dw-edma-pcie.c
> > > > > @@ -29,21 +29,21 @@
> > > > >    #define PCI_DEVICE_ID_XILINX_B054		0xb054
> > > > >    #define PCI_DEVICE_ID_XILINX_B00F		0xb00f
> > > > >
> > > > > -#define DW_PCIE_XILINX_MDB_VSEC_DMA_ID		0x6
> > > > > -#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)
> > > > > -#define DW_PCIE_XILINX_MDB_VSEC_DMA_WR_CH	GENMASK(9, 0)
> > > > > -#define DW_PCIE_XILINX_MDB_VSEC_DMA_RD_CH	GENMASK(25, 16)
> > > > > -
> > > > > -#define DW_PCIE_XILINX_MDB_DEVMEM_OFF_REG_HIGH	0xc
> > > > > -#define DW_PCIE_XILINX_MDB_DEVMEM_OFF_REG_LOW	0x8
> > > > > -#define DW_PCIE_XILINX_MDB_INVALID_ADDR		(~0ULL)
> > > > > -
> > > > > -#define DW_PCIE_XILINX_MDB_LL_OFF_GAP		0x200000
> > > > > -#define DW_PCIE_XILINX_MDB_LL_SIZE		0x800
> > > > > -#define DW_PCIE_XILINX_MDB_DT_OFF_GAP		0x100000
> > > > > -#define DW_PCIE_XILINX_MDB_DT_SIZE		0x800
> > > > > +#define DW_PCIE_XILINX_VSEC_DMA_ID		0x6
> > > > > +#define DW_PCIE_XILINX_VSEC_ID			0x20
> > > > > +#define DW_PCIE_XILINX_VSEC_DMA_BAR		GENMASK(10, 8)
> > > > > +#define DW_PCIE_XILINX_VSEC_DMA_MAP		GENMASK(2, 0)
> > > > > +#define DW_PCIE_XILINX_VSEC_DMA_WR_CH		GENMASK(9, 0)
> > > > > +#define DW_PCIE_XILINX_VSEC_DMA_RD_CH		GENMASK(25, 16)
> > > >
> > > > v1, you agree keep use old MDB ?
> > > >
> > > > Frank
> > > >
> > >
> > > I followed the suggestion you provided at the given link at the end.
> > > Talking of Xilinx based devices, the channel separation is fixed for MDB
> > > but not for CPM6. So, I have have renamed the specific functionality
> > > specific to CPM6 in 2/3 of the same patch series.
> > >
> > > This one cleans up the MDB references and makes the functionality generic
> > > for all the Xilinx devices.
> > >
> > > Suggestion: https://lore.kernel.org/all/amI09ZcfhX4SEPIH@SMW015318/
> >
> > Maybe I have not said cleanly
> >
> > Actually you only need add one macro to for CPM6, other use MDB macro can
> > work well.
> >
> > #define DW_PCIE_XILINX_CPM6_VSEC_CH_SEP                GENMASK(18, 16)
> >
> > These rename are totally unnecessary.  It is quite popular that new chip
> > reuse old chip's register name.
> >
> > We rename it utils we really can't handle these without rename.
>
> You have pointed out the issue in the last line. For the upcoming
> support we anticipated that it would be messy to use the MDB related
> stuff for CPM6 and that's why wanted to clean it before introducing
> functionality for CPM6.

Do it only when have to do that. Now only add one macro
DW_PCIE_XILINX_CPM6_VSEC_CH_SEP to support CPM6.

The prefix "DW_PCIE_XILINX_MDB" and "DW_PCIE_XILINX_VSEC" have not bring
much information,

The most important part following part after it.

Frank

>
> The MDB works, no denying, but mixing the two creates confusion and
> requires the understanding of MDB first and CPM6. For that reason
> the clean approach taken is:
> - Add the generic functionality supported by MDB and CPM6 under the
>   name Xilinx
> - Add the MDB and CPM6 specific functionality with their own
>   associated names, keeping it clean.
>
> - Devendra>
> > Frank
> >
> > >
> > > CPM6 specific declaration:
> > > https://lore.kernel.org/all/20260728091744.1086942-3-devverma@amd.com/
> > >
> > > - Devendra
> > >
> > > >
> > > > > +
> > > > > +#define DW_PCIE_XILINX_DEVMEM_OFF_REG_HIGH	0xc
> > > > > +#define DW_PCIE_XILINX_DEVMEM_OFF_REG_LOW	0x8
> > > > > +#define DW_PCIE_XILINX_INVALID_ADDR		(~0ULL)
> > > > > +
> > > > > +#define DW_PCIE_XILINX_LL_OFF_GAP		0x200000
> > > > > +#define DW_PCIE_XILINX_LL_SIZE			0x800
> > > > > +#define DW_PCIE_XILINX_DT_OFF_GAP		0x100000
> > > > > +#define DW_PCIE_XILINX_DT_SIZE			0x800
> > > > >
> > > > >    #define DW_BLOCK(a, b, c) \
> > > > >    	{ \
> > > > > @@ -258,10 +258,10 @@ static void dw_edma_pcie_get_xilinx_dma_data(struct pci_dev *pdev,
> > > > >    	u16 vsec;
> > > > >    	u64 off;
> > > > >
> > > > > -	pdata->devmem_phys_off = DW_PCIE_XILINX_MDB_INVALID_ADDR;
> > > > > +	pdata->devmem_phys_off = DW_PCIE_XILINX_INVALID_ADDR;
> > > > >
> > > > >    	vsec = pci_find_vsec_capability(pdev, PCI_VENDOR_ID_XILINX,
> > > > > -					DW_PCIE_XILINX_MDB_VSEC_DMA_ID);
> > > > > +					DW_PCIE_XILINX_VSEC_DMA_ID);
> > > > >    	if (!vsec)
> > > > >    		return;
> > > > >
> > > > > @@ -272,18 +272,18 @@ static void dw_edma_pcie_get_xilinx_dma_data(struct pci_dev *pdev,
> > > > >
> > > > >    	pci_dbg(pdev, "Detected Xilinx PCIe Vendor-Specific Extended Capability DMA\n");
> > > > >    	pci_read_config_dword(pdev, vsec + 0x8, &val);
> > > > > -	map = FIELD_GET(DW_PCIE_XILINX_MDB_VSEC_DMA_MAP, val);
> > > > > +	map = FIELD_GET(DW_PCIE_XILINX_VSEC_DMA_MAP, val);
> > > > >    	if (map != EDMA_MF_HDMA_NATIVE)
> > > > >    		return;
> > > > >
> > > > >    	pdata->mf = map;
> > > > > -	pdata->rg.bar = FIELD_GET(DW_PCIE_XILINX_MDB_VSEC_DMA_BAR, val);
> > > > > +	pdata->rg.bar = FIELD_GET(DW_PCIE_XILINX_VSEC_DMA_BAR, 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));
> > > > > +			       FIELD_GET(DW_PCIE_XILINX_VSEC_DMA_WR_CH, val));
> > > > >    	pdata->rd_ch_cnt = min(pdata->rd_ch_cnt,
> > > > > -			       FIELD_GET(DW_PCIE_XILINX_MDB_VSEC_DMA_RD_CH, val));
> > > > > +			       FIELD_GET(DW_PCIE_XILINX_VSEC_DMA_RD_CH, val));
> > > > >
> > > > >    	pci_read_config_dword(pdev, vsec + 0x14, &val);
> > > > >    	off = val;
> > > > > @@ -293,16 +293,16 @@ static void dw_edma_pcie_get_xilinx_dma_data(struct pci_dev *pdev,
> > > > >    	pdata->rg.off = off;
> > > > >
> > > > >    	vsec = pci_find_vsec_capability(pdev, PCI_VENDOR_ID_XILINX,
> > > > > -					DW_PCIE_XILINX_MDB_VSEC_ID);
> > > > > +					DW_PCIE_XILINX_VSEC_ID);
> > > > >    	if (!vsec)
> > > > >    		return;
> > > > >
> > > > >    	pci_read_config_dword(pdev,
> > > > > -			      vsec + DW_PCIE_XILINX_MDB_DEVMEM_OFF_REG_HIGH,
> > > > > +			      vsec + DW_PCIE_XILINX_DEVMEM_OFF_REG_HIGH,
> > > > >    			      &val);
> > > > >    	off = val;
> > > > >    	pci_read_config_dword(pdev,
> > > > > -			      vsec + DW_PCIE_XILINX_MDB_DEVMEM_OFF_REG_LOW,
> > > > > +			      vsec + DW_PCIE_XILINX_DEVMEM_OFF_REG_LOW,
> > > > >    			      &val);
> > > > >    	off <<= 32;
> > > > >    	off |= val;
> > > > > @@ -360,7 +360,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
> > > > >    		 * address use the non-LL mode or simple mode supported by
> > > > >    		 * the HDMA IP.
> > > > >    		 */
> > > > > -		if (vsec_data->devmem_phys_off == DW_PCIE_XILINX_MDB_INVALID_ADDR)
> > > > > +		if (vsec_data->devmem_phys_off == DW_PCIE_XILINX_INVALID_ADDR)
> > > > >    			non_ll = true;
> > > > >
> > > > >    		/*
> > > > > @@ -370,10 +370,10 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev,
> > > > >    		 */
> > > > >    		if (!non_ll)
> > > > >    			dw_edma_set_chan_region_offset(vsec_data, BAR_2, 0,
> > > > > -						       DW_PCIE_XILINX_MDB_LL_OFF_GAP,
> > > > > -						       DW_PCIE_XILINX_MDB_LL_SIZE,
> > > > > -						       DW_PCIE_XILINX_MDB_DT_OFF_GAP,
> > > > > -						       DW_PCIE_XILINX_MDB_DT_SIZE);
> > > > > +						       DW_PCIE_XILINX_LL_OFF_GAP,
> > > > > +						       DW_PCIE_XILINX_LL_SIZE,
> > > > > +						       DW_PCIE_XILINX_DT_OFF_GAP,
> > > > > +						       DW_PCIE_XILINX_DT_SIZE);
> > > > >    	}
> > > > >
> > > > >    	/* Mapping PCI BAR regions */
> > > > > --
> > > > > 2.43.0
> > > > >
> > >
>

  reply	other threads:[~2026-08-04 22:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  9:17 [PATCH v2 0/3] CPM6 Channel Separation Support Devendra K Verma
2026-07-28  9:17 ` [PATCH v2 1/3] dmaengine: dw-edma: Make Xilinx Macros Dev Name Agnostic Devendra K Verma
2026-07-28 15:31   ` Frank Li
2026-07-31 16:24     ` Verma, Devendra
2026-07-31 19:20       ` Frank Li
2026-08-03 12:15         ` Verma, Devendra
2026-08-04 22:43           ` Frank Li [this message]
2026-07-28  9:17 ` [PATCH v2 2/3] dmaengine: dw-edma: Enable Chan Separation via VSEC Devendra K Verma
2026-07-28 15:33   ` Frank Li
2026-07-31 10:52     ` Verma, Devendra
2026-07-31 15:34       ` Frank Li
2026-07-31 16:33         ` Verma, Devendra
2026-07-31 19:05           ` Frank Li
2026-08-03 12:31             ` Verma, Devendra
2026-08-04 22:33               ` Frank Li
2026-07-28  9:17 ` [PATCH v2 3/3] dmaengine: dw-edma: Add changes to support Channel Separation Devendra K Verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anJrAuO4Kh2Q2L9B@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=den@valinux.co.jp \
    --cc=devverma@amd.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=frank.li@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox