@@ -43,20 +43,14 @@ machine_early_initcall(pseries, init_svm);
*/
void __init svm_swiotlb_init(void)
{
+ unsigned long bytes = swiotlb_size_or_default();
unsigned char *vstart;
- unsigned long bytes, io_tlb_nslabs;
-
- io_tlb_nslabs = (swiotlb_size_or_default() >> IO_TLB_SHIFT);
- io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
-
- bytes = io_tlb_nslabs << IO_TLB_SHIFT;
vstart = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE);
if (vstart && !swiotlb_init_with_tbl(vstart, bytes, false))
return;
- memblock_free_early(__pa(vstart),
- PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
+ memblock_free_early(__pa(vstart), PAGE_ALIGN(bytes));
panic("SVM: Cannot allocate SWIOTLB buffer");
}
The value returned by swiotlb_size_or_default is always properly aligned now, so don't duplicate the work. Signed-off-by: Christoph Hellwig <hch@lst.de>dddd --- arch/powerpc/platforms/pseries/svm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)