From patchwork Tue Apr 6 13:14:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 12185293 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.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,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 DD47FC43460 for ; Tue, 6 Apr 2021 13:16:37 +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 6B5F1613B8 for ; Tue, 6 Apr 2021 13:16:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B5F1613B8 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: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=KjNxwuOivxzLEbko/HA6bwHoKlKiIBjkUpVPnC9o5PI=; b=YsdGmlOWmjuwvojgNMFUnzgw6R yWoMLLf7sjQYeMPNki98i31IY2UmXoeA6GcxYzqG2F8Mjq5D1JQpGRvwDuVMvJ1HyeaqI/4qeewCP XafCwGJkIFyKFdJI0R0uBYYgC8i6L3rvZi6WpglkMMZf5K8yF16gl3toF0UxxqmDPScBxjaiO20DB aiciVm1yaX2OGSiwUrRER5Md1QKBOT2m3BCsLRhzOZtSR2fCW2IoYTCXT49rFyG/CVaiTaprJO0Ou KORrTYDq3YuvuTh0EOaGRFbK2ae9mgsKykyBpRdMCU+6soDQOU2Wfg2oySYOKuy8sb7ifA+9pkyk7 dNPpZuuQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lTlXU-002g14-P0; Tue, 06 Apr 2021 13:14:40 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lTlXR-002fzk-4z for linux-arm-kernel@lists.infradead.org; Tue, 06 Apr 2021 13:14:38 +0000 Received: by mail-pf1-x432.google.com with SMTP id i190so2133575pfc.12 for ; Tue, 06 Apr 2021 06:14:33 -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=yJLUgnCAu8n/Ve/jq38IeouPC1KrbAQkqVoO+GIC00s=; b=DqMj45zcX2BsL6nhb7foqAa4Umn0Pwm5n1aR0V1XW3WMWizQoGY8UDSlAqQD6RL+fi VW6yO/jCUplAVaJvGqtxCrQlSV4aqWRif6a/kiIASsX1qWLTeXbhYT0l6Zkg7ktnYbrL 6zyfw3JbeptHIahqJnIBuU6eSMSsVQeQEAneRiK3zI5TGK4FquuNkKiKAZdRuow3cnA2 Mh1c2cisI/wVsn/nOVE6etK4o9l5ahQBrrkXfLDMF/fdqAJjXMAusYs/haHuoL/royi6 oVD4hf5fGReGisxjcGHZ9qp3C+uWtrQdjVAtD39XkGfl9A3/oZT4Prh0b77bopOMD37v oEiQ== 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=yJLUgnCAu8n/Ve/jq38IeouPC1KrbAQkqVoO+GIC00s=; b=YRkRd8i5Qt7oAfUPTRWKDf3ghwSXnjhNk9ZZ7zhkQ87UwINukqhVda1krstvFeYxvD TvV+tXNaUKEZDpHsYCiOAHDvIb2ZybtDNI0Fb40/PExBeJqHQl0qcHc+BHL26wPz9aG0 x5dHPCrFPekHfHohfo5z7Nm3mXG5fhEQHnuYEwXXlj6l6WqUt3nxZjrWNOZnV6ndIINj cDq24p1oFAAORmr62dyQXbLiyQPI1EEqQS1lQn0OeqzfaQo11zLkQd9/qQOxXyGsHVpl QttHG6JRuQH+kCmPSnCZUczVP1iUgTOCUa3OAFz9olQmqXTEmofppGhv+PtrgUO7SvFX foJA== X-Gm-Message-State: AOAM533gpQ4QFeEGCVRoMJCGHz7nhrenZGCrjveJEkBt+ZfrI0TTw74C pIvlAWewQ5OSvHeLEB5Ep+puFOFpDw== X-Google-Smtp-Source: ABdhPJzJybfwDdO1UPE3j9zk0Cbx+BKCAkyfy4+4TsEURXuuWriUInbKUTREMDzODiC/2WwKEoZk4w== X-Received: by 2002:a63:181c:: with SMTP id y28mr27971056pgl.175.1617714872431; Tue, 06 Apr 2021 06:14:32 -0700 (PDT) Received: from x1pad.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id d24sm2586723pjw.37.2021.04.06.06.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 06:14:32 -0700 (PDT) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Catalin Marinas , Will Deacon , Pavel Tatashin , James Morse , Matthias Brugger Subject: [PATCH] arm64/mm: remove useless trans_pgd_map_page() Date: Tue, 6 Apr 2021 21:14:20 +0800 Message-Id: <20210406131420.56262-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210406_141437_289693_D67D0543 X-CRM114-Status: GOOD ( 13.36 ) 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 Since the commit 7018d467ff2d ("arm64: trans_pgd: hibernate: idmap the single page that holds the copy page routines"), trans_pgd_map_page() is useless. Signed-off-by: Pingfan Liu Cc: Catalin Marinas Cc: Will Deacon Cc: Pavel Tatashin Cc: James Morse Cc: Matthias Brugger To: linux-arm-kernel@lists.infradead.org --- 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 5d08e5adf3d5..9b6858c032a5 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 527f0a39c3da..a1d936f9559f 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