Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp2021617img; Wed, 27 Feb 2019 09:09:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IZZ4jnVrI6WcOjnXF91Pvn2KlsTcZFg0+hXYI3NH4HoqOuryoFxhsoStI7Y34V3EvZdhTqj X-Received: by 2002:a17:902:104:: with SMTP id 4mr3166909plb.62.1551287392013; Wed, 27 Feb 2019 09:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287392; cv=none; d=google.com; s=arc-20160816; b=sLzG2kVNKuQvB+U/Q1vrjNPmo02BHux0e1CbLj99rQZvcU1p7ujAV1HplcKlMMUILp Tq0A27Cns1nWF28kGTu44INDcVu/RvEi85ZZdpI1+zHXIn2/Boeq9sao/hIHwhuWoobg SoeMVOthxbjA4jb4T+Hg8p9Ntsz0MHKhsqXP0zXspUiOxUqcTWO9QcRlIDH+x83QC8iP fkNgSWAF1Tehz+kXZkas5Hf+qUJICal/eaw4cVK0LM5qMd4gLDhMrk09L73IwbrIVA7U dtBylT+CSP7lkIR+VQe4J+yYkFEJgfLX8+du6AThFerIJbfBNBrfEfnCivijH+WAwnOB xObA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d7Ez4LEs1GxX+k7wJ+eVDpmUwku09yzSGsf2pAay+/c=; b=ggjgSan22GeeCEe/pvowS7k0QImuVSZinB0rY6Ui4qANYJ4ar+rxwOYVRHw64aYxLM CjfdX/QMfjmrs+wzBJUCt1wQpuVenqYxUlhnvpjyodTjPucQtHC/kfhaYq8/qTfCSiEX T96+NOMiQb2ox2qNqa5dCTVxuLtXNaBtvAuI78w9iTeiR2lyD7F7jmnBmfv8BRPWRx5D pd4FIk1WMTxC9nleUI+c30hy6xUCjU3JhJH6ugfRgeTJXARZe3oefL6AleX3gxZfI7KH ED1Fhfq5ktMll6POK9/lAgPLm5BbVvWQhFktlySfAAfFCXn9csy8OBtesPs6hI15XGTF cabQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k30si15248621pgi.146.2019.02.27.09.09.36; Wed, 27 Feb 2019 09:09:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730375AbfB0RHf (ORCPT + 99 others); Wed, 27 Feb 2019 12:07:35 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36336 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729402AbfB0RHe (ORCPT ); Wed, 27 Feb 2019 12:07:34 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B989EA78; Wed, 27 Feb 2019 09:07:33 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 13FF23F738; Wed, 27 Feb 2019 09:07:29 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH v3 17/34] riscv: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:51 +0000 Message-Id: <20190227170608.27963-18-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 is provided by the p?d_large() functions/macros. For riscv a page is large when it has a read, write or execute bit set on it. CC: Palmer Dabbelt CC: Albert Ou CC: linux-riscv@lists.infradead.org Signed-off-by: Steven Price --- arch/riscv/include/asm/pgtable-64.h | 6 ++++++ arch/riscv/include/asm/pgtable.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h index 7aa0ea9bd8bb..6763c44d338d 100644 --- a/arch/riscv/include/asm/pgtable-64.h +++ b/arch/riscv/include/asm/pgtable-64.h @@ -51,6 +51,12 @@ static inline int pud_bad(pud_t pud) return !pud_present(pud); } +static inline int pud_large(pud_t pud) +{ + return pud_present(pud) + && (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pud(pud_t *pudp, pud_t pud) { *pudp = pud; diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 16301966d65b..17624d7e7e8b 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -111,6 +111,12 @@ static inline int pmd_bad(pmd_t pmd) return !pmd_present(pmd); } +static inline int pmd_large(pmd_t pmd) +{ + return pmd_present(pmd) + && (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; -- 2.20.1