From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96313C43613 for ; Sun, 23 Jun 2019 09:45:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5AFFE20840 for ; Sun, 23 Jun 2019 09:45:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nZ1uAEh/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AFFE20840 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EDC0F6B0006; Sun, 23 Jun 2019 05:45:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8E2C8E0002; Sun, 23 Jun 2019 05:45:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7C938E0001; Sun, 23 Jun 2019 05:45:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id A297D6B0006 for ; Sun, 23 Jun 2019 05:45:38 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id e16so7134341pga.4 for ; Sun, 23 Jun 2019 02:45:38 -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:mime-version :content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=anOvKpOq4VC8KxuRalCPSS8OS4/LP645ZGFxRunmAjRiu9pVCdZ+YnKT+dqpvoirjY AGzwkqPYPMOm4LNiVLPuueFmVFoe/NFLiWC1Sn6dmmH/IQ34e6Z2bLENjva3he4zF4CW fhJxC8R9ARwtFKuHoV8dZPB9B8mi7Dij3yJPf6Wox8lzy/42ntGYIiJohUISZx9IGr0m N/5binFOfAFlSRtF4l3A/NtMQboZCuFaKPBiY1fvjjYVet3lDBId87nAZECn0F3DxR95 4U5YkLCdBW+qxP0lGNTkyScZDKjPXqTKf3cEXgRl9WothSfpoH4w9OZ93dD/l/SnOf3U b4WA== X-Gm-Message-State: APjAAAVLEw7elqyw8m7lDxhyXwnls/9/Wy2WeOZDuOGg1b69W28WxgoX ypNXtegBWzd0lG6+R4Jr2c7DwaZlyFRg9ZX5wQ0TULZTsLjeNiXct6MFg3Laf9CaDzfRjJ2RWUC Iv1yQW7HzMN72AxZ/xfpExLtyoxdfANk+zroFLEFeQZbRNNRoEfFTvPDaMV0Lm+MMnw== X-Received: by 2002:a63:6183:: with SMTP id v125mr22719393pgb.221.1561283138175; Sun, 23 Jun 2019 02:45:38 -0700 (PDT) X-Received: by 2002:a63:6183:: with SMTP id v125mr22719323pgb.221.1561283137140; Sun, 23 Jun 2019 02:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561283137; cv=none; d=google.com; s=arc-20160816; b=vIanlroz1O6nAduVY5XA6cxMhbfzRqD0ufi8ws3TQ9mUIzb23qQ/61fMSTEDDj+40H G0am9+gWje6kjGBxZymR1At5ZU5t3x5A3+GSvZAYmfQgy9raw2za0PixhRCYzuhXY+N2 JeSOSt8zTLPfHhSmm2pJWZ63yvjf0QHCSPYwxxHppdylD/thnpway3NDbXNVCGoAdcTX RYbKGWkeyG20EUc9ta8TFk9YWxdk1xphlswXC9kSoiB+Ew1tnTKREIIxYDPyX9V9MIl7 buf1Ew0oJEEdvuaGUO+O1Kn05DfAYTx0NafaN1uMw146tHtSkjPKL3rSrrhFd9wrdC+Y +qwA== 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=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=de26r/qWl5TI4sTzB0MyNEPDFIdR0SmrxPxvZHlIV0rdRND9YDwPH8r1Bu9y0aoQwc TrQXXBjEscYmcuUp+1JtdCFr3PChaYY9yJcCDeEZTk057Z+hYKmfA2IbSgNfkL/xW/3I tUa1+Al1J135pgEbBu9JKCETPW+5qmuAwMnqcg9xUEupcHS3A2Vntios64Q5UPqRZeaM AiTNjW8u5Qv0Bj5pbkJFcUxCb42yowFeb9L5Ieb/2RJFNqNp1ybctDyHLAY983THrDWv trgXQBPscXxwdtbz8snbZIHV8vy4YzcwNAbi8q8yHe/bQVW9BIqkEpmHhDCmj/Byocxn eRDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="nZ1uAEh/"; spf=pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id g95sor9159079plb.67.2019.06.23.02.45.36 for (Google Transport Security); Sun, 23 Jun 2019 02:45:37 -0700 (PDT) Received-SPF: pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="nZ1uAEh/"; spf=pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=nZ1uAEh/l/iH3XHgJ4JMzpVgG2BAjVP+Z4uP0nLctfLAj7AD/MmtA4UP0ovGBefyCX oi/eiKdn5rkb+cERs9Q8dHLJnb+ghuSMilmtfbCoNwrAS8IHMPARnfgHf8n9HMnua6zS +dxXBrDAzpJmAl2a5WPEl0+v9WftLVMpwR+Ki8qD5BEfrZHM6Z+MwQFgDagG17N4lc1g 5g3hUt3k1Vuvyww7G6od0qdoZYGYGxV4ZJ+E/1RRGg0hnv1OCHh2088YsdWh7C6PTe+t pG1oasPj0r+b4PVWCRQ/vj3KXGeUaEOXaQbg+/rH4Dd4SeFUb1BicT4qR09j10i/WFg9 yGJg== X-Google-Smtp-Source: APXvYqy03K0Z/MbKC+X3ScMS1p5nrg83Wdw/gotWUEhNW5qLKL0hUnw5AV3nEp2FnFcsXPqkd+XVzA== X-Received: by 2002:a17:902:7c03:: with SMTP id x3mr117368602pll.242.1561283136704; Sun, 23 Jun 2019 02:45:36 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([1.129.156.141]) by smtp.gmail.com with ESMTPSA id d26sm6181062pfn.29.2019.06.23.02.45.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 23 Jun 2019 02:45:36 -0700 (PDT) From: Nicholas Piggin To: linux-mm@kvack.org Cc: Nicholas Piggin , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Andrew Morton , Anshuman Khandual , Christophe Leroy , Ard Biesheuvel , Mark Rutland , Catalin Marinas , Will Deacon , Steven Price Subject: [PATCH 1/3] arm64: mm: Add p?d_large() definitions Date: Sun, 23 Jun 2019 19:44:44 +1000 Message-Id: <20190623094446.28722-2-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190623094446.28722-1-npiggin@gmail.com> References: <20190623094446.28722-1-npiggin@gmail.com> 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: walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information will be provided by the p?d_large() functions/macros. For arm64, we already have p?d_sect() macros which we can reuse for p?d_large(). pud_sect() is defined as a dummy function when CONFIG_PGTABLE_LEVELS < 3 or CONFIG_ARM64_64K_PAGES is defined. However when the kernel is configured this way then architecturally it isn't allowed to have a large page that this level, and any code using these page walking macros is implicitly relying on the page size/number of levels being the same as the kernel. So it is safe to reuse this for p?d_large() as it is an architectural restriction. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Steven Price --- This patch is taken from arm64 but is required if this series is not build together with arm64 tree. arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index fca26759081a..0e973201bc16 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -417,6 +417,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_large(pmd) pmd_sect(pmd) #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 #define pud_sect(pud) (0) @@ -499,6 +500,7 @@ static inline void pte_unmap(pte_t *pte) { } #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_large(pud) pud_sect(pud) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A6D3C43613 for ; Sun, 23 Jun 2019 09:49:14 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 760E820679 for ; Sun, 23 Jun 2019 09:49:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nZ1uAEh/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 760E820679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45Wngn0LzlzDq6Q for ; Sun, 23 Jun 2019 19:49:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::643; helo=mail-pl1-x643.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nZ1uAEh/"; dkim-atps=neutral Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45Wnbk2J5PzDqWx for ; Sun, 23 Jun 2019 19:45:38 +1000 (AEST) Received: by mail-pl1-x643.google.com with SMTP id cl9so5175959plb.10 for ; Sun, 23 Jun 2019 02:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=nZ1uAEh/l/iH3XHgJ4JMzpVgG2BAjVP+Z4uP0nLctfLAj7AD/MmtA4UP0ovGBefyCX oi/eiKdn5rkb+cERs9Q8dHLJnb+ghuSMilmtfbCoNwrAS8IHMPARnfgHf8n9HMnua6zS +dxXBrDAzpJmAl2a5WPEl0+v9WftLVMpwR+Ki8qD5BEfrZHM6Z+MwQFgDagG17N4lc1g 5g3hUt3k1Vuvyww7G6od0qdoZYGYGxV4ZJ+E/1RRGg0hnv1OCHh2088YsdWh7C6PTe+t pG1oasPj0r+b4PVWCRQ/vj3KXGeUaEOXaQbg+/rH4Dd4SeFUb1BicT4qR09j10i/WFg9 yGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=J7YsxpZPxzFbyFT0AgA3zZnieQP9FWxf378ccptvx8iuvnM+3t8J+8SnSKOQjra+V0 w37jipyQw8xgTSxgcKlEX+5JPinDJtsjtspKRVy54KMInYyK93PmpIjlKWqrNM8qXSW7 /EG9+NeOSuQYGbAwgLtToreIUm0SAy+tOpDNeTLy79+6zyoRTsDOa2ZILUWV84DKJUGH NLqKX6iDbQ6oALYgfU1cHgATCRsi4kDRT/IWj6N8680yX2R0ZEFn0fcp+2cstHuTiwMV HkenqleAusUNJQNsc0gfHbzWzGI7Kv36dLXm7tvN1B3CoUDOcF9pPsWDUPH97dbazjsX Zg+g== X-Gm-Message-State: APjAAAVK7PjoFXvTZuTDf/g0XsmehrDfaduA6DFbe202sTZKS9hAySjk gi50S1zdOTFnF//REpUbazrrz56ptV0= X-Google-Smtp-Source: APXvYqy03K0Z/MbKC+X3ScMS1p5nrg83Wdw/gotWUEhNW5qLKL0hUnw5AV3nEp2FnFcsXPqkd+XVzA== X-Received: by 2002:a17:902:7c03:: with SMTP id x3mr117368602pll.242.1561283136704; Sun, 23 Jun 2019 02:45:36 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([1.129.156.141]) by smtp.gmail.com with ESMTPSA id d26sm6181062pfn.29.2019.06.23.02.45.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 23 Jun 2019 02:45:36 -0700 (PDT) From: Nicholas Piggin To: linux-mm@kvack.org Subject: [PATCH 1/3] arm64: mm: Add p?d_large() definitions Date: Sun, 23 Jun 2019 19:44:44 +1000 Message-Id: <20190623094446.28722-2-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190623094446.28722-1-npiggin@gmail.com> References: <20190623094446.28722-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Anshuman Khandual , Catalin Marinas , Ard Biesheuvel , Will Deacon , Nicholas Piggin , Steven Price , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information will be provided by the p?d_large() functions/macros. For arm64, we already have p?d_sect() macros which we can reuse for p?d_large(). pud_sect() is defined as a dummy function when CONFIG_PGTABLE_LEVELS < 3 or CONFIG_ARM64_64K_PAGES is defined. However when the kernel is configured this way then architecturally it isn't allowed to have a large page that this level, and any code using these page walking macros is implicitly relying on the page size/number of levels being the same as the kernel. So it is safe to reuse this for p?d_large() as it is an architectural restriction. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Steven Price --- This patch is taken from arm64 but is required if this series is not build together with arm64 tree. arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index fca26759081a..0e973201bc16 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -417,6 +417,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_large(pmd) pmd_sect(pmd) #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 #define pud_sect(pud) (0) @@ -499,6 +500,7 @@ static inline void pte_unmap(pte_t *pte) { } #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_large(pud) pud_sect(pud) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D93A5C43613 for ; Sun, 23 Jun 2019 09:46:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAB2D20679 for ; Sun, 23 Jun 2019 09:46:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CarSQJzq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nZ1uAEh/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAB2D20679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7sHUahc4+Yw5me13JXg/+jQYe9DVklDQxb6bLd6xLl8=; b=CarSQJzqbpJiH9 /gMj04al/7WZpUiolB/WHNiokFhLH3iBjHHyJWjh8tErQ6wi5kVTbukcdAqbOoj0MznqrtoP5Nol4 aJZuJ9afqC5NHcV+kH9PKAhZZ2f7vDzHstwApuBIWni72IP0kwGsyNvnCOeKeNnxosrn6rYs0RgLa kmZ3uleW+Bsm8Mc6xKZvvbYBv8WFHn1gsEYoFv2Yh4SggrZ8W8r8LL7q/vJ+YpimJFqmzn4Ibc6qt SG4UvElD8oySUuSMb04+prxOfI3SoCUR3/56qNQ/D4VaWQM6mMH0ufRo0JW/HB4HJawHl7zPf9Yo1 EJW9UKaLQ3iqQ/kch33g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hez4T-0001JS-BH; Sun, 23 Jun 2019 09:46:01 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hez45-00017L-1M for linux-arm-kernel@lists.infradead.org; Sun, 23 Jun 2019 09:45:39 +0000 Received: by mail-pl1-x643.google.com with SMTP id p1so5209766plo.2 for ; Sun, 23 Jun 2019 02:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=nZ1uAEh/l/iH3XHgJ4JMzpVgG2BAjVP+Z4uP0nLctfLAj7AD/MmtA4UP0ovGBefyCX oi/eiKdn5rkb+cERs9Q8dHLJnb+ghuSMilmtfbCoNwrAS8IHMPARnfgHf8n9HMnua6zS +dxXBrDAzpJmAl2a5WPEl0+v9WftLVMpwR+Ki8qD5BEfrZHM6Z+MwQFgDagG17N4lc1g 5g3hUt3k1Vuvyww7G6od0qdoZYGYGxV4ZJ+E/1RRGg0hnv1OCHh2088YsdWh7C6PTe+t pG1oasPj0r+b4PVWCRQ/vj3KXGeUaEOXaQbg+/rH4Dd4SeFUb1BicT4qR09j10i/WFg9 yGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wnbjux+HxNYOkFaRKhTh2OlBlr6Yjq4h8O9uCggPaW0=; b=OpzcYG3ZqCjqADPX7AuCdj6Ns1ft5ZyHYdq9TG7AWOE+xIYV/zo71k+ROYSZRUc+a9 97H544P9gFInWhHH5DdMRUJxi2xryX+ZsjFU+9SOvI71Em1b110EjwQLXc36goLT/d3z qlnnSQtb2k25vJ/3OlaBfDlsrvWXF9bSlTNAR25U9mnE5bn5pHIS/5bIe9ji+tVIcpM6 FRZxoJw4mcWN5ViWMQz0R7KV3ZvEO+C5dP8aixQKanHqXDQ6K+3HrDUAheKKAzZeGRE0 Mi276eEtfDInPXQ0pLQdsdoh0gMwSsmsX7PhLlMgXd8JdXBcQqKbhzrE5p3pS/euLifl VJ6w== X-Gm-Message-State: APjAAAVDRXtLsdFVFXCdWFoSC5vmHnmPH7EOYMgKElCjsQ8LwBM6dQB8 C0u4cr3iTxg4f5EyNIFy0to= X-Google-Smtp-Source: APXvYqy03K0Z/MbKC+X3ScMS1p5nrg83Wdw/gotWUEhNW5qLKL0hUnw5AV3nEp2FnFcsXPqkd+XVzA== X-Received: by 2002:a17:902:7c03:: with SMTP id x3mr117368602pll.242.1561283136704; Sun, 23 Jun 2019 02:45:36 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([1.129.156.141]) by smtp.gmail.com with ESMTPSA id d26sm6181062pfn.29.2019.06.23.02.45.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 23 Jun 2019 02:45:36 -0700 (PDT) From: Nicholas Piggin To: linux-mm@kvack.org Subject: [PATCH 1/3] arm64: mm: Add p?d_large() definitions Date: Sun, 23 Jun 2019 19:44:44 +1000 Message-Id: <20190623094446.28722-2-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190623094446.28722-1-npiggin@gmail.com> References: <20190623094446.28722-1-npiggin@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190623_024537_562073_613A2625 X-CRM114-Status: GOOD ( 12.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christophe Leroy , Mark Rutland , Anshuman Khandual , Catalin Marinas , Ard Biesheuvel , Will Deacon , Nicholas Piggin , Steven Price , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information will be provided by the p?d_large() functions/macros. For arm64, we already have p?d_sect() macros which we can reuse for p?d_large(). pud_sect() is defined as a dummy function when CONFIG_PGTABLE_LEVELS < 3 or CONFIG_ARM64_64K_PAGES is defined. However when the kernel is configured this way then architecturally it isn't allowed to have a large page that this level, and any code using these page walking macros is implicitly relying on the page size/number of levels being the same as the kernel. So it is safe to reuse this for p?d_large() as it is an architectural restriction. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Steven Price --- This patch is taken from arm64 but is required if this series is not build together with arm64 tree. arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index fca26759081a..0e973201bc16 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -417,6 +417,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_large(pmd) pmd_sect(pmd) #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 #define pud_sect(pud) (0) @@ -499,6 +500,7 @@ static inline void pte_unmap(pte_t *pte) { } #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_large(pud) pud_sect(pud) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel