Skip to content

Commit 4d8f5f9

Browse files
committed
Merge branch 'stable/for-linus-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb
Pull swiotlb fix from Konrad Rzeszutek Wilk: "One tiny fix for ARM64 where we could allocate the SWIOTLB twice" * 'stable/for-linus-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb: xen/swiotlb: don't initialize swiotlb twice on arm64
2 parents c23b071 + 4e7372e commit 4d8f5f9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/xen/swiotlb-xen.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ int __ref xen_swiotlb_init(int verbose, bool early)
202202
retry:
203203
bytes = xen_set_nslabs(xen_io_tlb_nslabs);
204204
order = get_order(xen_io_tlb_nslabs << IO_TLB_SHIFT);
205+
206+
/*
207+
* IO TLB memory already allocated. Just use it.
208+
*/
209+
if (io_tlb_start != 0) {
210+
xen_io_tlb_start = phys_to_virt(io_tlb_start);
211+
goto end;
212+
}
213+
205214
/*
206215
* Get IO TLB memory from any location.
207216
*/
@@ -231,7 +240,6 @@ int __ref xen_swiotlb_init(int verbose, bool early)
231240
m_ret = XEN_SWIOTLB_ENOMEM;
232241
goto error;
233242
}
234-
xen_io_tlb_end = xen_io_tlb_start + bytes;
235243
/*
236244
* And replace that memory with pages under 4GB.
237245
*/
@@ -258,6 +266,8 @@ int __ref xen_swiotlb_init(int verbose, bool early)
258266
} else
259267
rc = swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs);
260268

269+
end:
270+
xen_io_tlb_end = xen_io_tlb_start + bytes;
261271
if (!rc)
262272
swiotlb_set_max_segment(PAGE_SIZE);
263273

0 commit comments

Comments
 (0)