Skip to content

Commit 7425195

Browse files
author
Christoph Hellwig
committed
swiotlb: pass a gfp_mask argument to swiotlb_init_late
Let the caller chose a zone to allocate from. This will be used later on by the xen-swiotlb initialization on arm. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Tested-by: Boris Ostrovsky <[email protected]>
1 parent 8ba2ed1 commit 7425195

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

arch/x86/pci/sta2x11-fixup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void sta2x11_new_instance(struct pci_dev *pdev)
5757
int size = STA2X11_SWIOTLB_SIZE;
5858
/* First instance: register your own swiotlb area */
5959
dev_info(&pdev->dev, "Using SWIOTLB (size %i)\n", size);
60-
if (swiotlb_init_late(size))
60+
if (swiotlb_init_late(size, GFP_DMA))
6161
dev_emerg(&pdev->dev, "init swiotlb failed\n");
6262
}
6363
list_add(&instance->list, &sta2x11_instance_list);

include/linux/swiotlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct scatterlist;
3737
int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, unsigned int flags);
3838
unsigned long swiotlb_size_or_default(void);
3939
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
40-
int swiotlb_init_late(size_t size);
40+
int swiotlb_init_late(size_t size, gfp_t gfp_mask);
4141
extern void __init swiotlb_update_mem_attributes(void);
4242

4343
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,

kernel/dma/swiotlb.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void __init swiotlb_init(bool addressing_limit, unsigned int flags)
292292
* initialize the swiotlb later using the slab allocator if needed.
293293
* This should be just like above, but with some error catching.
294294
*/
295-
int swiotlb_init_late(size_t size)
295+
int swiotlb_init_late(size_t size, gfp_t gfp_mask)
296296
{
297297
unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
298298
unsigned long bytes;
@@ -303,15 +303,12 @@ int swiotlb_init_late(size_t size)
303303
if (swiotlb_force_disable)
304304
return 0;
305305

306-
/*
307-
* Get IO TLB memory from the low pages
308-
*/
309306
order = get_order(nslabs << IO_TLB_SHIFT);
310307
nslabs = SLABS_PER_PAGE << order;
311308
bytes = nslabs << IO_TLB_SHIFT;
312309

313310
while ((SLABS_PER_PAGE << order) > IO_TLB_MIN_SLABS) {
314-
vstart = (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN,
311+
vstart = (void *)__get_free_pages(gfp_mask | __GFP_NOWARN,
315312
order);
316313
if (vstart)
317314
break;

0 commit comments

Comments
 (0)