Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4442135img; Tue, 26 Mar 2019 09:27:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxei/+PGfTFMFnnJPPw9pcK5j9o1hyaeyhMfoRGnty/v1wswHxavWBmdMn1qq8QfDsqK9HQ X-Received: by 2002:a62:26c1:: with SMTP id m184mr460471pfm.102.1553617665242; Tue, 26 Mar 2019 09:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553617665; cv=none; d=google.com; s=arc-20160816; b=s1LSJTpYHaJ3EmlYHW3FBNb8Hi4eKwGjtrS73yGcESygzFUs2d07buzbf+kTt99u3O 1VHglPm5SL8aMDwHXdiefreHSDUv0SPhZuJ3pGjX+F9Bv+wMZYi3TDddfm9utbV3cPCZ N5H+fvexB8FgW+ommKO1CRNR1Uf1Q/rWYpd+hyQYVyGhkZ5YWI382T/UimpPO2ZeAdMn OS/0sw2kz8megce98rDukwXebbDtiVnKtzqGDGi2AgvAniGNpPh61tYxdwSBsT7I0vNC 2kaXkeq2eqdvEGYD2rM1iz/BIHs7HzurRQKLdZwA4K+KW42A+yH5upFlhVkcKWCfn8FS n2XQ== 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=MqMqukGILHQS5vjuNGdSQFWysz8AgSB4keSNgmoOKiU=; b=lT/e7RmReQZPTfkxVfov+34Uu68rgA61G6YggwOHTw1WEgy4vpAnaDiEfQ7GToLyQ0 77L+HKnO8hp/5kpHmIrqWRgmnVfDWqY8KL2GLEae6Vwqd8MavzL8xb+moOddM9MNVj9+ cXaaysNn/1APC8xIWy7twZS6o3nuUU6+AaLgoP+rlIOjDv9wyv5uTkCWGJyO9ecifmtT YFU9/jPs3WzZxsuIATHqTe91t9tIBUCvdpHlQqIz1WoT/sloXJNcamklynVumI3I9BD+ EccFU6cL2VGp2AzQramFvYmiGRfrTHQUsz46UA16K61gzFmpgUVDUauTKWNKxaJTHfJt 3BYQ== 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 g24si16606866pfd.212.2019.03.26.09.27.29; Tue, 26 Mar 2019 09:27:45 -0700 (PDT) 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 S1732041AbfCZQ0s (ORCPT + 99 others); Tue, 26 Mar 2019 12:26:48 -0400 Received: from foss.arm.com ([217.140.101.70]:39586 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfCZQ0r (ORCPT ); Tue, 26 Mar 2019 12:26:47 -0400 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 C66841684; Tue, 26 Mar 2019 09:26:46 -0700 (PDT) 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 F09503F614; Tue, 26 Mar 2019 09:26:42 -0700 (PDT) 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" , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v6 03/19] mips: mm: Add p?d_large() definitions Date: Tue, 26 Mar 2019 16:26:08 +0000 Message-Id: <20190326162624.20736-4-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326162624.20736-1-steven.price@arm.com> References: <20190326162624.20736-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 mips, we only support large pages on 64 bit. For 64 bit if _PAGE_HUGE is defined we can simply look for it. When not defined we can be confident that there are no large pages in existence and fall back on the generic implementation (added in a later patch) which returns 0. CC: Ralf Baechle CC: Paul Burton CC: James Hogan CC: linux-mips@vger.kernel.org Signed-off-by: Steven Price Acked-by: Paul Burton --- arch/mips/include/asm/pgtable-64.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..42162877ac62 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -273,6 +273,10 @@ static inline int pmd_present(pmd_t pmd) return pmd_val(pmd) != (unsigned long) invalid_pte_table; } +#ifdef _PAGE_HUGE +#define pmd_large(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) +#endif + static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); @@ -297,6 +301,10 @@ static inline int pud_present(pud_t pud) return pud_val(pud) != (unsigned long) invalid_pmd_table; } +#ifdef _PAGE_HUGE +#define pud_large(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +#endif + static inline void pud_clear(pud_t *pudp) { pud_val(*pudp) = ((unsigned long) invalid_pmd_table); -- 2.20.1