Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423810AbbFEOcL (ORCPT ); Fri, 5 Jun 2015 10:32:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56021 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932313AbbFEOcI (ORCPT ); Fri, 5 Jun 2015 10:32:08 -0400 Date: Fri, 5 Jun 2015 16:32:04 +0200 From: "jroedel@suse.de" To: Will Deacon Cc: Joerg Roedel , "iommu@lists.linux-foundation.org" , Kukjin Kim , David Woodhouse , Heiko Stuebner , Hiroshi Doyu , Thierry Reding , Alex Williamson , Robin Murphy , Laurent Pinchart , Oded Gabbay , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 10/22] iommu: Introduce direct mapped region handling Message-ID: <20150605143204.GJ16345@suse.de> References: <1432831305-11126-1-git-send-email-joro@8bytes.org> <1432831305-11126-11-git-send-email-joro@8bytes.org> <20150605141749.GA7420@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150605141749.GA7420@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2156 Lines: 50 Hi Will, On Fri, Jun 05, 2015 at 03:17:50PM +0100, Will Deacon wrote: > On Thu, May 28, 2015 at 05:41:33PM +0100, Joerg Roedel wrote: > > +/** > > + * struct iommu_dm_region - descriptor for a direct mapped memory region > > + * @list: Linked list pointers > > + * @start: System physical start address of the region > > + * @length: Length of the region in bytes > > + * @prot: IOMMU Protection flags (READ/WRITE/...) > > + */ > > +struct iommu_dm_region { > > + struct list_head list; > > + phys_addr_t start; > > + size_t length; > > + int prot; > > +}; > > I'm slightly puzzled about this. It looks to me like we're asking the > IOMMU driver to construct a description of the system's physical address > space, but this information tends to be known elsewhere for things like > initialising lowmem on the CPU using memblock. Well, this is not about the general memory layout of the machine, it is more about the requirements of the firmware. The firmware might have their own mapping requirements, for example a USB controler that is handled by the BIOS. Other devices (be2net adapters with special firmware) might have such requirements too. On x86 these requirements are described in the IOMMU ACPI tables (RMRR entries on Intel, Unity mappings on AMD). > Also, it looks like we just use these regions to create the default > domain using iommu_map calls -- why don't we just have an IOMMU callback > to initialise the default domain instead? That would allow IOMMUs with a > per-master bypass mode to avoid allocating page tables altogether. In theory yes, but this information is not only needed for the creation of default domains, but also for a generic DMA-API implementation for IOMMU drivers. A DMA-API implementation has to mark these address ranges as reserved in its address allocator, so it is better to export this information than doing the handling in the iommu drivers. Joerg -- 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/