Commit 74251953 authored by Christoph Hellwig's avatar Christoph Hellwig

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
parent 8ba2ed1b
...@@ -57,7 +57,7 @@ static void sta2x11_new_instance(struct pci_dev *pdev) ...@@ -57,7 +57,7 @@ static void sta2x11_new_instance(struct pci_dev *pdev)
int size = STA2X11_SWIOTLB_SIZE; int size = STA2X11_SWIOTLB_SIZE;
/* First instance: register your own swiotlb area */ /* First instance: register your own swiotlb area */
dev_info(&pdev->dev, "Using SWIOTLB (size %i)\n", size); dev_info(&pdev->dev, "Using SWIOTLB (size %i)\n", size);
if (swiotlb_init_late(size)) if (swiotlb_init_late(size, GFP_DMA))
dev_emerg(&pdev->dev, "init swiotlb failed\n"); dev_emerg(&pdev->dev, "init swiotlb failed\n");
} }
list_add(&instance->list, &sta2x11_instance_list); list_add(&instance->list, &sta2x11_instance_list);
......
...@@ -37,7 +37,7 @@ struct scatterlist; ...@@ -37,7 +37,7 @@ struct scatterlist;
int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, unsigned int flags); int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, unsigned int flags);
unsigned long swiotlb_size_or_default(void); unsigned long swiotlb_size_or_default(void);
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs); extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
int swiotlb_init_late(size_t size); int swiotlb_init_late(size_t size, gfp_t gfp_mask);
extern void __init swiotlb_update_mem_attributes(void); extern void __init swiotlb_update_mem_attributes(void);
phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys, phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,
......
...@@ -292,7 +292,7 @@ void __init swiotlb_init(bool addressing_limit, unsigned int flags) ...@@ -292,7 +292,7 @@ void __init swiotlb_init(bool addressing_limit, unsigned int flags)
* initialize the swiotlb later using the slab allocator if needed. * initialize the swiotlb later using the slab allocator if needed.
* This should be just like above, but with some error catching. * This should be just like above, but with some error catching.
*/ */
int swiotlb_init_late(size_t size) int swiotlb_init_late(size_t size, gfp_t gfp_mask)
{ {
unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE); unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
unsigned long bytes; unsigned long bytes;
...@@ -303,15 +303,12 @@ int swiotlb_init_late(size_t size) ...@@ -303,15 +303,12 @@ int swiotlb_init_late(size_t size)
if (swiotlb_force_disable) if (swiotlb_force_disable)
return 0; return 0;
/*
* Get IO TLB memory from the low pages
*/
order = get_order(nslabs << IO_TLB_SHIFT); order = get_order(nslabs << IO_TLB_SHIFT);
nslabs = SLABS_PER_PAGE << order; nslabs = SLABS_PER_PAGE << order;
bytes = nslabs << IO_TLB_SHIFT; bytes = nslabs << IO_TLB_SHIFT;
while ((SLABS_PER_PAGE << order) > IO_TLB_MIN_SLABS) { while ((SLABS_PER_PAGE << order) > IO_TLB_MIN_SLABS) {
vstart = (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, vstart = (void *)__get_free_pages(gfp_mask | __GFP_NOWARN,
order); order);
if (vstart) if (vstart)
break; break;
......
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