From patchwork Mon May 17 07:51:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261039 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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, 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 207D1C433ED for ; Mon, 17 May 2021 07:57:10 +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 98B626100B for ; Mon, 17 May 2021 07:57:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98B626100B 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:Mime-Version:Message-Id:Date: 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=/Mx3lPu7p/d6cKDh04GyLz69hun9KbSxJ5vfS/hnXoY=; b=hdAmC5pJvW1nNUvmiuETQsD6gW j4byzbTml4u7GnOxwU3QDRRIT+YMaK98GyT1lCi0mw/1omwflmM/7IItCRuyfqs9Bih+1ALbnm9vE 4cILMS1bAhlq/HMoAxQ4bWwni/4gDiOiKWVtW348QcWhOSdT5wSpvT+z8lwrGyur6adJCrJYj7fpM a1mGoWH9WTu/KEkLqBJZN16k+ImHUek2YmJn2GB2LeFsbBsfp3RnPO2G0ETzCTzxYQAXudUaBrpM1 zPrJzOm4NTAx8sOMoxBz6UZlVQwL+DcHFnoaWsest2BcpV4LKLOpituGvGkdzcU2tLG1HGB8PwblT Qk4w3xvA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY5G-00E7FE-3c; Mon, 17 May 2021 07:54:42 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2H-00E6UX-6k for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:33 +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: Mime-Version:Message-Id:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=8e9ojex140CC+MNuX1Vna3FZMibGGU0ke7yEg7q9+z0=; b=FUs0MZytjvou5HWwzWtYNCLo9X eyBWYiZo0Cn3qDSUZp8UBkYKjL80TO9GObDqPPWnDCFfmcZbsp3oqg1nGVAsgn5uC6yI9dzQCSpFs 7TwtARMGNlqfrZhqCmPG8VZ7GX2gRdrnyM86V4QRZ9jDjEH6zEGim1laerPy70uXlcjJZYf8I7iyJ xjPmyIFvvjiv3kdOu3z0l32if9AcSlBC5jM9M3KDgDK8ZvcZOQVbEM6KC2/beDPSkLHKJ9gdP0K0U uSR28Tf3dfhiSF9jvRZMB9ly55cb+SNnZ4+BtOa8AZOgAjC1rI8F8VSFGFLzfARQg8TAaAN3F+xFS +97jQVFQ==; Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2D-00DYub-Ik for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:31 +0000 Received: by mail-qt1-x84a.google.com with SMTP id d13-20020a05622a05cdb02901c2cffd946bso4689685qtb.23 for ; Mon, 17 May 2021 00:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=8e9ojex140CC+MNuX1Vna3FZMibGGU0ke7yEg7q9+z0=; b=FsK4hdYkHRy3q77dL+9nbPjpjMniy4XaOJbKqH/dJJLn7hI3QQ04/+vXVfKa/ruXPw H5siJl5cUW1crcffBB1zEc+5pbtXZthPcEsehNTtSnCuRiJUm42FMRIgAPlHnBg2x3LY HDNSxKXxDm+ooXrvBFFbNXPO/qz3teTopZHADVOPCDH5jaUAJvrqny8f/9nG+XxUXD1c zqRxz8XTU2ila7CEDE0GQE2eJ6Iqla/5/INR7WTABumqDVwqUYzILLnN+AJfyoR7oS/w kbv7pmpc5JSxqkUJaib8lfoveBE2lMvGmTTF+9n2jLeQQRkHJmBEJMO6v6Gb287Ajum7 jqFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=8e9ojex140CC+MNuX1Vna3FZMibGGU0ke7yEg7q9+z0=; b=L2KisCdKG9ISkqXaYkM9dcNUgOqofzqfjF0T+DmJLtRNBwXe3tc2kP070rN1s7oa6m tVHvsbHtjqIRBSPZ/jBVdrONKlZxmukzVKqSLCk5gxtHyaL8t+sRtH6vsm4PoWMUivU9 lHWpkvQbzWZTJP6FfhlVyddgow26pYOGxVvu7Ue26iRZFk4diHW+qTeZCVurDdOyGwSv KkSyjjDdVujSo2zqWqu8Of7YOErAKC/ywgiXs60LnJU8YBONSri0jNiAjHsGVf9mLAM+ o2A+7cM/7kkBrEv78fb1hfyO97/L9T6/6OJgj+DfFxJTlKfYC8JuSpMuj+tLJZE48SFC Y3qg== X-Gm-Message-State: AOAM53003Dy6VBA/aTk6qX1njW+B003dxl1JlsxzZ52UaZwS9pXwK50G 7cFYsj6e7bCsoHU+zsJLfkazlmh7Tn3UY6WO7eKi84yarVnQQbotwwI4+Woi1VC8+O9mUAPyQSE qgwgyUat8WA74DcrIGU1gYazetQUYPs6SnDWhH/2kWCv3kWPNg/1/tUmNn2wN47B0br2YHuCH6D mE+A== X-Google-Smtp-Source: ABdhPJzGiCp9Zu8g7qV+9aV1xOoZY19PCyjI4/VPof5U9cQuPRhddTWV0KY7uyrgJjXbtNzx56WapvPS1g== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:902:: with SMTP id dj2mr26179480qvb.11.1621237886310; Mon, 17 May 2021 00:51:26 -0700 (PDT) Date: Mon, 17 May 2021 08:51:08 +0100 Message-Id: <20210517075124.152151-1-tabba@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 00/16] Tidy up cache.S 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-20210517_005129_656761_1AFB2444 X-CRM114-Status: GOOD ( 14.17 ) 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 Hi, Changes since v1 [1]: - Apply ARM64_WORKAROUND_CLEAN_CACHE errata to swsusp_arch_suspend_exit (Mark) - Remove toggling of uaccess from the newly created cache flush (clean/invalidate) macro and leave it up to the caller (Robin) - Fix renaming of cache maintenance functions (Ard, Mark) - Fix comment on maintenance operations in machine_kexec_post_load (Ard) - Fix commit msg comments to clarify some of the changes and outline potential performance impact (Mark) - Fix code comments that refer to flush_icache_range when the intended function is __flush_icache_range As has been noted before [2], the code in cache.S isn't very tidy. Some of its functions accept address ranges by start and size, whereas others with similar names do so by start and end. This has resulted in at least one bug [3]. Moreover, invalidate_icache_range and __flush_icache_range toggle uaccess, which isn't necessary because they work on the kernel linear map [4]. This patch series attempts to fix these issues, as well as tidy up the code in general to reduce ambiguity and make it consistent with Arm terminology and with the functions' actual operations. No functional change intended in this series. However, there might be a performance impact due to the reduced number of instructions in general. This series is based on v5.13-rc1. You can find the applied series here [5]. Cheers, /fuad [1] https://lore.kernel.org/linux-arm-kernel/20210511144252.3779113-1-tabba@google.com/T/ [2] https://lore.kernel.org/linux-arch/20200511075115.GA16134@willie-the-truck/ [3] https://lore.kernel.org/linux-arch/20200510075510.987823-3-hch@lst.de/ [4] https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ [5] https://android-kvm.googlesource.com/linux/+/refs/heads/tabba/fixcache-5.13 Fuad Tabba (16): arm64: Apply errata to swsusp_arch_suspend_exit arm64: Do not enable uaccess for flush_icache_range arm64: Do not enable uaccess for invalidate_icache_range arm64: Downgrade flush_icache_range to invalidate arm64: Remove uaccess toggle from __flush_cache_range macro arm64: Move documentation of dcache_by_line_op arm64: Fix comments to refer to correct function __flush_icache_range arm64: __inval_dcache_area to take end parameter instead of size arm64: dcache_by_line_op to take end parameter instead of size arm64: __flush_dcache_area to take end parameter instead of size arm64: __clean_dcache_area_poc to take end parameter instead of size arm64: __clean_dcache_area_pop to take end parameter instead of size arm64: __clean_dcache_area_pou to take end parameter instead of size arm64: sync_icache_aliases to take end parameter instead of size arm64: Fix cache maintenance function comments arm64: Rename arm64-internal cache maintenance functions arch/arm64/include/asm/arch_gicv3.h | 3 +- arch/arm64/include/asm/assembler.h | 52 ++++----- arch/arm64/include/asm/cacheflush.h | 69 +++++++----- arch/arm64/include/asm/efi.h | 2 +- arch/arm64/include/asm/kvm_mmu.h | 7 +- arch/arm64/kernel/alternative.c | 2 +- arch/arm64/kernel/efi-entry.S | 9 +- arch/arm64/kernel/head.S | 13 +-- arch/arm64/kernel/hibernate-asm.S | 7 +- arch/arm64/kernel/hibernate.c | 20 ++-- arch/arm64/kernel/idreg-override.c | 3 +- arch/arm64/kernel/image-vars.h | 2 +- arch/arm64/kernel/insn.c | 2 +- arch/arm64/kernel/kaslr.c | 12 ++- arch/arm64/kernel/machine_kexec.c | 30 ++++-- arch/arm64/kernel/probes/uprobes.c | 2 +- arch/arm64/kernel/smp.c | 8 +- arch/arm64/kernel/smp_spin_table.c | 7 +- arch/arm64/kernel/sys_compat.c | 2 +- arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/hyp/nvhe/cache.S | 4 +- arch/arm64/kvm/hyp/nvhe/setup.c | 3 +- arch/arm64/kvm/hyp/nvhe/tlb.c | 2 +- arch/arm64/kvm/hyp/pgtable.c | 13 ++- arch/arm64/lib/uaccess_flushcache.c | 4 +- arch/arm64/mm/cache.S | 157 +++++++++++++++------------- arch/arm64/mm/flush.c | 29 ++--- 27 files changed, 267 insertions(+), 199 deletions(-) base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5