From patchwork Mon Sep 22 10:55:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 37673 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59B99202A1 for ; Mon, 22 Sep 2014 10:55:33 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id t60sf1430619wes.6 for ; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:thread-topic:accept-language :user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type:content-disposition :content-language; bh=UqMSvq0RRQHKO7hZa61SGRPRFQe4IE8iEti0I5+fF6s=; b=JUM8ZwqSrCc0nLGWFD4Cdtrra/rOmRBcL8MoE5WjL8nlU8QQGwjA/Ng3DUOL7eWgoF J7FLbe9sPQJIW0p96GC0CdpMKJQsvIuLMILle/VzB3vG1+6cSy9gxq/UX1HNCG7oMcRa ohk0Y3bMCACEmroElTyeDVECFaxHfeyq89C7fmN5EgJbGmptSAmkljaHoAnJojizPRwl g4TVzt6nzbIUin1RjBur00cxNQuDHU47svyyODlUHjTSMOOjvGol+5lxFVoQuPYjzz44 ry6dRnSPj6HBLW7hXSD/2tunRg8lGJw2aw5JV/FJ2x7r+N26UHUow8/JLQ9KHL/qCzBM UIRQ== X-Gm-Message-State: ALoCoQm6vSlkWpBNu58Gx47+iqtKjr38E8Odw+VoiNetNtyIh2S30YCvRMDsg72VJqLRX3wDPpNc X-Received: by 10.180.109.194 with SMTP id hu2mr1960149wib.1.1411383332567; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.7 with SMTP id f7ls508449laa.64.gmail; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) X-Received: by 10.112.144.228 with SMTP id sp4mr24061924lbb.54.1411383332417; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id 2si13936573lay.98.2014.09.22.03.55.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 03:55:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id l4so6459038lbv.2 for ; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr2333538lbb.73.1411383332100; Mon, 22 Sep 2014 03:55:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp213548lbb; Mon, 22 Sep 2014 03:55:31 -0700 (PDT) X-Received: by 10.68.241.138 with SMTP id wi10mr23324443pbc.126.1411383330424; Mon, 22 Sep 2014 03:55:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id et2si15201191pbc.59.2014.09.22.03.55.29 for ; Mon, 22 Sep 2014 03:55:30 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752723AbaIVKz3 (ORCPT + 5 others); Mon, 22 Sep 2014 06:55:29 -0400 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]:35396 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619AbaIVKz2 (ORCPT ); Mon, 22 Sep 2014 06:55:28 -0400 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id 74F0E104; Mon, 22 Sep 2014 05:55:24 -0500 (CDT) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 249005FADE; Mon, 22 Sep 2014 05:55:22 -0500 (CDT) Received: from e104818-lin.cambridge.arm.com (e104818-lin.cambridge.arm.com [10.1.203.37]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id 79F1013F6EE; Mon, 22 Sep 2014 05:55:20 -0500 (CDT) Date: Mon, 22 Sep 2014 11:55:18 +0100 From: Catalin Marinas To: Robin Murphy Cc: Will Deacon , Rob Herring , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "grant.likely@linaro.org" , "robh+dt@kernel.org" , "linux@arm.linux.org.uk" , "arm@kernel.org" , Mark Salter Subject: Re: [PATCH] of: amba: use of_dma_configure for AMBA devices Message-ID: <20140922105515.GI30085@e104818-lin.cambridge.arm.com> References: <90bd1ff3c93b827c12e1b3dc9ad3f227632d0f6e.1410954967.git.robin.murphy@arm.com> <20140917170338.GC18532@arm.com> <20140917180524.GG18532@arm.com> <541AC384.8010806@arm.com> <20140918125535.GB17701@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 In-Reply-To: <20140918125535.GB17701@e104818-lin.cambridge.arm.com> Thread-Topic: [PATCH] of: amba: use of_dma_configure for AMBA devices Accept-Language: en-GB, en-US User-Agent: Mutt/1.5.23 (2014-03-12) Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Disposition: inline Content-Language: en-US On Thu, Sep 18, 2014 at 01:55:36PM +0100, Catalin Marinas wrote: > On Thu, Sep 18, 2014 at 12:35:32PM +0100, Robin Murphy wrote: > > On 17/09/14 19:05, Will Deacon wrote: > > > On Wed, Sep 17, 2014 at 06:47:19PM +0100, Rob Herring wrote: > > >> On Wed, Sep 17, 2014 at 12:03 PM, Will Deacon wrote: > > >>> On Wed, Sep 17, 2014 at 12:56:07PM +0100, Robin Murphy wrote: > > >>>> Commit 591c1e ("of: configure the platform device dma parameters) > > >>>> introduced a common mechanism to configure DMA from DT properties. > > >>>> AMBA devices created from DT can take advantage of this, too. > > >>>> > > >>>> Signed-off-by: Robin Murphy > > >>> > > >>> Acked-by: Will Deacon > > >>> > > >>> It would be great if the arm-soc guys can pick this up. > > >> > > >> Is this a dependency for something else? If so, > > >> > > >> Acked-by: Rob Herring > > > > > > Yeah, it's going to be needed by my IOMMU init rework so that AMBA devices > > > get registered with their IOMMUs. > > > > Noob question: Does that mean I should resend (with ACKs) to > > arm@kernel.org? (I wasn't entirely sure where this should go, hence just > > throwing at the list with CCs) > > If it is not part of a larger series you want to merge, Rob could pick > it up (he could add the acks as well). > > Alternatively, I can get it via the arm64 tree together with an > additional patch removing the bus hooks in dma-mapping.c (maybe that's a > better option if no-one objects). So I plan to take this patch via the arm64 tree together with the patch below (after some more testing): ----8<---------------------------- >From 2189064795dc3fb4101e5c34d28c6b62b8a3bfd9 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Mon, 22 Sep 2014 11:48:31 +0100 Subject: [PATCH] arm64: Implement set_arch_dma_coherent_ops() to replace bus notifiers Commit 6ecba8eb51b7 (arm64: Use bus notifiers to set per-device coherent DMA ops) introduced bus notifiers to set the coherent dma ops based on the 'dma-coherent' DT property. Since the generic of_dma_configure() handles this property for platform and AMBA devices, replace the notifiers with set_arch_dma_coherent_ops(). Signed-off-by: Catalin Marinas Acked-by: Arnd Bergmann --- arch/arm64/include/asm/dma-mapping.h | 7 +++++++ arch/arm64/mm/dma-mapping.c | 31 ------------------------------- 2 files changed, 7 insertions(+), 31 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index dc82e52acdb3..adeae3f6f0fc 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -52,6 +52,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) dev->archdata.dma_ops = ops; } +static inline int set_arch_dma_coherent_ops(struct device *dev) +{ + set_dma_ops(dev, &coherent_swiotlb_dma_ops); + return 0; +} +#define set_arch_dma_coherent_ops set_arch_dma_coherent_ops + #include static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 4164c5ace9f8..d6ceb3df0047 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -22,11 +22,8 @@ #include #include #include -#include -#include #include #include -#include #include @@ -308,40 +305,12 @@ struct dma_map_ops coherent_swiotlb_dma_ops = { }; EXPORT_SYMBOL(coherent_swiotlb_dma_ops); -static int dma_bus_notifier(struct notifier_block *nb, - unsigned long event, void *_dev) -{ - struct device *dev = _dev; - - if (event != BUS_NOTIFY_ADD_DEVICE) - return NOTIFY_DONE; - - if (of_property_read_bool(dev->of_node, "dma-coherent")) - set_dma_ops(dev, &coherent_swiotlb_dma_ops); - - return NOTIFY_OK; -} - -static struct notifier_block platform_bus_nb = { - .notifier_call = dma_bus_notifier, -}; - -static struct notifier_block amba_bus_nb = { - .notifier_call = dma_bus_notifier, -}; - extern int swiotlb_late_init_with_default_size(size_t default_size); static int __init swiotlb_late_init(void) { size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT); - /* - * These must be registered before of_platform_populate(). - */ - bus_register_notifier(&platform_bus_type, &platform_bus_nb); - bus_register_notifier(&amba_bustype, &amba_bus_nb); - dma_ops = &noncoherent_swiotlb_dma_ops; return swiotlb_late_init_with_default_size(swiotlb_size);