diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-07-17 05:45:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-07-17 05:45:29 -0400 |
commit | b5e4111f027c4be85dbe97e090530d03c55c4cf4 (patch) | |
tree | 11e0a37cb59314f4e9a7b2810124a4a7a33140e5 /lib | |
parent | 72d5305dcb3637913c2c37e847a4de9028e49244 (diff) | |
parent | 9de8033f1bbcce5ed23fe5da9ca1a5060207f7ed (diff) |
Merge branch 'locking/urgent' into locking/core, before applying larger changes and to refresh the branch with fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 4 | ||||
-rw-r--r-- | lib/iovec.c | 55 | ||||
-rw-r--r-- | lib/lz4/lz4_decompress.c | 12 | ||||
-rw-r--r-- | lib/lzo/lzo1x_decompress_safe.c | 62 | ||||
-rw-r--r-- | lib/swiotlb.c | 28 |
5 files changed, 126 insertions, 35 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index cf3b30dd0e0a..f488bef5ac37 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -930,7 +930,7 @@ config LOCKDEP | |||
930 | bool | 930 | bool |
931 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT | 931 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT |
932 | select STACKTRACE | 932 | select STACKTRACE |
933 | select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC | 933 | select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE |
934 | select KALLSYMS | 934 | select KALLSYMS |
935 | select KALLSYMS_ALL | 935 | select KALLSYMS_ALL |
936 | 936 | ||
@@ -1408,7 +1408,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER | |||
1408 | depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT | 1408 | depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT |
1409 | depends on !X86_64 | 1409 | depends on !X86_64 |
1410 | select STACKTRACE | 1410 | select STACKTRACE |
1411 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC | 1411 | select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE |
1412 | help | 1412 | help |
1413 | Provide stacktrace filter for fault-injection capabilities | 1413 | Provide stacktrace filter for fault-injection capabilities |
1414 | 1414 | ||
diff --git a/lib/iovec.c b/lib/iovec.c index 454baa88bf27..7a7c2da4cddf 100644 --- a/lib/iovec.c +++ b/lib/iovec.c | |||
@@ -51,3 +51,58 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) | |||
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | EXPORT_SYMBOL(memcpy_toiovec); | 53 | EXPORT_SYMBOL(memcpy_toiovec); |
54 | |||
55 | /* | ||
56 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
57 | */ | ||
58 | |||
59 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
60 | int offset, int len) | ||
61 | { | ||
62 | int copy; | ||
63 | for (; len > 0; ++iov) { | ||
64 | /* Skip over the finished iovecs */ | ||
65 | if (unlikely(offset >= iov->iov_len)) { | ||
66 | offset -= iov->iov_len; | ||
67 | continue; | ||
68 | } | ||
69 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
70 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
71 | return -EFAULT; | ||
72 | offset = 0; | ||
73 | kdata += copy; | ||
74 | len -= copy; | ||
75 | } | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
80 | |||
81 | /* | ||
82 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
83 | */ | ||
84 | |||
85 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
86 | int offset, int len) | ||
87 | { | ||
88 | /* Skip over the finished iovecs */ | ||
89 | while (offset >= iov->iov_len) { | ||
90 | offset -= iov->iov_len; | ||
91 | iov++; | ||
92 | } | ||
93 | |||
94 | while (len > 0) { | ||
95 | u8 __user *base = iov->iov_base + offset; | ||
96 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
97 | |||
98 | offset = 0; | ||
99 | if (copy_from_user(kdata, base, copy)) | ||
100 | return -EFAULT; | ||
101 | len -= copy; | ||
102 | kdata += copy; | ||
103 | iov++; | ||
104 | } | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index df6839e3ce08..7a85967060a5 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
@@ -72,6 +72,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
72 | len = *ip++; | 72 | len = *ip++; |
73 | for (; len == 255; length += 255) | 73 | for (; len == 255; length += 255) |
74 | len = *ip++; | 74 | len = *ip++; |
75 | if (unlikely(length > (size_t)(length + len))) | ||
76 | goto _output_error; | ||
75 | length += len; | 77 | length += len; |
76 | } | 78 | } |
77 | 79 | ||
@@ -106,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
106 | if (length == ML_MASK) { | 108 | if (length == ML_MASK) { |
107 | for (; *ip == 255; length += 255) | 109 | for (; *ip == 255; length += 255) |
108 | ip++; | 110 | ip++; |
111 | if (unlikely(length > (size_t)(length + *ip))) | ||
112 | goto _output_error; | ||
109 | length += *ip++; | 113 | length += *ip++; |
110 | } | 114 | } |
111 | 115 | ||
@@ -155,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
155 | 159 | ||
156 | /* write overflow error detected */ | 160 | /* write overflow error detected */ |
157 | _output_error: | 161 | _output_error: |
158 | return (int) (-(((char *)ip) - source)); | 162 | return -1; |
159 | } | 163 | } |
160 | 164 | ||
161 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | 165 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, |
@@ -188,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
188 | int s = 255; | 192 | int s = 255; |
189 | while ((ip < iend) && (s == 255)) { | 193 | while ((ip < iend) && (s == 255)) { |
190 | s = *ip++; | 194 | s = *ip++; |
195 | if (unlikely(length > (size_t)(length + s))) | ||
196 | goto _output_error; | ||
191 | length += s; | 197 | length += s; |
192 | } | 198 | } |
193 | } | 199 | } |
@@ -228,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
228 | if (length == ML_MASK) { | 234 | if (length == ML_MASK) { |
229 | while (ip < iend) { | 235 | while (ip < iend) { |
230 | int s = *ip++; | 236 | int s = *ip++; |
237 | if (unlikely(length > (size_t)(length + s))) | ||
238 | goto _output_error; | ||
231 | length += s; | 239 | length += s; |
232 | if (s == 255) | 240 | if (s == 255) |
233 | continue; | 241 | continue; |
@@ -280,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
280 | 288 | ||
281 | /* write overflow error detected */ | 289 | /* write overflow error detected */ |
282 | _output_error: | 290 | _output_error: |
283 | return (int) (-(((char *) ip) - source)); | 291 | return -1; |
284 | } | 292 | } |
285 | 293 | ||
286 | int lz4_decompress(const unsigned char *src, size_t *src_len, | 294 | int lz4_decompress(const unsigned char *src, size_t *src_len, |
diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c index 569985d522d5..8563081e8da3 100644 --- a/lib/lzo/lzo1x_decompress_safe.c +++ b/lib/lzo/lzo1x_decompress_safe.c | |||
@@ -19,11 +19,31 @@ | |||
19 | #include <linux/lzo.h> | 19 | #include <linux/lzo.h> |
20 | #include "lzodefs.h" | 20 | #include "lzodefs.h" |
21 | 21 | ||
22 | #define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x)) | 22 | #define HAVE_IP(t, x) \ |
23 | #define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x)) | 23 | (((size_t)(ip_end - ip) >= (size_t)(t + x)) && \ |
24 | #define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun | 24 | (((t + x) >= t) && ((t + x) >= x))) |
25 | #define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun | 25 | |
26 | #define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun | 26 | #define HAVE_OP(t, x) \ |
27 | (((size_t)(op_end - op) >= (size_t)(t + x)) && \ | ||
28 | (((t + x) >= t) && ((t + x) >= x))) | ||
29 | |||
30 | #define NEED_IP(t, x) \ | ||
31 | do { \ | ||
32 | if (!HAVE_IP(t, x)) \ | ||
33 | goto input_overrun; \ | ||
34 | } while (0) | ||
35 | |||
36 | #define NEED_OP(t, x) \ | ||
37 | do { \ | ||
38 | if (!HAVE_OP(t, x)) \ | ||
39 | goto output_overrun; \ | ||
40 | } while (0) | ||
41 | |||
42 | #define TEST_LB(m_pos) \ | ||
43 | do { \ | ||
44 | if ((m_pos) < out) \ | ||
45 | goto lookbehind_overrun; \ | ||
46 | } while (0) | ||
27 | 47 | ||
28 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, | 48 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, |
29 | unsigned char *out, size_t *out_len) | 49 | unsigned char *out, size_t *out_len) |
@@ -58,14 +78,14 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, | |||
58 | while (unlikely(*ip == 0)) { | 78 | while (unlikely(*ip == 0)) { |
59 | t += 255; | 79 | t += 255; |
60 | ip++; | 80 | ip++; |
61 | NEED_IP(1); | 81 | NEED_IP(1, 0); |
62 | } | 82 | } |
63 | t += 15 + *ip++; | 83 | t += 15 + *ip++; |
64 | } | 84 | } |
65 | t += 3; | 85 | t += 3; |
66 | copy_literal_run: | 86 | copy_literal_run: |
67 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 87 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
68 | if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) { | 88 | if (likely(HAVE_IP(t, 15) && HAVE_OP(t, 15))) { |
69 | const unsigned char *ie = ip + t; | 89 | const unsigned char *ie = ip + t; |
70 | unsigned char *oe = op + t; | 90 | unsigned char *oe = op + t; |
71 | do { | 91 | do { |
@@ -81,8 +101,8 @@ copy_literal_run: | |||
81 | } else | 101 | } else |
82 | #endif | 102 | #endif |
83 | { | 103 | { |
84 | NEED_OP(t); | 104 | NEED_OP(t, 0); |
85 | NEED_IP(t + 3); | 105 | NEED_IP(t, 3); |
86 | do { | 106 | do { |
87 | *op++ = *ip++; | 107 | *op++ = *ip++; |
88 | } while (--t > 0); | 108 | } while (--t > 0); |
@@ -95,7 +115,7 @@ copy_literal_run: | |||
95 | m_pos -= t >> 2; | 115 | m_pos -= t >> 2; |
96 | m_pos -= *ip++ << 2; | 116 | m_pos -= *ip++ << 2; |
97 | TEST_LB(m_pos); | 117 | TEST_LB(m_pos); |
98 | NEED_OP(2); | 118 | NEED_OP(2, 0); |
99 | op[0] = m_pos[0]; | 119 | op[0] = m_pos[0]; |
100 | op[1] = m_pos[1]; | 120 | op[1] = m_pos[1]; |
101 | op += 2; | 121 | op += 2; |
@@ -119,10 +139,10 @@ copy_literal_run: | |||
119 | while (unlikely(*ip == 0)) { | 139 | while (unlikely(*ip == 0)) { |
120 | t += 255; | 140 | t += 255; |
121 | ip++; | 141 | ip++; |
122 | NEED_IP(1); | 142 | NEED_IP(1, 0); |
123 | } | 143 | } |
124 | t += 31 + *ip++; | 144 | t += 31 + *ip++; |
125 | NEED_IP(2); | 145 | NEED_IP(2, 0); |
126 | } | 146 | } |
127 | m_pos = op - 1; | 147 | m_pos = op - 1; |
128 | next = get_unaligned_le16(ip); | 148 | next = get_unaligned_le16(ip); |
@@ -137,10 +157,10 @@ copy_literal_run: | |||
137 | while (unlikely(*ip == 0)) { | 157 | while (unlikely(*ip == 0)) { |
138 | t += 255; | 158 | t += 255; |
139 | ip++; | 159 | ip++; |
140 | NEED_IP(1); | 160 | NEED_IP(1, 0); |
141 | } | 161 | } |
142 | t += 7 + *ip++; | 162 | t += 7 + *ip++; |
143 | NEED_IP(2); | 163 | NEED_IP(2, 0); |
144 | } | 164 | } |
145 | next = get_unaligned_le16(ip); | 165 | next = get_unaligned_le16(ip); |
146 | ip += 2; | 166 | ip += 2; |
@@ -154,7 +174,7 @@ copy_literal_run: | |||
154 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 174 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
155 | if (op - m_pos >= 8) { | 175 | if (op - m_pos >= 8) { |
156 | unsigned char *oe = op + t; | 176 | unsigned char *oe = op + t; |
157 | if (likely(HAVE_OP(t + 15))) { | 177 | if (likely(HAVE_OP(t, 15))) { |
158 | do { | 178 | do { |
159 | COPY8(op, m_pos); | 179 | COPY8(op, m_pos); |
160 | op += 8; | 180 | op += 8; |
@@ -164,7 +184,7 @@ copy_literal_run: | |||
164 | m_pos += 8; | 184 | m_pos += 8; |
165 | } while (op < oe); | 185 | } while (op < oe); |
166 | op = oe; | 186 | op = oe; |
167 | if (HAVE_IP(6)) { | 187 | if (HAVE_IP(6, 0)) { |
168 | state = next; | 188 | state = next; |
169 | COPY4(op, ip); | 189 | COPY4(op, ip); |
170 | op += next; | 190 | op += next; |
@@ -172,7 +192,7 @@ copy_literal_run: | |||
172 | continue; | 192 | continue; |
173 | } | 193 | } |
174 | } else { | 194 | } else { |
175 | NEED_OP(t); | 195 | NEED_OP(t, 0); |
176 | do { | 196 | do { |
177 | *op++ = *m_pos++; | 197 | *op++ = *m_pos++; |
178 | } while (op < oe); | 198 | } while (op < oe); |
@@ -181,7 +201,7 @@ copy_literal_run: | |||
181 | #endif | 201 | #endif |
182 | { | 202 | { |
183 | unsigned char *oe = op + t; | 203 | unsigned char *oe = op + t; |
184 | NEED_OP(t); | 204 | NEED_OP(t, 0); |
185 | op[0] = m_pos[0]; | 205 | op[0] = m_pos[0]; |
186 | op[1] = m_pos[1]; | 206 | op[1] = m_pos[1]; |
187 | op += 2; | 207 | op += 2; |
@@ -194,15 +214,15 @@ match_next: | |||
194 | state = next; | 214 | state = next; |
195 | t = next; | 215 | t = next; |
196 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 216 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
197 | if (likely(HAVE_IP(6) && HAVE_OP(4))) { | 217 | if (likely(HAVE_IP(6, 0) && HAVE_OP(4, 0))) { |
198 | COPY4(op, ip); | 218 | COPY4(op, ip); |
199 | op += t; | 219 | op += t; |
200 | ip += t; | 220 | ip += t; |
201 | } else | 221 | } else |
202 | #endif | 222 | #endif |
203 | { | 223 | { |
204 | NEED_IP(t + 3); | 224 | NEED_IP(t, 3); |
205 | NEED_OP(t); | 225 | NEED_OP(t, 0); |
206 | while (t > 0) { | 226 | while (t > 0) { |
207 | *op++ = *ip++; | 227 | *op++ = *ip++; |
208 | t--; | 228 | t--; |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 649d097853a1..4abda074ea45 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -86,6 +86,7 @@ static unsigned int io_tlb_index; | |||
86 | * We need to save away the original address corresponding to a mapped entry | 86 | * We need to save away the original address corresponding to a mapped entry |
87 | * for the sync operations. | 87 | * for the sync operations. |
88 | */ | 88 | */ |
89 | #define INVALID_PHYS_ADDR (~(phys_addr_t)0) | ||
89 | static phys_addr_t *io_tlb_orig_addr; | 90 | static phys_addr_t *io_tlb_orig_addr; |
90 | 91 | ||
91 | /* | 92 | /* |
@@ -188,12 +189,14 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
188 | io_tlb_list = memblock_virt_alloc( | 189 | io_tlb_list = memblock_virt_alloc( |
189 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), | 190 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), |
190 | PAGE_SIZE); | 191 | PAGE_SIZE); |
191 | for (i = 0; i < io_tlb_nslabs; i++) | ||
192 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
193 | io_tlb_index = 0; | ||
194 | io_tlb_orig_addr = memblock_virt_alloc( | 192 | io_tlb_orig_addr = memblock_virt_alloc( |
195 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), | 193 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), |
196 | PAGE_SIZE); | 194 | PAGE_SIZE); |
195 | for (i = 0; i < io_tlb_nslabs; i++) { | ||
196 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
197 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
198 | } | ||
199 | io_tlb_index = 0; | ||
197 | 200 | ||
198 | if (verbose) | 201 | if (verbose) |
199 | swiotlb_print_info(); | 202 | swiotlb_print_info(); |
@@ -313,10 +316,6 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
313 | if (!io_tlb_list) | 316 | if (!io_tlb_list) |
314 | goto cleanup3; | 317 | goto cleanup3; |
315 | 318 | ||
316 | for (i = 0; i < io_tlb_nslabs; i++) | ||
317 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
318 | io_tlb_index = 0; | ||
319 | |||
320 | io_tlb_orig_addr = (phys_addr_t *) | 319 | io_tlb_orig_addr = (phys_addr_t *) |
321 | __get_free_pages(GFP_KERNEL, | 320 | __get_free_pages(GFP_KERNEL, |
322 | get_order(io_tlb_nslabs * | 321 | get_order(io_tlb_nslabs * |
@@ -324,7 +323,11 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
324 | if (!io_tlb_orig_addr) | 323 | if (!io_tlb_orig_addr) |
325 | goto cleanup4; | 324 | goto cleanup4; |
326 | 325 | ||
327 | memset(io_tlb_orig_addr, 0, io_tlb_nslabs * sizeof(phys_addr_t)); | 326 | for (i = 0; i < io_tlb_nslabs; i++) { |
327 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
328 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
329 | } | ||
330 | io_tlb_index = 0; | ||
328 | 331 | ||
329 | swiotlb_print_info(); | 332 | swiotlb_print_info(); |
330 | 333 | ||
@@ -556,7 +559,8 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
556 | /* | 559 | /* |
557 | * First, sync the memory before unmapping the entry | 560 | * First, sync the memory before unmapping the entry |
558 | */ | 561 | */ |
559 | if (orig_addr && ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | 562 | if (orig_addr != INVALID_PHYS_ADDR && |
563 | ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | ||
560 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); | 564 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); |
561 | 565 | ||
562 | /* | 566 | /* |
@@ -573,8 +577,10 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
573 | * Step 1: return the slots to the free list, merging the | 577 | * Step 1: return the slots to the free list, merging the |
574 | * slots with superceeding slots | 578 | * slots with superceeding slots |
575 | */ | 579 | */ |
576 | for (i = index + nslots - 1; i >= index; i--) | 580 | for (i = index + nslots - 1; i >= index; i--) { |
577 | io_tlb_list[i] = ++count; | 581 | io_tlb_list[i] = ++count; |
582 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
583 | } | ||
578 | /* | 584 | /* |
579 | * Step 2: merge the returned slots with the preceding slots, | 585 | * Step 2: merge the returned slots with the preceding slots, |
580 | * if available (non zero) | 586 | * if available (non zero) |
@@ -593,6 +599,8 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
593 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; | 599 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; |
594 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; | 600 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; |
595 | 601 | ||
602 | if (orig_addr == INVALID_PHYS_ADDR) | ||
603 | return; | ||
596 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); | 604 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); |
597 | 605 | ||
598 | switch (target) { | 606 | switch (target) { |