Commit 63a74175 authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk

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
e79f86b2 "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: stable@kernel.org
Suggested-by: default avatar"Kalev, Leonid" <Leonid.Kalev@ca.com>
Reported-and-Tested-by: default avatar"Taylor, Neal E" <Neal.Taylor@ca.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent d3db7281
...@@ -166,7 +166,7 @@ void __init xen_swiotlb_init(int verbose) ...@@ -166,7 +166,7 @@ void __init xen_swiotlb_init(int verbose)
/* /*
* Get IO TLB memory from any location. * Get IO TLB memory from any location.
*/ */
xen_io_tlb_start = alloc_bootmem(bytes); xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes));
if (!xen_io_tlb_start) { if (!xen_io_tlb_start) {
m = "Cannot allocate Xen-SWIOTLB buffer!\n"; m = "Cannot allocate Xen-SWIOTLB buffer!\n";
goto error; goto error;
...@@ -179,7 +179,7 @@ void __init xen_swiotlb_init(int verbose) ...@@ -179,7 +179,7 @@ void __init xen_swiotlb_init(int verbose)
bytes, bytes,
xen_io_tlb_nslabs); xen_io_tlb_nslabs);
if (rc) { if (rc) {
free_bootmem(__pa(xen_io_tlb_start), bytes); free_bootmem(__pa(xen_io_tlb_start), PAGE_ALIGN(bytes));
m = "Failed to get contiguous memory for DMA from Xen!\n"\ m = "Failed to get contiguous memory for DMA from Xen!\n"\
"You either: don't have the permissions, do not have"\ "You either: don't have the permissions, do not have"\
" enough free memory under 4GB, or the hypervisor memory"\ " enough free memory under 4GB, or the hypervisor memory"\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment