From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3864FC71156 for ; Thu, 3 Dec 2020 09:25:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEC242085B for ; Thu, 3 Dec 2020 09:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388436AbgLCJZP (ORCPT ); Thu, 3 Dec 2020 04:25:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729943AbgLCJZO (ORCPT ); Thu, 3 Dec 2020 04:25:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A2CC061A4D; Thu, 3 Dec 2020 01:24:34 -0800 (PST) Date: Thu, 03 Dec 2020 09:24:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606987472; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6oiergBTBy4iXtO/bgGEoGyFnIxs0JqHOOX54IB6Xv0=; b=WHXfS6gMyLWmrFVzudomYHIcJsYRQEu37s7vNrzjd8PWg6k95tsWRaebSgUiFKVo1w+mbL xm3oRMqdXcfhe9IGHtIYXnPivLWQnVD6iyQ8mj190/XqvHKWN2d8fNNmTSfi4TzwNabkpl NDVkzryh3ILHNhCes0mzn/Fz3nRJcuyJVfipwtEtHUQgrQ8fHv0hqK4NGgfByh5WfOOIN1 jMgReZSQYGByAbRb71poUrabuPcVs+pN7TZ3gHGstsOV3xrtszg568P2klKsRBAn5eomiS 1EyZTZOPk/V1lqY12Lz48CIrmqfR/Ilrm5b68TQ/yhAvSwEiDfihmG+t3YpKVA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606987472; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6oiergBTBy4iXtO/bgGEoGyFnIxs0JqHOOX54IB6Xv0=; b=14IqxZS7diqPMRXvtfO4fJv3XB8ZYzUaMiuoOr713eQbFdTs+yYc0mXjlVvRLawt6npLTr wB9xt65V4X3zilCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] powerpc/8xx: Implement pXX_leaf_size() support Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201126121121.364451610@infradead.org> References: <20201126121121.364451610@infradead.org> MIME-Version: 1.0 Message-ID: <160698747226.3364.11701061900605887245.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: c88a82f668cff457561272632a06a4a63dbf2fe0 Gitweb: https://git.kernel.org/tip/c88a82f668cff457561272632a06a4a63dbf2fe0 Author: Peter Zijlstra AuthorDate: Thu, 26 Nov 2020 11:53:33 +01:00 Committer: Peter Zijlstra CommitterDate: Thu, 03 Dec 2020 10:14:52 +01:00 powerpc/8xx: Implement pXX_leaf_size() support Christophe Leroy wrote: > I can help with powerpc 8xx. It is a 32 bits powerpc. The PGD has 1024 > entries, that means each entry maps 4M. > > Page sizes are 4k, 16k, 512k and 8M. > > For the 8M pages we use hugepd with a single entry. The two related PGD > entries point to the same hugepd. > > For the other sizes, they are in standard page tables. 16k pages appear > 4 times in the page table. 512k entries appear 128 times in the page > table. > > When the PGD entry has _PMD_PAGE_8M bits, the PMD entry points to a > hugepd with holds the single 8M entry. > > In the PTE, we have two bits: _PAGE_SPS and _PAGE_HUGE > > _PAGE_HUGE means it is a 512k page > _PAGE_SPS means it is not a 4k page > > The kernel can by build either with 4k pages as standard page size, or > 16k pages. It doesn't change the page table layout though. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20201126121121.364451610@infradead.org --- arch/powerpc/include/asm/nohash/32/pte-8xx.h | 23 +++++++++++++++++++- 1 file changed, 23 insertions(+) diff --git a/arch/powerpc/include/asm/nohash/32/pte-8xx.h b/arch/powerpc/include/asm/nohash/32/pte-8xx.h index 1581204..fcc48d5 100644 --- a/arch/powerpc/include/asm/nohash/32/pte-8xx.h +++ b/arch/powerpc/include/asm/nohash/32/pte-8xx.h @@ -135,6 +135,29 @@ static inline pte_t pte_mkhuge(pte_t pte) } #define pte_mkhuge pte_mkhuge + +static inline unsigned long pgd_leaf_size(pgd_t pgd) +{ + if (pgd_val(pgd) & _PMD_PAGE_8M) + return SZ_8M; + return SZ_4M; +} + +#define pgd_leaf_size pgd_leaf_size + +static inline unsigned long pte_leaf_size(pte_t pte) +{ + pte_basic_t val = pte_val(pte); + + if (val & _PAGE_HUGE) + return SZ_512K; + if (val & _PAGE_SPS) + return SZ_16K; + return SZ_4K; +} + +#define pte_leaf_size pte_leaf_size + #endif #endif /* __KERNEL__ */