• Nicolas Boichat's avatar
    iommu/io-pgtable-arm-v7s: request DMA32 memory, and improve debugging · 0a352554
    Nicolas Boichat authored
    IOMMUs using ARMv7 short-descriptor format require page tables (level 1
    and 2) to be allocated within the first 4GB of RAM, even on 64-bit
    systems.
    
    For level 1/2 pages, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 is
    defined (e.g.  on arm64 platforms).
    
    For level 2 pages, allocate a slab cache in SLAB_CACHE_DMA32.  Note that
    we do not explicitly pass GFP_DMA[32] to kmem_cache_zalloc, as this is
    not strictly necessary, and would cause a warning in mm/sl*b.c, as we
    did not update GFP_SLAB_BUG_MASK.
    
    Also, print an error when the physical address does not fit in
    32-bit, to make debugging easier in the future.
    
    Link: http://lkml.kernel.org/r/20181210011504.122604-3-drinkcat@chromium.org
    Fixes: ad67f5a6 ("arm64: replace ZONE_DMA with ZONE_DMA32")
    Signed-off-by: default avatarNicolas Boichat <drinkcat@chromium.org>
    Acked-by: default avatarWill Deacon <will.deacon@arm.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Hsin-Yi Wang <hsinyi@chromium.org>
    Cc: Huaisheng Ye <yehs1@lenovo.com>
    Cc: Joerg Roedel <joro@8bytes.org>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Matthias Brugger <matthias.bgg@gmail.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Cc: Sasha Levin <Alexander.Levin@microsoft.com>
    Cc: Tomasz Figa <tfiga@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
    Cc: Yong Wu <yong.wu@mediatek.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    0a352554
io-pgtable-arm-v7s.c 26 KB