From patchwork Mon Jul 1 06:40:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11025109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D7F9746 for ; Mon, 1 Jul 2019 06:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CB25284B3 for ; Mon, 1 Jul 2019 06:41:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DBD0284E9; Mon, 1 Jul 2019 06:41:19 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D3635284B3 for ; Mon, 1 Jul 2019 06:41:18 +0000 (UTC) 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=v3kfRBHVv2SvmoDE7ORCsOuatUWSyJD/jc19i4SP4JY=; b=SZCMeQ5W4INCrd B1UYHV6IddSmTOTaninxUUHoDlrve1NexTo+fVkNgkPUxGVkKDeY/1tJcLsi9YtelojIC9/vvjbu+ JLXTd990+3ra90Y8ZlNNsSrToEgxu7vnYNEhzXKS54Ei1Hn3hI1WGGairv8QpTPO0XJWuqeL/X2ol tR5ZYCk5L+g0wM/NPfftdHvyl4SYj0uocTihj1RZ/wNYQCQB+LpFRjUGhBshT2Z88PUTYyFj1WZzz NV0HSmB3gD/v1fId6DoJJxdIuyyob5+U/0pBP2tROEnv5JLiV9Bugbu+YGIqJqlxRS1SvWep09sVx GgFv4JmoS0DU71dsACUw==; 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 1hhpzx-0005nS-9i; Mon, 01 Jul 2019 06:41:09 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hhpzi-0005bg-BJ for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2019 06:40:55 +0000 Received: by mail-pf1-x442.google.com with SMTP id c85so6055344pfc.1 for ; Sun, 30 Jun 2019 23:40:54 -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=pKOh82x9P2FXMy8MB5i8VNrUUku24zVBdhYruM45v1s=; b=Yv7ONmA4HXrBg5Z7fqXzGOQbgQwuhlK4G2llLAPL9hd//uUhAJCdLP1gC4MiqhQmS1 PV4CZ1/6GPjUs6tQxXSl9GVwIuOpYlj0kPjLUd5KNaZDhIEToxG1Sa+JbI0gqbWYCnK1 nlIT45EuZA6x+yj65DFrpUmE+ukUb3brmWRiJ0sEST0egchnVhKD3wf61QoTZodMZhmy k4LLY0TR+zKUetQRGdhUpKeJcCk0KpXMV/eM/4aPeAhRmDX3A00d0snpwA3wONNLJH4u fRpP7dt48AfYD+D5tlNpsUuYik0uEhm3cuSW3WNaRLnnooak0yNkr7b21OrBtbTM1gge bOuA== 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=pKOh82x9P2FXMy8MB5i8VNrUUku24zVBdhYruM45v1s=; b=XL2a/QOZRIQJK5xtzWendUlFSeI/Rg6/sNx4FevHySAddYhUrg9bJxrE8XFbG0QYbV yA6TsdkNC1clVSFGOsvAk4hUEFhjpDUTmtcSxHWnUrctbb/tO6Og+GjeoIqA0UCNO9EE K58xSrCadCWB6gCIYSbEmOvqGI9sWWOkLtrfsaV/klb1cogLgD9dk7ad3NalicW4ThOL X/cg2D13BjFZoO/Zv/dArMMVmuRxwu118xPxGCMQEgTKpKr6W+oPRd+QIidyf80Du7db rnYoQlI87ikyof/Xe8HJPnAXXe/dflM6D7vtgxx4R0IAFU68QqrmyAZeDf0JJ3kSGQ0l HFlw== X-Gm-Message-State: APjAAAWcVMwnCmUvHv9j5lurvzXYv0oI+xEySWG10z26XpYNclpFFuVo zMc+QNt5fen3lQPxHqYF8+k= X-Google-Smtp-Source: APXvYqyuG0y2ZSl0o0Y8HuBhNNVpR47p1znHr/GTjxdAJLwOfhhJ0EB9nOQKOhPc/GH1Qv7SUWLDfA== X-Received: by 2002:a17:90a:eb08:: with SMTP id j8mr14461754pjz.72.1561963253877; Sun, 30 Jun 2019 23:40:53 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id x128sm24238285pfd.17.2019.06.30.23.40.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 23:40:53 -0700 (PDT) From: Nicholas Piggin To: "linux-mm @ kvack . org" Subject: [PATCH v2 1/3] arm64: mm: Add p?d_large() definitions Date: Mon, 1 Jul 2019 16:40:24 +1000 Message-Id: <20190701064026.970-2-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190701064026.970-1-npiggin@gmail.com> References: <20190701064026.970-1-npiggin@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190630_234054_385892_B158FA8E X-CRM114-Status: GOOD ( 13.36 ) 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" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Catalin Marinas --- 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)