From patchwork Thu May 9 21:33:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 2545941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id C8769DF24C for ; Thu, 9 May 2013 21:37:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UaYWb-0002Mu-99; Thu, 09 May 2013 21:37:17 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UaYWY-0004AW-Ny; Thu, 09 May 2013 21:37:14 +0000 Received: from caramon.arm.linux.org.uk ([78.32.30.218]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UaYWT-0004AC-KL for linux-arm-kernel@lists.infradead.org; Thu, 09 May 2013 21:37:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=aS24qFUH03+JjVseFPVGk0gAhCWuWzYoHFPRdB02kB8=; b=Bf9gKpmmksK5E2DZ9vNtVD+MMqwJ53vh6wOk5biqGcXh+PF6UvLDpex8r/Nk1aC7DOSeyLyMEY5/u3IgY2Q50XzxjDS8NDYJUYyo9X56WOFyvfw4u9vnKzsVt9jGjCkI6OHgNvHiqJAdCwjHlq7ODwEACDl7roPtSRDd+gdLkVE=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:39876) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1UaYTG-0000xG-Uh; Thu, 09 May 2013 22:33:51 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1UaYTF-0004PI-Mk; Thu, 09 May 2013 22:33:49 +0100 Date: Thu, 9 May 2013 22:33:49 +0100 From: Russell King - ARM Linux To: Arnd Bergmann Subject: Re: [PATCH] USB: set device dma_mask without reference to global data Message-ID: <20130509213349.GN21614@n2100.arm.linux.org.uk> References: <1367967232-10128-1-git-send-email-swarren@wwwdotorg.org> <20130507230445.GC9105@kroah.com> <201305080142.12025.arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201305080142.12025.arnd@arndb.de> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130509_173709_991712_CE2EFBB0 X-CRM114-Status: GOOD ( 23.15 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [78.32.30.218 listed in list.dnswl.org] -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid Cc: Stephen Warren , Stephen Warren , Alexander Shishkin , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Felipe Balbi , Alan Stern , linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Wed, May 08, 2013 at 01:42:11AM +0200, Arnd Bergmann wrote: > On Wednesday 08 May 2013, Greg Kroah-Hartman wrote: > > On Tue, May 07, 2013 at 04:53:52PM -0600, Stephen Warren wrote: > > > From: Stephen Warren > > > > Suggested-by: Arnd Bergmann > > > Signed-off-by: Stephen Warren > > > > So this needs to go in for 3.10, right? Any older kernels as well? If > > so, which ones? > > The fix should definitely go into 3.10, but I'd suggest waiting with > the backport for a couple of -rc releases to avoid possible regressions. > We know that the current code is broken, but few people fully understand > what is going on with coherent_dma_mask, so it might cause new problems > in combination with some other unknown bug, and I don't see this as > urgent: none of the ARM defconfigs build this driver as a loadable > module and there is no bug in the built-in case. For some reason, only > the ARM back-end drivers are broken. > > The first occurence was apparently in 3.3, but only in ehci-tegra.c, > while the other drivers subsequently copied the bug. I've already suggested this approach: diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h index dc662fc..51bb740 100644 --- a/arch/arm/include/asm/device.h +++ b/arch/arm/include/asm/device.h @@ -22,6 +22,7 @@ struct dev_archdata { struct omap_device; struct pdev_archdata { + u64 dma_mask; #ifdef CONFIG_ARCH_OMAP struct omap_device *od; #endif And then we can have dev->dma_mask pointed at that instead, which fully eliminates any possible problems of things like dma_set_mask() interfering with dma_set_coherent_mask(). Even better - because this is a common problem - would be to make 'dma_mask' be a member of struct platform_device so that all arches can sort this out once and for all (correction: generic code/drivers can in an arch- independent way.) IOW: diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 9abf1db..121c74c 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -26,6 +26,7 @@ struct platform_device { struct device dev; u32 num_resources; struct resource *resource; + u64 dma_mask; const struct platform_device_id *id_entry;