From patchwork Thu May 10 18:55:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 10392267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA78460353 for ; Thu, 10 May 2018 18:55:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BDEF28D2C for ; Thu, 10 May 2018 18:55:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9076828D33; Thu, 10 May 2018 18:55:21 +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 2579D28D2C for ; Thu, 10 May 2018 18:55:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 864AB6B063A; Thu, 10 May 2018 14:55:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 813B66B063B; Thu, 10 May 2018 14:55:17 -0400 (EDT) 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 703AA6B063D; Thu, 10 May 2018 14:55:17 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 204A86B063A for ; Thu, 10 May 2018 14:55:17 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id n78-v6so1591471pfj.4 for ; Thu, 10 May 2018 11:55:17 -0700 (PDT) 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; bh=7yyJ0TIX9OyqEfDxugdyXUmzhB1T4tR2oQwLtmWLdP0=; b=HJdfh3eh4tFii4MNxfIR5wNIrD+fKH2IPze1VVWG4e7yw9dFQckUqGY1bxibjHoAWc EYBCRN9lQL2KWhk9mHXrQibDI28P7KvABi19csi4OxItIhvrpQAg0uRRMzVq2l/JjQSW HgK55pCmYv9uMybJbByOt7dD+Wr/vDhKtJJu5N74y+WAomerktnI+Q6RhwPIEmMcpKNZ FO+obyfLT5q4UA8rSGO0iS5I9RAQ2qeFC73BnCWGMgOhtFhVNaCkMlYy/sYNyaG4GNjJ 8FtVyUf7p7lvizFeuDkkHfoKe5N9L7lcjNaZKKc4mcyB4VfQDdjH4bb4O/UZ5RfUxKa+ dHGw== X-Gm-Message-State: ALKqPwcGq0o14oxX3rvlsszohn4hjF1DjD3fmkrVIj5Jf1kr8bZl/E9/ WkmnF4Rt/AaYMiVRR5BKKaHdb8oiwishU19qVnC5HNYD/bHOjPHNFVaobLsTyb3MqtmsvhB9Sj2 UOLJ8Dv0g0fM7HPrNhhAjof+DRDxPHMo+v58fOhgj7ppaum7HT8ux9hXwOWaZPREAEA== X-Received: by 2002:a17:902:aa04:: with SMTP id be4-v6mr2437179plb.20.1525978516813; Thu, 10 May 2018 11:55:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpiXfdCGZ3n66ca8/knFNxX/nKPX5qhKSD9Jjis0F/24pkyDVUHt3OsDQ+YoA2L7LmDMcbx X-Received: by 2002:a17:902:aa04:: with SMTP id be4-v6mr2437099plb.20.1525978515304; Thu, 10 May 2018 11:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525978515; cv=none; d=google.com; s=arc-20160816; b=JFy35+EmEhYHR4AxfM6b0PfzfcBVn7DKGNEuUFOdEipKD3bxv/W/7UOF39CdaSxEzU MmYgh6FAkGNCXMDgxoxM4vPwYvuCadpSypUvUXA0tGzTiOKSBVmKswZg/mSrDX8GxTG1 UqAr7lcMwlL6XlrT7PDMga3Aj5rWDvsy+bzsZbtlf2EHjL73LDMO1+TFdmnva43PQ+ZF E+G+Fhtc4Ky49J/LVRtOL9XT+NNKTrfrD/pKdceFN1rOXnhNTdEy8Rrez537EUOYp8LO SYVx2SmVKv8I/OBRT0h1ir1tN6cF62EoULiqbRCzFHtlBCnKNNjyLhWWJmjmuLvWoIrW I87w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=7yyJ0TIX9OyqEfDxugdyXUmzhB1T4tR2oQwLtmWLdP0=; b=Wf79f6wTMXCwf3lR8sZTUtEeHxxLMuwjeSTBlbPweGNq0u/QidKSnMZG2jwcO3WcqN xau7W5qxvOnZ5QimQuzWr9hwFLBBy+hXK3jDFG8a/rcJaR9wJFx5QYqAmPe2+Hds2I5c otrizOnO9AnBI9JRS+gUT9EVuEeA4MS9Xhy0NP5utT7McpuodUhdci5xV07xqW22TnJO ydNpsclslZ3014qu+wkQ1S9RDGmXgCTemLy3NJknSEzPKowDR/vayzS7qaIBzCwOAhL2 aapPavPyBAiQGt7i2USv6cRU5DK4SyrlGtAzpjM26d4DWOrerePyNlNkWz7Vbmb06N8s f0pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xkzlb682; spf=pass (google.com: domain of mcgrof@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mcgrof@kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id z21-v6si1278470plo.465.2018.05.10.11.55.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 11:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of mcgrof@kernel.org designates 198.145.29.99 as permitted sender) client-ip=198.145.29.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xkzlb682; spf=pass (google.com: domain of mcgrof@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mcgrof@kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A00472183D; Thu, 10 May 2018 18:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525978515; bh=TcewW6vqy2dM07QlFP3vzMa7+FuHxW6GrRcpYMQzCDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xkzlb6825F4WxyzCjXzD9UuhWVuTMgNj6G7phipq+/I3GKx0sumrH9jIj5cj51h1U 5m3TaQ7dmqMVIEmYnvPDP31KoYzscNac2iNa9SjudMxgvYT87blOIAed9dFYJ4hFtK uevCYxs+0LEe0FJVx3rum9r9rdcsuwLrJM+6LLe0= From: "Luis R. Rodriguez" To: arnd@arndb.de Cc: gregkh@linuxfoundation.org, willy@infradead.org, geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH v3 1/2] mm: provide a fallback for PAGE_KERNEL_RO for architectures Date: Thu, 10 May 2018 11:55:06 -0700 Message-Id: <20180510185507.2439-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510185507.2439-1-mcgrof@kernel.org> References: <20180510185507.2439-1-mcgrof@kernel.org> 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: X-Virus-Scanned: ClamAV using ClamSMTP Some architectures do not define certain PAGE_KERNEL_* flags, this is either because: a) The way to implement some of these flags is *not yet ported*, or b) The architecture *has no way* to describe them Over time we have accumulated a few PAGE_KERNEL_* fallback work arounds for architectures in the kernel which do not define them using *relatively safe* equivalents. Move these scattered fallback hacks into asm-generic. We start off with PAGE_KERNEL_RO using PAGE_KERNEL as a fallback. This has been in place on the firmware loader for years. Move the fallback into the respective asm-generic header. Signed-off-by: Luis R. Rodriguez --- drivers/base/firmware_loader/fallback.c | 5 ----- include/asm-generic/pgtable.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c index 358354148dec..36f016b753e0 100644 --- a/drivers/base/firmware_loader/fallback.c +++ b/drivers/base/firmware_loader/fallback.c @@ -219,11 +219,6 @@ static ssize_t firmware_loading_show(struct device *dev, return sprintf(buf, "%d\n", loading); } -/* Some architectures don't have PAGE_KERNEL_RO */ -#ifndef PAGE_KERNEL_RO -#define PAGE_KERNEL_RO PAGE_KERNEL -#endif - /* one pages buffer should be mapped/unmapped only once */ static int map_fw_priv_pages(struct fw_priv *fw_priv) { diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index f59639afaa39..4e310e543fc8 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1083,6 +1083,20 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, static inline void init_espfix_bsp(void) { } #endif +/* + * Architecture PAGE_KERNEL_* fallbacks + * + * Some architectures don't define certain PAGE_KERNEL_* flags. This is either + * because they really don't support them, or the port needs to be updated to + * reflect the required functionality. Below are a set of relatively safe + * fallbacks, as best effort, which we can count on in lieu of the architectures + * not defining them on their own yet. + */ + +#ifndef PAGE_KERNEL_RO +# define PAGE_KERNEL_RO PAGE_KERNEL +#endif + #endif /* !__ASSEMBLY__ */ #ifndef io_remap_pfn_range