From patchwork Mon Jul 21 14:47:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 4595791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E04A9F295 for ; Mon, 21 Jul 2014 14:51:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB8DB20158 for ; Mon, 21 Jul 2014 14:51:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE7CD20127 for ; Mon, 21 Jul 2014 14:51:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9EuJ-0003g8-4i; Mon, 21 Jul 2014 14:49:39 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9Etj-0002nI-84 for linux-arm-kernel@lists.infradead.org; Mon, 21 Jul 2014 14:49:03 +0000 Received: by mail-wi0-f179.google.com with SMTP id f8so4196697wiw.0 for ; Mon, 21 Jul 2014 07:48:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Xc9tlHWMdsEINYEZDnLiYYi4YHDy8u7pzj860It3lU4=; b=Z/KrLiLG4NY+mNE0plClNwqP2IDNZEZDst2+xGm4XGx6GkPgAVSyQtD50XMnSh+hAT BQDQm49IN6kbqkosIM9m+DgCT8arHPR9XGMC+dI4iR521rXcBz+Zx+EWJ4jwSgeNaHYp /lboDhYaexgXXuwzQLmvFV/qBDKUlTyaazSOaLDfFE2hfVr7lGaUuulewb/pg1eWacGJ dnGha3G9V8zlJG9TQ24dX79nVQsPJ0dlQpNiBrdRZ5pMNTEhtZAIuyuTSyzM3cQPrGw5 3up6+FznybTMEEuT1UTOaWDOIC4tBhfvfIGE3jyAolkn2hv9BttY9wt8SzCBodGU2Lgt Rj3w== X-Gm-Message-State: ALoCoQnoNNm49Q4nYJs57YnIy7K6IEq9oVMNayo+VFu4WQEoMeC9sRxJTuvNfCIFEebBW7QQak3E X-Received: by 10.194.191.131 with SMTP id gy3mr24029887wjc.108.1405954122288; Mon, 21 Jul 2014 07:48:42 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id di7sm38135166wjb.34.2014.07.21.07.48.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jul 2014 07:48:41 -0700 (PDT) From: Daniel Thompson To: Russell King , Thomas Gleixner , Jason Cooper Subject: [PATCH RFC 6/9] arm: mm: Avoid ioremap_page_range() for non-secure mappings Date: Mon, 21 Jul 2014 15:47:17 +0100 Message-Id: <1405954040-30399-7-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1405954040-30399-1-git-send-email-daniel.thompson@linaro.org> References: <1405954040-30399-1-git-send-email-daniel.thompson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140721_074903_446107_17EC4035 X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: -0.7 (/) Cc: Marex Vasut , Daniel Thompson , linaro-kernel@lists.linaro.org, patches@linaro.org, Harro Haan , linux-kernel@vger.kernel.org, John Stultz , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ioremap_page_range() cannot provide us memory with the the non-secure section flag set unfortunately at present ioremap+MT_DEVICE_NS will fallback to this function and spuriously return a virtual pointer to what is effectively MT_DEVICE memory. This patch makes the fallback to ioremap_page_range() ineffective; to allocate MT_DEVICE_NS memory we must rely instead on the platform startup code providing a suitable static mapping. Signed-off-by: Daniel Thompson --- arch/arm/mm/ioremap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index d1e5ad7..1cb12f8 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -319,6 +319,10 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, err = remap_area_sections(addr, pfn, size, type); } else #endif + if (type->prot_sect & PMD_SECT_NS) + /* required section flag is not achievable; give up */ + return NULL; + else err = ioremap_page_range(addr, addr + size, paddr, __pgprot(type->prot_pte));