Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165120467
D34118.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D34118.diff
View Options
diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c
--- a/sys/arm/arm/busdma_machdep.c
+++ b/sys/arm/arm/busdma_machdep.c
@@ -812,6 +812,7 @@
vm_offset_t vaddr;
vm_offset_t vendaddr;
bus_addr_t paddr;
+ bus_size_t sg_len;
if (map->pagesneeded == 0) {
CTR5(KTR_BUSDMA, "lowaddr= %d, boundary= %d, alignment= %d"
@@ -826,16 +827,16 @@
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
+ sg_len = MIN(vendaddr - vaddr,
+ (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)));
+ sg_len = MIN(sg_len, dmat->maxsegsz);
if (__predict_true(pmap == kernel_pmap))
paddr = pmap_kextract(vaddr);
else
paddr = pmap_extract(pmap, vaddr);
- if (must_bounce(dmat, map, paddr,
- min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr &
- PAGE_MASK)))) != 0) {
+ if (must_bounce(dmat, map, paddr, sg_len) != 0)
map->pagesneeded++;
- }
- vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK));
+ vaddr += sg_len;
}
CTR1(KTR_BUSDMA, "pagesneeded= %d", map->pagesneeded);
}
diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -693,6 +693,7 @@
while (vaddr < vendaddr) {
sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK);
+ sg_len = MIN(sg_len, dmat->common.maxsegsz);
if (pmap == kernel_pmap)
paddr = pmap_kextract(vaddr);
else
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -520,6 +520,7 @@
bus_size_t sg_len;
sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK);
+ sg_len = MIN(sg_len, dmat->maxsegsz);
if (pmap == kernel_pmap)
paddr = pmap_kextract(vaddr);
else
diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c
--- a/sys/riscv/riscv/busdma_bounce.c
+++ b/sys/riscv/riscv/busdma_bounce.c
@@ -531,6 +531,7 @@
while (vaddr < vendaddr) {
sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK);
+ sg_len = MIN(sg_len, dmat->common.maxsegsz);
if (pmap == kernel_pmap)
paddr = pmap_kextract(vaddr);
else
diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -560,6 +560,7 @@
while (vaddr < vendaddr) {
sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK);
+ sg_len = MIN(sg_len, dmat->common.maxsegsz);
if (pmap == kernel_pmap)
paddr = pmap_kextract(vaddr);
else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 7, 5:43 AM (17 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36148576
Default Alt Text
D34118.diff (2 KB)
Attached To
Mode
D34118: busdma: fix page miscount for small segment sizes
Attached
Detach File
Event Timeline
Log In to Comment