Skip to content

Commit 42ebfc6

Browse files
committed
Merge branch 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen/swiotlb: Use page alignment for early buffer allocation. xen: only limit memory map to maximum reservation for domain 0.
2 parents 55b02d2 + 63a7417 commit 42ebfc6

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎arch/x86/xen/setup.c‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,21 @@ static unsigned long __init xen_get_max_pages(void)
173173
domid_t domid = DOMID_SELF;
174174
int ret;
175175

176-
ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
177-
if (ret > 0)
178-
max_pages = ret;
176+
/*
177+
* For the initial domain we use the maximum reservation as
178+
* the maximum page.
179+
*
180+
* For guest domains the current maximum reservation reflects
181+
* the current maximum rather than the static maximum. In this
182+
* case the e820 map provided to us will cover the static
183+
* maximum region.
184+
*/
185+
if (xen_initial_domain()) {
186+
ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
187+
if (ret > 0)
188+
max_pages = ret;
189+
}
190+
179191
return min(max_pages, MAX_DOMAIN_PAGES);
180192
}
181193

‎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)