Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4318140imb; Wed, 6 Mar 2019 10:22:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxP6kGMaE4gHwuAw6n3Q4JSbypeKzxFPNi4dRPdsYsbfzNN8KSerRzft17vWN5R7x8QB/n2 X-Received: by 2002:a17:902:403:: with SMTP id 3mr8397987ple.48.1551896541261; Wed, 06 Mar 2019 10:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551896541; cv=none; d=google.com; s=arc-20160816; b=UJeVwPDvLLvVFxwneKaxxCtFReYQMtjSSKL3h1A97uH0z+mSV4HZSm2uhPF+tXeFqO wbuGPhejHKmAlwcfBXYKknlVhNXbuftTtFN3DHWHTPtIVAY1VXGaHXbYnF8nD3WRypZa JHzL89P13CdkPKGK6rvzk7gDw/MTUdE8qj8gJeuGoVkcKHbGS48+R422NlmicZSQ7Omy IPLe6Xh1C2EFfj4RDTEnkoH1zHFgn+TUiLlDUYO80vxQVwG/CoihEEc6uVipZMCdV3Ij UKlO9cUxrbV9Do+zalGf07MzafiR1ag4KYT7W2kQiErK9iNitlPZQHcb7TNqhDbgj4IS 5ixQ== 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=cPKBnLK8oZvB2lWO7ABGhCwqW0QzKgUdLTrWIxZALpE=; b=kaFrRVeXTwoeKk5V6JvPimJ4SRQFQFv1BWIvQHH3e/q2kyZrgePP7ieB6u/aNeLUUj oq0dHQc1irs7ZiQoHENXoqtJZutKtyCC8zr5hZ/SAnw/VN7WGxy/jHL2Snkwd16zBMQ4 2Pe1Z7TwXvq26NvB59KLZ8tD/j19ceUZLmnz/uVxg4FLasarzPZycHC6m4t+HgemwnLI pfntSCY7IbhgHD1pJbU5gQKRv1qPlj/tWnLot7Phs63zNaPEoLTZiXUzeZCZwVkUb/wA 4QHCWUCz4dtte0VT9qLx6b8oEqXyhLJfvKz0nUUAfcapjV+BXFE0qzTg4issb/NGXFQc 5R5A== 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 f8si1936748pgo.80.2019.03.06.10.22.06; Wed, 06 Mar 2019 10:22:21 -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 S1729801AbfCFPu6 (ORCPT + 99 others); Wed, 6 Mar 2019 10:50:58 -0500 Received: from foss.arm.com ([217.140.101.70]:34256 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729359AbfCFPu5 (ORCPT ); Wed, 6 Mar 2019 10:50:57 -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 2A69C80D; Wed, 6 Mar 2019 07:50:57 -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 567923F703; Wed, 6 Mar 2019 07:50:53 -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" , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v4 03/19] mips: mm: Add p?d_large() definitions Date: Wed, 6 Mar 2019 15:50:15 +0000 Message-Id: <20190306155031.4291-4-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190306155031.4291-1-steven.price@arm.com> References: <20190306155031.4291-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 --- 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