Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4455727ybp; Mon, 7 Oct 2019 08:41:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXkjjP0unHBCKlKyWXSuNOca4kkKKFN0cPRGMQf1EBtEIysomv+AET275tKGrOJMLJC5gT X-Received: by 2002:a17:906:6d4:: with SMTP id v20mr23716246ejb.223.1570462908431; Mon, 07 Oct 2019 08:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570462908; cv=none; d=google.com; s=arc-20160816; b=GNsMkkvlAN4nbaCr0kX+aK+RRpw4gr9xZ+cCEy3txJlYBOiwimBR4zFCyy/gQBIbEt WQPCgmgLk3uzGKGihK0TttlVG7RVqxoZao6R5/Z5BBsEQhPHYDKSNdsvq73ArdHAKK40 nuSxdm/Z5mxwVs891CvGFHXUCh5k+Yg13JSAWSZD7qQUewAM2rzbr6WViUvxpLVFFrBW je3uhZKBO2YF9EMoaa3ega9h9VYtq8sDlP7bgN522aN+jtYCNj8nlgIyQW88dKFa07QJ Ch5QvksgxUcgnaoQF/rmjxIxnwXw1avq0IWzWQGJBwELvj+XJAjBTYjAt2BmTcwNf9lt f5mw== 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=dZ9XXPU2jjxL34c8YS/tHpYjqPyXKm2evNHDnWEBB7I=; b=DLhO5G2jIPX2Xvkx3WdGBdeeb53ytb/s9d6Ug0yiEFkV6hpUgyQ24rRwFECmOLUk85 p2boQl1P9PS/XzxWaRYbrQ0V/F4xw5fImXLVEzWntUa1pQdbDkq3w/dznq+CtQvbLKgG yEa3SgZxA1K4qto7eocaEvmSuujLCre5R/9+PAzioyX/83ynff0soBBew0+BYtubJSMF wN/xRO/9YFKwSuD2gYOdCQaammeuGNXoEhjW1qEGm/J3UWlO+V2cL0vuVjHfnMzkJaf6 o58yNYT3b1EAihxz/CVcxOW+5Puup84FFylCG7ptdpjHujv2mNStIXR9Fc54CgvlzLUu iWpg== 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 r9si7069991eju.10.2019.10.07.08.41.25; Mon, 07 Oct 2019 08:41:48 -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 S1728901AbfJGPi6 (ORCPT + 99 others); Mon, 7 Oct 2019 11:38:58 -0400 Received: from foss.arm.com ([217.140.110.172]:38352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbfJGPi4 (ORCPT ); Mon, 7 Oct 2019 11:38:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 333181576; Mon, 7 Oct 2019 08:38:56 -0700 (PDT) Received: from e112269-lin.arm.com (unknown [10.1.197.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2DC7E3F6C4; Mon, 7 Oct 2019 08:38:53 -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 v11 05/22] mips: mm: Add p?d_leaf() definitions Date: Mon, 7 Oct 2019 16:38:05 +0100 Message-Id: <20191007153822.16518-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007153822.16518-1-steven.price@arm.com> References: <20191007153822.16518-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_leaf() functions/macros. If _PAGE_HUGE is defined we can simply look for it. When not defined we can be confident that there are no leaf 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.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index f85bd5b15f51..fff392ea80c7 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -639,6 +639,11 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#ifdef _PAGE_HUGE +#define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +#endif + #define gup_fast_permitted(start, end) (!cpu_has_dc_aliases) #include -- 2.20.1