Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3988304ybe; Mon, 9 Sep 2019 02:19:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3q5GTUlkEK3Hl+nGruHw8yJuM2+17btM/vmnNOd8nX+Ajh2P4lzWbx+e0uaMJxwWHkpeB X-Received: by 2002:a17:906:5e09:: with SMTP id n9mr9286980eju.143.1568020798169; Mon, 09 Sep 2019 02:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568020798; cv=none; d=google.com; s=arc-20160816; b=E9tubpfeohEUv7yyDovW+NJ8m5f04KwQlddARb5WkIa3QP8+tqtcXvvkF0r8IO697S bkc+WvSWgBOYQ9321Q4HNm9DGyeOIbjGQInkpi8oUZpVSAHKTO6CyTv+K4ng2b7V4B4f 9j2vrpVYL8qkN6/xq6oXp0eoLngVhWTrHq6OJDQr5NiwTvenx3r2r01BkjAHngmIfcw8 cJwfmcvoh2WBWAlNNTUCxC2Nuj4nFHE+Ct+iDvQSjkAq1mFrt1zcQEZczVgltrztUfeY 89IK/S19I9qposfsWV+XfL1d6Eex8JAWjcyfPXv1NmAR3fa7WjpUuoPkFjQ6f/gNmRVy Oo/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1KVE+s0OQSkRgS5ESWFYf5chpCvpmwnpvRS3Ee6M4Ow=; b=SQF0voxYeh1evxt+Hl6wH9GWak2YMxbH9ib6uYKYa0C2RGmUz+elma4JvpHd47bRdf GLU6IeMyr/qbpdtQu7eXo9B4f1hgrvkCNgLjytHlRhSTP03wmlb/RJzSUetvXCejs9sN qppGvuAudzlTB3Njvyye9wYJAHvBosE39DOJ4wkcaSfKdp1ok71v7TemguuGbhv0m/zj 107pKTchXJRgRxfbgYhyWqNkDINS7Wva3WVbkxfKPRsFM2s+EetX/PgnEJr7OFZXB0aH NHe5ej7eahKosDIg6E4dhe/HPhFuvQCUWYtNJLQ8aBuc+VIh6/8Li6be/ib1HOI2+9EQ XAIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hfE6J2n1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si7775905edo.354.2019.09.09.02.19.32; Mon, 09 Sep 2019 02:19:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hfE6J2n1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729058AbfIHMQR (ORCPT + 99 others); Sun, 8 Sep 2019 08:16:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:42946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729045AbfIHMQQ (ORCPT ); Sun, 8 Sep 2019 08:16:16 -0400 Received: from localhost (unknown [122.182.221.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 41670214D9; Sun, 8 Sep 2019 12:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567944976; bh=I6rWRHaNedcvLoxTXZr5u4VVQbWS7vhOw83Pfjw9FPE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hfE6J2n16FueM2f5TUyJrXOXzAoDGX+5c9xf+UpDNVDwAXuRF5fVantJky4mDcWCy xnlsN4a5JMT2n0m2eStrpqi6TM0O0PXk2d8xc43HettTdqH14OQzPfm9r/29BA3ik0 ulNfG32fmow5KfRZE/6hFEfCrS/8I6OollYJ4dnQ= Date: Sun, 8 Sep 2019 17:45:07 +0530 From: Vinod Koul To: Peter Ujfalusi Cc: robh+dt@kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com, devicetree@vger.kernel.org Subject: Re: [RFC 3/3] dmaengine: Support for requesting channels preferring DMA domain controller Message-ID: <20190908121507.GN2672@vkoul-mobl> References: <20190906141816.24095-1-peter.ujfalusi@ti.com> <20190906141816.24095-4-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906141816.24095-4-peter.ujfalusi@ti.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06-09-19, 17:18, Peter Ujfalusi wrote: > In case the channel is not requested via the slave API, use the > of_find_dma_domain() to see if a system default DMA controller is > specified. > > Add new function which can be used by clients to request channels by mask > from their DMA domain controller if specified. > > Client drivers can take advantage of the domain support by moving from > dma_request_chan_by_mask() to dma_domain_request_chan_by_mask() > > Signed-off-by: Peter Ujfalusi > --- > drivers/dma/dmaengine.c | 17 ++++++++++++----- > include/linux/dmaengine.h | 9 ++++++--- > 2 files changed, 18 insertions(+), 8 deletions(-) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 6baddf7dcbfd..087450eed68c 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -640,6 +640,10 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, > struct dma_device *device, *_d; > struct dma_chan *chan = NULL; > > + /* If np is not specified, get the default DMA domain controller */ > + if (!np) > + np = of_find_dma_domain(NULL); > + > /* Find a channel */ > mutex_lock(&dma_list_mutex); > list_for_each_entry_safe(device, _d, &dma_device_list, global_node) { > @@ -751,19 +755,22 @@ struct dma_chan *dma_request_slave_channel(struct device *dev, > EXPORT_SYMBOL_GPL(dma_request_slave_channel); > > /** > - * dma_request_chan_by_mask - allocate a channel satisfying certain capabilities > - * @mask: capabilities that the channel must satisfy > + * dma_domain_request_chan_by_mask - allocate a channel by mask from DMA domain > + * @dev: pointer to client device structure > + * @mask: capabilities that the channel must satisfy > * > * Returns pointer to appropriate DMA channel on success or an error pointer. > */ > -struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask) > +struct dma_chan *dma_domain_request_chan_by_mask(struct device *dev, > + const dma_cap_mask_t *mask) should we really use dma_request_chan_by_mask() why not create a new api dma_request_chan_by_domain() and use that, it falls back to dma_request_chan_by_mask() if it doesnt find a valid domain! -- ~Vinod