From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932288AbbJ0OJJ (ORCPT ); Tue, 27 Oct 2015 10:09:09 -0400 Received: from mga01.intel.com ([192.55.52.88]:25621 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753868AbbJ0OJG (ORCPT ); Tue, 27 Oct 2015 10:09:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,205,1444719600"; d="scan'208";a="672713198" Date: Tue, 27 Oct 2015 14:06:47 +0000 From: "Busch, Keith" To: Alexey Kardashevskiy Cc: Nishanth Aravamudan , Michael Ellerman , Matthew Wilcox , Benjamin Herrenschmidt , Paul Mackerras , David Gibson , Christoph Hellwig , "David S. Miller" , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: Re: [PATCH 2/7 v2] powerpc/dma-mapping: override dma_get_page_shift Message-ID: <20151027140647.GA15583@localhost.localdomain> References: <20151023205420.GA10197@linux.vnet.ibm.com> <20151023205718.GC10197@linux.vnet.ibm.com> <562F1368.1030204@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <562F1368.1030204@ozlabs.ru> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2015 at 05:02:16PM +1100, Alexey Kardashevskiy wrote: > >+unsigned long dma_get_page_shift(struct device *dev) > >+{ > >+ struct iommu_table *tbl = get_iommu_table_base(dev); > >+ if (tbl) > >+ return tbl->it_page_shift; > > > All PCI devices have this initialized on POWER (at least, our, IBM's > POWER) so 4K will always be returned here while in the case of > (get_dma_ops(dev)==&dma_direct_ops) it could actually return > PAGE_SHIFT. Is 4K still preferred value to return here? 4k is always a safe option to return, but ideally you want to return the highest guaranteed DMA address alignment. The driver just needs to know which bits to mask from virtual addresses such that the offset is the same as the DMA address.