From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753132AbcD0QFT (ORCPT ); Wed, 27 Apr 2016 12:05:19 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:57030 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753031AbcD0QFR (ORCPT ); Wed, 27 Apr 2016 12:05:17 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Felipe Balbi , Grygorii Strashko , Greg Kroah-Hartman , Yoshihiro Shimoda , linux-usb@vger.kernel.org, Sekhar Nori , linux-kernel@vger.kernel.org, David Fisher , "Thang Q. Nguyen" Subject: Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Date: Wed, 27 Apr 2016 18:04:27 +0200 Message-ID: <4985498.GT33RtioOA@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160427155019.GE20646@e104818-lin.cambridge.arm.com> References: <1461612094-30939-1-git-send-email-grygorii.strashko@ti.com> <9452408.uEOOA4q1YW@wuerfel> <20160427155019.GE20646@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:wdmx+mgrznUk9XF8/V82FfE0KH++f+xtgxlBwGsRUz1asHH+Vh/ mFjsHmKltQrxq8T3WbDNwRFI4/j/601TeC43ke0bOGyn1bVH4zbUkCCi+I1LDFeV/iCOo6z uNo5gTSurdCXVHkImmlKx7JURU3NHE0UYTwJZO6VQx+p4wEzUt3yFGPw5u2bjTwjlSpEuot 3IPIXyZqqpQjozWGNydcw== X-UI-Out-Filterresults: notjunk:1;V01:K0:DJKUAfudmIg=:XneF5ydlEbwkc/0DsxLWlJ 08qROrwD1ZEKI/ZsJl+UbdMG1vvx+h9G7+4vp7RUOtZeEhkIcr6VS5yyLQXiJBTJeS7/l439o xj1Tbyy2hvuwyDUbmOIYZnEC147MtG0oHPGeOYOFUzVbX2vc7tajvC8KvUCm5aYPzHl34p4lt FFdEZihwqlrmOeMGgTbf6jk3Cquisqjc2wEjo1pExEpLSkrennASoV57H0s1aXnuDyE9H6zJI 3Twu9x+4frf4oRK3z9VYhjwGh80prfnu/8bOF5EChtsmbtx6sK4fQ7bgr0PUuauG7Z7zYygLU 7+S9QHMpi//lupfy/hHBOBilvUjuLZ1GzVXQDSUM8QIjacUMnGUNDz0TyNHUGd2bMQZb47cvl hUtKJjVPFHXJHqQDF8s1RiNPdRCDhYpEIXhLmClk3f1yZKw9SckwyAGfc9lfOQ/sdaSGaUdfE Jvmkc70hCxPVeQ+WKP2HOA/BSB9NeWML9PIIgN3iGHdJJUKLWjw8IikJ83L5Xuj2lWqqu7wiz cnqN6l9LZxdgkl374mYlxor3puQN0OlWXfqVK5ZtnJ485R0xJ7LF/UBiBBnG//588ORKwkYjK jx32fKdEAp4TQyu5wljgxe6Q8sIVlppLENeWuC70372rKTMdxSh5IBsS6Jk1fMccSLL6TQvN2 sPzYazm87lF+JDV/i6ug7bvP0JKI7DE8BjhDlb9QZqfvEVal8P9wfLL+nf0bL2gnpyDZaJ0NJ D/okFz2DT8hwO06u Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 27 April 2016 16:50:19 Catalin Marinas wrote: > On Wed, Apr 27, 2016 at 04:11:17PM +0200, Arnd Bergmann wrote: > > On Wednesday 27 April 2016 14:59:00 Catalin Marinas wrote: > > > > > > I would be in favour of a dma_inherit() function as well. We could hack > > > something up in the arch code (like below) but I would rather prefer an > > > explicit dma_inherit() call by drivers creating such devices. > > > > > > diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h > > > index ba437f090a74..ea6fb9b0e8fa 100644 > > > --- a/arch/arm64/include/asm/dma-mapping.h > > > +++ b/arch/arm64/include/asm/dma-mapping.h > > > @@ -29,8 +29,11 @@ extern struct dma_map_ops dummy_dma_ops; > > > > > > static inline struct dma_map_ops *__generic_dma_ops(struct device *dev) > > > { > > > - if (dev && dev->archdata.dma_ops) > > > - return dev->archdata.dma_ops; > > > + while (dev) { > > > + if (dev->archdata.dma_ops) > > > + return dev->archdata.dma_ops; > > > + dev = dev->parent; > > > + } > > > > I think this would be a very bad idea: we don't want to have random > > devices be able to perform DMA just because their parent devices > > have been set up that way. > > I agree, it's a big hack. It would be nice to have a simpler way to do > this in driver code rather than explicitly calling > of_dma_configure/arch_setup_dma_ops as per the original patch in this > thread. > I haven't followed the entire discussion, but what's wrong with passing around a pointer to a 'struct device *hwdev' that represents the physical device that does the DMA? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Wed, 27 Apr 2016 18:04:27 +0200 Subject: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev In-Reply-To: <20160427155019.GE20646@e104818-lin.cambridge.arm.com> References: <1461612094-30939-1-git-send-email-grygorii.strashko@ti.com> <9452408.uEOOA4q1YW@wuerfel> <20160427155019.GE20646@e104818-lin.cambridge.arm.com> Message-ID: <4985498.GT33RtioOA@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wednesday 27 April 2016 16:50:19 Catalin Marinas wrote: > On Wed, Apr 27, 2016 at 04:11:17PM +0200, Arnd Bergmann wrote: > > On Wednesday 27 April 2016 14:59:00 Catalin Marinas wrote: > > > > > > I would be in favour of a dma_inherit() function as well. We could hack > > > something up in the arch code (like below) but I would rather prefer an > > > explicit dma_inherit() call by drivers creating such devices. > > > > > > diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h > > > index ba437f090a74..ea6fb9b0e8fa 100644 > > > --- a/arch/arm64/include/asm/dma-mapping.h > > > +++ b/arch/arm64/include/asm/dma-mapping.h > > > @@ -29,8 +29,11 @@ extern struct dma_map_ops dummy_dma_ops; > > > > > > static inline struct dma_map_ops *__generic_dma_ops(struct device *dev) > > > { > > > - if (dev && dev->archdata.dma_ops) > > > - return dev->archdata.dma_ops; > > > + while (dev) { > > > + if (dev->archdata.dma_ops) > > > + return dev->archdata.dma_ops; > > > + dev = dev->parent; > > > + } > > > > I think this would be a very bad idea: we don't want to have random > > devices be able to perform DMA just because their parent devices > > have been set up that way. > > I agree, it's a big hack. It would be nice to have a simpler way to do > this in driver code rather than explicitly calling > of_dma_configure/arch_setup_dma_ops as per the original patch in this > thread. > I haven't followed the entire discussion, but what's wrong with passing around a pointer to a 'struct device *hwdev' that represents the physical device that does the DMA? Arnd