From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbbKQMXN (ORCPT ); Tue, 17 Nov 2015 07:23:13 -0500 Received: from foss.arm.com ([217.140.101.70]:56423 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbbKQMWz (ORCPT ); Tue, 17 Nov 2015 07:22:55 -0500 Date: Tue, 17 Nov 2015 12:22:51 +0000 From: Catalin Marinas To: Arnd Bergmann Cc: "Rafael J. Wysocki" , Will Deacon , linux-kernel@vger.kernel.org, Suravee Suthikulpanit , Mark Salter , linux-arm-kernel@lists.infradead.org Subject: Re: [RFC] ARM64: simplify dma_get_ops Message-ID: <20151117122250.GH6556@e104818-lin.cambridge.arm.com> References: <4270550.cGd11OgA5n@wuerfel> <20151116183941.GF6556@e104818-lin.cambridge.arm.com> <5118146.8KqrJiJrDe@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5118146.8KqrJiJrDe@wuerfel> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 16, 2015 at 08:57:41PM +0100, Arnd Bergmann wrote: > On Monday 16 November 2015 18:39:41 Catalin Marinas wrote: > > On Mon, Nov 16, 2015 at 05:25:48PM +0100, Arnd Bergmann wrote: > > > @@ -985,7 +977,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > > > struct iommu_ops *iommu, bool coherent) > > > { > > > if (!acpi_disabled && !dev->archdata.dma_ops) > > > - dev->archdata.dma_ops = dma_ops; > > > + dev->archdata.dma_ops = &swiotlb_dma_ops; > > > > Why do we still keep the !acpi_disabled check here? If I remove it, the > > WARN_ON() above disappears. > > Ah, good. That must be my mistake then. This looks much better. I merged this patch with the above change. Thanks. > On a related note, we should also urgently fix the > arch_setup_dma_ops() function to no longer ignore the base and size > arguments. For dma_base, we can simply WARN_ON(dma_base != 0), so we > can implement support for that whenever we need it, I think we should, at least until we implement support for dev->dma_pfn_offset. I'm not sure about iommu though, maybe there are working configurations with dma_base != 0. > but for the size we need to prevent drivers from calling > dma_set_mask() with an argument larger than the size we pass in here, > unless the size is also larger than max_pfn. We have a default mask set up in of_dma_configure() based on size and dma_base. Can we check the new mask against the default one? -- Catalin