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, 28 Sep 2011 14:38:07 +0530
From:	Vinod Koul <vinod.koul@...el.com>
To:	Viresh Kumar <viresh.kumar@...com>, Dan <dan.j.williams@...el.com>
Cc:	linux-kernel@...r.kernel.org, armando.visconti@...com,
	shiraz.hashim@...com, vipin.kumar@...com, rajeev-dlh.kumar@...com,
	deepak.sikri@...com, vipulkumar.samar@...com, amit.virdi@...com,
	pratyush.anand@...com, bhupesh.sharma@...com,
	viresh.linux@...il.com, bhavna.yadav@...com
Subject: Re: [PATCH 1/3] dmaengine: Allow controller drivers to set channel
 ids

On Thu, 2011-09-22 at 16:13 +0530, Viresh Kumar wrote:
> Currently value of chan_id field is updated by dmaengine.c while the dma device
> is registered. In some cases the controller driver may need to assign channel
> numbers by itself. For example, dw_dmac.c wants to control the order in which
> channels are allocated by dmaengine. So it added channels inside channel list of
> dma_device in reverse order. Now channel 7 is allocated first and channel 0 is
> allocated last.
> 
> But as the channel ids are updated by dmaengine, channel numbers in sysfs will
> be overwritten if controller has added channels in reverse order. To represent
> correct channel number in sysfs, it is required that dmaengine must not assume
> that first channel in list is channel 0 and last is 7.
to dmaengine, this is just a channel representation in sysfs and nothing
more. If damc is assuming that this is same as what dmaengine will do
then dmac is wrong.

Nevertheless, Dan was okay with changing this representation.
Dan I would need your comments/Ack before we discuss this further
> 
> To handled this situation, chan_ids_set is passed by controller driver inside
> struct dma_device. Controller drivers that need to set channel numbers
> themselves must pass this field as true.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@...com>
> ---
>  drivers/dma/dmaengine.c   |    7 ++++++-
>  include/linux/dmaengine.h |    5 +++++
>  2 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 0e5f684..1d09258 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -735,7 +735,12 @@ int dma_async_device_register(struct dma_device *device)
>  			goto err_out;
>  		}
>  
> -		chan->chan_id = chancnt++;
> +		/* channel ids are set by controller drivers, don't update it */
> +		if (!device->chan_ids_set)
> +			chan->chan_id = chancnt;
> +
> +		chancnt++;
> +
>  		chan->dev->device.class = &dma_devclass;
>  		chan->dev->device.parent = device->dev;
>  		chan->dev->chan = chan;
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 19cbe39..b4607f4 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -417,6 +417,8 @@ struct dma_tx_state {
>   * @xor_align: alignment shift for xor operations
>   * @pq_align: alignment shift for pq operations
>   * @fill_align: alignment shift for memset operations
> + * @chan_ids_set: channel id's are already set by driver and must not be
> + * reinitialized by dmaengine.
>   * @dev_id: unique device ID
>   * @dev: struct device reference for dma mapping api
>   * @device_alloc_chan_resources: allocate resources and return the
> @@ -456,6 +458,9 @@ struct dma_device {
>  	u8 fill_align;
>  	#define DMA_HAS_PQ_CONTINUE (1 << 15)
>  
> +	/* sysfs */
> +	bool chan_ids_set;
> +
>  	int dev_id;
>  	struct device *dev;
>  


-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ