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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 447B5C433E0 for ; Thu, 4 Mar 2021 17:41:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3BFD64F1E for ; Thu, 4 Mar 2021 17:41:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3BFD64F1E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XjDzKJktl81GVg9Ic1GF2Q0T4QqGhc0QzHEeFQfTYx0=; b=YtWKUA3hsO0CDAW+gCV1zWYhJ xNruACx/es03hu4GeD6rzZKe8OgUMplSis8U2irY3ZWiJHJ2r5GoARDJGPKcJCFJHHH0a7KtXhuOl HJ9Ae1XnJeJLrjJxTEpuuUnMBJNCwGn8cJYFyChmYlrwC+nEyAEF0v106UcmiD9tz4tGQFmlseuvk uajWfsuPBmp18T1lBST5LylEOH3bgizd27mAs/WwjnztvMGklX4D5GiqCTdZfJKAVW7A78NEpOseV efbWBbkUysRcNW6DgBiB3LBQo7mlmm3lxDZguUFIJQL21mFDVeXOw+xc1xQ5HREvBnSAsv9R1axfJ hi/YskX5g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHrxH-009SXS-3h; Thu, 04 Mar 2021 17:40:07 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHrxD-009SWz-SF for linux-arm-kernel@desiato.infradead.org; Thu, 04 Mar 2021 17:40:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Vuzi+2WJGSLrAUIt165P06URWgU9gquy0m7GtjvfHmY=; b=HdXY07z3vDCutL4W+EfOWhl8Rh t+Dxx1vROVN486edSlI3daq41iNxdLj6j8kxf18o7HYyXGaaUAG/TWfkMc4A28TBTgxzVh55Ko7fp u0wqDEDmqvPTsYlq10e2EL+nelAEZN7yJHwLf3s33/J4hAsUxz1Ip0BcuxZIGjBjQ/Gyyvi3Cm2ok MIqRn+nTDgLi+XnUFQh8jE1kgN0fa+JN5Y1iMU2BHsaU0bvDQxFCAHLKwbv4OkFfYSb/GYCuahzGL Uh+O+K0jVucU3tgNVULEMyWe1p1Uz/9WZOHt57MmnPZ9QKB+PZCiX6fMe9hYvKwSxaxiWdJrXqvfH OZHqr8sQ==; Received: from foss.arm.com ([217.140.110.172]) by casper.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHrwu-0082SE-Dh for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 17:39:48 +0000 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 5578531B; Thu, 4 Mar 2021 09:39:38 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.53.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1DA073F7D7; Thu, 4 Mar 2021 09:39:36 -0800 (PST) Date: Thu, 4 Mar 2021 17:39:34 +0000 From: Mark Rutland To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, anshuman.khandual@arm.com, qperret@google.com, kernel-team@android.com Subject: Re: [PATCH 1/2] arm64: mm: add missing P4D definitions and use them consistently Message-ID: <20210304173934.GC60457@C02TD0UTHF1T.local> References: <20210304171145.12281-1-ardb@kernel.org> <20210304171145.12281-2-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210304171145.12281-2-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210304_173948_314600_C0319B14 X-CRM114-Status: GOOD ( 18.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 04, 2021 at 06:11:44PM +0100, Ard Biesheuvel wrote: > Even though level 0, 1 and 2 descriptors share the same attribute > encodings, let's be a bit more consistent about using the right one at > the right level. So add new macros for level 0/P4D definitions, and > clean up some inconsistencies involving these macros. > > Signed-off-by: Ard Biesheuvel Acked-by: Mark Rutland > --- > arch/arm64/include/asm/pgtable-hwdef.h | 9 +++++++++ > arch/arm64/mm/mmu.c | 6 +++--- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h > index 42442a0ae2ab..e64e77a345b2 100644 > --- a/arch/arm64/include/asm/pgtable-hwdef.h > +++ b/arch/arm64/include/asm/pgtable-hwdef.h > @@ -94,6 +94,15 @@ > /* > * Hardware page table definitions. > * > + * Level 0 descriptor (P4D). > + */ > +#define P4D_TYPE_TABLE (_AT(p4dval_t, 3) << 0) > +#define P4D_TABLE_BIT (_AT(p4dval_t, 1) << 1) > +#define P4D_TYPE_MASK (_AT(p4dval_t, 3) << 0) > +#define P4D_TYPE_SECT (_AT(p4dval_t, 1) << 0) > +#define P4D_SECT_RDONLY (_AT(p4dval_t, 1) << 7) /* AP[2] */ > + > +/* > * Level 1 descriptor (PUD). > */ > #define PUD_TYPE_TABLE (_AT(pudval_t, 3) << 0) > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 3802cfbdd20d..029091474042 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -309,7 +309,7 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, > phys_addr_t pud_phys; > BUG_ON(!pgtable_alloc); > pud_phys = pgtable_alloc(PUD_SHIFT); > - __p4d_populate(p4dp, pud_phys, PUD_TYPE_TABLE); > + __p4d_populate(p4dp, pud_phys, P4D_TYPE_TABLE); > p4d = READ_ONCE(*p4dp); > } > BUG_ON(p4d_bad(p4d)); > @@ -1209,11 +1209,11 @@ void __init early_fixmap_init(void) > pudp = pud_offset_kimg(p4dp, addr); > } else { > if (p4d_none(p4d)) > - __p4d_populate(p4dp, __pa_symbol(bm_pud), PUD_TYPE_TABLE); > + __p4d_populate(p4dp, __pa_symbol(bm_pud), P4D_TYPE_TABLE); > pudp = fixmap_pud(addr); > } > if (pud_none(READ_ONCE(*pudp))) > - __pud_populate(pudp, __pa_symbol(bm_pmd), PMD_TYPE_TABLE); > + __pud_populate(pudp, __pa_symbol(bm_pmd), PUD_TYPE_TABLE); > pmdp = fixmap_pmd(addr); > __pmd_populate(pmdp, __pa_symbol(bm_pte), PMD_TYPE_TABLE); > > -- > 2.20.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel