Received: by 10.213.65.68 with SMTP id h4csp646514imn; Tue, 27 Mar 2018 06:17:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELtL1tjGtbIecDF3LbKnQzQKizROLBxmBptiz8ddMRy3UeuSk4wHPkUrg8yUVR7KDJkry2ye X-Received: by 2002:a17:902:6c4f:: with SMTP id h15-v6mr30474503pln.33.1522156666466; Tue, 27 Mar 2018 06:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522156666; cv=none; d=google.com; s=arc-20160816; b=f0PYeegVIpSnD0EGvcnSwu9aLDbDXwrM1u+as5ovDDigEGQlCjD/EVo25/gdWMOg4i Mw3XEiasL/mX/a9LbuhXMjt79EkszanNJCd7ZIGloerb6hAqm5qORDWfTk19RZoKOaur pAuEI29o+IFmMjelf42bYwijucjASPU/hVHL99BbsbQoLsOAbdQ3gBhClR8rUPN+gnp6 vNOtV5U8aZJmcSLcQMWzl5c2+Je29hh2dkD4wPpWa0a0Q1kk8CNQh3ybWfnzZmfFixKh UajqgwS/UdDD/pmZ/WMpc5kXjXuF7Fni8leAUKyEfawZy0TdVC10tY/BXg4nb+ctMU5h 9n8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=PLUXs0LQArEuWKLUwcJRZEbxvN9jNCaWAQh2c0LLL6Q=; b=ASOU28jijX87w2ZhWPsvYsBKwWwLpvh5FHF8w2HyYiG/1xuNI+U4+N0RTOa3ZBySES ndk3LI/NaqDQMZ3s55Lh8NcaGa3/y8wTd2hi1faSeJjNKorf6At3oCcLZiQUCxJIn+8g OIZ0IdSKTqQ33yJ4hE72B9g6NO1EvvD+O9RWG/jmjZcEz39iln30G6zPkiryQVXqz4fM 6Cg7YJZQaVIuE593oAr91PT6VD3zHWxPzWDzm2/8zDXqLL8CCXS7gyjNYa8BpbajA2Cv 3/xm0cFf16+l9KP4fhhLmhS7QeSK0/u4chkl3T0PC7bT4pWDXdRw2iGgcinKocodQEQr BWbA== 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 n13si868912pgc.758.2018.03.27.06.17.31; Tue, 27 Mar 2018 06:17:46 -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 S1752719AbeC0NQO (ORCPT + 99 others); Tue, 27 Mar 2018 09:16:14 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbeC0NQN (ORCPT ); Tue, 27 Mar 2018 09:16:13 -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 DB7B8165D; Tue, 27 Mar 2018 06:16:12 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1AEFB3F24A; Tue, 27 Mar 2018 06:16:09 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, cdall@kernel.org, marc.zyngier@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, ard.biesheuvel@linaro.org, peter.maydell@linaro.org, kristina.martsenko@arm.com, mark.rutland@arm.com, Suzuki K Poulose , Steve Capper Subject: [PATCH v2 04/17] arm64: Refactor pud_huge for reusability Date: Tue, 27 Mar 2018 14:15:14 +0100 Message-Id: <1522156531-28348-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522156531-28348-1-git-send-email-suzuki.poulose@arm.com> References: <1522156531-28348-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make pud_huge reusable for stage2 tables, independent of the stage1 levels. Cc: Steve Capper Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Christoffer Dall Signed-off-by: Suzuki K Poulose --- arch/arm64/include/asm/pgtable.h | 5 +++++ arch/arm64/mm/hugetlbpage.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 5e22503..4a16c11 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -479,6 +479,11 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) #define __raw_pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define __raw_pud_present(pud) pte_present(pud_pte(pud)) +static inline int __raw_pud_huge(pud_t pud) +{ + return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT); +} + static inline void __raw_set_pud(pud_t *pudp, pud_t pud) { WRITE_ONCE(*pudp, pud); diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index ecc6818..3f4bb43 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -35,7 +35,7 @@ int pmd_huge(pmd_t pmd) int pud_huge(pud_t pud) { #ifndef __PAGETABLE_PMD_FOLDED - return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT); + return __raw_pud_huge(pud); #else return 0; #endif -- 2.7.4