From patchwork Thu May 20 12:43:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12270191 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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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 09390C433B4 for ; Thu, 20 May 2021 12:48:27 +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 7D13761163 for ; Thu, 20 May 2021 12:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D13761163 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6nh7EmmHRA/bRjOnGrwZXk2ASBd+OlyDXAuphL6K57E=; b=aWANCnXpZ8MDZu lAQAh+z+X5TYvrnOIj5ac8z++0fvI5kVL0uGyEmi1WnjclqkPMNxDszmXzIOhwJ48uJjYK/Aui3BY oq/rMYRjSz7Z1lmjlAwh4pIcDBHlnWgpphVRtzCayGTU9jeFmqMdFynvAmUNxlGBw4ullzcOr0QYy YIy+QAckB645KP6gWdKbmtouOIXpRP6hgSbsxCSrJsBBsGUVKHmsgTySi/af4jXF80jXozOEJemOC fVRxygyjzc4rQ464h10k5nCFRKn+feQ7lHOQAYdR05z39i5joS1gtZDhURKD3Ewnj3oDZnlb1NyCI UsU/vXgVSoQfJ5WC5voQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji4k-000vca-LB; Thu, 20 May 2021 12:46:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji2N-000u12-Tb for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 12:44:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EAsOuqOYSQDkzD7u/dqW8zn+FKdKohuXnegMwBwSH8Y=; b=jp8OT6ypF2kn+KjmwAaziDRRqd qxWUVsul3wekq39kShZyYQ+x+q64geuGT3csHtNUmqRNh3Cz9U2CTUWAplNGbmM7ouu3nsmY+GD0g VVX4GcQI5t1TpSk2Hvp9YXZ3ED+rojYjQlTOzCghuzHeAl3BBR2KOhb+/fuKbqASE/2HgXIx1bhiD +ZGQ6O3VR7n8ajBvWOxAa3A2+hNrCdUFjcbTave6jlOoyvorq06CuQS7vuMf3a4A8V/bim4JC6B89 XhrnB9cr4TVUYK17gpIUi1UYkDvAyApBT0zVOrDOXsrPCYhUuJOfxIlY3TL2cMwm1anUTZRgg+AEx kvG/aXqw==; Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lji2L-00GKdc-Bt for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 12:44:26 +0000 Received: by mail-qv1-xf49.google.com with SMTP id w14-20020a056214012eb02901f3a4388530so4717961qvs.17 for ; Thu, 20 May 2021 05:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EAsOuqOYSQDkzD7u/dqW8zn+FKdKohuXnegMwBwSH8Y=; b=iDPfjFAHFYMLg52cFCEGK7Ku4d34vpGZSxgF3DW/Ej7HrleVY/6JQGX3lHWVcP0OJu odfhweufwDfSrocz+hw0fcE3v4p0QYnuEPclROGUXNaeMSE8FoeA3nHCzsgJTCp+oeK8 1FRvUzlDrPW1jwDIAR5ng/J+EHYBXi9hxZcWy9EHeEOiv3oLVXmX+X14F0UAojA8YcHm wKdkNhG7OC1Fy1MFTUylarcqXjggMe2Mk7ITso4gmwZNzq0nQD2Lp4Fo4XiEYNUskByZ 3m+xivaDYj+4sNaXB3A0iVF2EtnYbG1hxlxT67lHB/+0pfNK1HMZ6pjBDQua03tR1bcD 3Jcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EAsOuqOYSQDkzD7u/dqW8zn+FKdKohuXnegMwBwSH8Y=; b=YsWMkpq3i55wB3W8pRUqMDm6WLnOuqbvWZ91WNxQEO4ESO2/wdO5rT+tjuGkGQ4bq2 c/CV1M+rj/hgUmUiQzuWwkeVmvQVkBCJqNxxoSYv7wnHK0Vfl2GA7kHMgUU9bpY3Okz4 4jn91tFAmwOE5BaA8zXUSPuLtQRmcoDAjC4bGrX12D0w1Odw05p2/+/VvW8Bp8+Reu3B uCLTGPllrt4ku4w08TvriYVsQ3GgkFTxxUaU9POGJJL9bnfdYrVtcM8TlTQXzbfUnJHu F00fUCmZPnNhklnnF+aqV3dPaFERGUMmC/mVoEUofDeQ2m388O0C4juaFxtyjtk5EYW1 o7vw== X-Gm-Message-State: AOAM532+cHNxQDwmngzQYrT+0RkVmelyroRlGyFHJkYKSByhkAzwOL2o UXcHm4LLFf0cMDbNHxCmU1XzrZZkvFSZSqFXtFCG21gFEPLzFPnYL+s1PmRLNizsckoHZkXZq8K xMPbLXcokJG89OdKlXn8uKIs/ccJDmfG14xmRQ8r1cxL2QfpXNfGCqvq8CiZNQGeG2GCvjnAMIo twXQ== X-Google-Smtp-Source: ABdhPJyJGqokOrPGq2sqsm9kMP+ARGRWJQff+XzIZn1vJSBjr63p00h3N9nClCO1ieImaiFTjpIqUW4orQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a0c:ea4a:: with SMTP id u10mr5623325qvp.8.1621514663097; Thu, 20 May 2021 05:44:23 -0700 (PDT) Date: Thu, 20 May 2021 13:43:55 +0100 In-Reply-To: <20210520124406.2731873-1-tabba@google.com> Message-Id: <20210520124406.2731873-8-tabba@google.com> Mime-Version: 1.0 References: <20210520124406.2731873-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v3 07/18] arm64: Downgrade flush_icache_range to invalidate From: Fuad Tabba To: linux-arm-kernel@lists.infradead.org Cc: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, ardb@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, robin.murphy@arm.com, tabba@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_054425_425023_3A0CC27F X-CRM114-Status: GOOD ( 12.49 ) 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 __flush_dcache_area is called right before, invalidate_icache_range is sufficient in this case. Rewrite the comment to better explain the rationale behind the cache maintenance operations used here. No functional change intended. Possible performance impact due to invalidating only the icache rather than invalidating and cleaning both caches. Reported-by: Catalin Marinas Reported-by: Will Deacon Link: https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ Signed-off-by: Fuad Tabba Acked-by: Mark Rutland Acked-by: Catalin Marinas --- arch/arm64/kernel/machine_kexec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 90a335c74442..a03944fd0cd4 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -68,10 +68,14 @@ int machine_kexec_post_load(struct kimage *kimage) kimage->arch.kern_reloc = __pa(reloc_code); kexec_image_info(kimage); - /* Flush the reloc_code in preparation for its execution. */ + /* + * For execution with the MMU off, reloc_code needs to be cleaned to the + * PoC and invalidated from the I-cache. + */ __flush_dcache_area(reloc_code, arm64_relocate_new_kernel_size); - flush_icache_range((uintptr_t)reloc_code, (uintptr_t)reloc_code + - arm64_relocate_new_kernel_size); + invalidate_icache_range((uintptr_t)reloc_code, + (uintptr_t)reloc_code + + arm64_relocate_new_kernel_size); return 0; }