Skip to content

Commit 63a7417

Browse files
committed
xen/swiotlb: Use page alignment for early buffer allocation.
This fixes an odd bug found on a Dell PowerEdge 1850/0RC130 (BIOS A05 01/09/2006) where all of the modules doing pci_set_dma_mask would fail with: ata_piix 0000:00:1f.1: enabling device (0005 -> 0007) ata_piix 0000:00:1f.1: can't derive routing for PCI INT A ata_piix 0000:00:1f.1: BMDMA: failed to set dma mask, falling back to PIO The issue was the Xen-SWIOTLB was allocated such as that the end of buffer was stradling a page (and also above 4GB). The fix was spotted by Kalev Leonid which was to piggyback on git commit e79f86b "swiotlb: Use page alignment for early buffer allocation" which: We could call free_bootmem_late() if swiotlb is not used, and it will shrink to page alignment. So alloc them with page alignment at first, to avoid lose two pages And doing that fixes the outstanding issue. CC: [email protected] Suggested-by: "Kalev, Leonid" <[email protected]> Reported-and-Tested-by: "Taylor, Neal E" <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent d3db728 commit 63a7417

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/xen/swiotlb-xen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void __init xen_swiotlb_init(int verbose)
166166
/*
167167
* Get IO TLB memory from any location.
168168
*/
169-
xen_io_tlb_start = alloc_bootmem(bytes);
169+
xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes));
170170
if (!xen_io_tlb_start) {
171171
m = "Cannot allocate Xen-SWIOTLB buffer!\n";
172172
goto error;
@@ -179,7 +179,7 @@ void __init xen_swiotlb_init(int verbose)
179179
bytes,
180180
xen_io_tlb_nslabs);
181181
if (rc) {
182-
free_bootmem(__pa(xen_io_tlb_start), bytes);
182+
free_bootmem(__pa(xen_io_tlb_start), PAGE_ALIGN(bytes));
183183
m = "Failed to get contiguous memory for DMA from Xen!\n"\
184184
"You either: don't have the permissions, do not have"\
185185
" enough free memory under 4GB, or the hypervisor memory"\

0 commit comments

Comments
 (0)