From patchwork Mon Aug 2 21:54:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12414887 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=-17.4 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, USER_AGENT_GIT autolearn=unavailable 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 529A9C4338F for ; Mon, 2 Aug 2021 22:08:52 +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 175B060EBC for ; Mon, 2 Aug 2021 22:08:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 175B060EBC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4Y6rYSc9WVCDuvVHdP/myg2sZ6vLffpS0utuOwj2BIk=; b=LUQ2TlxKaP/kYt 9DCy0dDkb/mtGaJW5Kmm39qtxl1Ik95UTkjw4IOhTZuSaJoYftyHndAjCyuZcLSbgBLhosjJVWQCc 1q3BOpOzoPNLY6yMGiS5OpL61qrHoLWnd32pLnUrI1GaIJAT1cXoN7wWB2M7Uh1F1UwJwFDGSjzTN OzdXSf4Xym80GOect9P4qZ3WPbDwF7ANU5fLvGo9HJAMsp2I0vg453r8JmNWrtf5oQez17b34O/+Y etQsOzMPewlzlA1LhOsQec7MsVYvSdoFXKQxc4+z+GJNiipyxWkASeG56o+cFcvVyUJQvl56fKso2 CeVQKYKVCLWQK6WI6RrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAg4y-000P1u-AA; Mon, 02 Aug 2021 22:06:37 +0000 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAftI-000JwX-J0 for linux-arm-kernel@lists.infradead.org; Mon, 02 Aug 2021 21:54:34 +0000 Received: by mail-qk1-x72b.google.com with SMTP id 184so18152307qkh.1 for ; Mon, 02 Aug 2021 14:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KO+UtZYDZ93vRTmLSDKEJjOCFuS9p62EhZfFf9ovch8=; b=XKau4jwWMiCZa409w4MdI2PXmAxjIEEUEVgVNb4oqyKZvs4pzBFvMRyLou4UBwv+GQ TW+EJsuAd8LEq3UppSwoLKj2w/0TeuiJe4IGEABWnYRmbKKtlk+PE10R+S+6L1hDBKmv wmIiEFWWfvfUwhttS6zbIupZGyaYZbGyF6fOYqANIalWNad/7SCqTkmdzRxrAY+gL2Jy xTv09Un0W96gj6gvwoFBxqm0z+HDNJ88BsgZIOf27WfvUy40ipC/X3AoI0U2/OAuXPXk ZDgZy1N8l724D+q4JmH6H4itZ/vmMpWrskk2LUXOqmfm+DIkDhOpU+EHXoyaGbTObG0h 2U9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KO+UtZYDZ93vRTmLSDKEJjOCFuS9p62EhZfFf9ovch8=; b=N7brWKvMQh3KYKhDx4NaKq6kyH55ti3AtDyGs62TQkKimJh9Lhg1eWKMGxJi8c5Wzi 8lnJAzKOqBtdNjZ/GLmQdOvWvz+ivtxi/FeDUd/KmxwV7krmCVPyAyELl9U22IHx9in5 791k+cuqm3C8PraX4ahxPu5ssTT+ermqThq2u/ZCHR4Zp5mMKIdYYZr/V4G5Z2jCKMXW pPcpO5WufBlHPWr7jiEnAICkzLyIJi0qs/KIOIETZUMxAXxIRMHKnHBM75mZikj5k5qw pQqs4GfZX5/NnTQZM09EwYfZBR55KQKmCV9/vS7xQlYVMaBSzO7RWcPVY3jiqLh0K5Pr VQtw== X-Gm-Message-State: AOAM5306rlkfDkP7ZfLcU9aSjpgBOdav8H4dYlY6CAc5Hko7Ec+jct6+ lzttInNw5FVglXVZYF7nCbYF0g== X-Google-Smtp-Source: ABdhPJyLFm5KeldobIkuT9ocF0wPdPlFXom0qmn5x07S4Ban/u4jSm4NOTGd+dyu0FMWOe62wYnHYw== X-Received: by 2002:a05:620a:1327:: with SMTP id p7mr17704056qkj.483.1627941271676; Mon, 02 Aug 2021 14:54:31 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id v11sm5479216qtc.0.2021.08.02.14.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 14:54:31 -0700 (PDT) From: Pavel Tatashin To: pasha.tatashin@soleen.com, jmorris@namei.org, sashal@kernel.org, ebiederm@xmission.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, corbet@lwn.net, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org, james.morse@arm.com, vladimir.murzin@arm.com, matthias.bgg@gmail.com, linux-mm@kvack.org, mark.rutland@arm.com, steve.capper@arm.com, rfontana@redhat.com, tglx@linutronix.de, selindag@gmail.com, tyhicks@linux.microsoft.com, kernelfans@gmail.com, akpm@linux-foundation.org, madvenka@linux.microsoft.com Subject: [PATCH v16 15/15] arm64: trans_pgd: remove trans_pgd_map_page() Date: Mon, 2 Aug 2021 17:54:08 -0400 Message-Id: <20210802215408.804942-16-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210802215408.804942-1-pasha.tatashin@soleen.com> References: <20210802215408.804942-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210802_145432_681685_9F76FE8F X-CRM114-Status: GOOD ( 13.78 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The intend of trans_pgd_map_page() was to map contiguous range of VA memory to the memory that is getting relocated during kexec. However, since we are now using linear map instead of contiguous range this function is not needed Suggested-by: Pingfan Liu Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/trans_pgd.h | 5 +-- arch/arm64/mm/trans_pgd.c | 57 ------------------------------ 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/arch/arm64/include/asm/trans_pgd.h b/arch/arm64/include/asm/trans_pgd.h index 411323bda7a4..c373d43c07ec 100644 --- a/arch/arm64/include/asm/trans_pgd.h +++ b/arch/arm64/include/asm/trans_pgd.h @@ -15,7 +15,7 @@ /* * trans_alloc_page * - Allocator that should return exactly one zeroed page, if this - * allocator fails, trans_pgd_create_copy() and trans_pgd_map_page() + * allocator fails, trans_pgd_create_copy() and trans_pgd_idmap_page() * return -ENOMEM error. * * trans_alloc_arg @@ -30,9 +30,6 @@ struct trans_pgd_info { int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **trans_pgd, unsigned long start, unsigned long end); -int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd, - void *page, unsigned long dst_addr, pgprot_t pgprot); - int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0, unsigned long *t0sz, void *page); diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c index a08cf313c858..b70588a42c29 100644 --- a/arch/arm64/mm/trans_pgd.c +++ b/arch/arm64/mm/trans_pgd.c @@ -217,63 +217,6 @@ int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **dst_pgdp, return rc; } -/* - * Add map entry to trans_pgd for a base-size page at PTE level. - * info: contains allocator and its argument - * trans_pgd: page table in which new map is added. - * page: page to be mapped. - * dst_addr: new VA address for the page - * pgprot: protection for the page. - * - * Returns 0 on success, and -ENOMEM on failure. - */ -int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd, - void *page, unsigned long dst_addr, pgprot_t pgprot) -{ - pgd_t *pgdp; - p4d_t *p4dp; - pud_t *pudp; - pmd_t *pmdp; - pte_t *ptep; - - pgdp = pgd_offset_pgd(trans_pgd, dst_addr); - if (pgd_none(READ_ONCE(*pgdp))) { - p4dp = trans_alloc(info); - if (!pgdp) - return -ENOMEM; - pgd_populate(NULL, pgdp, p4dp); - } - - p4dp = p4d_offset(pgdp, dst_addr); - if (p4d_none(READ_ONCE(*p4dp))) { - pudp = trans_alloc(info); - if (!pudp) - return -ENOMEM; - p4d_populate(NULL, p4dp, pudp); - } - - pudp = pud_offset(p4dp, dst_addr); - if (pud_none(READ_ONCE(*pudp))) { - pmdp = trans_alloc(info); - if (!pmdp) - return -ENOMEM; - pud_populate(NULL, pudp, pmdp); - } - - pmdp = pmd_offset(pudp, dst_addr); - if (pmd_none(READ_ONCE(*pmdp))) { - ptep = trans_alloc(info); - if (!ptep) - return -ENOMEM; - pmd_populate_kernel(NULL, pmdp, ptep); - } - - ptep = pte_offset_kernel(pmdp, dst_addr); - set_pte(ptep, pfn_pte(virt_to_pfn(page), pgprot)); - - return 0; -} - /* * The page we want to idmap may be outside the range covered by VA_BITS that * can be built using the kernel's p?d_populate() helpers. As a one off, for a