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: 33972 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCF2F20492 for ; Mon, 21 Jul 2014 14:48:51 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 142sf15080296ykq.8 for ; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Xc9tlHWMdsEINYEZDnLiYYi4YHDy8u7pzj860It3lU4=; b=P7xTv9Vb0+3cQwnHt2CpB9n1XOFOupo+AEd9JR4LW0wlDrOkMLqMd+tqEiNTVe/reI 1du38S8qYi8XVcfXW15RoDpTfQLxIzR1cnY5aE/EpVxeCAN1/8vsyoiNKD1haKRa+UxT MuYiGZfN9qo1XkscvXwGwbi028u2krLyKjiSODwtN6d2IIRlHSzJEVexvHKzfWh8Bz96 9FKCjri+EnLNKRDlX0DbePUvhxs2+6MW85qHppzEaAQKplDxiqUHjV0ioIy3vf9/7Sty 0YgC213qbleYMTAu49uysAebCnnCRdFlJEcy+USpPMKtWAufONm7f5Pa9XCm3cqsB2jX booA== X-Gm-Message-State: ALoCoQm+XL2agyVO+xyNh+s7Iz0EMHD+X7PytBnLAkvNZbBIR2GM27zoOLfRh6JwdZ55YutE/40c X-Received: by 10.236.26.206 with SMTP id c54mr11218076yha.44.1405954131619; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.231 with SMTP id z94ls1999903qgz.63.gmail; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) X-Received: by 10.220.199.193 with SMTP id et1mr4837033vcb.58.1405954131515; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id qa10si11472772vcb.103.2014.07.21.07.48.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 07:48:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so10638503vcb.24 for ; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) X-Received: by 10.52.244.138 with SMTP id xg10mr25395388vdc.40.1405954131388; Mon, 21 Jul 2014 07:48:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp118448vcb; Mon, 21 Jul 2014 07:48:50 -0700 (PDT) X-Received: by 10.194.237.135 with SMTP id vc7mr24593152wjc.86.1405954130433; Mon, 21 Jul 2014 07:48:50 -0700 (PDT) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by mx.google.com with ESMTPS id 18si28464541wjt.144.2014.07.21.07.48.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 07:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.45 as permitted sender) client-ip=74.125.82.45; Received: by mail-wg0-f45.google.com with SMTP id x12so6675853wgg.16 for ; Mon, 21 Jul 2014 07:48:42 -0700 (PDT) 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 Cc: Daniel Thompson , Marex Vasut , Harro Haan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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));