[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/7] powerpc/pseries: simplify svm_swiotlb_init



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@xxxxxx>dddd
---
 arch/powerpc/platforms/pseries/svm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/svm.c 
b/arch/powerpc/platforms/pseries/svm.c
index 4d281ff56ce96f..9187d2a1ed568d 100644
--- a/arch/powerpc/platforms/pseries/svm.c
+++ b/arch/powerpc/platforms/pseries/svm.c
@@ -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");
 }
 
-- 
2.30.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.