diff options
| author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-08-23 13:55:26 -0400 |
|---|---|---|
| committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-09-17 10:14:54 -0400 |
| commit | 1cef36a529f44dbb3612ee0deeb0b5563de36163 (patch) | |
| tree | a5851da4d1ff6df0a1be05755205e01d33c9d20e | |
| parent | 74838b75379a53678ffc5f59de86161d21e2c808 (diff) | |
xen/swiotlb: Move the nr_tbl determination in its own function.
Moving the function out of the way to prepare for the late
SWIOTLB init.
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| -rw-r--r-- | drivers/xen/swiotlb-xen.c | 21 |
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 | } |
| 147 | static 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 | } | ||
| 148 | void __init xen_swiotlb_init(int verbose) | 157 | void __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 | } | ||
| 163 | retry: | 165 | retry: |
| 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 | */ |
