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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5E5FCDB474 for ; Tue, 17 Oct 2023 00:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=v7httH90cCqzYiQy6bBk5lWdWWpL4tVWkYFV4Rqdz1g=; b=ccgIYHRJDSsb61 PK1gnsd2UuNqlmqFccOPu9xktVrXf327l5XdbGXDtRGELnZQNOiOwGw/1FZiGMyJFROfkybpfZ0PG TpaHQk9Ja+cainisL5A0dKwi+sX0FFoKDsIkF+fbuqcZ5Q/k3borSgjl6lsUvNEEHrfQA8Qc2Ktz5 Yc6Ghi62Hb6IuQhd9nSR/LeRIOmYbGnxRes9YJ4fFbjUY09udWaQmlZZIPhw5TtB0RlVD5FKT+eGv 2zQedBSFdKYCJ2IQfRsitV/kBMzuF79jM20EcAucZ+UCi3g/58gfx8DXcWteSbCVgqtAzXz5QBkli WOw9Pej+1CvINxhhuXWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsYKq-00AxNT-0z; Tue, 17 Oct 2023 00:53:24 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsYKn-00AxN6-0U for linux-arm-kernel@lists.infradead.org; Tue, 17 Oct 2023 00:53:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697503997; h=from:from: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; bh=FVYfxxgypJNUOYWqlo9r89JsXo7lPpAWq0cYDAv2yF0=; b=hghKVaqwQoK1NdfjgkKwvByQgr2EoGjMtgyuv+MACeKu8rZ+QAJzz8U1gYVlQ1Wpbp81bh uGs4gCdGB0zbw2iZZwpp9fpuEKVgeug6wkI5gA4D1cWPh2n53kvBPfWgBsuMAJP7nJ0QNL O38jdYrbhygtKG5g4lftj+SnB9Z9jNk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-i2a4zPEuMQ6T_suWUDgpzw-1; Mon, 16 Oct 2023 20:53:13 -0400 X-MC-Unique: i2a4zPEuMQ6T_suWUDgpzw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA2C5185A795; Tue, 17 Oct 2023 00:53:12 +0000 (UTC) Received: from gshan.redhat.com (unknown [10.64.136.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32E1840C6F79; Tue, 17 Oct 2023 00:53:09 +0000 (UTC) From: Gavin Shan To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, ryan.roberts@arm.com, mark.rutland@arm.com, anshuman.khandual@arm.com, shan.gavin@gmail.com Subject: [PATCH] arm64: mm: Validate CONFIG_PGTABLE_LEVELS conditionally Date: Tue, 17 Oct 2023 10:53:00 +1000 Message-ID: <20231017005300.334140-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_175321_262208_CD86715B X-CRM114-Status: GOOD ( 11.44 ) 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 It's allowed for the fixmap virtual address space to span multiple PMD entries. Instead, the address space isn't allowed to span multiple PUD entries. However, PMD entries are folded to PUD and PGD entries in the following combination. In this particular case, the validation on NR_BM_PMD_TABLES should be avoided. CONFIG_ARM64_PAGE_SHIFT = 14 CONFIG_ARM64_VA_BITS_36 = y CONFIG_PGTABLE_LEVELS = 2 Signed-off-by: Gavin Shan --- arch/arm64/mm/fixmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c index c0a3301203bd..5384e5c3aeaa 100644 --- a/arch/arm64/mm/fixmap.c +++ b/arch/arm64/mm/fixmap.c @@ -18,10 +18,11 @@ #define NR_BM_PTE_TABLES \ SPAN_NR_ENTRIES(FIXADDR_TOT_START, FIXADDR_TOP, PMD_SHIFT) +#if CONFIG_PGTABLE_LEVELS > 2 #define NR_BM_PMD_TABLES \ SPAN_NR_ENTRIES(FIXADDR_TOT_START, FIXADDR_TOP, PUD_SHIFT) - static_assert(NR_BM_PMD_TABLES == 1); +#endif #define __BM_TABLE_IDX(addr, shift) \ (((addr) >> (shift)) - (FIXADDR_TOT_START >> (shift))) -- 2.41.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel