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=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 30931C4708F for ; Mon, 31 May 2021 08:48:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E349661186 for ; Mon, 31 May 2021 08:48:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E349661186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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=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=fWHWB14BeCKR/zTmABdIgwY/XV1yP+9QAVja3LxD378=; b=sJgVxQau05hsri S15i6LyTxX3xNTJxuTZOw/eHy3LT+uVIv0jHAGcsA3F3/+zlXWYImom9gB8QXUtjrwkVgO4pv8/5m aoKL6Wi2FwyYLFNURli/IeM8I8DIaU5hylJuTI4uFWK2MROW2Fp+QQauamJgiY7zE7Iv1jJpBdusi VieNoJADQT/rJvQ3Hxv53V+rU3CXrvLz6iMCT5WSu2qRmsJB5GdAGA0FyMPCavZWeDaYSPl5lI1Hr ajgvNm1xCFcaNY4idfkaS2eYoKDvk1Owa+uYv+xMCM6N/ZbVLdE6G/hEDs4h9G1DAHcFR1KguIOyZ 8WZiuGycsuahVLi0zlGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lndYs-00BW94-1b; Mon, 31 May 2021 08:46:14 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lndYi-00BW8H-As for linux-arm-kernel@lists.infradead.org; Mon, 31 May 2021 08:46:09 +0000 Received: by mail-pj1-x102e.google.com with SMTP id mq2-20020a17090b3802b0290162428291f5so3136896pjb.4 for ; Mon, 31 May 2021 01:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AbxaUTTWsu/Vlx8oHxYKp9TTKc/CIdtRLbQGA6f4CZY=; b=X13Z2mGbiSEQM/Ull4DBAcsjFTFdH4COJFenb5iVbo4kqiVcfZqZyNNceovmtugZHT 6Ih/p464C1GGozKcDnrXmfA1C84IvF3tLjiOjoJOQNasTSStuxjDJCqPH115qSSAf7XL 6PkNMoETF0bz8b26t8DdowjqMGH5CFsH89KFXJmvkOYYg0DNkld+p2D3BTvZc4cJ/8Tz mcu64WmYpUlo7sXF9rBjwy196uQ9qxEsEtq5yRv6bL6kgLAYAbzUp6wdg1ZADoYAGDBT 4G/+mHHH7zHjaX/WAtsVKNJezdZZM4ar2oPhPJplF9Ywm+humNofgEWFpisMo0nn0Nxe 1STg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AbxaUTTWsu/Vlx8oHxYKp9TTKc/CIdtRLbQGA6f4CZY=; b=KpZE9jgxLWMetNaRPEvb4YTaoITJTntQ1uDr+2gvCfX9UuLo1WaB4EsBpgvd2r8Sai L0r1WV2VfRq7CbH666k1+mkyikhOrvhTuBcYDxH3TycXQMJ+oSKNHWy/Pm2R/ZTIGIxe KzCVGbEaoAAR1Apu+IAlCTsN8JCQSlVy8eTw7w5BbuptKzyRGp1MOv+Yl/sua5hqq1Xs R8Rne1eE2Aa8cjAj8KnAGQoqdzkBq4eOLiUst2jr5rvls+bMo3Rn6rSkoGrsQMh9tco2 ZkB4i+GMSjXuVPN98130+PHtkutfR0B/zMKULTyHu20BreueDulYBdN2M/Dvl0ojg/Oc W/3w== X-Gm-Message-State: AOAM530IVwQm3nJlXfjknh6dE8VLxt+uJJ4uni094iqbMDB9KVhLgmgc sh4C9Q2GI1VJflxENJf/0EKCAz8hv8T/CwY= X-Google-Smtp-Source: ABdhPJye35/J92X6XzffHZ0NmUy0kIGTdWtfGdxxjIyycoO+j2sMxfgdQqef13jQZ1od0/pUA/LiAQ== X-Received: by 2002:a17:90b:4a91:: with SMTP id lp17mr2672293pjb.185.1622450762224; Mon, 31 May 2021 01:46:02 -0700 (PDT) Received: from qualcomm-amberwing-rep-18.khw4.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id fs24sm5125677pjb.6.2021.05.31.01.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 01:46:01 -0700 (PDT) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , Kristina Martsenko , James Morse , Steven Price , Jonathan Cameron , Pavel Tatashin , Anshuman Khandual , Atish Patra , Mike Rapoport , Logan Gunthorpe , Mark Brown Subject: [PATCHv3 0/5] use __create_pgd_mapping() to implement idmap and unify codes Date: Mon, 31 May 2021 04:45:35 -0400 Message-Id: <20210531084540.78546-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210531_014604_416613_2C84E98C X-CRM114-Status: GOOD ( 12.54 ) 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 v2 -> v3: -1. leave out the part of redefinition the CONFIG_PGTABLE_LEVEL, concentrate on sharing __create_pgd_mapping() in head.S as the first step. -2. make IDMAP_PGTABLE_LEVELS use the max value ([3/5]) rfc -> v2: more debug and test *** Goal of this series *** __create_pgd_mapping() sets up the pgtable for mapping __va(paddr) -> paddr under the MMU-on situation. Since pgtable upper level holds the paddr of the lower level, with a slight adaptation, __create_pgd_mapping() can also set up the mapping under the MMU-off situation. ([4/5]) After that, both idmap_pg_dir and init_pg_dir can be created by __create_pgd_mapping(). And the counterpart asm code can be simplified. This series can be applied against commit 4284bdf9405a ("Linux 5.13-rc2"). *** Plan for the next *** The omitted part in V2, which resorts to redefinition of CONFIG_PGTABLE_LEVEL to provides two sets of routines. One set is proper to set up a idmap which can adress total system RAM. That can simplify the asm code in head.S furtherly, also provide an create_idmap() API. *** Test *** This series can success booting with the following configuration on either Cavium ThunderX2 99xx or Qualcomm Falkor: PAGE_SIZE VA PA PGTABLE_LEVEL Qualcomm 4K 48 48 4 4K 39 48 3 16K 48 48 4 16K 47 48 3 Cavium 64K 52 52 3 64K 48 52 3 64K 42 52 2 *** History *** RFC: https://lore.kernel.org/linux-arm-kernel/20210410095654.24102-1-kernelfans@gmail.com/ V2: https://lore.kernel.org/linux-arm-kernel/20210425141304.32721-1-kernelfans@gmail.com/ Cc: Catalin Marinas Cc: Will Deacon Cc: Ard Biesheuvel Cc: Marc Zyngier Cc: Kristina Martsenko Cc: James Morse Cc: Steven Price Cc: Jonathan Cameron Cc: Pavel Tatashin Cc: Anshuman Khandual Cc: Atish Patra Cc: Mike Rapoport Cc: Logan Gunthorpe Cc: Mark Brown To: linux-arm-kernel@lists.infradead.org Pingfan Liu (5): arm64/mm: introduce pgtable allocator for idmap_pg_dir and init_pg_dir arm64/mm: disable WARN_ON() and BUG_ON() in __create_pgd_mapping() if too early arm64/mm: unconditionally set IDMAP_PGTABLE_LEVELS to max pgtable level arm64/mm: make __create_pgd_mapping() capable to handle pgtable's paddr arm64/mm: use __create_pgd_mapping() to create pgtable for idmap_pg_dir and init_pg_dir arch/arm64/include/asm/kernel-pgtable.h | 33 +++-- arch/arm64/include/asm/pgalloc.h | 9 ++ arch/arm64/kernel/head.S | 164 +++++++----------------- arch/arm64/mm/mmu.c | 108 ++++++++++++---- 4 files changed, 153 insertions(+), 161 deletions(-) -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel