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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 BE800C47089 for ; Thu, 27 May 2021 15:05:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 644EF6128D for ; Thu, 27 May 2021 15:05:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 644EF6128D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8AC966B007E; Thu, 27 May 2021 11:05:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 831976B0080; Thu, 27 May 2021 11:05:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68AA36B0081; Thu, 27 May 2021 11:05:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 2858E6B007E for ; Thu, 27 May 2021 11:05:44 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B2C5E181AEF1F for ; Thu, 27 May 2021 15:05:43 +0000 (UTC) X-FDA: 78187335366.11.63B4DED Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by imf12.hostedemail.com (Postfix) with ESMTP id 42BD42C8 for ; Thu, 27 May 2021 15:05:32 +0000 (UTC) Received: by mail-qt1-f180.google.com with SMTP id c15so423305qte.6 for ; Thu, 27 May 2021 08:05:42 -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=I6lkOzPEa6syzQf8r+RZ8XuPpKpclGEbIUwShbrK82U=; b=TnnFfUUvHvEm/etkMIl6FavDDCjxG9hxxxgfKcLeF7n8pbKBfizh0PVGR9SMdhavpQ /qaXI18/FRxFUfElEb2Mw/gUsiyEEVcvLvMB17wq4wMBqThZ8ZW1wxboXPji+jtFXAzA dmFznHFw0mFTEWzs07I5Or3POBDkvY2Li5BAWGSV9TlzSh3tpEA7QozmVmOde0tdRNWJ Ho9DhH92QuT2QsQkhMfXBenFVxdWr5De+0nSVKKvmbALAiuom+VmBP2Ocl+xIXaospwh fhvqjPCz2kafZH+AeYAvRnXpZ979KsJEGkCMNPqV9/MZKUUhRoCgzAp927vHfgXWTBlK QONw== 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=I6lkOzPEa6syzQf8r+RZ8XuPpKpclGEbIUwShbrK82U=; b=uZqZiY3JjGKy040ZvgUeDYPfgzGdMWZDlzfM82vKD7qBAWGNXkO6+KDaQoYhCOeITm Qj9mfIewvIoOQWZCbtyYzhr+l0N1STzZ87x6aR09pd6yMXYSzI633E8ZrBkw5qLdBcm1 OPSD9p8xMfwvdK/UR2kdAf/xkfbvINDLQBA5B+qLNT/K3DLKG060X3iuqc8IT7w6jDE9 RaPjs2NNMCJkJjexiDmSPzdS20v5V3irAe43Bi3/khou3g/iHunFqWWdQ1y31ursJHeN OU2e0Xz3hdTCYWsQX/X+Cq3FHxqHeTdpf6PV4sVIf9gorWi86PxFWGc77HrTqXwVnZ6e KpsA== X-Gm-Message-State: AOAM532wz3BApBP8mhUvTA+DvTrnaDoufidxN8twfw9D/Git/ksSmVqJ t4T3czYxEFxitLlVATuq7Mwlzg== X-Google-Smtp-Source: ABdhPJyswzPAqJ6yfkg4N9Ue8mJrxUt1+TgPxwsNMw1UD8Ns1Nxidx0p88Kxuz6WsVPrCUipNJJJbg== X-Received: by 2002:ac8:5e98:: with SMTP id r24mr3491247qtx.25.1622127942481; Thu, 27 May 2021 08:05:42 -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 x10sm1447468qkh.124.2021.05.27.08.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 08:05:42 -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 09/18] arm64: kexec: Use dcache ops macros instead of open-coding Date: Thu, 27 May 2021 11:05:17 -0400 Message-Id: <20210527150526.271941-10-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527150526.271941-1-pasha.tatashin@soleen.com> References: <20210527150526.271941-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=TnnFfUUv; dmarc=none; spf=pass (imf12.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com X-Stat-Signature: 4e8qqwuwpdkajz1767jjdoto8nec1be1 X-Rspamd-Queue-Id: 42BD42C8 X-Rspamd-Server: rspam02 X-HE-Tag: 1622127932-965888 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: James Morse kexec does dcache maintenance when it re-writes all memory. Our dcache_by_line_op macro depends on reading the sanitised DminLine from memory. Kexec may have overwritten this, so open-codes the sequence. dcache_by_line_op is a whole set of macros, it uses dcache_line_size which uses read_ctr for the sanitsed DminLine. Reading the DminLine is the first thing the dcache_by_line_op does. Rename dcache_by_line_op dcache_by_myline_op and take DminLine as an argument. Kexec can now use the slightly smaller macro. This makes up-coming changes to the dcache maintenance easier on the eye. Code generated by the existing callers is unchanged. Signed-off-by: James Morse [Fixed merging issues] Signed-off-by: Pavel Tatashin --- arch/arm64/include/asm/assembler.h | 12 ++++++++---- arch/arm64/kernel/relocate_kernel.S | 13 +++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/= assembler.h index 8418c1bd8f04..f1367863d995 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -393,10 +393,9 @@ alternative_else alternative_endif .endm =20 - .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 - dcache_line_size \tmp1, \tmp2 + .macro dcache_by_myline_op op, domain, kaddr, size, linesz, tmp2 add \size, \kaddr, \size - sub \tmp2, \tmp1, #1 + sub \tmp2, \linesz, #1 bic \kaddr, \kaddr, \tmp2 9998: .ifc \op, cvau @@ -416,12 +415,17 @@ alternative_endif .endif .endif .endif - add \kaddr, \kaddr, \tmp1 + add \kaddr, \kaddr, \linesz cmp \kaddr, \size b.lo 9998b dsb \domain .endm =20 + .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 + dcache_line_size \tmp1, \tmp2 + dcache_by_myline_op \op, \domain, \kaddr, \size, \tmp1, \tmp2 + .endm + /* * Macro to perform an instruction cache maintenance for the interval * [start, end) diff --git a/arch/arm64/kernel/relocate_kernel.S b/arch/arm64/kernel/relo= cate_kernel.S index 8058fabe0a76..718037bef560 100644 --- a/arch/arm64/kernel/relocate_kernel.S +++ b/arch/arm64/kernel/relocate_kernel.S @@ -41,16 +41,9 @@ SYM_CODE_START(arm64_relocate_new_kernel) tbz x16, IND_SOURCE_BIT, .Ltest_indirection =20 /* Invalidate dest page to PoC. */ - mov x2, x13 - add x20, x2, #PAGE_SIZE - sub x1, x15, #1 - bic x2, x2, x1 -2: dc ivac, x2 - add x2, x2, x15 - cmp x2, x20 - b.lo 2b - dsb sy - + mov x2, x13 + mov x1, #PAGE_SIZE + dcache_by_myline_op ivac, sy, x2, x1, x15, x20 copy_page x13, x12, x1, x2, x3, x4, x5, x6, x7, x8 b .Lnext .Ltest_indirection: --=20 2.25.1