Message ID | 20181109082448.150302-4-drinkcat@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 510975A4 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 9 Nov 2018 08:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4176C28FBA for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 9 Nov 2018 08:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 342672E661; Fri, 9 Nov 2018 08:25:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4AAB28FBA for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 9 Nov 2018 08:25:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D26E6B06B9; Fri, 9 Nov 2018 03:25:12 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 45A706B06BA; Fri, 9 Nov 2018 03:25:12 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3233C6B06BB; Fri, 9 Nov 2018 03:25:12 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id DADA76B06B9 for <linux-mm@kvack.org>; Fri, 9 Nov 2018 03:25:11 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id x11-v6so741451pgp.20 for <linux-mm@kvack.org>; Fri, 09 Nov 2018 00:25:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yRFndY2zWJb5bN9k8QGyB+00poAzGsSVjzJBS2+e7OE=; b=h2yYx6j0x8EdUXBaY879feZP6UhxUf6+rFBNdNCimjWlJv5L0QPg8BNuYc7iZAsOf/ RErVG+bvBhFX3Nj6cIrlMIdLPmkyYR3Brk2sKrIZErDphmaf2UrYu1GgIrYzxFdp1H1+ aN8yLeBFbKLVKzk8CuYrkMCRl2fuRKON+vHiAoJEqFl7tWMQZ6s+srzmftodjHZENR2G GyRs/zDNGCFE0RGGBHKYwT5Cl709vzwZ7zR8BgHxjPodJKlwU2vRN69/e1U8v9s31IgS pGjcy0YBglYBLM5iCNCgbRiUEi+IDUulCMcZXH1z7+k077CvYfpwE/yXgE5YQcxTveKF ungA== X-Gm-Message-State: AGRZ1gIcgtPCpG61Oa+qKMR9e/RbCpy/6shqE4Vw+o1nwuBKVzh+08Jt 5N2h8Es9yow0uZv6YcyuGVjmGjyGkwbfyw7VWqeeEkELiCChWtw0M+2uQuPHycbMr4XbVDoLWWJ gUWyxmYcXS9scyx0r5uiHff853zg9FBY1XAWhDs2gOj6fn7NGWWuv+9BEIfN4v7Inq7UKd0ZQrU AVo0eRqsfWvNX3OSGf+sxxiHk12OktrLWBFrubjx0NBdcrDmY09oYURnn8kDaBreJoEwrFlRfvg XMS5iA7/CvTtojt+UcGNlENW+55xZyfHxzx6olxQaZ9spmeKg1qkhl6A+tyzjnJ+vSVYLpeFF4W nWxO+p5tdTkI+7Ljyj3Ka6ZgWpqqv8tTkVp16LqiNzMERYZI8wOR9AJQ0RQl8+IY3B+c+J0qLUO Q X-Received: by 2002:a62:c5c6:: with SMTP id j189-v6mr8256998pfg.194.1541751911538; Fri, 09 Nov 2018 00:25:11 -0800 (PST) X-Received: by 2002:a62:c5c6:: with SMTP id j189-v6mr8256971pfg.194.1541751910916; Fri, 09 Nov 2018 00:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541751910; cv=none; d=google.com; s=arc-20160816; b=s00eF+062pLhhPxw82SZIHJby9Dmdz3gvDIzSkFTtDued83h2MXvqRcac+qxL+chIz AiM4QT9R+BGzvBDU/zisWWIbKVka5Wro556Mdbkg8Cnn/m3zHlbkIPvctJaukzhA4LYU 72kkodrhnNE7sYLv5rADy7O+z4h/LTe9cI/6AdrvXSOMS7kvxO6+1RhXUh/1sBa1IuIU loHyYxUIhDEg4Urp/gTMfdxIYzB3p8D5WbgUhTygFhNEF9j9iY5lX+jV6Kw293igHw99 9i7YjUR1y28ar74+ArFIWs8LGHvNp91iSgI+w+5ws8CysvVvaGf/u4+P1uaKfmN4Jznh unqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yRFndY2zWJb5bN9k8QGyB+00poAzGsSVjzJBS2+e7OE=; b=eIs9pseYn+HTXLW5s3InelBxFTbWztGGki+7Y88170XyM9YhMHfQAtFHPMQE7ekN83 JdKjg7jBFmeCHM0rlMX8mRexdtPqgZ+9Yo37WVEv9DNoKnEohh15TikN6AxDAVe64AAU cHmqYgyl9nGgZipPltrSFauWSzjJ3W3MlGsVUYnPvD3raLuhcQ7Eh43Fhi7/gY6NwNU5 7cz901lcVvtrZq6R2ldqQZU+4f3yN3/vJBEM2fUPQ7qckKT06Ga6C0UruTdcQEiEKHBc S9pKDebsghzFOWpFKG5PKqqaVd5EIFMTr6UJDeqBB662uhpyj6upXCmPeYXDFVliPMTG MCdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Iur53HJy; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u17-v6sor7312686pgg.80.2018.11.09.00.25.10 for <linux-mm@kvack.org> (Google Transport Security); Fri, 09 Nov 2018 00:25:10 -0800 (PST) Received-SPF: pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Iur53HJy; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yRFndY2zWJb5bN9k8QGyB+00poAzGsSVjzJBS2+e7OE=; b=Iur53HJyqMem/YVgQlfnZkpmkDpU75IDHa1psWcirqFy2J7OUTJYecd2nH/Tm1VU4Y wHD0Wj4ikT4n1v9ophkIXv8eHbTkqamS77yub3whxQJ3ALJ5ShBRCmalyGimLeM0OTKZ KD55YMwDGgVT3dwjemx/XmpVCxgR0pphrkUVY= X-Google-Smtp-Source: AJdET5dCO8mv60sae7fHIDtGCVEJeKFEfFmKIeaExlKA/10SNZoPYXI7O9H3owoxai+S1I+fmnLhmg== X-Received: by 2002:a63:6984:: with SMTP id e126mr6756085pgc.143.1541751910462; Fri, 09 Nov 2018 00:25:10 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f659:7f17:ea11:4e8e]) by smtp.gmail.com with ESMTPSA id u2-v6sm6415667pfn.50.2018.11.09.00.25.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Nov 2018 00:25:09 -0800 (PST) From: Nicolas Boichat <drinkcat@chromium.org> To: Robin Murphy <robin.murphy@arm.com> Cc: Will Deacon <will.deacon@arm.com>, Joerg Roedel <joro@8bytes.org>, Christoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Andrew Morton <akpm@linux-foundation.org>, Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>, Mel Gorman <mgorman@techsingularity.net>, Levin Alexander <alexander.levin@verizon.com>, Huaisheng Ye <yehs1@lenovo.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu <yong.wu@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, Tomasz Figa <tfiga@google.com>, yingjoe.chen@mediatek.com Subject: [PATCH RFC 3/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging Date: Fri, 9 Nov 2018 16:24:48 +0800 Message-Id: <20181109082448.150302-4-drinkcat@chromium.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181109082448.150302-1-drinkcat@chromium.org> References: <20181109082448.150302-1-drinkcat@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables
|
expand
|
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 445c3bde04800c..862fd404de84d8 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -198,13 +198,15 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, void *table = NULL; if (lvl == 1) - table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size)); + table = (void *)__get_dma32_pages(__GFP_ZERO, get_order(size)); else if (lvl == 2) table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA); phys = virt_to_phys(table); - if (phys != (arm_v7s_iopte)phys) + if (phys != (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ + dev_err(dev, "Page table does not fit: %pa", &phys); goto out_free; + } if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) { dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma))
For level 1 pages, use __get_dma32_pages to make sure physical memory address is 32-bit. For level 2 pages, kmem_cache_zalloc with GFP_DMA has been modified in a previous patch to be allocated in DMA32 zone. Also, print an error when the physical address does not fit in 32-bit, to make debugging easier in the future. Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> --- drivers/iommu/io-pgtable-arm-v7s.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)