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]
Date: Wed, 5 Jun 2024 14:05:20 -0400
From: Frank Li <Frank.li@....com>
To: Dave Stevenson <dave.stevenson@...pberrypi.com>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Ray Jui <rjui@...adcom.com>, Scott Branden <sbranden@...adcom.com>,
	Vinod Koul <vkoul@...nel.org>, Maxime Ripard <mripard@...nel.org>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Mark Brown <broonie@...nel.org>, Christoph Hellwig <hch@....de>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Robin Murphy <robin.murphy@....com>,
	Liam Girdwood <lgirdwood@...il.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
	Vladimir Murzin <vladimir.murzin@....com>,
	Phil Elwell <phil@...pberrypi.com>,
	Stefan Wahren <wahrenst@....net>,
	Serge Semin <Sergey.Semin@...kalelectronics.ru>,
	devicetree@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	dmaengine@...r.kernel.org, dri-devel@...ts.freedesktop.org,
	linux-mmc@...r.kernel.org, linux-spi@...r.kernel.org,
	iommu@...ts.linux.dev, linux-sound@...r.kernel.org,
	Stefan Wahren <stefan.wahren@...e.com>
Subject: Re: [PATCH 08/18] dmaengine: bcm2835: pass dma_chan to generic
 functions

On Fri, May 24, 2024 at 07:26:52PM +0100, Dave Stevenson wrote:
> From: Stefan Wahren <stefan.wahren@...e.com>
> 
> In preparation to support more platforms pass the dma_chan to the
> generic functions. This provides access to the DMA device and possible
> platform specific data.

why need this change? you can easy convert between dma_chan and
bcm2835_chan.


> 
> Signed-off-by: Stefan Wahren <wahrenst@....net>
> Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
> ---
>  drivers/dma/bcm2835-dma.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index e2f9c8692e6b..aefaa1f01d7f 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -288,12 +288,13 @@ static void bcm2835_dma_desc_free(struct virt_dma_desc *vd)
>  }
>  
>  static bool
> -bcm2835_dma_create_cb_set_length(struct bcm2835_chan *chan,
> +bcm2835_dma_create_cb_set_length(struct dma_chan *chan,
>  				 struct bcm2835_dma_cb *control_block,
>  				 size_t len, size_t period_len,
>  				 size_t *total_len)
>  {
> -	size_t max_len = bcm2835_dma_max_frame_length(chan);
> +	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
> +	size_t max_len = bcm2835_dma_max_frame_length(c);
>  
>  	/* set the length taking lite-channel limitations into account */
>  	control_block->length = min_t(u32, len, max_len);
> @@ -417,7 +418,7 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain(
>  		/* set up length in control_block if requested */
>  		if (buf_len) {
>  			/* calculate length honoring period_length */
> -			if (bcm2835_dma_create_cb_set_length(c, control_block,
> +			if (bcm2835_dma_create_cb_set_length(chan, control_block,
>  							     len, period_len,
>  							     &total_len)) {
>  				/* add extrainfo bits in info */
> @@ -485,8 +486,9 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
>  	}
>  }
>  
> -static void bcm2835_dma_abort(struct bcm2835_chan *c)
> +static void bcm2835_dma_abort(struct dma_chan *chan)
>  {
> +	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
>  	void __iomem *chan_base = c->chan_base;
>  	long int timeout = 10000;
>  
> @@ -513,8 +515,9 @@ static void bcm2835_dma_abort(struct bcm2835_chan *c)
>  	writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS);
>  }
>  
> -static void bcm2835_dma_start_desc(struct bcm2835_chan *c)
> +static void bcm2835_dma_start_desc(struct dma_chan *chan)
>  {
> +	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
>  	struct virt_dma_desc *vd = vchan_next_desc(&c->vc);
>  	struct bcm2835_desc *d;
>  
> @@ -533,7 +536,8 @@ static void bcm2835_dma_start_desc(struct bcm2835_chan *c)
>  
>  static irqreturn_t bcm2835_dma_callback(int irq, void *data)
>  {
> -	struct bcm2835_chan *c = data;
> +	struct dma_chan *chan = data;
> +	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
>  	struct bcm2835_desc *d;
>  	unsigned long flags;
>  
> @@ -566,7 +570,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data)
>  			vchan_cyclic_callback(&d->vd);
>  		} else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) {
>  			vchan_cookie_complete(&c->desc->vd);
> -			bcm2835_dma_start_desc(c);
> +			bcm2835_dma_start_desc(chan);
>  		}
>  	}
>  
> @@ -594,7 +598,7 @@ static int bcm2835_dma_alloc_chan_resources(struct dma_chan *chan)
>  	}
>  
>  	return request_irq(c->irq_number, bcm2835_dma_callback,
> -			   c->irq_flags, "DMA IRQ", c);
> +			   c->irq_flags, "DMA IRQ", chan);
>  }
>  
>  static void bcm2835_dma_free_chan_resources(struct dma_chan *chan)
> @@ -682,7 +686,7 @@ static void bcm2835_dma_issue_pending(struct dma_chan *chan)
>  
>  	spin_lock_irqsave(&c->vc.lock, flags);
>  	if (vchan_issue_pending(&c->vc) && !c->desc)
> -		bcm2835_dma_start_desc(c);
> +		bcm2835_dma_start_desc(chan);
>  
>  	spin_unlock_irqrestore(&c->vc.lock, flags);
>  }
> @@ -846,7 +850,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
>  	if (c->desc) {
>  		vchan_terminate_vdesc(&c->desc->vd);
>  		c->desc = NULL;
> -		bcm2835_dma_abort(c);
> +		bcm2835_dma_abort(chan);
>  	}
>  
>  	vchan_get_all_descriptors(&c->vc, &head);
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ