aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/swiotlb-xen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/swiotlb-xen.c')
-rw-r--r--drivers/xen/swiotlb-xen.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 1afb4fba11b4..a2aad6ec2401 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -144,25 +144,26 @@ xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
144 } while (i < nslabs); 144 } while (i < nslabs);
145 return 0; 145 return 0;
146} 146}
147static unsigned long xen_set_nslabs(unsigned long nr_tbl)
148{
149 if (!nr_tbl) {
150 xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT);
151 xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE);
152 } else
153 xen_io_tlb_nslabs = nr_tbl;
147 154
155 return xen_io_tlb_nslabs << IO_TLB_SHIFT;
156}
148void __init xen_swiotlb_init(int verbose) 157void __init xen_swiotlb_init(int verbose)
149{ 158{
150 unsigned long bytes; 159 unsigned long bytes;
151 int rc = -ENOMEM; 160 int rc = -ENOMEM;
152 unsigned long nr_tbl;
153 char *m = NULL; 161 char *m = NULL;
154 unsigned int repeat = 3; 162 unsigned int repeat = 3;
155 163
156 nr_tbl = swiotlb_nr_tbl(); 164 xen_io_tlb_nslabs = swiotlb_nr_tbl();
157 if (nr_tbl)
158 xen_io_tlb_nslabs = nr_tbl;
159 else {
160 xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT);
161 xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE);
162 }
163retry: 165retry:
164 bytes = xen_io_tlb_nslabs << IO_TLB_SHIFT; 166 bytes = xen_set_nslabs(xen_io_tlb_nslabs);
165
166 /* 167 /*
167 * Get IO TLB memory from any location. 168 * Get IO TLB memory from any location.
168 */ 169 */