Message ID | 20210425141304.32721-7-kernelfans@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=OMFA=JW=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> 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.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_CR_TRAILER, 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 A3E48C433B4 for <linux-arm-kernel@archiver.kernel.org>; Sun, 25 Apr 2021 14:16:14 +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 2F55961364 for <linux-arm-kernel@archiver.kernel.org>; Sun, 25 Apr 2021 14:16:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F55961364 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=k5lAntggxDOIIP0GeOMhWdLIQDPIRGhgHM5ElL123XQ=; b=CqS0Lh0UxT3E+AtuyGQRyT/Tz YzVJnamisPfx2QeTXHl0wQwqVGSNPcmhQkmLAN0042qQLBPtUexJQBiQkkSMjSDKs5fuU+7wkbPFV 0SQlvSaaHImsZZnfXQ8S8i07KlyQS1gLJmKkRMoY5iXAGqWQ4v8C/NfWNhd0SXLlSDLZemfZjV3Dt 6+QvBjra45mtLEFoymj+MlMqRfwTpR0WxKqvCsYvuEYdnBNVMBi0wdDj8u6SX6aEKENUTaVo/iicU 4DoLdLimf9IDJ57Z9yCJDn4RKPP1z/0LUJsxOxep8a8D+mvgU/NoYztuCfFVu+eZloeFvtZ2TSC5X /kbywDl2A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lafX5-005iRe-6s; Sun, 25 Apr 2021 14:14:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lafWO-005iHx-96 for linux-arm-kernel@desiato.infradead.org; Sun, 25 Apr 2021 14:14:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=sfT3LasW4fyUJsDzudYiBtZnqE1vuRDuVen9QAUkGmM=; b=gm0q9VvCsTfDGCd86+cCn2kSLR U+4BwL7njVJlx4nM7lhjGU6kHxSW4Gitd3d+YFmaRnI8lgTuGY4ig2ikujg65Y0157z9EfwphMC7Q sKKcVIkfR27/YFBASuwKm8en7tfRlj3qWc4Tye2HLhS41gAc3+moX8Wx31YfOysOokcDYk6T3cGlz Eya8Y53mjIF794ztpORdgIZU8LaL4rK/bumy7CvCJ92Fat5+rzWJTPgwxFJVR/On0njmbIADyrrxA I65USYsbw5Ex3+DbpTOwjofF5uP+KPLHQX53dVkdb4vL+oumgIlT3tYSFYb2BICicfqKApBS4e8jq f+Fz5oTQ==; Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lafWL-00FT5y-Qr for linux-arm-kernel@lists.infradead.org; Sun, 25 Apr 2021 14:14:03 +0000 Received: by mail-pj1-x102f.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so3692074pjh.1 for <linux-arm-kernel@lists.infradead.org>; Sun, 25 Apr 2021 07:14:01 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=sfT3LasW4fyUJsDzudYiBtZnqE1vuRDuVen9QAUkGmM=; b=D/PCsLDdtSO2/FiUVgUXklRTWGMRztDo8W7TMjQrb9yUH74aKvmSD2Cskp6xfiFZYt vFUGPNssOZWTd37uXBK3jlieE8o6dqx9Ev3qEIqHY97E9vApas7VFUlyoBa8OeUSi9RX /2UhDrkCwNSbpx6+drctTOMjUt4OTYRH/OsqM+TPm/F/5GL5HIleKyhl03oZdVG1ZC1t Ff1p3XuwLJ/7PeEZPI9SRZL8BI/yGdtT0nBJmsmzgPc6qJVvwu88vRMLrhDEzbXcqS+3 ZXNmxYOMeEUeDCyi/hj/pJpJ0/b85aVzu/Fgwp7qTkJPsuYXlr9MzZVWAqxoX0VeuVFu SvZg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=sfT3LasW4fyUJsDzudYiBtZnqE1vuRDuVen9QAUkGmM=; b=JiZaAFvucVZsv82sc8YMp12lt9DC0OunKgk8yS04b0uToBbrmLymPDec9tBuIntEsx XtLq5JbcZ9+GqSiylvJM3rAemcuLpFNeYoM7xJ892P5m/pVpGTe3nX/vgSQ5IPixchQW DKmMn1Os58IIiMzeZCSKCmy7oOApHKjlCHo2xtuo/JneKOQ9PPBmH5TDgleaHEw3LQxH fzCLtDWp9LyC0gd1rAfiIznFxdlZ4bagFs1KCW4p9vL/tU7fdcZ8PCuyezltkjkPs4Nt HMWIY8qZJaBdfSreh5mdM9qolKxJ4XIIGlHZsiVzVhD4is/J42LvAKLEzIkjoJQXYGg+ l3TQ== X-Gm-Message-State: AOAM5328ua/1GQWWNrBIblcOTH8IneQw0ZzDKMRcUIAyRSBqmHHg41pP L9BdPaCZbbRH1/uYY7g8q3um9SS+iA== X-Google-Smtp-Source: ABdhPJzsYM+D3ue5me27kamNDaIB2/1Y3qvltf7ayBkGPuJ3EHvDMPvullKl+En8mbatCMXN52TXyg== X-Received: by 2002:a17:90a:fb97:: with SMTP id cp23mr7605004pjb.169.1619360040906; Sun, 25 Apr 2021 07:14:00 -0700 (PDT) Received: from x1pad.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id r32sm1007139pgm.49.2021.04.25.07.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Apr 2021 07:14:00 -0700 (PDT) From: Pingfan Liu <kernelfans@gmail.com> To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu <kernelfans@gmail.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>, Kristina Martsenko <kristina.martsenko@arm.com>, James Morse <james.morse@arm.com>, Steven Price <steven.price@arm.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Pavel Tatashin <pasha.tatashin@soleen.com>, Anshuman Khandual <anshuman.khandual@arm.com>, Atish Patra <atish.patra@wdc.com>, Mike Rapoport <rppt@kernel.org>, Logan Gunthorpe <logang@deltatee.com>, Mark Brown <broonie@kernel.org> Subject: [PATCHv2 06/10] arm64/mm: introduce pgtable allocator for idmap_pg_dir and init_pg_dir Date: Sun, 25 Apr 2021 22:13:00 +0800 Message-Id: <20210425141304.32721-7-kernelfans@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210425141304.32721-1-kernelfans@gmail.com> References: <20210425141304.32721-1-kernelfans@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210425_071401_890687_C330BA09 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
use __create_pgd_mapping() to implement idmap and unify codes
|
expand
|
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 520738c43874..fa1d1d4fee8f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -86,6 +86,28 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, } EXPORT_SYMBOL(phys_mem_access_prot); +struct mempool { + phys_addr_t start; + unsigned long size; + unsigned long next_idx; +}; + +struct mempool cur_pool; + +void set_cur_mempool(phys_addr_t start, unsigned long size) +{ + cur_pool.start = start; + cur_pool.size = size; + cur_pool.next_idx = 0; +} + +phys_addr_t __init head_pgtable_alloc(unsigned long unused_a, void *unused_b) +{ + unsigned long idx = cur_pool.next_idx++; + + return cur_pool.start + (idx << PAGE_SHIFT); +} + static phys_addr_t __init early_pgtable_alloc(unsigned long unused_a, void *unused_b) { phys_addr_t phys;
From the view of __create_pgd_mapping(), both idmap_pg_dir and init_pg_dir can be treated as a memory pool. Introduce an allocator working on them, so __create_pgd_mapping() can create mapping. Signed-off-by: Pingfan Liu <kernelfans@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Kristina Martsenko <kristina.martsenko@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Steven Price <steven.price@arm.com> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Pavel Tatashin <pasha.tatashin@soleen.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Atish Patra <atish.patra@wdc.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Logan Gunthorpe <logang@deltatee.com> Cc: Mark Brown <broonie@kernel.org> To: linux-arm-kernel@lists.infradead.org --- arch/arm64/mm/mmu.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)