Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315243

Re: [PATCH] Platform: goldfish: goldfish_pipe.c: Add DMA support using managed version

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Platform: goldfish: goldfish_pipe.c: Add DMA support using managed version
Date Fri, 22 Jan 2016 21:00:02 +0100
Message-ID <qTQ2e-cO-3@gated-at.bofh.it> (permalink)
References <qTQ2e-cO-5@gated-at.bofh.it>
X-Original-To Shraddha Barke <shraddha.6596@gmail.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Dan Carpenter <dan.carpenter@oracle.com>, linux-kernel@vger.kernel.org
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3867:3868:3871:4321:5007:6261:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12048:12296:12438:12517:12519:12740:13069:13095:13255:13311:13357:13894:14659:21080:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none
X-He-Tag class11_64d15cc4f9d1b
X-Filterd-Recvd-Size 2343
Content-Type text/plain; charset="ISO-8859-1"
X-Mailer Evolution 3.18.3-1ubuntu1
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 38
Organization linux.* mail to news gateway
X-Original-Cc Peter Senna Tschudin <peter.senna@gmail.com>, Julia Lawall <julia.lawall@lip6.fr>
X-Original-Date Fri, 22 Jan 2016 11:58:11 -0800
X-Original-Message-ID <1453492691.13870.34.camel@perches.com>
X-Original-References <1453492292-17279-1-git-send-email-shraddha.6596@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1315243

Show key headers only | View raw


On Sat, 2016-01-23 at 01:21 +0530, Shraddha Barke wrote:
> Function setup_access_params_addr is called only from probe function, hence
> managed version dmam_alloc_coherent is used.

trivia:

> diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
[]
> @@ -217,17 +218,19 @@ static int valid_batchbuffer_addr(struct goldfish_pipe_dev *dev,
>  static int setup_access_params_addr(struct platform_device *pdev,
>  					struct goldfish_pipe_dev *dev)
>  {
> -	u64 paddr;
> +	dma_addr_t dma_handle;
>  	struct access_params *aps;
>  
> -	aps = devm_kzalloc(&pdev->dev, sizeof(struct access_params), GFP_KERNEL);
> -	if (!aps)
> -		return -1;
> +	aps = dmam_alloc_coherent(&pdev->dev, sizeof(struct access_params),
> +				  &dma_handle, GFP_KERNEL);
> +	if (!aps) {
> +		dev_err(&pdev->dev, "allocate buffer failed\n");

Unnecessary error message

> +		return -ENOMEM;
> +	}
>  
> -	/* FIXME */
> -	paddr = __pa(aps);
> -	writel((u32)(paddr >> 32), dev->base + PIPE_REG_PARAMS_ADDR_HIGH);
> -	writel((u32)paddr, dev->base + PIPE_REG_PARAMS_ADDR_LOW);
> +	writel((u32)((u64)dma_handle >> 32), dev->base +
> +		PIPE_REG_PARAMS_ADDR_HIGH);
> +	writel((u32)dma_handle, dev->base + PIPE_REG_PARAMS_ADDR_LOW);

Probably better to use upper_32_bits and lower_32_bits

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] Platform: goldfish: goldfish_pipe.c: Add DMA support  using managed version Joe Perches <joe@perches.com> - 2016-01-22 21:00 +0100

csiph-web