From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: remove the ->mapping_error method from dma_map_ops V2 Date: Fri, 23 Nov 2018 11:49:18 +0100 Message-ID: <20181123104918.GE1586@8bytes.org> References: <20181122140320.24080-1-hch@lst.de> <20181122170715.GI30658@n2100.armlinux.org.uk> <11829e3c-7302-f821-cf5c-863e5267a17b@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <11829e3c-7302-f821-cf5c-863e5267a17b@arm.com> Sender: linux-kernel-owner@vger.kernel.org To: Robin Murphy Cc: Linus Torvalds , linux@armlinux.org.uk, Christoph Hellwig , linux-arch@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, David Woodhouse , the arch/x86 maintainers , Linux List Kernel Mailing , iommu@lists.linux-foundation.org, jdmason@kudzu.us, xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com List-Id: linux-arch.vger.kernel.org On Thu, Nov 22, 2018 at 05:52:15PM +0000, Robin Murphy wrote: > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > systems in general, "the top 4095" values may well still be valid addresses > - we're relying on a 1-byte mapping of the very top byte of memory/IOVA > space being sufficiently ridiculous that no real code would ever do that, > but even a 4-byte mapping of the top 4 bytes is within the realms of the > plausible (I've definitely seen the USB layer make 8-byte mappings from any > old offset within a page, for example). But we can easily work around that by reserving the top 4k of the first 4GB of IOVA address space in the allocator, no? Then these values are never returned as valid DMA handles. Regards, Joerg From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from 8bytes.org ([81.169.241.247]:49232 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387655AbeKWVdG (ORCPT ); Fri, 23 Nov 2018 16:33:06 -0500 Date: Fri, 23 Nov 2018 11:49:18 +0100 From: Joerg Roedel Subject: Re: remove the ->mapping_error method from dma_map_ops V2 Message-ID: <20181123104918.GE1586@8bytes.org> References: <20181122140320.24080-1-hch@lst.de> <20181122170715.GI30658@n2100.armlinux.org.uk> <11829e3c-7302-f821-cf5c-863e5267a17b@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11829e3c-7302-f821-cf5c-863e5267a17b@arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Robin Murphy Cc: Linus Torvalds , linux@armlinux.org.uk, Christoph Hellwig , linux-arch@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, David Woodhouse , the arch/x86 maintainers , Linux List Kernel Mailing , iommu@lists.linux-foundation.org, jdmason@kudzu.us, xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Message-ID: <20181123104918.jnujRjkI-iA92K9MWEpuPX63eXmMhhRgU0JEnNtzKaQ@z> On Thu, Nov 22, 2018 at 05:52:15PM +0000, Robin Murphy wrote: > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > systems in general, "the top 4095" values may well still be valid addresses > - we're relying on a 1-byte mapping of the very top byte of memory/IOVA > space being sufficiently ridiculous that no real code would ever do that, > but even a 4-byte mapping of the top 4 bytes is within the realms of the > plausible (I've definitely seen the USB layer make 8-byte mappings from any > old offset within a page, for example). But we can easily work around that by reserving the top 4k of the first 4GB of IOVA address space in the allocator, no? Then these values are never returned as valid DMA handles. Regards, Joerg