From patchwork Thu May 10 01:44:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 10391029 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 94E5360236 for ; Thu, 10 May 2018 01:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C62288DA for ; Thu, 10 May 2018 01:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C412288E4; Thu, 10 May 2018 01:44:55 +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 135D8288DA for ; Thu, 10 May 2018 01:44:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE23B6B05AD; Wed, 9 May 2018 21:44:51 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D3E236B05AF; Wed, 9 May 2018 21:44:51 -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 B917A6B05B1; Wed, 9 May 2018 21:44:51 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 655936B05AD for ; Wed, 9 May 2018 21:44:51 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id p19-v6so332954plo.14 for ; Wed, 09 May 2018 18:44:51 -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=1K+9TNjwLVRAkCgZ5vXSneAJWIs9CpFSOGSiRhWSunw=; b=nE3RHn4M91KTGn3rGneR7FP/l4Wf6gw2Sq20+SkhkfX8RB70/P5EkHMxDN5t/WDsts yv47pHZ1cfGOOwVlq2+0ZTgbBHdJyL0v75BlNwQTJet9oy3b9weH2gs0Cq4tCo0aLwj1 JQFVvMRLL1uCDtFRdig7vVpFj18RZZPvSp9+DJrXsw8582cd9u0TeQXwsNtXRSGl0yjL k+5+iG24+wbID9V5p53MUUbFZGOyDMhgpDGEx+csZW5riaBaLBVmu2GpMlfcORwYaVGg oKFK3cm90ANsGK8g+b40rvkMx0qzMKUvo+gZbAH48pXAGB07BgBSpwbM3dB53DMaYGWj EogQ== X-Gm-Message-State: ALQs6tDt8m5MzRYnp/vm4tnBUSv6uD9SxjMGy3yY+XU2WymdzbQ6ExES vRcQBWoj3W0I9Kkw47b8bquICgCIdt/PMYgbQgbroVzPC/qr5gt1l8XV6esIP3RCAfQWXf229mR chgnZFonn3hFutGZiXGqZmt97RVqx4CO9teOpnLSyJWmDTds8I2B50h8rac6RJWQEoQ== X-Received: by 2002:a17:902:3303:: with SMTP id a3-v6mr32442574plc.209.1525916691117; Wed, 09 May 2018 18:44:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqIySaKlo2CDnRbHRt7hbZmu0uHQWT9WVRjZD0GJC1Kwd6LG2TMObsDlkeo+yexba4AayX0 X-Received: by 2002:a17:902:3303:: with SMTP id a3-v6mr32442538plc.209.1525916690303; Wed, 09 May 2018 18:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525916690; cv=none; d=google.com; s=arc-20160816; b=yLVqnWlNmPO3SAsspZQ4rIusgu4/6YL1Xn+7yV5f0JnXiXUUUyYCeO6JzADK7BiOcd 5xVpgNJzlPTba61Lk15aKZaevTsdFov89l3vyPlFZAc3SCv9iDyRzI67GpevNnvcJtLP EYmkATc7u5buNCek57YsgCaJZmndZzkvlvY1KZ5QhKqfCRvfHDGlH/Gw1ksqAuNcayyC 1n93kN27EpOKaiIE5S3OVTAlzGGC9WVM8B4/zBh8vXRg+wcqE86ebXdudj2aCQLw2li1 792bY+uJRQ0lzGVrQYO4wxL0D6jww5NQj1u7A7pyDvJ/jJ/S3ouWSC+snPxnE8GXjVRd NuMw== 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=1K+9TNjwLVRAkCgZ5vXSneAJWIs9CpFSOGSiRhWSunw=; b=SBG3KUu2KVEoinGAOApv0jaGwd8aG3YfDkMH8DIIt6jIjvNfKyMwAoaPyu0wFg65KS yfBW8/nbX1a9VG8TNRp6y2PkW5tZD3FHmIvF/uEXlNaIQagdGMG0OroflNzvvn+roDiZ 9f9D6Q5SKxSsvcka3Qvj5wIThtCmUss0km/3OszCjOSNQsHDSLe5sKdriFHvUf1ODHns TiHfa57UGnNaOW48PQN+6uVrtKgAZbcYKVdOZkQnaVP+RaeCN/wU+aTM1dtAVGxpDOKd 9zNdlylPYyAMGYxr/T2BOJ3YDI6HtzGV65cmmE53CoovHiNQ3M6JwmS8da1bp1w6qXm/ CK5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b5llzdOD; 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 d20si13146550pfn.213.2018.05.09.18.44.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 18:44:50 -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=b5llzdOD; 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 90063217C6; Thu, 10 May 2018 01:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525916689; bh=T9+4wDkH5RsBZh8+Pkm/xhhrn3sA3XQ3CSpDVq76AQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5llzdOD6zFqIH7DpGzq5ODVcUY5jJ/Iw8t4t0I35fZQH51B2EUDBCN8ONmqsyxVq lsLNC7GOV2cfa9KEv+Ir8KbGR4kgjiIlKodg3xmKyjcsiaMR3upyEednbz5EK2Auko V2WAyehUI2/ryduNsJ5FlY+5ZuDbQC2KEQVRxkYM= 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 v2 1/2] mm: provide a fallback for PAGE_KERNEL_RO for architectures Date: Wed, 9 May 2018 18:44:46 -0700 Message-Id: <20180510014447.15989-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510014447.15989-1-mcgrof@kernel.org> References: <20180510014447.15989-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 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 and document which architectures needs further evaluation for which PAGE_KERNEL_* flag. 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. Architectures which don't define this yet: o alpha o ia64 o m68k o mips o sparc64 o sparc Signed-off-by: Luis R. Rodriguez --- drivers/base/firmware_loader/fallback.c | 5 ----- include/asm-generic/pgtable.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 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..890fc54f4713 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1083,6 +1083,30 @@ 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. + */ + +/* + * Current architectures known to not define PAGE_KERNEL_RO: + * + * o alpha + * o ia64 + * o m68k + * o mips + * o sparc64 + * o sparc + */ +#ifndef PAGE_KERNEL_RO +# define PAGE_KERNEL_RO PAGE_KERNEL +#endif + #endif /* !__ASSEMBLY__ */ #ifndef io_remap_pfn_range