From patchwork Wed Apr 3 14:16:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10883889 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 AA12717E9 for ; Wed, 3 Apr 2019 14:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F45C28A30 for ; Wed, 3 Apr 2019 14:17:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8310F28A13; Wed, 3 Apr 2019 14:17:28 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4D3628A27 for ; Wed, 3 Apr 2019 14:17:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17A566B000D; Wed, 3 Apr 2019 10:17:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 12C736B000E; Wed, 3 Apr 2019 10:17:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 019E56B0010; Wed, 3 Apr 2019 10:17:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id A7F3A6B000D for ; Wed, 3 Apr 2019 10:17:25 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id l19so7505505edr.12 for ; Wed, 03 Apr 2019 07:17:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MqMqukGILHQS5vjuNGdSQFWysz8AgSB4keSNgmoOKiU=; b=o8Qk1cc6LFZ8YLvUQNDoV2i0gv6OtOf7vsEtPqrWMrKItUrqs94liwd3STbszBnJdg 46/DqSKGe/lif0+BYw7GHw3si/sp3cMYu38CQw08sFpWh4LoUP505rEwi4GKUeyFP0rj lJeuSawovU/ophqFqKVlG1uSqnJnL0/S3KGpSi6rdKcjUihqbC+5+CzHshaW+kmfXN1v bP9VH7v/lkUFFRUV4Do2DzuqnmDRMLbW6SmIUrb7Z3aieoXGrj9MFNAcn71KS1dn9aS1 RVKCIBfg5KrdCsJ+gua7NBoS/lteUH7eoMRzZsM42y903gaVEt4MSBD85wk9L0ZguCSt 2PJQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: APjAAAU/ILlmRDxf9rlG1RlMfAYRhyKzq7/z1FjdYOfmc8gUW/OLbQ1V x0iR4IZSL5gYPt8cq1LbSIla9pFRUSLfUsikZzMIFIFafTSEyVpN/FL0hUBDHB2znNrgaIaW21+ AbumMfTRXQ5LAU8MdCrC2WpOLV810yD4Wn5f4KEDcg00Af7R2KHuwIPz8ywWauW1ucQ== X-Received: by 2002:a50:b6a9:: with SMTP id d38mr50401035ede.98.1554301045211; Wed, 03 Apr 2019 07:17:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfeB19XcgSAHCGppBvscGbZbZ5gJefz0Tbm9nutsLt8y2P1ALT5M6OM5aGHCb2/OfvI+/X X-Received: by 2002:a50:b6a9:: with SMTP id d38mr50400988ede.98.1554301044371; Wed, 03 Apr 2019 07:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554301044; cv=none; d=google.com; s=arc-20160816; b=gPKHl2HUP8uCo70kZSNfZAQJ2CoKHwqniF2j7BghBUUrqtgYkUCMHPJouBCumd1OTd 6z2e20OLkQPf2wxVgLmdHSoa6L21h0Vdff59q4AJTv+qTeUHTtzrJoqskNApJ3OHvd6k uH8TFtRfG8BeVdtBT5EfmUrfo91Kr0NZ1V2tm3DR9Q8QUONBJqHGLuqAE+tGcGlZhI9Z skoTs7Wfjs8I1KPFdsRtqgyeTilLbuhl7312qfr6GlRf4VmL+xfcELqHTmACVwS0vKZi XbtPCdQW1m/52hE9mIDqsSRMVvYKP/R9XdN5zdO9oWAuqPmjlvVZS8ptdOoieNHbUp9s dHEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MqMqukGILHQS5vjuNGdSQFWysz8AgSB4keSNgmoOKiU=; b=Y/g8q6JyFhyUyO/M4tJnadGXKfyiJvX7FGBSCKGQiG/jEYhsl4CDrJCiq5ckK14ozM ndql2l6Wl0f80RZ92h67ErbLMZTwOJ/UIbx8H4fBL1hPXW4i7akPxNUeFpF4AtcgQG3C fNftQcyYyzQEFVQvOY8L16herXcuAIQGe/CZBiDEhkxgUUNZcLpe59uZY7+2ORvEvtpE yYvGChAbBY+sR7NFCtj26kByDweJIqBO0r/wW3+uHF5KdEjeMVlU5AGLpcbdSiFWtHN/ KpYX3FgU5czlv+7mglT8ZddEB4rla1qeDoC6bfya/0MeBu/kQecsoNfeIL1Yaa1ftWjL JhQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id e4si2203466ejl.232.2019.04.03.07.17.24 for ; Wed, 03 Apr 2019 07:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com 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?b?SsOpcsO0bWUgR2xpc3Nl?= , 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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);