From: Andi Kleen <ak@suse.de>
To: Andi Kleen <ak@suse.de>
Cc: davem@redhat.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, gibbs@scsiguy.com
Subject: Re: [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps II
Date: Mon, 5 Jan 2004 22:40:18 +0100 [thread overview]
Message-ID: <20040105224018.43c8cde1.ak@suse.de> (raw)
In-Reply-To: <20040105223158.3364a676.ak@suse.de>
On Mon, 5 Jan 2004 22:31:58 +0100
Andi Kleen <ak@suse.de> wrote:
> For the sake of bug-to-bug compatibility to the SCSI layer this patch may
> work. I haven't tested it so no guarantees if it won't eat your file systems.
> Feedback welcome anyways.
[...]
This version will likely work better (original still set ->length to zero)
-Andi
diff -u linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h-o linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h
--- linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h-o 2003-07-18 02:40:01.000000000 +0200
+++ linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h 2004-01-05 22:10:15.000000000 +0100
@@ -4,8 +4,9 @@
struct scatterlist {
struct page *page;
unsigned int offset;
- unsigned int length;
+ unsigned int length;
dma_addr_t dma_address;
+ unsigned int dma_length;
};
#define ISA_DMA_THRESHOLD (0x00ffffff)
diff -u linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h-o linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h
--- linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h-o 2003-07-18 02:40:01.000000000 +0200
+++ linux-2.6.1rc1-amd64/include/asm-x86_64/scatterlist.h 2004-01-05 22:10:15.000000000 +0100
@@ -4,8 +4,9 @@
struct scatterlist {
struct page *page;
unsigned int offset;
- unsigned int length;
+ unsigned int length;
dma_addr_t dma_address;
+ unsigned int dma_length;
};
#define ISA_DMA_THRESHOLD (0x00ffffff)
diff -u linux-2.6.1rc1-amd64/arch/x86_64/kernel/pci-gart.c-o linux-2.6.1rc1-amd64/arch/x86_64/kernel/pci-gart.c
--- linux-2.6.1rc1-amd64/arch/x86_64/kernel/pci-gart.c-o 2004-01-01 06:40:28.000000000 +0100
+++ linux-2.6.1rc1-amd64/arch/x86_64/kernel/pci-gart.c 2004-01-05 22:37:59.000000000 +0100
@@ -384,6 +395,7 @@
}
}
s->dma_address = addr;
+ s->dma_length = s->length;
}
flush_gart(dev);
return nents;
@@ -410,8 +422,9 @@
*sout = *s;
sout->dma_address = iommu_bus_base;
sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
+ sout->dma_length = s->length;
} else {
- sout->length += s->length;
+ sout->dma_length += s->length;
}
addr = phys_addr;
@@ -490,8 +503,8 @@
goto error;
out++;
flush_gart(dev);
- if (out < nents)
- sg[out].length = 0;
+ if (out < nents)
+ sg[out].dma_length = 0;
return out;
error:
@@ -538,9 +551,9 @@
int i;
for (i = 0; i < nents; i++) {
struct scatterlist *s = &sg[i];
- if (!s->length)
+ if (!s->dma_length || !s->length)
break;
- pci_unmap_single(dev, s->dma_address, s->length, dir);
+ pci_unmap_single(dev, s->dma_address, s->dma_length, dir);
}
}
next prev parent reply other threads:[~2004-01-05 21:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200401051929.i05JTsM0000014248@mudpuddle.cs.wustl.edu.suse.lists.linux.kernel>
[not found] ` <20040105112800.7a9f240b.davem@redhat.com.suse.lists.linux.kernel>
2004-01-05 21:02 ` [BUG] x86_64 pci_map_sg modifies sg list - fails multiple map/unmaps Andi Kleen
2004-01-05 21:01 ` David S. Miller
2004-01-05 21:31 ` Andi Kleen
2004-01-05 21:40 ` Andi Kleen [this message]
2004-01-06 0:05 ` James Bottomley
2004-01-06 3:06 ` Andi Kleen
2004-01-06 3:04 ` David S. Miller
2004-01-06 3:14 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040105224018.43c8cde1.ak@suse.de \
--to=ak@suse.de \
--cc=davem@redhat.com \
--cc=gibbs@scsiguy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox