lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXzTubDlsQDIgLGM@lizhi-Precision-Tower-5810>
Date: Fri, 30 Jan 2026 10:52:25 -0500
From: Frank Li <Frank.li@....com>
To: Sai Sree Kartheek Adivi <s-adivi@...com>
Cc: peter.ujfalusi@...il.com, vkoul@...nel.org, robh@...nel.org,
	krzk+dt@...nel.org, conor+dt@...nel.org, nm@...com,
	ssantosh@...nel.org, dmaengine@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, vigneshr@...com,
	r-sharma3@...com, gehariprasath@...com
Subject: Re: [PATCH v4 06/19] dmaengine: ti: k3-udma: Add variant-specific
 function pointers to udma_dev

On Fri, Jan 30, 2026 at 04:31:46PM +0530, Sai Sree Kartheek Adivi wrote:
> Introduce function pointers in the udma_dev structure to allow
> variant-specific implementations for certain operations.
> This prepares the driver for supporting multiple K3 UDMA variants,
> such as UDMA v2, with minimal code duplication.
>
> No functional changes intended in this commit.
>
> Signed-off-by: Sai Sree Kartheek Adivi <s-adivi@...com>
> ---

Reviewed-by: Frank Li <Frank.Li@....com>
>  drivers/dma/ti/k3-udma-private.c | 10 +++++--
>  drivers/dma/ti/k3-udma.c         | 46 +++++++++++++++++++-------------
>  drivers/dma/ti/k3-udma.h         | 12 +++++++++
>  3 files changed, 47 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
> index 624360423ef17..44c097fff5ee6 100644
> --- a/drivers/dma/ti/k3-udma-private.c
> +++ b/drivers/dma/ti/k3-udma-private.c
> @@ -8,13 +8,19 @@
>
>  int xudma_navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
>  {
> -	return navss_psil_pair(ud, src_thread, dst_thread);
> +	if (ud->psil_pair)
> +		return ud->psil_pair(ud, src_thread, dst_thread);
> +
> +	return 0;
>  }
>  EXPORT_SYMBOL(xudma_navss_psil_pair);
>
>  int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
>  {
> -	return navss_psil_unpair(ud, src_thread, dst_thread);
> +	if (ud->psil_unpair)
> +		return ud->psil_unpair(ud, src_thread, dst_thread);
> +
> +	return 0;
>  }
>  EXPORT_SYMBOL(xudma_navss_psil_unpair);
>
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 214a1ca1e1776..397e890283eaa 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -40,7 +40,7 @@ static const char * const mmr_names[] = {
>  	[MMR_TCHANRT] = "tchanrt",
>  };
>
> -static int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
> +int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
>  {
>  	struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
>
> @@ -50,8 +50,8 @@ static int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread)
>  					      src_thread, dst_thread);
>  }
>
> -static int navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> -			     u32 dst_thread)
> +int navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> +		      u32 dst_thread)
>  {
>  	struct udma_tisci_rm *tisci_rm = &ud->tisci_rm;
>
> @@ -329,7 +329,7 @@ static int udma_start(struct udma_chan *uc)
>  	}
>
>  	/* Make sure that we clear the teardown bit, if it is set */
> -	udma_reset_chan(uc, false);
> +	uc->ud->reset_chan(uc, false);
>
>  	/* Push descriptors before we start the channel */
>  	udma_start_desc(uc);
> @@ -521,8 +521,8 @@ static void udma_check_tx_completion(struct work_struct *work)
>  		if (uc->desc) {
>  			struct udma_desc *d = uc->desc;
>
> -			udma_decrement_byte_counters(uc, d->residue);
> -			udma_start(uc);
> +			uc->ud->decrement_byte_counters(uc, d->residue);
> +			uc->ud->start(uc);
>  			vchan_cookie_complete(&d->vd);
>  			break;
>  		}
> @@ -554,7 +554,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)
>  		}
>
>  		if (!uc->desc)
> -			udma_start(uc);
> +			uc->ud->start(uc);
>
>  		goto out;
>  	}
> @@ -576,8 +576,8 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)
>  				vchan_cyclic_callback(&d->vd);
>  			} else {
>  				if (udma_is_desc_really_done(uc, d)) {
> -					udma_decrement_byte_counters(uc, d->residue);
> -					udma_start(uc);
> +					uc->ud->decrement_byte_counters(uc, d->residue);
> +					uc->ud->start(uc);
>  					vchan_cookie_complete(&d->vd);
>  				} else {
>  					schedule_delayed_work(&uc->tx_drain.work,
> @@ -612,8 +612,8 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data)
>  			vchan_cyclic_callback(&d->vd);
>  		} else {
>  			/* TODO: figure out the real amount of data */
> -			udma_decrement_byte_counters(uc, d->residue);
> -			udma_start(uc);
> +			uc->ud->decrement_byte_counters(uc, d->residue);
> +			uc->ud->start(uc);
>  			vchan_cookie_complete(&d->vd);
>  		}
>  	}
> @@ -1654,7 +1654,7 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
>
>  	if (udma_is_chan_running(uc)) {
>  		dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> -		udma_reset_chan(uc, false);
> +		ud->reset_chan(uc, false);
>  		if (udma_is_chan_running(uc)) {
>  			dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
>  			ret = -EBUSY;
> @@ -1821,7 +1821,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
>
>  	if (udma_is_chan_running(uc)) {
>  		dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> -		udma_reset_chan(uc, false);
> +		ud->reset_chan(uc, false);
>  		if (udma_is_chan_running(uc)) {
>  			dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
>  			ret = -EBUSY;
> @@ -2014,7 +2014,7 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
>
>  	if (udma_is_chan_running(uc)) {
>  		dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
> -		udma_reset_chan(uc, false);
> +		ud->reset_chan(uc, false);
>  		if (udma_is_chan_running(uc)) {
>  			dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
>  			ret = -EBUSY;
> @@ -2123,7 +2123,7 @@ static void udma_issue_pending(struct dma_chan *chan)
>  		 */
>  		if (!(uc->state == UDMA_CHAN_IS_TERMINATING &&
>  		      udma_is_chan_running(uc)))
> -			udma_start(uc);
> +			uc->ud->start(uc);
>  	}
>
>  	spin_unlock_irqrestore(&uc->vc.lock, flags);
> @@ -2265,7 +2265,7 @@ static int udma_terminate_all(struct dma_chan *chan)
>  	spin_lock_irqsave(&uc->vc.lock, flags);
>
>  	if (udma_is_chan_running(uc))
> -		udma_stop(uc);
> +		uc->ud->stop(uc);
>
>  	if (uc->desc) {
>  		uc->terminated_desc = uc->desc;
> @@ -2297,11 +2297,11 @@ static void udma_synchronize(struct dma_chan *chan)
>  			dev_warn(uc->ud->dev, "chan%d teardown timeout!\n",
>  				 uc->id);
>  			udma_dump_chan_stdata(uc);
> -			udma_reset_chan(uc, true);
> +			uc->ud->reset_chan(uc, true);
>  		}
>  	}
>
> -	udma_reset_chan(uc, false);
> +	uc->ud->reset_chan(uc, false);
>  	if (udma_is_chan_running(uc))
>  		dev_warn(uc->ud->dev, "chan%d refused to stop!\n", uc->id);
>
> @@ -2355,7 +2355,7 @@ static void udma_free_chan_resources(struct dma_chan *chan)
>
>  	udma_terminate_all(chan);
>  	if (uc->terminated_desc) {
> -		udma_reset_chan(uc, false);
> +		ud->reset_chan(uc, false);
>  		udma_reset_rings(uc);
>  	}
>
> @@ -3694,6 +3694,14 @@ static int udma_probe(struct platform_device *pdev)
>  		ud->soc_data = soc->data;
>  	}
>
> +	// Setup function pointers
> +	ud->start = udma_start;
> +	ud->stop = udma_stop;
> +	ud->reset_chan = udma_reset_chan;
> +	ud->decrement_byte_counters = udma_decrement_byte_counters;
> +	ud->psil_pair = navss_psil_pair;
> +	ud->psil_unpair = navss_psil_unpair;
> +
>  	ret = udma_get_mmrs(pdev, ud);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/dma/ti/k3-udma.h b/drivers/dma/ti/k3-udma.h
> index 4c6e5b946d5cf..2f5fbea446fed 100644
> --- a/drivers/dma/ti/k3-udma.h
> +++ b/drivers/dma/ti/k3-udma.h
> @@ -344,6 +344,15 @@ struct udma_dev {
>  	u32 psil_base;
>  	u32 atype;
>  	u32 asel;
> +
> +	int (*start)(struct udma_chan *uc);
> +	int (*stop)(struct udma_chan *uc);
> +	int (*reset_chan)(struct udma_chan *uc, bool hard);
> +	void (*decrement_byte_counters)(struct udma_chan *uc, u32 val);
> +	int (*psil_pair)(struct udma_dev *ud, u32 src_thread,
> +			 u32 dst_thread);
> +	int (*psil_unpair)(struct udma_dev *ud, u32 src_thread,
> +			   u32 dst_thread);
>  };
>
>  struct udma_desc {
> @@ -614,6 +623,9 @@ int udma_push_to_ring(struct udma_chan *uc, int idx);
>  int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr);
>  void udma_reset_rings(struct udma_chan *uc);
>
> +int navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
> +int navss_psil_unpair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
> +
>  /* Direct access to UDMA low lever resources for the glue layer */
>  int xudma_navss_psil_pair(struct udma_dev *ud, u32 src_thread, u32 dst_thread);
>  int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ