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=-12.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 9D745C433DB for ; Wed, 10 Feb 2021 18:56:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 62A3364E32 for ; Wed, 10 Feb 2021 18:56:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62A3364E32 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=dU2U7jDiDlLDBaHKNIkvDKAPyTMqE1GReNzJhMSYc2k=; b=yWL2VM0j8EQ8JjAyEXq+pOwdiI cY/IqWsFJcLA/E4MLyqDjvBq46ijoCxWsA0itHNkOZhHdbZfmFbQQy1FXj0B6X/g1VgPhI2aZiJwh Es4bm85kw8gdHQa6vlhlRWgbd9QcQwL7cpZpzJQDkPCsrZHyeptTa57yUgcdzfdqY9ZgOyccU77Rz pe9dlzZ4MC8hXXHxoDKbBYjy/ZI3rOglLfueEOD7hMTz19Mx2NpzvbjEZg98cllqVwKKyDc1XDpSx KgIdJxohnVAGEP545oWYJRlj+L/xcBVgCbfAtLX6GOSdNJQyHp6xNU6MZ82ogxPhdHMaHvy094Dck YYQBzLQA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9ueT-0001lI-9C; Wed, 10 Feb 2021 18:55:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9ueP-0001kC-GQ for linux-arm-kernel@lists.infradead.org; Wed, 10 Feb 2021 18:55:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EAFF60C41; Wed, 10 Feb 2021 18:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612983344; bh=vTUczcxotfeZ5BhGFN7MuZ/nPy+6cBtrs/KsOl4Zxz0=; h=From:To:Cc:Subject:Date:From; b=pCWr0lCVvxAMO1xzgBXudJkwncbZtbMzxRB+3wr7HWyp/avpmuL8xXlEA8rW442PO La0Oft/v5biQ7viT4b+kllgTMhZ4qxUEe8OIRpAXaCuRfpAFHz2oscgsYubFZR1T2B TaGuvDlZ82HSN46wtKjwDfF2WBLFPtRZkuCZFVwFCqZrE7vKxcNfpg5TsC4rVYyZJ8 ZMXyn+bn/gIaO6g48BgK6WbP057yR42cxYyqtsN454Y/DQXQGgnCZ4zAjjTjsWqHwB klBFag5U7D4molxkSZHjMud1uvmxpS/91301TilEbNY7UardHf0KHRIMb6QK7p+IjV UluowV5x28MnA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/3] ARM: v7: get rid of boot time mini stack Date: Wed, 10 Feb 2021 19:55:29 +0100 Message-Id: <20210210185532.8425-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210210_135545_637663_4BBB9A3F X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , Marc Zyngier , Linus Walleij , Russell King , kernel-team@android.com, Ard Biesheuvel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The v7 boot code uses a small chunk of BSS to preserve some register contents across a call to v7_invalidate_l1 that occurs with the MMU and caches disabled. Memory accesses in such cases are tricky on v7+, given that the architecture permits some unintuitive behaviors (it is implementation defined whether accesses done with the MMU and caches off may hit in the caches). Also, cache invalidation is not safe under virtualization if the intent is to retain stores issued directly to DRAM, as the hypervisor may upgrade invalidate operations to clean+invalidate, resulting in DRAM contents to be overwritte by the dirty cachelines that we were trying to evict in the first place. So let's address this issue, by removing the need for this stack to exist in the first place: v7_invalidate_l1 can be rewritten to use fewer registers, which means fewer registers need to be preserved, and we have enough spare registers available. Patch #1 adds a missing ISB. This patch is included separately so it can be backported if desired. Patch #2 rewrites v7_invalidate_l1 so it only uses 5 registers (not counting lr which it must preserve as well) Patch #3 updates the callers to use spare registers instead of the mini stack to stash the values that need to be preserved across the calls to v7_invalidate_l1. Changes since v1: - use correct stop condition in outer loop (cc not mi) - bring back ENDPROC() in patch #3 - add Nico's ack This version of the series was build/boot tested here: https://kernelci.org/build/ardb/branch/for-kernelci/kernel/v5.11-rc7-3-gafc656039a99/ https://kernelci.org/test/job/ardb/branch/for-kernelci/kernel/v5.11-rc7-3-gafc656039a99/plan/baseline/ Cc: Marc Zyngier Cc: Russell King Cc: Linus Walleij Cc: Nicolas Pitre Ard Biesheuvel (3): ARM: cache-v7: add missing ISB after cache level selection ARM: cache-v7: refactor v7_invalidate_l1 to avoid clobbering r5/r6 ARM: cache-v7: get rid of mini-stack arch/arm/include/asm/memory.h | 15 ----- arch/arm/mm/cache-v7.S | 58 ++++++++++---------- arch/arm/mm/proc-v7.S | 39 ++++++------- 3 files changed, 47 insertions(+), 65 deletions(-) -- 2.30.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel