From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551AbbJLQED (ORCPT ); Mon, 12 Oct 2015 12:04:03 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:33452 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752517AbbJLQD7 (ORCPT ); Mon, 12 Oct 2015 12:03:59 -0400 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: nacc@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Mon, 12 Oct 2015 09:03:52 -0700 From: Nishanth Aravamudan To: David Gibson Cc: Matthew Wilcox , Keith Busch , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Alexey Kardashevskiy , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 1/2] powerpc/iommu: expose IOMMU page shift Message-ID: <20151012160352.GA24212@linux.vnet.ibm.com> References: <20151002171606.GA41011@linux.vnet.ibm.com> <20151002171800.GB41011@linux.vnet.ibm.com> <20151006031943.GC3861@voom.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151006031943.GC3861@voom.fritz.box> X-Operating-System: Linux 3.13.0-40-generic (x86_64) User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15101216-0017-0000-0000-00000E95317D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06.10.2015 [14:19:43 +1100], David Gibson wrote: > On Fri, Oct 02, 2015 at 10:18:00AM -0700, Nishanth Aravamudan wrote: > > We will leverage this macro in the NVMe driver, which needs to know the > > configured IOMMU page shift to properly configure its device's page > > size. > > > > Signed-off-by: Nishanth Aravamudan > > > > --- > > Given this is available, it seems reasonable to expose -- and it doesn't > > really make sense to make the driver do a log2 call on the existing > > IOMMU_PAGE_SIZE() value. > > > > diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h > > index ca18cff..6fdf857 100644 > > --- a/arch/powerpc/include/asm/iommu.h > > +++ b/arch/powerpc/include/asm/iommu.h > > @@ -36,6 +36,7 @@ > > #define IOMMU_PAGE_MASK_4K (~((1 << IOMMU_PAGE_SHIFT_4K) - 1)) > > #define IOMMU_PAGE_ALIGN_4K(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE_4K) > > > > +#define IOMMU_PAGE_SHIFT(tblptr) (tblptr)->it_page_shift > > #define IOMMU_PAGE_SIZE(tblptr) (ASM_CONST(1) << (tblptr)->it_page_shift) > > Seems like it would be a touch safer to alter IOMMU_PAGE_SIZE so it > uses the new IOMMU_PAGE_SHIFT macro. Yes absolutely! Sorry, I initially didn't add the first macro, so didn't think that through. Will update. -Nish