Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp206347yba; Wed, 3 Apr 2019 07:18:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIrOXBzgs7xiDQ9vllSfblNiVhpcB6ol6pxLg/npoptmgj5khbqxvSRWvAYU+eQNP8PUzB X-Received: by 2002:a17:902:6a89:: with SMTP id n9mr165781plk.76.1554301109980; Wed, 03 Apr 2019 07:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554301109; cv=none; d=google.com; s=arc-20160816; b=lGUOSRnWfoR7bQg3IY8kQgDsGU0L9LcDxONXJ8CcRrVLIlpAXXFs2lvUj68FQqV1Az sdpyQpCR+fs9urv+iaC+ar3Q+5M0wuyOmE+pGOAusPKYMtaDc/lcqOHjg6I1dci9iM/3 AqZo3tsJ7SVeFCimdBRI3kMab75iCkLZtZjimp4jmNjEK3CoFyXHCBdUxUfRVXDJyda7 VAarzZtEoq0x8E4PjCrU//vC5peB4NJeZVr82LaBG0PVpttrL4xISsVcILTNwk06C8Pm KnjusvbkIYVdjcEKq8dk4aYgf5HBbKxmwdWmHfmIJ2yXwLu0BBv+v589OcuP2gEFdHkK xsDg== 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=kzhWhBNdEc/dmeeHejUDOzhC0LM+xGFH6MOnEUmJPPXSaFz8jRD93NfDxt9+ZlO/eo I9WD3jrwADiZKRTOxTDjPVe26hHJoyNeUCCk50N+SZvPgMkbTv6R5XwA4PhSR0vAHoUY w/Ej1unpWgAOkfX8MTAr1zc/9eoEjI6tzimuTOzaryDR1p70Kii9FoJDObGgjLAEnDVY /7G+4In3nOpDcPPT9xEM+FgX8xWJi/A2KN2M+oNZA66/SVHKX7+2HTWsJqnAedjJOm0S P4hnMO2HayIcI+kLiwedWZslDxa5Ww1qWsNanb2SuzC9ed6rD9XP4epD8m/sIOmeei3X VFAg== 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 l8si8557198pfc.223.2019.04.03.07.18.14; Wed, 03 Apr 2019 07:18:29 -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 S1726723AbfDCORY (ORCPT + 99 others); Wed, 3 Apr 2019 10:17:24 -0400 Received: from foss.arm.com ([217.140.101.70]:41434 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfDCORX (ORCPT ); Wed, 3 Apr 2019 10:17:23 -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 52CBD1596; Wed, 3 Apr 2019 07:17:23 -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 5A7813F68F; Wed, 3 Apr 2019 07:17:19 -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" , Andrew Morton , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v8 03/20] mips: mm: Add p?d_large() definitions Date: Wed, 3 Apr 2019 15:16:10 +0100 Message-Id: <20190403141627.11664-4-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190403141627.11664-1-steven.price@arm.com> References: <20190403141627.11664-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