Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754014AbYJCPd1 (ORCPT ); Fri, 3 Oct 2008 11:33:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752180AbYJCPdR (ORCPT ); Fri, 3 Oct 2008 11:33:17 -0400 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:40503 "EHLO g5t0006.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbYJCPdQ (ORCPT ); Fri, 3 Oct 2008 11:33:16 -0400 From: Bjorn Helgaas To: "Yu, Fenghua" Subject: Re: [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Date: Fri, 3 Oct 2008 09:33:09 -0600 User-Agent: KMail/1.9.9 Cc: "Luck, Tony" , Jesse Barnes , David Woodhouse , Ingo Molnar , Avi Kivity , Stephen Rothwell , Andrew Morton , LKML , "linux-ia64@vger.kernel.org" References: <200810020931.48952.bjorn.helgaas@hp.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810030933.10627.bjorn.helgaas@hp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2869 Lines: 63 On Thursday 02 October 2008 03:46:06 pm Yu, Fenghua wrote: > >> The current Intel IOMMU code assumes that both host page size and Intel IOMMU page size are 4K. The first patch supports variable page size. This provides support for IA64 which has multiple page sizes. > >> > >> This patch also adds some other code hooks for IA64 platform including DMAR_OPERATION_TIMEOUT definition, . > > >Can you split this patch up? It contains several logically separate > changes: > > - casting things to unsigned long long > > - adding stuff under #ifdef CONFIG_IA64 > > - page size changes > > - whitespace changes > > Depends on who is picking up the generic patch. If it's needed, I can split it into multiple patches. Regardless of who's picking up the patch, splitting it makes it easier to review and easier to spot bugs, and makes bisection yield better information. > >> @@ -510,7 +514,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) > >> > >> iommu->seq_id = iommu_allocated++; > >> > >> - iommu->reg = ioremap(drhd->reg_base_addr, PAGE_SIZE_4K); > >> + iommu->reg = ioremap(drhd->reg_base_addr, IOMMU_PAGE_SIZE); > >> if (!iommu->reg) { > >> printk(KERN_ERR "IOMMU: can't map the region\n"); > > > >This printk should include a clue, like the IOMMU ID and/or address > >we tried to map. > > This is a good comment. This patch set is mainly for porting IOMMU to IA64. I will add IOMMU ID in a follow-up clean-up patch. Since you're not actually adding the printk in this patch, it sounds fair to clean it up in a follow-up patch. > >> -#define PAGE_SHIFT_4K (12) > >> -#define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K) > >> -#define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K) > >> -#define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K) > >> +#define IOMMU_PAGE_SHIFT (12) > >> +#define IOMMU_PAGE_SIZE (1UL << IOMMU_PAGE_SHIFT) > >> +#define IOMMU_PAGE_MASK (((u64)-1) << IOMMU_PAGE_SHIFT) > >> +#define IOMMU_PAGE_ALIGN(addr) \ > >> + (((addr) + IOMMU_PAGE_SIZE - 1) & IOMMU_PAGE_MASK) > >> > >> -#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT_4K) > >> +#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT) > > > >These are pretty generic names (IOMMU_PAGE_SHIFT, IOVA_PFN, etc), > >but the definitions seem to be specific to VT-d. I can't tell if > >this file is supposed to be sort of generic, or if it's Intel-specific. > > I can change IOMMU_PAGE_SHIFT etc to VTD_PAGE_SHIFT etc and change IOVA_PFN to VTD_IOVA_PFN. What do you think? Those sound good to me. Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/