From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [PATCH] dc395x: Fix support for highmem Date: Sun, 24 Apr 2005 18:11:58 -0400 Message-ID: <1114380718.4786.10.camel@mulgrave> References: <20050321075531.GC23911@suse.de> <7044.1111398919@www16.gmx.net> <20050321104419.GH23911@suse.de> <1112220802.9435.1.camel@mulgrave> <20050422113654.GY9371@suse.de> <1114282904.5068.19.camel@mulgrave> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from stat16.steeleye.com ([209.192.50.48]:55787 "EHLO hancock.sc.steeleye.com") by vger.kernel.org with ESMTP id S262480AbVDXX0l (ORCPT ); Sun, 24 Apr 2005 19:26:41 -0400 In-Reply-To: Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Guennadi Liakhovetski Cc: Jens Axboe , Christoph Hellwig , Matthew Wilcox , SCSI Mailing List , Kurt Garloff On Sun, 2005-04-24 at 02:22 +0200, Guennadi Liakhovetski wrote: > Thanks for the info. Let me see, if I got you right. Say, we've got an sg > with 2 elements: first 2 * PAGE_SIZE long, offset 0, pointing to page #0, > second PAGE_SIZE long, offset 0, page #3. Say, dma_map_sg returned 1, so, > it mapped all those 3 (physically discontiguous) pages to a contiguous bus > address range. And now sg_dma_len() returns 3 * PAGE_SIZE. Yes, that's true. > But, I hope, > the .page, .length, and .offset elements stayed unchanged, so, one can > still walk elements 0 and 1, calculating a sum of sg[i].length and thus > arrive to the required page, right? This, I'm not entirely sure about. There are some weird iommu mapping implementations out there. The only absolute requirement is that the map_sg unmap_sg map_sg actually work. There was some debate over whether unmap_sg was supposed to return the sg list to its original form, but x86_64 got beaten up in the argument, so this is true too. So ... I think the answer to your question is "yes", at least for all the iommu implementations I know about. However, nothing in the published API actually requires this. What I think all this means is that you can get away with what you're proposing. However, the proper route would be to unmap the sglist before you start feeding the leftovers via pio. James