From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934141AbbEMCxz (ORCPT ); Tue, 12 May 2015 22:53:55 -0400 Received: from mailgw02.mediatek.com ([218.249.47.111]:55857 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932719AbbEMCxy (ORCPT ); Tue, 12 May 2015 22:53:54 -0400 X-Listener-Flag: 11101 Message-ID: <1431485563.4799.2.camel@mhfsdcap03> Subject: Re: [RFC PATCH] iommu: add ARM short descriptor page table allocator. From: Yong Wu To: Matthias Brugger CC: Will Deacon , Joerg Roedel , "Robin Murphy" , Tomasz Figa , Lucas Stach , , Sascha Hauer , srv_heupstream , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Date: Wed, 13 May 2015 10:52:43 +0800 In-Reply-To: References: <1430206881-18294-1-git-send-email-yong.wu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2015-05-12 at 11:15 +0200, Matthias Brugger wrote: > 2015-04-28 9:41 GMT+02:00 Yong Wu : > > This patch is for ARM Short Descriptor Format.It has 2-levels > > pagetable and the allocator supports 4K/64K/1M/16M. > > > > Signed-off-by: Yong Wu [snip] > > +static phys_addr_t arm_short_iova_to_phys(struct io_pgtable_ops *ops, > > + unsigned long iova) > > +{ > > + struct arm_short_io_pgtable *data = io_pgtable_short_ops_to_data(ops); > > + arm_short_iopte *pte, *pgd = data->pgd; > > + phys_addr_t pa = 0; > > + > > + pgd += ARM_SHORT_PGD_IDX(iova); > > + > > + if (ARM_SHORT_F_PGD_TYPE_IS_PAGE(*pgd)) { > > + pte = arm_short_get_pte_in_pgd(*pgd, iova); > > + > > + if (ARM_SHORT_F_PTE_TYPE_GET(*pte) > > + == ARM_SHORT_F_PTE_TYPE_LARGE) { > > + pa = (*pte) & ARM_SHORT_F_PTE_PA_LARGE_MSK; > > + pa |= iova & (~ARM_SHORT_F_PTE_PA_LARGE_MSK); > > + } else if (ARM_SHORT_F_PTE_TYPE_GET(*pte) > > + == ARM_SHORT_F_PTE_TYPE_SMALL) { > > Would make it easier to read: > u8 pte_type; > > [...] > > pte_type = ARM_SHORT_F_PTE_TYPE_GET(*pte) > if (pte_type == ARM_SHORT_F_PTE_TYPE_LARGE) { > [...] > } else if (pte_type == ARM_SHORT_F_PTE_TYPE_SMALL) { > [...] Hi Matthias, Thanks for your review.I will fix this in next version.