From patchwork Mon May 17 07:51:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261041 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, 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 55782C433ED for ; Mon, 17 May 2021 07:57:32 +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 CF040600D4 for ; Mon, 17 May 2021 07:57:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF040600D4 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=jkku/NH5WxgSRSbFk9Q8st7tj/1tkeBJwjoO8i0mmr4=; b=KW1a0PlRkucWgR t64iOmJs9CQRG4R0BPMNUSq24ElKH8CPC9PmySoki0qkbDH+pJNmnLNCEM1uI+9rv+HiOUEz6PjOk xgdfldbw7cWtIBPgSBQFLrbJUZSiI/VccIvmOX0mxrihwwVQnrzpHRm52xcMDHmapGTUdYHdplRi+ 23pN1BEKr1QCb/ByeVAk9h7vrt+mo0DSZnnz05/UpGQbrxRxs+tP2ac/r2kE/uuvkBGI9Fo9ZBCn8 7r9wDPGLExagsfDdGfzNir2G8VSd758Ylio8CJhX5Mc7ycJhYCsqRYbel0ge5A275AhXZ+nYBAv2F AU6pB/jO0oT8yKZ/kHHQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY5s-00E7Mm-Ap; Mon, 17 May 2021 07:55:16 +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-00E6UW-6X 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: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ahqZ8V/+zcLNEI2Yj0kSxAMlF/YVwDMa5CLwXEXBovw=; b=vdZFtBHKK4fyjxSxuFsFjvpyyK +SnpoP9AGKWQnXOijEmqh5ebP9EleNTRTzG1pRCNA6TNNl4trhW1LugEL9/Y1moyIwE5cTk2odxXf 0NQ8NJ2yHhT/GFmc+HSQHqma+TUy8OjEh6XwcMLOuone8+kxfHyKn7WtBDKrUD3AC/xGoTvTkT0Mf IjwURMFfJYFTw3Mlf/xqf70kIvFozaMIfQDQKoySGwYzHpmP8JHTs6ia6/AA8mxew5xUiS/YBob0d NTrb11OZeF/0oKneMDfG2gYgb8kr2wgMolEnkFyUk8A9OJV3PAk9lUKimyIKwwr1rte0aveHOt5ud 3YHAv2WA==; 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 1liY2E-00DYuq-GY for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:31 +0000 Received: by mail-qv1-xf49.google.com with SMTP id d11-20020a0cdb0b0000b02901c0da4391d5so4124889qvk.12 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:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ahqZ8V/+zcLNEI2Yj0kSxAMlF/YVwDMa5CLwXEXBovw=; b=YZhni3RFxT6XSnxNDu6uquj+9pci//PNf5EgSqnDAwTwWfyq2GPYAYt1YR7q+AcJQ/ YgQfopQ0LqX/ZEtkVs4Fc6fCUurqH5SAib6gVIUAnkHVikByj9ReQdG/OHHHo0fVlBIb +0p+QxOuOiKkbObwS6mFECoIkMVQVnWi+YvahMfdr8OMnBM6d2gnEM1PW882fTe3KE9N 1/JdVeuxolm8v/LriuWDXKesWuBmshfjX/6LOChLsnj5zSzilDi6ACBcKJwcUtnQ2KB4 FojM1lYmxsGfQO2QA72WSU0sfBGmlTIwPgoRMQuPrci+l3XdRUvGnFg7XN7v9F5IpERd SpZQ== 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=ahqZ8V/+zcLNEI2Yj0kSxAMlF/YVwDMa5CLwXEXBovw=; b=oHXNqkiPTmJyv/lsefHM+/qVwISLN2NvR2aCSQc5cgbpWq86ItvVki9Lf5KxpEqSkE 6RzjeHT9IYfxMan/m4OEI9TVFMl1PFmtVCiyhv9eq0qlh8a9AoYOF8G6JiKyCNyW7vHK WeZn1es8JahTivfg1zJwd8oZnvfypP4CL7Z+1mruM5sACgxb+rl9PqCWOJbDDC60GJ/q MGme4VxNxtS58BCewsXGJL3FsLTxl26N4lvEhkt/knHqoJQJqSee0H05S1+Xyh8lfAlx pc0UP5+3+ct7wpjfjuzmGU9VHjJ7JdEgd6U7FiF1kHoHuZYJmi1pr/1bsiFpxOtZ6wMi 1jCA== X-Gm-Message-State: AOAM530lPFop2Q8WHFxZ/0mideQ4BBSJpCgMftG4U/vZoH82A9TcpmXM jllYhMGHkPGEsJ4nj/qD+2YZTlaI5bkH5M+WyqKyj/Lnp8ylpnIGnHGm73ecjVqzs+98W7hZEkS KRNUsoUJ44kKn9tfLY0i2Ev1EpK1p2bF2Sq4cQC4Qh6KoQ0PdRYM6vdEt3+t9LLQstmPk36aTd6 i3lg== X-Google-Smtp-Source: ABdhPJwVmSmMxjE5xReyRdkDn2kHP0guMmUdsAtzLnBRbXDyZngbkhukfI9CZWDh3D1OLzvtTh4dxKIgvw== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a0c:ea2e:: with SMTP id t14mr40031841qvp.40.1621237888113; Mon, 17 May 2021 00:51:28 -0700 (PDT) Date: Mon, 17 May 2021 08:51:09 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-2-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 01/16] arm64: Apply errata to swsusp_arch_suspend_exit 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_005130_569536_DF6C4A1D X-CRM114-Status: UNSURE ( 9.03 ) X-CRM114-Notice: Please train this message. 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 The Arm errata covered by ARM64_WORKAROUND_CLEAN_CACHE require that "dc cvau" instructions get promoted to "dc civac". Reported-by: Mark Rutland Signed-off-by: Fuad Tabba --- arch/arm64/kernel/hibernate-asm.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/hibernate-asm.S b/arch/arm64/kernel/hibernate-asm.S index 8ccca660034e..0ed2f72a6b94 100644 --- a/arch/arm64/kernel/hibernate-asm.S +++ b/arch/arm64/kernel/hibernate-asm.S @@ -91,7 +91,8 @@ SYM_CODE_START(swsusp_arch_suspend_exit) raw_dcache_line_size x2, x3 sub x3, x2, #1 bic x4, x10, x3 -2: dc cvau, x4 /* clean D line / unified line */ +2: /* clean D line / unified line */ +alternative_insn "dc cvau, x4", "dc civac, x4", ARM64_WORKAROUND_CLEAN_CACHE add x4, x4, x2 cmp x4, x1 b.lo 2b From patchwork Mon May 17 07:51:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261043 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, 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 7609BC433B4 for ; Mon, 17 May 2021 07:57:51 +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 F031C60FF0 for ; Mon, 17 May 2021 07:57:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F031C60FF0 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=zitqUcYo2BUqUVHA1lDTMVA0TZy7VH9rNjqSBZsaHI0=; b=LhRWDA7Gda8D6V /cxnEWXdLL3IKzbwkpdtsUq6kb4AbJ6uIFuIsooqqNb3emfuCYJTvgCo3YY4f9/L0u2A1uFlFm8k2 tNrHKDapmMScwrm+EgQH1OW3jdwX0Wt1cealNTiwY8zTdH6wMueoHKN0wNkbKak7DR9uKqPDVqykQ mYle/t0bTceo0VBYKmztfqA0C2jkoAqeuKSc3Wz+doeeqlobZnvpvIh5JWgs2uSZO+fePye+OlLpv mkThJGQZgLf0W684U5+kxp7PfqhMtTYeLp2t/bEgfo5YKfprRW45lccyjH4ZZtlDPs9iIpoQwlOB2 EvweqigHBRRf5GGzYjAg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY6B-00E7Qc-6M; Mon, 17 May 2021 07:55:43 +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 1liY2K-00E6Vo-Q2 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:37 +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=3fD2bGajdocFk7ES4jFUnMkgXuo5scqSJn5Icu9/qYQ=; b=r3OPoTA/cdF3j6cmG6NMTpzALa qAvQ8noH5LFcsdXKbcVfm4tzoVAKnYARI+yECLlItpKY8heKNq7Ojr8lbQ6C40c1iWWVwKc6YAHwS 4gYr99q78mQXRi9gaN7eHClS7bDsKlVWGMW8ZYkdEThChaUj6hDdEXXyhIW5QIBZ48brnwpm+F4TZ RiEPoLMlXx2Yzx1plWNfhlrjx5wp7LYjwo1L+eMkUivBPcIxM3VEQq9ATAAWlpWUmGzhK1m6AkMl2 30HVO0t/jLeTu9CxJzM0N7Qud49fPePmFhtQgweXhdWVtGzzdEdF70A1Gntlcc5276qruzorD7agt 4vlna5dw==; Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2H-00DYvL-M5 for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:35 +0000 Received: by mail-wm1-x349.google.com with SMTP id x7-20020a7bc2070000b0290149dcabfd85so1100105wmi.8 for ; Mon, 17 May 2021 00:51:31 -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=3fD2bGajdocFk7ES4jFUnMkgXuo5scqSJn5Icu9/qYQ=; b=TbMCk1vh5qr7S/gsLJewtveFG21nl+lZnuaT5mmUtWFHrhGBN8wHHzmIwoqdX/ZFFW zVbd0MWD7LaCdostNCARBa4JUsf/inmQp0xQ7Ks+7/SyQchDihTAwQUKTPD5w3rhjq55 nYgEeVqqeJdw03aLWng71m0MYhY6GYm7aeFDXUZQf3aAptUSRWr+RVPgOdzgezLfhLIn UrxeZD/4vnfzew2BTNBjQ+a+AEZr2xrRkrVObvjEMrCyrbJ/o2yZasWXjJrG0oQPMqNB dUWjI1mi+V7fatkrdiYD019eiSPh3zw5KuyrWxEqtxNNyIXkOUmSdjJ6SXZR+31SUNuL +Qfw== 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=3fD2bGajdocFk7ES4jFUnMkgXuo5scqSJn5Icu9/qYQ=; b=BalyIWEhlHdiXUK9nDb44br35bStUqm/waEObwVFMJGTCsMO81jGPZSxs7LJ27/kPY 8ZJ2Wmx/o5GyyC+mnGkeK07dzTsGHiYzmZZH5YT+ezWoPpYIJZgv7t3jSCr8lavrFJAf 5Hz7Ll3XmYGjbsSuPTRAp6NmJ8m+Lq0apN1OE7FWqGEWroF620pwAOUVfWILGKzSZgMY XhdbSuwup4C6wO4khIrByE4xfkyhcU0f8TbUEuFxSe6pQnMUtaTPmdUHBIO2+Ltuir8g 1ZJ7xW+Nf8w9QWgFoQnjXe2G53BYk4P/uZED+fVAm8KrDwA0jszlAMSErKlNuIejsWqa QaeA== X-Gm-Message-State: AOAM533uSpEvRV3e/mstF/DAxxQ8gd89UGFppXA4B0chsl+mmIff+KFq 3zsnG26eose5fI7zzMb+sRP3W6dxlOskHESRepfHsYh3qh1Nsn2YdWfjTrX5bbsMARUSTyrC83z QRxYMOugVrvspEyAwcSTf0zu4U5KTkBvnxsAEwiwee/VlFrg9KehKxbPsRgqQcHdaeGDgWoPsB3 k9Xw== X-Google-Smtp-Source: ABdhPJxuuYaV1u+hmFMMYD3uPf7jZy4GZ1A9Ac5ST2LTHC7meNBpZeBqSLWOdeAcX5/y4sj9sn0is7Rxaw== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a7b:cb0b:: with SMTP id u11mr1994821wmj.0.1621237890277; Mon, 17 May 2021 00:51:30 -0700 (PDT) Date: Mon, 17 May 2021 08:51:10 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-3-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 02/16] arm64: Do not enable uaccess for flush_icache_range 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_005133_745641_ED6F9727 X-CRM114-Status: GOOD ( 13.78 ) 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 __flush_icache_range works on the kernel linear map, and doesn't need uaccess. The existing code is a side-effect of its current implementation with __flush_cache_user_range fallthrough. Instead of fallthrough to share the code, use a common macro for the two where the caller can specify whether user-space access is needed. No functional change intended. Possible performance impact due to the reduced number of instructions. 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 --- arch/arm64/include/asm/assembler.h | 13 ++++-- arch/arm64/mm/cache.S | 64 +++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 8418c1bd8f04..6ff7a3a3b238 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -426,16 +426,21 @@ alternative_endif * Macro to perform an instruction cache maintenance for the interval * [start, end) * - * start, end: virtual addresses describing the region - * label: A label to branch to on user fault. - * Corrupts: tmp1, tmp2 + * start, end: virtual addresses describing the region + * needs_uaccess: might access user space memory + * label: label to branch to on user fault (if needs_uaccess) + * Corrupts: tmp1, tmp2 */ - .macro invalidate_icache_by_line start, end, tmp1, tmp2, label + .macro invalidate_icache_by_line start, end, tmp1, tmp2, needs_uaccess, label icache_line_size \tmp1, \tmp2 sub \tmp2, \tmp1, #1 bic \tmp2, \start, \tmp2 9997: + .if \needs_uaccess USER(\label, ic ivau, \tmp2) // invalidate I line PoU + .else + ic ivau, \tmp2 + .endif add \tmp2, \tmp2, \tmp1 cmp \tmp2, \end b.lo 9997b diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 2d881f34dd9d..092f73acdf9a 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -15,30 +15,20 @@ #include /* - * flush_icache_range(start,end) + * __flush_cache_range(start,end) [needs_uaccess] * * Ensure that the I and D caches are coherent within specified region. * This is typically used when code has been written to a memory region, * and will be executed. * - * - start - virtual start address of region - * - end - virtual end address of region + * - start - virtual start address of region + * - end - virtual end address of region + * - needs_uaccess - (macro parameter) might access user space memory */ -SYM_FUNC_START(__flush_icache_range) - /* FALLTHROUGH */ - -/* - * __flush_cache_user_range(start,end) - * - * Ensure that the I and D caches are coherent within specified region. - * This is typically used when code has been written to a memory region, - * and will be executed. - * - * - start - virtual start address of region - * - end - virtual end address of region - */ -SYM_FUNC_START(__flush_cache_user_range) +.macro __flush_cache_range, needs_uaccess + .if \needs_uaccess uaccess_ttbr0_enable x2, x3, x4 + .endif alternative_if ARM64_HAS_CACHE_IDC dsb ishst b 7f @@ -47,7 +37,11 @@ alternative_else_nop_endif sub x3, x2, #1 bic x4, x0, x3 1: + .if \needs_uaccess user_alt 9f, "dc cvau, x4", "dc civac, x4", ARM64_WORKAROUND_CLEAN_CACHE + .else +alternative_insn "dc cvau, x4", "dc civac, x4", ARM64_WORKAROUND_CLEAN_CACHE + .endif add x4, x4, x2 cmp x4, x1 b.lo 1b @@ -58,15 +52,47 @@ alternative_if ARM64_HAS_CACHE_DIC isb b 8f alternative_else_nop_endif - invalidate_icache_by_line x0, x1, x2, x3, 9f + invalidate_icache_by_line x0, x1, x2, x3, \needs_uaccess, 9f 8: mov x0, #0 1: + .if \needs_uaccess uaccess_ttbr0_disable x1, x2 + .endif ret + + .if \needs_uaccess 9: mov x0, #-EFAULT b 1b + .endif +.endm + +/* + * flush_icache_range(start,end) + * + * Ensure that the I and D caches are coherent within specified region. + * This is typically used when code has been written to a memory region, + * and will be executed. + * + * - start - virtual start address of region + * - end - virtual end address of region + */ +SYM_FUNC_START(__flush_icache_range) + __flush_cache_range needs_uaccess=0 SYM_FUNC_END(__flush_icache_range) + +/* + * __flush_cache_user_range(start,end) + * + * Ensure that the I and D caches are coherent within specified region. + * This is typically used when code has been written to a memory region, + * and will be executed. + * + * - start - virtual start address of region + * - end - virtual end address of region + */ +SYM_FUNC_START(__flush_cache_user_range) + __flush_cache_range needs_uaccess=1 SYM_FUNC_END(__flush_cache_user_range) /* @@ -86,7 +112,7 @@ alternative_else_nop_endif uaccess_ttbr0_enable x2, x3, x4 - invalidate_icache_by_line x0, x1, x2, x3, 2f + invalidate_icache_by_line x0, x1, x2, x3, 1, 2f mov x0, xzr 1: uaccess_ttbr0_disable x1, x2 From patchwork Mon May 17 07:51:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261045 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, 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 03784C433B4 for ; Mon, 17 May 2021 07:58:15 +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 8A4BB6105A for ; Mon, 17 May 2021 07:58:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A4BB6105A 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=csCSEZg3nNpxVHQootQitty8n/tDBYlG1yLqJH5QDTo=; b=JDYR3x4tyENiME d7Ow5c3ayba1/CXAE4hDUvaH85Kq1M9piNMlX0cymSvL3cBrrn+7dImox56d8PACzwcIEjLNNAonH XiDH+f8XgeccULBXFYRjZ280E5F/XUm8c36uySzHfrVuc9bBL+PHXeBuxx/PGMA9KEzkqgo9Aw+u9 py4ny/0bX2hQvoHChYe3eP1q/GhBGdBbzl6ILxaXMWjchHKNfLHXbPqmkfx3GguYVj+fEJG2m7hto 5FQ98KAd8WaFQhSq1fATX9q5dzjzPMifYwhgdxkoFZMHuvuFlW+V9LQj9QJdPQnUt4bn/ij/+Z2Ae QMte4eSV+KDxkQ+MnxVQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY6g-00E7X0-0b; Mon, 17 May 2021 07:56:14 +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 1liY2L-00E6Vv-3J for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:37 +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=8HMUlQnknAGRv+aVeWsuUhGmLLc5sNeLJkto1xUPVU8=; b=uXQzRugvR6suLWQ4/gmYzBLKJ5 mnrb/aQYNu1LHX9FgPFTcD8GRLxDePkRDiiY5ZpqWzqhJtDvRAngiNg6jHi4jwQd1ooXQ9Hrl173u Dq603P0eoX4ywa7F6R1cL6zQhdQDFCfDzHDJ228We1WFazF2ER5b2kpx3nwHeETfqj/1WPtUDQHcu O+VyC1AfrfskSxSRB1wC3J3vBItRRgS1DZHPMUYUk1g/8ji8YKvsNsi9UclatE1dGVT5/J+v5yvaZ UCxpxF9z9wL1jgpFgcBwPKqI9levp6RuTz+6kIFBIdh0rGoUNaU8ZPKy/kNiiLxcojA1ECW4XcWEN W6CgEhxg==; 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 1liY2I-00DYvk-84 for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:35 +0000 Received: by mail-qv1-xf49.google.com with SMTP id b24-20020a0cb3d80000b02901e78b82d74aso4096946qvf.20 for ; Mon, 17 May 2021 00:51:33 -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=8HMUlQnknAGRv+aVeWsuUhGmLLc5sNeLJkto1xUPVU8=; b=IxHYezeVwj8W2gFACbMemJr5LIoOshTBg9CWmNEFxH4PVU3RoIcmGNVRzZd+q8O32v 3f3zfeD69qcnkwcferYmA2FSnHRl59bs/3ACNTnXfRIU0Tr0kDT4ksiF9E47BIuHSzB0 FLIa4vK9udBh0vOkBRGsnrmAnw7IxnDEv4Q40ktQb4LMv6lOMI6u1eRtGRjlLmOEaO+A 2OELnWRZkfldprSqjN2DY4wBRGekQ2eREXn3ejKp1bGACZ5apA4rQ4e9b1TyiQbYl5cW 1K9qyvV/U287HCyXBrQ01nWtV9P6wub7PRleZCkZK5cH/w+IYk021f3SwKtsrTmbAej5 Jxeg== 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=8HMUlQnknAGRv+aVeWsuUhGmLLc5sNeLJkto1xUPVU8=; b=SkjlfTBZL0WuRT0tyGS6p4fVGlzFGoNr3kKA8iSl+SGHST7dI9qQ0f0y5mm1/pTiSI YEJNffXH/3V6lW6H+iUrxwQa2/1Q4q5OwA3p9TEDQw0lghKXW9pss2PvXnbo2LsLlFT+ kALkiqAD9HAphBjFmvApUCkK1Wa79HhJPKPCZAhpSn65Efrxw5lkhH3IfeBvufFJJyLS rreUMh63ASPer9Npq/gHI/v7tL60MpTNy0B3endzITQfZh+ylDRmDijLUEypKMtHZ/M0 0jQm+mMP8ul/iem7sCFO5ut49wCbmfOUTIFS+O2YaUkcq0qkfO6PcCrduIhqKpxzSmOP 8hmA== X-Gm-Message-State: AOAM532ETJv+GOH6C7ve7zXmMRuX/ulWkAiSnkkDb5huFHFjwDh+anA0 ftRH++2+YS2Q1rcdZHwGFa8DXIfT3PQ0ppYISza14ida+EwtJCofzrcEkuTf2x4ygB+qQRYZlTD pd4oQquprn447pVO/Dy2+Cdl1wzX44dZy0ILk2Wf+phOVGXOb+iNhtVDNCT1QVH2AeY2etixVxc SDqQ== X-Google-Smtp-Source: ABdhPJw9Miml3Sp88RILmMacZSAnL7ONyHh1mXGTbPQQCP3tFxiEB3tdFdOmK11T27JKsKrUVnsR/DGiYg== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:18d:: with SMTP id q13mr59343060qvr.60.1621237892619; Mon, 17 May 2021 00:51:32 -0700 (PDT) Date: Mon, 17 May 2021 08:51:11 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-4-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 03/16] arm64: Do not enable uaccess for invalidate_icache_range 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_005134_306329_7286C514 X-CRM114-Status: GOOD ( 12.37 ) 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 invalidate_icache_range() works on the kernel linear map, and doesn't need uaccess. Remove the code that toggles uaccess_ttbr0_enable, as well as the code that emits an entry into the exception table (via the macro invalidate_icache_by_line). Changes return type of invalidate_icache_range() from int (which used to indicate a fault) to void, since it doesn't need uaccess and won't fault. Note that return value was never checked by any of the callers. No functional change intended. Possible performance impact due to the reduced number of instructions. 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 --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/mm/cache.S | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 52e5c1623224..a586afa84172 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -57,7 +57,7 @@ * - size - region size */ extern void __flush_icache_range(unsigned long start, unsigned long end); -extern int invalidate_icache_range(unsigned long start, unsigned long end); +extern void invalidate_icache_range(unsigned long start, unsigned long end); extern void __flush_dcache_area(void *addr, size_t len); extern void __inval_dcache_area(void *addr, size_t len); extern void __clean_dcache_area_poc(void *addr, size_t len); diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 092f73acdf9a..6babaaf34f17 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -105,21 +105,12 @@ SYM_FUNC_END(__flush_cache_user_range) */ SYM_FUNC_START(invalidate_icache_range) alternative_if ARM64_HAS_CACHE_DIC - mov x0, xzr isb ret alternative_else_nop_endif - uaccess_ttbr0_enable x2, x3, x4 - - invalidate_icache_by_line x0, x1, x2, x3, 1, 2f - mov x0, xzr -1: - uaccess_ttbr0_disable x1, x2 + invalidate_icache_by_line x0, x1, x2, x3, 0, 0f ret -2: - mov x0, #-EFAULT - b 1b SYM_FUNC_END(invalidate_icache_range) /* From patchwork Mon May 17 07:51:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261047 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, 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 0F5E0C433ED for ; Mon, 17 May 2021 07:58:40 +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 81F726105A for ; Mon, 17 May 2021 07:58:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81F726105A 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=RyORI1oTa+87FpzkbUB7NG5knHIqGcv2+Mqm+2O5//o=; b=ZRHR75gC5Yn2dL 5w0ks8KQcu+aTSafYCOUfNRMoh9SotLgR60hJJdWnf3lIaKHjx8HLUO7kp+hrwEnliw/Xg8m5opSN UMh9p4G21fzF0xH0lHgjF2Mf6Ex6kqTtcAZBdCXCKbSVJY10AXuseCwl5oE5OMiQyG8ULbo4auQdl nDe/Egq63Rv3CVd6AIej/lHE1hTlF1c/XGlacF8xa590UbocLt5efJs3Mfhw8NmBYxXudtlSfmBnc X9VTOVqFwvs9e/L37RS99hAmmgqYgGOf3O6q8AlGsw7gW2lQWRLbklHBxX3AQUNrYfkrXw3pCRgkd Ii30m3hRjZ90BKoX527Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY7E-00E7eN-CS; Mon, 17 May 2021 07:56:44 +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 1liY2N-00E6X2-SO for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:40 +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=SbbNH0PC72XgGxWwdZdmmhNjeb6bnuUCdjTicxW0r8w=; b=wEMMk40+XDew4u0xxw5vMTLvdz tyWnYxz/wg8XFRSklmDuuRgRypw/XF8QLTg6TuqJsyXBG7EiIth7NQfKhUIgHTcvrJ0snwu9zwD82 8tC2CIQZ3Dx269rhm0YS92mpm+fKGVnR2cSTCggBsZSYf6PI7si+fjiHonzoZWhwvA2qfgX6BCdgt hNky0SWiXpKdkOxv0dnlEMr1wI2JL7J8IF9tMNY19WITk3uAAfWmNzqbJ8PkcDOL+ZW0lnVIKFFjK tFx952JqWpbPaH0CH04xnapR9oXzyH0ZHDiStPvprS2LNvWxI2cHamrqjlFLpB5IYHlKlCufhp9uW nhmLM8Yg==; Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2L-00DYwH-6w for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:38 +0000 Received: by mail-wr1-x44a.google.com with SMTP id d12-20020adfc3cc0000b029011166e2f1a7so2503451wrg.19 for ; Mon, 17 May 2021 00:51:35 -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=SbbNH0PC72XgGxWwdZdmmhNjeb6bnuUCdjTicxW0r8w=; b=ST1rZrDERwxml4qWbn2rkPSMUcW+hYtwJZoWnpyhvlHOj+DGMCRWQFN1/QoH1cOjzs n/IYQez6vNQwiBjsaOVkAYurgO+w8y3BJwUco9JutPeqVhskMqWJyepbhoiG0bqr7RLn YbOmxnkrMbrregWqvCVeDQo2PD2hjRDoJw5N/MbGMCcbdWUToZbHCyv3F1J0dG1lUrxT eFUa+mUT44cpQ0LLPZ2xunjjZhPCfmaQaf9tVi1cMBtYTKbUV1WZOi0EPXg6jtfVQSw7 3/CbVxK0AOnEo1NH8ZkawvFbHWrzRk4E3tMlwX7SEwKCGwQaILeVx+Osz5VwDjef+Ihq EpMA== 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=SbbNH0PC72XgGxWwdZdmmhNjeb6bnuUCdjTicxW0r8w=; b=ODr1EWyIsU6BVDo5UIKjNeli6ry9aR7MkZuiyVK6UUvdobzqjAJJgALKKCo5w3sDsd nO8Zai0oT89//ipkwbAXEomxZ83pklodvp03uPsWR/Vv1tRxWFSVDT8TZkEBgTPKL7hE sfbNKcjzN7gxq4lTnmX23bOtwcjq5lzTdDjIv6UbmQpD+UmxPuIGsubOGoEDEAoiOqkJ rR/FZ6VNiX6mbrm0gEN3qnk16w86AQvmvuD+znVAsiMb/yHjNSvFdxPrcjkGrR4/sbYx aDeNIpo/tG+SNA58wYo/EtTtqgN6dsxq8pA6Wqxm/u46ym+taa97p8+GC4hkVNARAdVW AMSA== X-Gm-Message-State: AOAM532GtQ3UUnQgubH5sr1oOasVARNiwNU79FpYURyZCTsN7HycIVop GyQAmrpG3t7Tb5hJyWPNgUJaQVfdp5XYMYpnHfDLJscRRxmlqbnK2+0XKZMp1BsYx+cVE8AIa65 CrGhtw8WnosGtdH5IWta1KxB2LmjDQsdbdu2KexUv3DuOz82fisryqYFZJNnCW8SuKJKXoX2ULt fkgw== X-Google-Smtp-Source: ABdhPJy5MhLyqSEgOxXilo6PJ+9dOwVIPC1FZwiNvr8UBQ5r4MUEoOaZBV8IQVVWRHv/SCc+Ro/dB65fGg== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6000:2c2:: with SMTP id o2mr39716332wry.398.1621237894771; Mon, 17 May 2021 00:51:34 -0700 (PDT) Date: Mon, 17 May 2021 08:51:12 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-5-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 04/16] 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-20210517_005137_271934_CEB414EF X-CRM114-Status: GOOD ( 11.99 ) 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 --- 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..ecd8915e02e1 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 and I-cache on, 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; } From patchwork Mon May 17 07:51:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261049 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, 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 4B7F3C43460 for ; Mon, 17 May 2021 07:59:15 +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 D66B76105A for ; Mon, 17 May 2021 07:59:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D66B76105A 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=YOe1Fy1yE9s5NTc/3iJq36v/Um1plAPfyh50UJxe74Y=; b=TBPhbNmoy8fWbM jPHaEuZQvMbolXcCg9QyMPHmOIRW8ITCOcslZ69NC1Vc6ZA8GscFdTiptD0g/2kK2eyVYXMvIzsLU SVoqERivhaB8V86M8i4LTHNpfoWIf+t/o58h1CT8xo7x0TiZJO38SSJvmk8nAVj98zppf0dr0JMyf qCDAiCdTdqaqbHag9znYtMHmGbQRfUSon8Oa2yrme/gMOgzWaY0b7CprvXPwWJGxviXIRJUjZnv/Y XJZbXLIcOM4nxZtNH8QlAcvA6GxjOz8fOqOs68Xx8zq5KimpQenb3E19Lgrbhsr6ctSCSs4dd3qRW wiNv4A94vyt8Qr+fAjog==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY7n-00E7mO-EM; Mon, 17 May 2021 07:57:21 +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 1liY2P-00E6Xu-QX for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:41 +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=C9s07ZFSU6Iz8OXT01veCpRVIEgdS9WmWKM99th16f4=; b=o0anNCb0xlO/YYFzbltnaN+OgK LtKKRw5Rbfypilu7sgnlAaMDPzZZB/J5yTnbNSiwGg684X9Tzu+6MQR3nNXC+m/dp3bdibzgvJWdZ mKZr77Hyy6MFZAHxItbDvujDRSXGmAz8WaFe6sZWZRpQs4/cl6+PJq5FWo2/tVskpInYu3vGimlvq wvYgO25QNsDvCjYH2FH9fC/x/sZ+msqaBjrYZ8GcYQkL1IkVJ6oWQQmxECvgekIc260KTM5Zf8a+K HRpx49L097K564Wrh4OhJ2rWkd2UiruZWEW+wN8dCrKqwOOLb9/Dhk80sexYYESUcnFBywC3m5Q65 EqWqTmpQ==; Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2N-00DYwl-6C for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:40 +0000 Received: by mail-qk1-x74a.google.com with SMTP id n142-20020a3727940000b02902fa8eadfa9eso4185199qkn.7 for ; Mon, 17 May 2021 00:51:37 -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=C9s07ZFSU6Iz8OXT01veCpRVIEgdS9WmWKM99th16f4=; b=GDjcdatW9PrKhnGr9FQguP4GJBAXbbtqdJMmiYeUN5bI4uXX86NaghUO2E7Hnla924 dMuY1IxgKnPoPtA23T5V3xKciGwmmuTeMQfBg8Z8IsrnqYomzQLtsd17Qv/0nG9zZaoM Wt69xXFFymGeesJUvEjt4NDRz037G3hQJtXgow4aWXyV/FUU78GBX5No3K8JQUrkVb3g qEfqEh4giMlEovh8byZ0+mC/zt5EKU7UCozOUdDF+JkzSlWeMnK0qzUHPW6Lgw8uDnRo OWQL0Kg9oXJxg0ERhX8wkCTTQRUHQjxFRtf5Mebu0biP+UdJ0dQItSx8HyghcC9wIOPS hTlw== 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=C9s07ZFSU6Iz8OXT01veCpRVIEgdS9WmWKM99th16f4=; b=N9s7gzY2r4gvlq/3uKd6bHjyceSCTW9Mv/VP1RFWtEaHambNklwlRMMlTw9Zbe+LJJ EJDFccCK1OZPeNo5NpLwFPcmSfCclQVq5UDSFTiJGpwbNJ9l3byKhUkDWuyLtqczD7dM Zad4X25GljveH0QSeomtiIS1TxH8tYQmB7M6+g5hdxe7rO8xqUbOFOggYMlciTkZFPTd MiEYRjCskV40+H/ZWXEg7NNzh9lAcIR6bGPHjJzBUyAzGWQuasH2buJfHoIzEJ2ZAqNY qwvo3G9EF4815LbCvvYi+tbZyX+S8/zpJDY10fUTXcUcmr9N35IKpuTnCA98RbeyjJ2m +WwA== X-Gm-Message-State: AOAM532sIVfw5euYHPhspLr/5va9vKd7jc11TTyQNpGdEjMq2OLGd/1G WpH8nNx/WszgKGbGR8Gp6XflcCbrSYqPWwjEAjwsXDU8HTkgaIHkZcHvCZLK29/Wt5gP1FB0EWC c+TFrDbWuBvi/WHrKoFUjDqGdeS14dt8P0GkBd0FQvG0g920LOqggVBodeSipGgErDcxq52qWv7 edPQ== X-Google-Smtp-Source: ABdhPJyPD3ygDOSDCVJm8iczxHJ5dpDxACXMwiJ5Qih5OMMFmCgofWLBGs5Dv7rZ05rH+6rilZ8H9U654Q== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:851:: with SMTP id dg17mr58818565qvb.56.1621237896650; Mon, 17 May 2021 00:51:36 -0700 (PDT) Date: Mon, 17 May 2021 08:51:13 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-6-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 05/16] arm64: Remove uaccess toggle from __flush_cache_range macro 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_005139_245944_4FF44D26 X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. 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 The uaccess toggle isn't part of the cache maintenance operation. Move it directly to where it's needed. No functional change intended. Signed-off-by: Fuad Tabba --- arch/arm64/mm/cache.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 6babaaf34f17..d74b20cd6449 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -26,9 +26,6 @@ * - needs_uaccess - (macro parameter) might access user space memory */ .macro __flush_cache_range, needs_uaccess - .if \needs_uaccess - uaccess_ttbr0_enable x2, x3, x4 - .endif alternative_if ARM64_HAS_CACHE_IDC dsb ishst b 7f @@ -55,9 +52,6 @@ alternative_else_nop_endif invalidate_icache_by_line x0, x1, x2, x3, \needs_uaccess, 9f 8: mov x0, #0 1: - .if \needs_uaccess - uaccess_ttbr0_disable x1, x2 - .endif ret .if \needs_uaccess @@ -92,7 +86,9 @@ SYM_FUNC_END(__flush_icache_range) * - end - virtual end address of region */ SYM_FUNC_START(__flush_cache_user_range) + uaccess_ttbr0_enable x2, x3, x4 __flush_cache_range needs_uaccess=1 + uaccess_ttbr0_disable x1, x2 SYM_FUNC_END(__flush_cache_user_range) /* From patchwork Mon May 17 07:51:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261051 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, 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 0C49CC43460 for ; Mon, 17 May 2021 07:59:55 +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 98E1A61209 for ; Mon, 17 May 2021 07:59:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98E1A61209 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=CXhi4lzPuXmvRYQfwVk4309bnGF41hksGbwEngGPmz8=; b=pCqSUhj2GHiS21 L4flrTZtIXKSlJDdVkI8MbLkRwG2/kJ0N7pHgFgi1gT8lhD2vJVZUy4ZU0bHoAyO5EEYXbu/b4wrc f81PehSd7VTDDMkhwanlR7dxCr9QyVhGAy9uKHMRih0byaVZpQg4+3UsLBjaCkpv16kYow821rwWu QvJ60Wxjr7PKJsbFrN3HmLOeYR/TPUkFqWOsiq6m4lGQNTOm79JeV6822NSMd2F8g/gwbSERmzLC/ aFDUH+lWVZhsIPnwWkEf194y1yAcqyOCVT/tx+AMUU8lbCWMow2zQGH1y2FaxOP5+LXoMIQWd237N N8I0IKbLSi/X0nx4H6VA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY8U-00E7yZ-QD; Mon, 17 May 2021 07:58:01 +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 1liY2S-00E6aB-Cz for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:44 +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=GGoPLHDONIt+FatAKZW3+YCjiZQxlf9ftdwwMILI57c=; b=m5nXttI6xw7YOSvRd6pz+6muqi 9dYDC9F1DX0FEFqGJrfRjFnKu+lh8eQ7IqJ6tiNzDCrrg4l3uHdxCe1VHTCzyfHENDFB2yuzner+j MtPJ4Qtcc3mKzeUFOPlwUHkxNaYBvyxZJTHX1+VEnLKxju7CyoJ7cD+1ryQzJ3g3l025l9/ascxI4 5e6iR7B/hAPuKlZxz5V2BnXHs6m8hEX7RkNvQQOl0KSxOyNrggP/p/Ll4kWqQWL1HDpJYKF8ZPoCw GaZGXWYWx1IsSty24NftuVLjQFqBZ0lBwC4qTCreChKbCe/XBo0wmKB/3rbE9nmvNVILA55UYuuwG yQNrkCLA==; Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2P-00DYxL-Ra for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:43 +0000 Received: by mail-wr1-x449.google.com with SMTP id j33-20020adf91240000b029010e4009d2ffso3469483wrj.0 for ; Mon, 17 May 2021 00:51:40 -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=GGoPLHDONIt+FatAKZW3+YCjiZQxlf9ftdwwMILI57c=; b=M7tmJ7U1f8M7BxV1KyTpRyvlwwNaPlJYSWGjZgprvoWqPpFYIOiaLmbcEewtf/GjaG aymj0yscKVkgysHgFCh5L+HRf84jEqdXjBRxNaXq20yMyCxcwf3OcP5nDKvdnjgNMCpr ODc59rpWIkEjuY4OIc2QRC6m6te1o+H5MxFn3G00SgOHrnidEQ+oXkm/bgvYO84aW3kp CFbBSThRN95PkcTHi821nwvi1BXRo/FnLHAtPInC/I7u3W3yOpYfevQeSw5Fl1oEGWHK I5gWTSoezBYJYkacdN5TFiOGn1LbEKVEaw1BiXK8VIuICVOhoUnkfbzZ51GNTuL7/YCE i10Q== 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=GGoPLHDONIt+FatAKZW3+YCjiZQxlf9ftdwwMILI57c=; b=OI9csfHC781atYP4yftQxjNZgOKH2h7IjDfdNcx7PtOsTkT5k4NmuL813C5tkmyMfv yQCBhG5Ya0PLg2j469kA8fkZXlEjK53WtyJixXZJfsHx7Ps4ugfV0QXkNzXn1P44uhyD LAZdtFhH/3t7/Jbt4NEXbQy16GeTvuk2QqL8LPTXl88FbCJqgz3USZwppSJ4/SEvndfE dDoZb0uOnhoDUOjzgHOj74UArTBTX4atmH581Vlx4gv9LzKVcJ1YFXzdlYdUShpkeqc3 NMbs8SDKSF44tur/W3nQt4LeNu0fomszyyzoOgoKbskb2HqyjhHi7XKKX6GtfGLSzG3K cEkg== X-Gm-Message-State: AOAM530EsMjfLzZh1BM84QGnKAq1t5Y4Wul2GrQeKmLasF7uaWNmkm+w /aNhq499NOcD6w0ThbwEyyprBekc13zO1NGHGWq272Yi1qVuZN4l9+9/MFjBg1uQMkyjsR1Yfz5 bwyPszMDsgGwJeCtGP95XlxBkiZ6UdZeOtwmkfvdDqhVBGqc6efEmxyZN35CaVa5b5U6emejJly Fx6A== X-Google-Smtp-Source: ABdhPJwd2Uv2LjASOIkVaNHztEHIHgrSu29f2kCojee28++/mvIv0GI+h365kLNVX4/AC+YaOEa/M7LBOg== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a1c:1bcc:: with SMTP id b195mr6032377wmb.51.1621237899017; Mon, 17 May 2021 00:51:39 -0700 (PDT) Date: Mon, 17 May 2021 08:51:14 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-7-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 06/16] arm64: Move documentation of dcache_by_line_op 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_005141_910342_4611F7A1 X-CRM114-Status: GOOD ( 10.92 ) 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 The comment describing the macro dcache_by_line_op is placed right before the previous macro of the one it describes, which is a bit confusing. Move it to the macro it describes (dcache_by_line_op). No functional change intended. Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/assembler.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 6ff7a3a3b238..2bcfc5fdfafd 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -375,6 +375,14 @@ alternative_cb_end bfi \tcr, \tmp0, \pos, #3 .endm + .macro __dcache_op_workaround_clean_cache, op, kaddr +alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE + dc \op, \kaddr +alternative_else + dc civac, \kaddr +alternative_endif + .endm + /* * Macro to perform a data cache maintenance for the interval * [kaddr, kaddr + size) @@ -385,14 +393,6 @@ alternative_cb_end * size: size of the region * Corrupts: kaddr, size, tmp1, tmp2 */ - .macro __dcache_op_workaround_clean_cache, op, kaddr -alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE - dc \op, \kaddr -alternative_else - dc civac, \kaddr -alternative_endif - .endm - .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 dcache_line_size \tmp1, \tmp2 add \size, \kaddr, \size From patchwork Mon May 17 07:51:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261111 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, 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 288ABC433ED for ; Mon, 17 May 2021 08:02:25 +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 A259F61042 for ; Mon, 17 May 2021 08:02:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A259F61042 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=mnAG/d3g1plZfVPJVFHylf41zHSVE/g7xvTr8Xog2XQ=; b=Y9i5CsEL+c3TDD VbAni2Y/Tspc3aNrsWcKiiXQHWzH8EnPsFioKj6rI0W9oDXvBCGgGQ3ZjoL7SAahSzWA6fh7lZTXr azHZFINTvPDzhBdlPK8fY2SqdCo0po4PBb7yN3xrP6zB6TgPbIxWp+uOdOsxCrKXi7Q98AXpBmrVk FNydMWrPUHUM0nzy7smyj0td0kr5hcEtlJIlKt8D4IgvbcFNhUc08LIsQ59AtxXPr0dRvzvj2cB9C GITOMQXEDyzPK1NdyZ3TxNUKF0rAkJDRPwUUnC3rBpgKW93rlSRDaUgAcTTcR/FGV+dHE7QnhWYHv wrhZ164C+Q6nHxeBN71w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY9l-00E8L0-9g; Mon, 17 May 2021 07:59:17 +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 1liY2T-00E6ad-To for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:48 +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=UJHYkW0MvunaERrdBTTu1PDg1xaSNMbRKq8zDn80HL0=; b=p6QN7wbzh1RbDz2h+P58SNEEVE hJiJVf6gNlGh9JjtSqCbnGgxAz5YB283RnHH9K8EgzksI6xWDtuEULZg1/PnN0MQcOy+HMZdbKo1N zJglf0iqe7HdcJdYySC3lgvN3vqJALq7a2DmhNIr5MQjLMCFQebxc/LlGLWyfX9MxPayBF1LYJrB2 SjJ+qDh4TrqAQwaTb4J3uHEMLRWUfaHJJ/VlfLuXkmkKImbnBG5TKfVUOGMgd0GzeS69F19kwFYpc K6AOPP6VcRlXxHDGavrAxW7gyTDRC1lZJnn9HS6LWosaAvPiBNqJ2P8GNl/N9B8UXuJseIOG1h2Ha V2qyxlXQ==; Received: from mail-qk1-x749.google.com ([2607:f8b0:4864:20::749]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2R-00DYxO-7p for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:44 +0000 Received: by mail-qk1-x749.google.com with SMTP id v1-20020a05620a1221b02902ea88445e01so4179468qkj.9 for ; Mon, 17 May 2021 00:51:41 -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=UJHYkW0MvunaERrdBTTu1PDg1xaSNMbRKq8zDn80HL0=; b=hC9k8xznliIcnCZjDzrhJ3HuMToNqM3KbCSkuGbmIc+P/f2UpcubFmyzsdZiN9XVBF zYkt2gAShz1cdRV4wxRosd/D7tLWc69vT/1V2aV+lLHVaGixnMLQCOrec4WjPPPx8IS7 ED0glmYJRy/eDP4Ca6LZf2/2gQunCft9LMzpeJEeoMr+JF4qa9dCzq2wzkzS/fnPlF/Z CCb0EF3+F8CqIKoOACkvJP8LJ1APRorPSZgnLmP701dz732JgD3vmWfQm1nj/aKwlZAL j3X6VEzDYAKZ4Ogh6IYK/LBf9dqWXdXN5nlC/InNtNMfSWIPNNCsXZ0f/fNi0IjknYeY 1jOg== 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=UJHYkW0MvunaERrdBTTu1PDg1xaSNMbRKq8zDn80HL0=; b=EGpQfZnfpwcxDV8C+CXUFoXiVIlxtOOgCWPmKeAMR4NJRQJpnZKkI+kpOCb+yKBsfF GJGmfvsVkrKWStz1qXBNzPT+IcosZZqbFwiqtMEojOe8/F6UMVUhY9lOpyqljoUdtuub hn6ml/nTYjlyB/Kva1K486+RupA8PKCApwwo19xEqpo9T79AWyawRXnnoNZC7jcEXpDo Gm1tqpLr12NQJyefe5iLcfJtwILBI6UbnJvH28zChVh/oWDQPQhk8G70SASRTrqAXzPr jS2F0r0PNcUxxBOPegXU9PZ1bj/b/DxpqA+eGuXL/PR8NfNjccxFGtQGazMOad7NvEIu IT5g== X-Gm-Message-State: AOAM530ACOIZ3SZhEc3QCaZg6gKmkymJ5pzQG4wzxX84tvGbJBoWwdsD 1pAwjuqboPOi1/Xfw+vT/2MLYrHvw3UrtlKsFry8ZiGea3421lKQY660msnSZxvVaA4Yq8kZlC0 Um1Wc4kW8UfzdM29CopnqTDkq/F9bBBMGLL77E1KWFI9udjGKc8o9B/nwdh+kwiBmFitphBILww YyJg== X-Google-Smtp-Source: ABdhPJzdC3cJL8p49MW1FaEf4oucNPeOxTt1vWrE0SX08hJwuBsl3rX0R49n+Ad0R4uuNpdk3NnfykoRuw== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:ad4:5c63:: with SMTP id i3mr57738114qvh.36.1621237900961; Mon, 17 May 2021 00:51:40 -0700 (PDT) Date: Mon, 17 May 2021 08:51:15 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-8-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 07/16] arm64: Fix comments to refer to correct function __flush_icache_range 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_005143_299447_493C9143 X-CRM114-Status: GOOD ( 17.79 ) 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 Many comments refer to the function flush_icache_range, where the intent is in fact __flush_icache_range. Fix these comments to refer to the intended function. No functional change intended. Signed-off-by: Fuad Tabba Acked-by: Mark Rutland --- arch/arm64/kernel/hibernate-asm.S | 4 ++-- arch/arm64/mm/cache.S | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/hibernate-asm.S b/arch/arm64/kernel/hibernate-asm.S index 0ed2f72a6b94..ef2ab7caf815 100644 --- a/arch/arm64/kernel/hibernate-asm.S +++ b/arch/arm64/kernel/hibernate-asm.S @@ -45,7 +45,7 @@ * Because this code has to be copied to a 'safe' page, it can't call out to * other functions by PC-relative address. Also remember that it may be * mid-way through over-writing other functions. For this reason it contains - * code from flush_icache_range() and uses the copy_page() macro. + * code from __flush_icache_range() and uses the copy_page() macro. * * This 'safe' page is mapped via ttbr0, and executed from there. This function * switches to a copy of the linear map in ttbr1, performs the restore, then @@ -87,7 +87,7 @@ SYM_CODE_START(swsusp_arch_suspend_exit) copy_page x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 add x1, x10, #PAGE_SIZE - /* Clean the copied page to PoU - based on flush_icache_range() */ + /* Clean the copied page to PoU - based on __flush_icache_range() */ raw_dcache_line_size x2, x3 sub x3, x2, #1 bic x4, x10, x3 diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index d74b20cd6449..8920f63442ae 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -62,7 +62,7 @@ alternative_else_nop_endif .endm /* - * flush_icache_range(start,end) + * __flush_icache_range(start,end) * * Ensure that the I and D caches are coherent within specified region. * This is typically used when code has been written to a memory region, From patchwork Mon May 17 07:51:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261053 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, 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 37CE1C433ED for ; Mon, 17 May 2021 08:00:54 +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 C081D6105A for ; Mon, 17 May 2021 08:00:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C081D6105A 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=GuQDQds4U4yJ/GAQIZFBaIvsvOhweknjHx3Vclg5OB4=; b=WFk3UPQeJmdItV REMFlYh9+uxhJR4waOtu453jTYn/bJLlqDvKAMuuNm45bv0HxN5jRjSF5DetWlAbrggfU6r+lYws8 4oi5zA89BOJH9ePtBakICnuyCYWez1aiYa0qY7S+Y6stWyYQnI2WQv98vQvkQbcruQDZzvtnTRQd0 vmatFZIUm45RuhZWaOMFuvMcn2UIpxf7ccYMS/qhUmZB/440Ikgew/VuuWUOvRRq34+3HuaXq4zbl +u7n/K7Eyfuxz2LfHbOR6XeB+RUJtRw8gTW+KLyIvFbv8CeggPDeeLipH08DlBJpflQoWp4ug71Md nmypOudC8EkwSZjLPhRQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liY96-00E8Ax-Hn; Mon, 17 May 2021 07:58:37 +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 1liY2V-00E6bA-85 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:48 +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=WgG8oLNHR/e9+66xlT0prY/sIvRwJ26HMdS+WlaPdwI=; b=2iZ8jjHZ+sT82zrkCnQa5T9Awk /2JbJbkZpHMMZOgHk4QsOoLi0Uao3+0czITf0lQn+081PGjuAtYGi/OyISd5ZIO9TWsmsWiHF0lp8 2Xrv7zbzgfNrwp/39nlUtDoyvxy5SGctSQ3wv362/8dSjB+Z1pzxwwG5lM5MgZt2wI+i7Z0CxHeK7 UCcXginVKp2ztnifDBDeUyLfb8KHI5Wv9+IAH1nKXDqyVy+GycL0xynYlBPH7nsXLMNriVv1jQrkW ml8/5IcdXSbWmm2ZuNnjQpEPd7abKmQuH/yrbt+1gaSRvHXTGpeM20Rp+8L4z3W8N9Fo6AMuvzfpl h+2a1hiw==; Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2S-00DYxt-IL for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:46 +0000 Received: by mail-qk1-x74a.google.com with SMTP id c126-20020ae9ed840000b02903a5090d4944so2077795qkg.15 for ; Mon, 17 May 2021 00:51:43 -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=WgG8oLNHR/e9+66xlT0prY/sIvRwJ26HMdS+WlaPdwI=; b=WaD9itOeTyxZINciNVLf2IVakUMfGMIa/n2Nw6SapMX/cMRtLVlgzwlTDTuJpcZaBy MvhExyEvV1ZlTZYBR+VMxamy+QPfwOyhrKnBgZlHGU3/zaEGOgCp/LnUf5guZaMZVizw YozbQG0WDHlVrTvcWFSHbY3PWOteIlKssggtdm6ymOhDJOOvJCkAI94MAw/36Sy32al9 A5QwHvJLJ9ph8ByyERPYignoMdR+OnMG3IGJd7oO/G6sOTlw1rLnbwDe5xvRJwOMK/xk eVZFnEbGD6TBnAlkhxqDWIHPBmt9c12u1Z+jPff9p6OmF4NDadLaB4PlIQtLHDhyvWiq S6rQ== 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=WgG8oLNHR/e9+66xlT0prY/sIvRwJ26HMdS+WlaPdwI=; b=YzzX6wtbVgResFlQlhbqSJViU3Y4Z6HDf7j7ngjEhyeAFLKUiVPtS3RalD+SIu900/ jh56G+6dZ+s63e7jmjP4k2cEvMxqAhtAdvvThD65WBSY08T1DeQTyN80/jeKGriOqhND dwTX+flKBk6u2dqyqTxk6DA4HI6R6WMoqDBi5CRL0lEUlsnm2GEsdnoNa5EZAeVCiRP8 WspYi345K7JQvXzI52fKYYawgR94TRmL7zBJzTHVEi2BeJ+wLbBiFYIaUBgdURVUhsFY CTsI9d8ljiqgl5pE70AvMHDn9tbI/SJDWpKyhoV2emQhHXWDyd9FQXRlm7gNminhafMi 1mjg== X-Gm-Message-State: AOAM532A47qsCegKuq9PMTX6Numh0IsTjHB9glN+m1UoHTlvQtfiKb5P OBAnbuZkexiSGUua82UooER6Lx4AIcSaJAuwWPNWKXQWIXj9w+SfccX2hSwS34suDYsmxo3AKxP tSEothEk696QgjuNli87qc61+b063ELns6cHhcLrvVVrAUc7LmXU0pfq6fEmt92H872a2QG5UDs toUQ== X-Google-Smtp-Source: ABdhPJxb7wDiT8XRTGCU85mrSRRKl1NkIq5woJdIbE1Se8Vfz/H2myeYiNBeangbHcBsrurUOD+Ho2NDwQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a0c:f5cd:: with SMTP id q13mr58756175qvm.41.1621237902919; Mon, 17 May 2021 00:51:42 -0700 (PDT) Date: Mon, 17 May 2021 08:51:16 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-9-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 08/16] arm64: __inval_dcache_area to take end parameter instead of size 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_005144_633446_EA2D1B60 X-CRM114-Status: GOOD ( 14.69 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. Because the code is shared with __dma_inv_area, it changes the parameters for that as well. However, __dma_inv_area is local to cache.S, so no other users are affected. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/kernel/head.S | 5 +---- arch/arm64/mm/cache.S | 16 +++++++++------- arch/arm64/mm/flush.c | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index a586afa84172..157234706817 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -59,7 +59,7 @@ extern void __flush_icache_range(unsigned long start, unsigned long end); extern void invalidate_icache_range(unsigned long start, unsigned long end); extern void __flush_dcache_area(void *addr, size_t len); -extern void __inval_dcache_area(void *addr, size_t len); +extern void __inval_dcache_area(unsigned long start, unsigned long end); extern void __clean_dcache_area_poc(void *addr, size_t len); extern void __clean_dcache_area_pop(void *addr, size_t len); extern void __clean_dcache_area_pou(void *addr, size_t len); diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 96873dfa67fd..8df0ac8d9123 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -117,7 +117,7 @@ SYM_CODE_START_LOCAL(preserve_boot_args) dmb sy // needed before dc ivac with // MMU off - mov x1, #0x20 // 4 x 8 bytes + add x1, x0, #0x20 // 4 x 8 bytes b __inval_dcache_area // tail call SYM_CODE_END(preserve_boot_args) @@ -268,7 +268,6 @@ SYM_FUNC_START_LOCAL(__create_page_tables) */ adrp x0, init_pg_dir adrp x1, init_pg_end - sub x1, x1, x0 bl __inval_dcache_area /* @@ -382,12 +381,10 @@ SYM_FUNC_START_LOCAL(__create_page_tables) adrp x0, idmap_pg_dir adrp x1, idmap_pg_end - sub x1, x1, x0 bl __inval_dcache_area adrp x0, init_pg_dir adrp x1, init_pg_end - sub x1, x1, x0 bl __inval_dcache_area ret x28 diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 8920f63442ae..16660cbc45bf 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -142,25 +142,24 @@ alternative_else_nop_endif SYM_FUNC_END(__clean_dcache_area_pou) /* - * __inval_dcache_area(kaddr, size) + * __inval_dcache_area(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are invalidated. Any partial lines at the ends of the interval are * also cleaned to PoC to prevent data loss. * - * - kaddr - kernel address - * - size - size in question + * - start - kernel start address of region + * - end - kernel end address of region */ SYM_FUNC_START_LOCAL(__dma_inv_area) SYM_FUNC_START_PI(__inval_dcache_area) /* FALLTHROUGH */ /* - * __dma_inv_area(start, size) + * __dma_inv_area(start, end) * - start - virtual start address of region - * - size - size in question + * - end - virtual end address of region */ - add x1, x1, x0 dcache_line_size x2, x3 sub x3, x2, #1 tst x1, x3 // end cache line aligned? @@ -241,8 +240,10 @@ SYM_FUNC_END_PI(__dma_flush_area) * - dir - DMA direction */ SYM_FUNC_START_PI(__dma_map_area) + add x1, x0, x1 cmp w2, #DMA_FROM_DEVICE b.eq __dma_inv_area + sub x1, x1, x0 b __dma_clean_area SYM_FUNC_END_PI(__dma_map_area) @@ -253,6 +254,7 @@ SYM_FUNC_END_PI(__dma_map_area) * - dir - DMA direction */ SYM_FUNC_START_PI(__dma_unmap_area) + add x1, x0, x1 cmp w2, #DMA_TO_DEVICE b.ne __dma_inv_area ret diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index ac485163a4a7..4e3505c2bea6 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -88,7 +88,7 @@ EXPORT_SYMBOL_GPL(arch_wb_cache_pmem); void arch_invalidate_pmem(void *addr, size_t size) { - __inval_dcache_area(addr, size); + __inval_dcache_area((unsigned long)addr, (unsigned long)addr + size); } EXPORT_SYMBOL_GPL(arch_invalidate_pmem); #endif From patchwork Mon May 17 07:51:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261113 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, 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 1B51BC433ED for ; Mon, 17 May 2021 08:02:32 +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 A05A361042 for ; Mon, 17 May 2021 08:02:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A05A361042 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=FYKT845bRw4NtJ4B5RHWpSerfL4nBEFaJOj9+/YXobE=; b=pYG6xbRc60iVpR 5ayICrhgf90FP7/0J/6pid3B3p1xmiYDYs9K5aeIKhmKFSvPSRazgudyoKVZcQsHk32nQ/QUspZp0 wJkhp8QcPXJW1Gkqi1Qx4OecLDgRBOAUZLgVg6ImDKUhtd2ZsMbtgtwN8CBj3s+C790Zr23x4dhim NcwQipjte1/vytHqeD7fozYlf9l/uZ7H5XpCMfpJQdoOlmG00nseb4cfOALITHnVG5cl5GMfhMHD3 WFhEhPWlmNdSjgSUd9ya5Tqa4IZKYPGwUxTDP7VgFsPQkOCmNhDbw0kUl3exCGmpldNB72OOBqW1x CiSeK3G2Zt8az2vR3k4g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYAZ-00E8YY-3X; Mon, 17 May 2021 08:00:07 +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 1liY2Y-00E6cK-E5 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:50 +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=MnU53tpHz5any654e99iA4zDaSVL5BGmFnuo1gKdrgc=; b=mFtnvr26zdpqost163MIwCvD+8 oduvmvPswcuPoM12lDvAGrvn/3/aK03EK2c/30A2UUdY5ieOSD6naHBsNK4XaFBTfKVYx/lMzUSYy 1vjaVuci1zoLYKrflTQBEC41Vli5fKiMwax83APIHcJ4OqqhdF5+0USNLaqUstvU6BzzX8fnxPi/Y yBmsWoZS8EA5hciifNt9wa/dXHutKMkB+SGMK3n6p97lCcfqpA/kC2b0GG0ZKu1r+dgh5CRfHeLsd pNikFjJqbrRYqCuglNYJzhQbbM9BKRo+sYR8+uJZaTD/Ia0hqem72BVKsSRl1GfCZS1wTs9xTVWpC WAuAv+7Q==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2V-00DYyB-Mx for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:49 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id p140-20020a25d8920000b0290508c3296a35so6542682ybg.8 for ; Mon, 17 May 2021 00:51:45 -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=MnU53tpHz5any654e99iA4zDaSVL5BGmFnuo1gKdrgc=; b=AWapNUzNktWmnDkzLZNf56WPDBXF0U+LD8fq8gXnhyTFrrc3Y1vh40Rx2/sTbbU0AK ugYdfxa1ripe0Z8ZuQuWPaGcaZ1Dwf2H/6tfRMOo8cglip8OWjvLq9vmZg+2IwJLAq/q s9NdV/9kg4wrlRZMl9SjZKPqpAHYJHXzbkky4UKtLvc+nIE47LoGjkejAacbkymvrJ2n jvgpaVDdjGxet9ypL1TC5JvbRu97VMm1DaI/ihLiNE4xzwk4ysbrVRvwjW3v/CB/wap1 NANaEUsDi3RoeDLe/eO9q3N+jCmXTRvSLpPkCMNHaSKWLK5Adb3RPuSh8lt4I6yqSxLH MdlQ== 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=MnU53tpHz5any654e99iA4zDaSVL5BGmFnuo1gKdrgc=; b=oJzPN8/4k1QG50YeCknLbV7Gf6hIrRifsxcRcUAeNiRe+FI9Sc0SQv98LC451Zk6wu TCB2fqXVmA4uVS7GH7jTaabUNWBjyN4bIgerou3asXc1TGVkE1Z0SZWZrl7qPTetWaBt Jp+4twJr2S9ec/lpmcoNJiC8xAF+XrGixWIFuj+c5Z1Xp6TNZm/Lq5iF/2XWtyTUvZJe bMndYem+H+YAM3Zr4eCf9aroq1CCUfvDek8EyHHC5k69r7J+T4tE9HbPBO0Xn0Z7tmg9 18R/WEGN5eXLujfEV4WADOr80YrOL9kPupa1szZJfBExlwPL+COVI53rjR5KYXIZifOS 3tGw== X-Gm-Message-State: AOAM530u4kl2R8DOvJ7MG5eIzZj8fI+egH/vOQe2pQu7itb5twDGJNvB KkdTvBhzzkLDsSJiOx4ez+1Brk6yp54OUxWVfmpDoTct5KXAZbnBFt95uzZXocgEB8G9uNt0KVY 46Mpczb/TWIMkeCkMt6wd4ToXgldTdrdqXKmifNjf4NdMLeoj7Ve9pl4hfTu6/hYbdd3KEZdS05 EQog== X-Google-Smtp-Source: ABdhPJxBl5uE3ZwFv7h6YR/emNSaCp+kiG1eVvuS0COIoT+UtIv9roUAWTqyTjXmw/CqouvRrY/aYhLsgQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a25:84d1:: with SMTP id x17mr41782079ybm.127.1621237905106; Mon, 17 May 2021 00:51:45 -0700 (PDT) Date: Mon, 17 May 2021 08:51:17 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-10-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 09/16] arm64: dcache_by_line_op to take end parameter instead of size 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_005147_771023_D092904D X-CRM114-Status: GOOD ( 12.51 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/assembler.h | 27 +++++++++++++-------------- arch/arm64/kvm/hyp/nvhe/cache.S | 1 + arch/arm64/mm/cache.S | 5 +++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 2bcfc5fdfafd..3f75a600e6c0 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -385,39 +385,38 @@ alternative_endif /* * Macro to perform a data cache maintenance for the interval - * [kaddr, kaddr + size) + * [start, end) * * op: operation passed to dc instruction * domain: domain used in dsb instruciton - * kaddr: starting virtual address of the region - * size: size of the region - * Corrupts: kaddr, size, tmp1, tmp2 + * start: starting virtual address of the region + * end: end virtual address of the region + * Corrupts: start, end, tmp1, tmp2 */ - .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 + .macro dcache_by_line_op op, domain, start, end, tmp1, tmp2 dcache_line_size \tmp1, \tmp2 - add \size, \kaddr, \size sub \tmp2, \tmp1, #1 - bic \kaddr, \kaddr, \tmp2 + bic \start, \start, \tmp2 9998: .ifc \op, cvau - __dcache_op_workaround_clean_cache \op, \kaddr + __dcache_op_workaround_clean_cache \op, \start .else .ifc \op, cvac - __dcache_op_workaround_clean_cache \op, \kaddr + __dcache_op_workaround_clean_cache \op, \start .else .ifc \op, cvap - sys 3, c7, c12, 1, \kaddr // dc cvap + sys 3, c7, c12, 1, \start // dc cvap .else .ifc \op, cvadp - sys 3, c7, c13, 1, \kaddr // dc cvadp + sys 3, c7, c13, 1, \start // dc cvadp .else - dc \op, \kaddr + dc \op, \start .endif .endif .endif .endif - add \kaddr, \kaddr, \tmp1 - cmp \kaddr, \size + add \start, \start, \tmp1 + cmp \start, \end b.lo 9998b dsb \domain .endm diff --git a/arch/arm64/kvm/hyp/nvhe/cache.S b/arch/arm64/kvm/hyp/nvhe/cache.S index 36cef6915428..3bcfa3cac46f 100644 --- a/arch/arm64/kvm/hyp/nvhe/cache.S +++ b/arch/arm64/kvm/hyp/nvhe/cache.S @@ -8,6 +8,7 @@ #include SYM_FUNC_START_PI(__flush_dcache_area) + add x1, x0, x1 dcache_by_line_op civac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__flush_dcache_area) diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 16660cbc45bf..b599c334a2e8 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -119,6 +119,7 @@ SYM_FUNC_END(invalidate_icache_range) * - size - size in question */ SYM_FUNC_START_PI(__flush_dcache_area) + add x1, x0, x1 dcache_by_line_op civac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__flush_dcache_area) @@ -137,6 +138,7 @@ alternative_if ARM64_HAS_CACHE_IDC dsb ishst ret alternative_else_nop_endif + add x1, x0, x1 dcache_by_line_op cvau, ish, x0, x1, x2, x3 ret SYM_FUNC_END(__clean_dcache_area_pou) @@ -198,6 +200,7 @@ SYM_FUNC_START_PI(__clean_dcache_area_poc) * - start - virtual start address of region * - size - size in question */ + add x1, x0, x1 dcache_by_line_op cvac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__clean_dcache_area_poc) @@ -216,6 +219,7 @@ SYM_FUNC_START_PI(__clean_dcache_area_pop) alternative_if_not ARM64_HAS_DCPOP b __clean_dcache_area_poc alternative_else_nop_endif + add x1, x0, x1 dcache_by_line_op cvap, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__clean_dcache_area_pop) @@ -229,6 +233,7 @@ SYM_FUNC_END_PI(__clean_dcache_area_pop) * - size - size in question */ SYM_FUNC_START_PI(__dma_flush_area) + add x1, x0, x1 dcache_by_line_op civac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__dma_flush_area) From patchwork Mon May 17 07:51:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261115 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, 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 B2403C433B4 for ; Mon, 17 May 2021 08:03:36 +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 3EE1C61042 for ; Mon, 17 May 2021 08:03:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EE1C61042 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=SfEANqPJYfdWSEkmOATMZskWUqMavTvtr05rth3JB7Y=; b=YDWhojXMHg159Z ep+fB9yVUJVwmyxVEMD4VF29Lufs8EgNUpAvMZeXklvRTMdH9I+X3ma/o3vjxLKaNV8/z24A48/aW ViOdXshUJutTITF8AAqG/AX0aZgpUYPVkrIg7rsnOmwh4u0AeUScML90GC+Y3djJofqfrlPOijFeH KURCWJYSArlzfVvQxLR5Yy2CwCqj5TUz9u9VSkpOlotPBgeX6eutDBYEqWekXdVNP6sdiPtI3FLTu 01yb9KPo4LlNgv8VP7oZTBIp3MKOkkTzlyRmR03247AaLQBc0sl50AIYw/vggopcTGZSiZdT/Zjox dmS34SCXFKHEecE5R4yQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYB2-00E8gb-Th; Mon, 17 May 2021 08:00:43 +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 1liY2a-00E6dC-IA for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:52 +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=6ay/TMkeFehwr+6BYo2evrpCOGm9ntEArdREr71AtnE=; b=dE5llft4lJqf1r7ii9gj6VLSbq xnd1y3+fGBE4jOk73aVQEMDp90DenEocEeXcZpkprToge3GWrLYmoSDAwvAbMQwFL0DuVMT1++Iqg 1Td8VI4UkZfoE/f353iRw9bGi20lHDiF0HzUOsH42UvLPtYUVv1Kgaba7paQFv0cLyRVH4PV5wGTZ DDk+rtweuejOMvIJF7TmiMDs4XLt7I8xTHIERRepBU88PzkfM0c1KJbSTBcqtUsA0pQil8AZFfHbJ W9+s0A9o0RF8mLof7fLuhbImsLWsbasQ5rijiv+ZUPiKUsJPJD0bqnb/WIKYXut1CQTXZ1uoyNNyX tgfsklRg==; 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 1liY2W-00DYyH-Sp for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:51 +0000 Received: by mail-qt1-x84a.google.com with SMTP id j12-20020ac8550c0000b02901dae492d1f2so4772475qtq.0 for ; Mon, 17 May 2021 00:51:47 -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=6ay/TMkeFehwr+6BYo2evrpCOGm9ntEArdREr71AtnE=; b=Nm3xUFdhabG41bpFbjuM1Fugeo4e5lRp8bR48ppxirVUxY2JNmR/TU5g4kjq01PuEo 8eerd8UsP9NiI819l+R5eiPvoe+frJhNaglkozc840n5GzfrkGnnuQxp96vucm5CKMPK uIEpCCYTOOOgXxGXVhRzz3izGSLhMeY2ryHJH9RhAyAvns0ULAAPtdgjSZovlm7NNebh jjozmY1n6ABlKFWcbuop5lQpaMF4g5EpG+KrieRiQLqwc6WdUv+eneh9xpvflzTTf8uD on8HnYOqjYCIscdvMxYrJ6AZItem401irSnpFNY6pknrdrUqyOJLTUOHz2syrNKowlZW f2NA== 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=6ay/TMkeFehwr+6BYo2evrpCOGm9ntEArdREr71AtnE=; b=FjF+z6sGj2kJBK2Aq3do6n6zogyxduhZS96xsL+Zo3aGoFEC+GjlRFW9n0NHuag/8d 0h3r+cTO2IJ0zOzKUsn5x5k4CoYoqk7LoJEY342zt1lppd5EkDWYIQEN0B+Qea4+TYrP fNYWhmZa3Ymq7rISJOSV2/PPNCM07yn6w+DNNIbCID2rPxVP8RDXZFy/DaJ03BKHsaa+ 4hvfx6bbihtd/gbRyEslsTu+3weC3a/6Hsnkc4v4zYZZhbLJAAuE3rXQbyI5apKgziUj yoVcqyeETIld8VAEcUGABlbuBeHnrAI8O08VjX2gdtWAppOIMpYalH4tuRyk0ULOG0ke tnWw== X-Gm-Message-State: AOAM530Tgerz3zQ8vYTN3tcXJtZgNGZodU9FpLFOIeSUbwNWBqUfUuiz BPJtizYouwA4RPZ7/19i+dvoaL9PVywh4xXEXlMKor0AaYvjo+jrMTiSGOgNSoj2BK+X6gHfL6S s4aHFKFSTwoG+NKBQ/iCUbjpAwanGq5PaAhCITigrBqOeImfy4t+fxvOxqu2/r/LuD/LeO4TBhS cjZw== X-Google-Smtp-Source: ABdhPJzD3E1br034H4rnfZAESWAVkkd2isY84bKSvBU10dssxwi9unmnqid7nHvklNqkn4QwWWl257/hqA== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:c6c:: with SMTP id t12mr6191493qvj.34.1621237907300; Mon, 17 May 2021 00:51:47 -0700 (PDT) Date: Mon, 17 May 2021 08:51:18 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-11-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 10/16] arm64: __flush_dcache_area to take end parameter instead of size 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_005148_963762_B46ACD73 X-CRM114-Status: GOOD ( 23.21 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/arch_gicv3.h | 3 ++- arch/arm64/include/asm/cacheflush.h | 8 ++++---- arch/arm64/include/asm/efi.h | 2 +- arch/arm64/include/asm/kvm_mmu.h | 3 ++- arch/arm64/kernel/hibernate.c | 18 +++++++++++------- arch/arm64/kernel/idreg-override.c | 3 ++- arch/arm64/kernel/kaslr.c | 12 +++++++++--- arch/arm64/kernel/machine_kexec.c | 20 +++++++++++++------- arch/arm64/kernel/smp.c | 8 ++++++-- arch/arm64/kernel/smp_spin_table.c | 7 ++++--- arch/arm64/kvm/hyp/nvhe/cache.S | 1 - arch/arm64/kvm/hyp/nvhe/setup.c | 3 ++- arch/arm64/kvm/hyp/pgtable.c | 13 ++++++++++--- arch/arm64/mm/cache.S | 9 ++++----- 14 files changed, 70 insertions(+), 40 deletions(-) diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h index 934b9be582d2..ed1cc9d8e6df 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -124,7 +124,8 @@ static inline u32 gic_read_rpr(void) #define gic_read_lpir(c) readq_relaxed(c) #define gic_write_lpir(v, c) writeq_relaxed(v, c) -#define gic_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) +#define gic_flush_dcache_to_poc(a,l) \ + __flush_dcache_area((unsigned long)(a), (unsigned long)(a)+(l)) #define gits_read_baser(c) readq_relaxed(c) #define gits_write_baser(v, c) writeq_relaxed(v, c) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 157234706817..695f88864784 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -50,15 +50,15 @@ * - start - virtual start address * - end - virtual end address * - * __flush_dcache_area(kaddr, size) + * __flush_dcache_area(start, end) * * Ensure that the data held in page is written back. - * - kaddr - page address - * - size - region size + * - start - virtual start address + * - end - virtual end address */ extern void __flush_icache_range(unsigned long start, unsigned long end); extern void invalidate_icache_range(unsigned long start, unsigned long end); -extern void __flush_dcache_area(void *addr, size_t len); +extern void __flush_dcache_area(unsigned long start, unsigned long end); extern void __inval_dcache_area(unsigned long start, unsigned long end); extern void __clean_dcache_area_poc(void *addr, size_t len); extern void __clean_dcache_area_pop(void *addr, size_t len); diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 3578aba9c608..0ae2397076fd 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -137,7 +137,7 @@ void efi_virtmap_unload(void); static inline void efi_capsule_flush_cache_range(void *addr, int size) { - __flush_dcache_area(addr, size); + __flush_dcache_area((unsigned long)addr, (unsigned long)addr + size); } #endif /* _ASM_EFI_H */ diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 25ed956f9af1..33293d5855af 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -180,7 +180,8 @@ static inline void *__kvm_vector_slot2addr(void *base, struct kvm; -#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) +#define kvm_flush_dcache_to_poc(a,l) \ + __flush_dcache_area((unsigned long)(a), (unsigned long)(a)+(l)) static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu) { diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index b1cef371df2b..b40ddce71507 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -240,8 +240,6 @@ static int create_safe_exec_page(void *src_start, size_t length, return 0; } -#define dcache_clean_range(start, end) __flush_dcache_area(start, (end - start)) - #ifdef CONFIG_ARM64_MTE static DEFINE_XARRAY(mte_pages); @@ -383,13 +381,18 @@ int swsusp_arch_suspend(void) ret = swsusp_save(); } else { /* Clean kernel core startup/idle code to PoC*/ - dcache_clean_range(__mmuoff_data_start, __mmuoff_data_end); - dcache_clean_range(__idmap_text_start, __idmap_text_end); + __flush_dcache_area((unsigned long)__mmuoff_data_start, + (unsigned long)__mmuoff_data_end); + __flush_dcache_area((unsigned long)__idmap_text_start, + (unsigned long)__idmap_text_end); /* Clean kvm setup code to PoC? */ if (el2_reset_needed()) { - dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); - dcache_clean_range(__hyp_text_start, __hyp_text_end); + __flush_dcache_area( + (unsigned long)__hyp_idmap_text_start, + (unsigned long)__hyp_idmap_text_end); + __flush_dcache_area((unsigned long)__hyp_text_start, + (unsigned long)__hyp_text_end); } swsusp_mte_restore_tags(); @@ -474,7 +477,8 @@ int swsusp_arch_resume(void) * The hibernate exit text contains a set of el2 vectors, that will * be executed at el2 with the mmu off in order to reload hyp-stub. */ - __flush_dcache_area(hibernate_exit, exit_size); + __flush_dcache_area((unsigned long)hibernate_exit, + (unsigned long)hibernate_exit + exit_size); /* * KASLR will cause the el2 vectors to be in a different location in diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index e628c8ce1ffe..3dd515baf526 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -237,7 +237,8 @@ asmlinkage void __init init_feature_override(void) for (i = 0; i < ARRAY_SIZE(regs); i++) { if (regs[i]->override) - __flush_dcache_area(regs[i]->override, + __flush_dcache_area((unsigned long)regs[i]->override, + (unsigned long)regs[i]->override + sizeof(*regs[i]->override)); } } diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index 341342b207f6..49cccd03cb37 100644 --- a/arch/arm64/kernel/kaslr.c +++ b/arch/arm64/kernel/kaslr.c @@ -72,7 +72,9 @@ u64 __init kaslr_early_init(void) * we end up running with module randomization disabled. */ module_alloc_base = (u64)_etext - MODULES_VSIZE; - __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); + __flush_dcache_area((unsigned long)&module_alloc_base, + (unsigned long)&module_alloc_base + + sizeof(module_alloc_base)); /* * Try to map the FDT early. If this fails, we simply bail, @@ -170,8 +172,12 @@ u64 __init kaslr_early_init(void) module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; module_alloc_base &= PAGE_MASK; - __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); - __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); + __flush_dcache_area((unsigned long)&module_alloc_base, + (unsigned long)&module_alloc_base + + sizeof(module_alloc_base)); + __flush_dcache_area((unsigned long)&memstart_offset_seed, + (unsigned long)&memstart_offset_seed + + sizeof(memstart_offset_seed)); return offset; } diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index ecd8915e02e1..eadb0b189348 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -72,7 +72,9 @@ int machine_kexec_post_load(struct kimage *kimage) * For execution with the MMU off and I-cache on, 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_dcache_area((unsigned long)reloc_code, + (unsigned long)reloc_code + + arm64_relocate_new_kernel_size); invalidate_icache_range((uintptr_t)reloc_code, (uintptr_t)reloc_code + arm64_relocate_new_kernel_size); @@ -106,16 +108,18 @@ static void kexec_list_flush(struct kimage *kimage) for (entry = &kimage->head; ; entry++) { unsigned int flag; - void *addr; + unsigned long addr; /* flush the list entries. */ - __flush_dcache_area(entry, sizeof(kimage_entry_t)); + __flush_dcache_area((unsigned long)entry, + (unsigned long)entry + + sizeof(kimage_entry_t)); flag = *entry & IND_FLAGS; if (flag == IND_DONE) break; - addr = phys_to_virt(*entry & PAGE_MASK); + addr = (unsigned long)phys_to_virt(*entry & PAGE_MASK); switch (flag) { case IND_INDIRECTION: @@ -124,7 +128,7 @@ static void kexec_list_flush(struct kimage *kimage) break; case IND_SOURCE: /* flush the source pages. */ - __flush_dcache_area(addr, PAGE_SIZE); + __flush_dcache_area(addr, addr + PAGE_SIZE); break; case IND_DESTINATION: break; @@ -151,8 +155,10 @@ static void kexec_segment_flush(const struct kimage *kimage) kimage->segment[i].memsz, kimage->segment[i].memsz / PAGE_SIZE); - __flush_dcache_area(phys_to_virt(kimage->segment[i].mem), - kimage->segment[i].memsz); + __flush_dcache_area( + (unsigned long)phys_to_virt(kimage->segment[i].mem), + (unsigned long)phys_to_virt(kimage->segment[i].mem) + + kimage->segment[i].memsz); } } diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index dcd7041b2b07..5fcdee331087 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -122,7 +122,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) secondary_data.task = idle; secondary_data.stack = task_stack_page(idle) + THREAD_SIZE; update_cpu_boot_status(CPU_MMU_OFF); - __flush_dcache_area(&secondary_data, sizeof(secondary_data)); + __flush_dcache_area((unsigned long)&secondary_data, + (unsigned long)&secondary_data + + sizeof(secondary_data)); /* Now bring the CPU into our world */ ret = boot_secondary(cpu, idle); @@ -143,7 +145,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) pr_crit("CPU%u: failed to come online\n", cpu); secondary_data.task = NULL; secondary_data.stack = NULL; - __flush_dcache_area(&secondary_data, sizeof(secondary_data)); + __flush_dcache_area((unsigned long)&secondary_data, + (unsigned long)&secondary_data + + sizeof(secondary_data)); status = READ_ONCE(secondary_data.status); if (status == CPU_MMU_OFF) status = READ_ONCE(__early_cpu_boot_status); diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c index c45a83512805..58d804582a35 100644 --- a/arch/arm64/kernel/smp_spin_table.c +++ b/arch/arm64/kernel/smp_spin_table.c @@ -36,7 +36,7 @@ static void write_pen_release(u64 val) unsigned long size = sizeof(secondary_holding_pen_release); secondary_holding_pen_release = val; - __flush_dcache_area(start, size); + __flush_dcache_area((unsigned long)start, (unsigned long)start + size); } @@ -90,8 +90,9 @@ static int smp_spin_table_cpu_prepare(unsigned int cpu) * the boot protocol. */ writeq_relaxed(pa_holding_pen, release_addr); - __flush_dcache_area((__force void *)release_addr, - sizeof(*release_addr)); + __flush_dcache_area((__force unsigned long)release_addr, + (__force unsigned long)release_addr + + sizeof(*release_addr)); /* * Send an event to wake up the secondary CPU. diff --git a/arch/arm64/kvm/hyp/nvhe/cache.S b/arch/arm64/kvm/hyp/nvhe/cache.S index 3bcfa3cac46f..36cef6915428 100644 --- a/arch/arm64/kvm/hyp/nvhe/cache.S +++ b/arch/arm64/kvm/hyp/nvhe/cache.S @@ -8,7 +8,6 @@ #include SYM_FUNC_START_PI(__flush_dcache_area) - add x1, x0, x1 dcache_by_line_op civac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__flush_dcache_area) diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c index 7488f53b0aa2..5dffe928f256 100644 --- a/arch/arm64/kvm/hyp/nvhe/setup.c +++ b/arch/arm64/kvm/hyp/nvhe/setup.c @@ -134,7 +134,8 @@ static void update_nvhe_init_params(void) for (i = 0; i < hyp_nr_cpus; i++) { params = per_cpu_ptr(&kvm_init_params, i); params->pgd_pa = __hyp_pa(pkvm_pgtable.pgd); - __flush_dcache_area(params, sizeof(*params)); + __flush_dcache_area((unsigned long)params, + (unsigned long)params + sizeof(*params)); } } diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index c37c1dc4feaf..10d2f04013d4 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -839,8 +839,11 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, stage2_put_pte(ptep, mmu, addr, level, mm_ops); if (need_flush) { - __flush_dcache_area(kvm_pte_follow(pte, mm_ops), - kvm_granule_size(level)); + kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops); + + __flush_dcache_area((unsigned long)pte_follow, + (unsigned long)pte_follow + + kvm_granule_size(level)); } if (childp) @@ -988,11 +991,15 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, struct kvm_pgtable *pgt = arg; struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops; kvm_pte_t pte = *ptep; + kvm_pte_t *pte_follow; if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte)) return 0; - __flush_dcache_area(kvm_pte_follow(pte, mm_ops), kvm_granule_size(level)); + pte_follow = kvm_pte_follow(pte, mm_ops); + __flush_dcache_area((unsigned long)pte_follow, + (unsigned long)pte_follow + + kvm_granule_size(level)); return 0; } diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index b599c334a2e8..058605ac75a1 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -110,16 +110,15 @@ alternative_else_nop_endif SYM_FUNC_END(invalidate_icache_range) /* - * __flush_dcache_area(kaddr, size) + * __flush_dcache_area(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are cleaned and invalidated to the PoC. * - * - kaddr - kernel address - * - size - size in question + * - start - virtual start address of region + * - end - virtual end address of region */ SYM_FUNC_START_PI(__flush_dcache_area) - add x1, x0, x1 dcache_by_line_op civac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__flush_dcache_area) From patchwork Mon May 17 07:51:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261117 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, 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 71462C433ED for ; Mon, 17 May 2021 08:04:49 +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 E831E61042 for ; Mon, 17 May 2021 08:04:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E831E61042 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=UziUpr3iF4yMf/fmO7cO4ZYxskHoZ80jbncgA8Nu4YU=; b=Xm5o2vhA3Kzfzd /gQYRtxU20frxMgq0xKJYggC2OvSyx5pi2i0hEnqttkPvj/qBVjGrhKDpLjGvi8cgRbMKVOBkoRy7 y5BVq36iX7BqvbNCb1/tcXY9DBezi1HIyhIjO0GWZGF4zvWQxZ91FPEpuRG7sorkbwENiYQ99w3ev MLh8wchBDU598C6/r2iskMDCxA5Y3vrDsYeO9ROqQv3gaDC0wAPaIuCpfMkk24KQefhjWfDHG+WtI l/3qkRAykvixC55IzL6dZogthabXs9MiYKsDUxYzooegB5BnkOpXtf/9GPK0ABfmvs2CAzCTb81eR 0/vR5UO6lLs09WOUmR8Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYC6-00E8tn-Ik; Mon, 17 May 2021 08:01:43 +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 1liY2b-00E6e4-Sr for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:54 +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=cFIYMobvfVxBSsjID/I2la04uf9rE3ub181A8Qj0oaM=; b=0nSmO9MrqnEqlMUB4unymO8Ew5 oek4lpbNtQyv1jRaV4hlPtJMMmiBxgbCSJwpZE1u6Gd42q/Ww2QhXEMs6OIe/Q6bdWE9f3+CM/mMX IfHWtLPXPm5QPIOFZfbMTvdE0FGOfID47Gx4Urr9lDzehOo3d6bGYw7X5cUSqxrxuKODrothEyzfN RKEWMr+CK+HFKx/ApSb2RbT5TueyGnoe/cKUMQn1v8n3rtnFm0zE2EPMkC+VnX+/S2UMUHp4MLiDv r1cEixwFd/GgbO7R7W3Ue+Tix36Qfsi3jwQdt0IWVOtV+O0J20XgBtTzCYnECrBHlUV8cyee2oUCk rAFGVslw==; Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2Z-00DYyz-0i for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:52 +0000 Received: by mail-qk1-x74a.google.com with SMTP id n142-20020a3727940000b02902fa8eadfa9eso4185366qkn.7 for ; Mon, 17 May 2021 00:51:49 -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=cFIYMobvfVxBSsjID/I2la04uf9rE3ub181A8Qj0oaM=; b=Kx+7LuBdfjMMobc5vv0ib8ETlQQS++feHYmHvAWsEDDgmdD0bawC3M/rKtCWnuEsSe ithzPxpY8mV40j7p1gwHMUcZcIwxQcHzmkM+2kWzUtLj6ORjyEWYdKbKPSTOjwIJ5aYz obtKMrZM0t1wtj6bTpO5Wx+jEMRCFMMSE4l8nMPdUSDINEA8DI7QhlBUzmIZEw2iTSl/ e8DbdBvMt+6Wyw6vtvBmjI9PERlg7eHMFKgZEz6OI7jIvvNjkemZcN9nULEfbce7TJif bcWyCha2n0+E03lVld6RWO3XDhSQUKYgWTs6F+byGy1DYOd6FbWfbGCmlcM3+Q500osN 56Nw== 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=cFIYMobvfVxBSsjID/I2la04uf9rE3ub181A8Qj0oaM=; b=egaXc7qFyqlBVn6264pSkGapb0iVgtwNh0w7yVnTMfwVa/nFD42uB04uwpZGrUnOmu oS13BU/zp6Av5tcsDhfKMcpy+5+VBt404TvF3fxNlIQbGAsRcm/xTtmqWCFY7db68+b3 GcI6xVtqlBAXpAA18pMRxZ03fjCycpQFhSbz8MwPmlErF0baSS36lbSCbbXZgOmMRzKT EAqZ6moQa34+jBezxLxZK3rxX6N/DWJOTojPsqC+ERzeksrNxgepc8f9FEJ72rRjyqW6 iHf28HRTwLJJ6Imv4GbxPQ3IvT8SsNH91293t6lOvgGYTZGesC0VO/nSNT//66yceyLV 7sOA== X-Gm-Message-State: AOAM530tvJTlyTnNa79VIsJSnjrv+sebmviY/VkSk1KrjKDGObDItX5y CUfFaIMV+xXF1USKDQvhr8c/gEDzv3XgdsCEVZzxQfAFvtOARsumi5/hqQo7Bl4SYGWa9+j8RcI l18i0ugGB5DB1jMDLvVidoS5Vji6qpxONaawwwroNG7pFks4NZegYdrULKdeZeh+p9/cmgImEwA raEQ== X-Google-Smtp-Source: ABdhPJxWIuUq/PNursJ3/M4S56oX9JQVgkf0eScOPS+HWBbr7C11IkNa/LezxUfdafMoK95WIIl4ZvKyOA== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:a91:: with SMTP id ev17mr13770896qvb.9.1621237909205; Mon, 17 May 2021 00:51:49 -0700 (PDT) Date: Mon, 17 May 2021 08:51:19 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-12-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 11/16] arm64: __clean_dcache_area_poc to take end parameter instead of size 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_005151_082465_BE4A8642 X-CRM114-Status: GOOD ( 14.81 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. Because the code is shared with __dma_clean_area, it changes the parameters for that as well. However, __dma_clean_area is local to cache.S, so no other users are affected. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/kernel/efi-entry.S | 5 +++-- arch/arm64/mm/cache.S | 16 +++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 695f88864784..3255878d6f30 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -60,7 +60,7 @@ extern void __flush_icache_range(unsigned long start, unsigned long end); extern void invalidate_icache_range(unsigned long start, unsigned long end); extern void __flush_dcache_area(unsigned long start, unsigned long end); extern void __inval_dcache_area(unsigned long start, unsigned long end); -extern void __clean_dcache_area_poc(void *addr, size_t len); +extern void __clean_dcache_area_poc(unsigned long start, unsigned long end); extern void __clean_dcache_area_pop(void *addr, size_t len); extern void __clean_dcache_area_pou(void *addr, size_t len); extern long __flush_cache_user_range(unsigned long start, unsigned long end); diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 0073b24b5d25..72e6a580290a 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S @@ -28,6 +28,7 @@ SYM_CODE_START(efi_enter_kernel) * stale icache entries from before relocation. */ ldr w1, =kernel_size + add x1, x0, x1 bl __clean_dcache_area_poc ic ialluis @@ -36,7 +37,7 @@ SYM_CODE_START(efi_enter_kernel) * so that we can safely disable the MMU and caches. */ adr x0, 0f - ldr w1, 3f + adr x1, 3f bl __clean_dcache_area_poc 0: /* Turn off Dcache and MMU */ @@ -65,4 +66,4 @@ SYM_CODE_START(efi_enter_kernel) mov x3, xzr br x19 SYM_CODE_END(efi_enter_kernel) -3: .long . - 0b +3: diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 058605ac75a1..38d62cef243f 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -182,24 +182,23 @@ SYM_FUNC_END_PI(__inval_dcache_area) SYM_FUNC_END(__dma_inv_area) /* - * __clean_dcache_area_poc(kaddr, size) + * __clean_dcache_area_poc(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoC. * - * - kaddr - kernel address - * - size - size in question + * - start - virtual start address of region + * - end - virtual end address of region */ SYM_FUNC_START_LOCAL(__dma_clean_area) SYM_FUNC_START_PI(__clean_dcache_area_poc) /* FALLTHROUGH */ /* - * __dma_clean_area(start, size) + * __dma_clean_area(start, end) * - start - virtual start address of region - * - size - size in question + * - end - virtual end address of region */ - add x1, x0, x1 dcache_by_line_op cvac, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__clean_dcache_area_poc) @@ -215,10 +214,10 @@ SYM_FUNC_END(__dma_clean_area) * - size - size in question */ SYM_FUNC_START_PI(__clean_dcache_area_pop) + add x1, x0, x1 alternative_if_not ARM64_HAS_DCPOP b __clean_dcache_area_poc alternative_else_nop_endif - add x1, x0, x1 dcache_by_line_op cvap, sy, x0, x1, x2, x3 ret SYM_FUNC_END_PI(__clean_dcache_area_pop) @@ -247,7 +246,6 @@ SYM_FUNC_START_PI(__dma_map_area) add x1, x0, x1 cmp w2, #DMA_FROM_DEVICE b.eq __dma_inv_area - sub x1, x1, x0 b __dma_clean_area SYM_FUNC_END_PI(__dma_map_area) From patchwork Mon May 17 07:51:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261119 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, 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 11407C433B4 for ; Mon, 17 May 2021 08:04:52 +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 8C5FC6117A for ; Mon, 17 May 2021 08:04:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C5FC6117A 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=bBDC3df6RLlZ2COxaNcBAOYu8SdKlb36VX93HHRB8U0=; b=HtkEZ2y8DlgvQv UF7zGzLqv9awOAjm9QnTJQIkyDkFFVfspLixW5tKHsVPhA31OBZNAgig9SfaA7kNOg6WVaT5rIE+0 vlU7/umZ40NhEPGMY5lCvfhNU8aeGbxZjXe7uJ1KdsyvKWA2fu1/DIfeDyXGhjpdaE/6A/eWc8T51 Q/vGK5IeERKPj4MgoTG3b1kI+5ozKmkmkfgUN+cEspbbx9Xdj/Sxh7O2KwL8Clc+tLERjcA/aMq4u yaftV+Q3vPuJixK3wFro3OiF3tu7Zgae137qaEtTXZ27cltZXAvWL83dV7ABndAshimchiBDW+wvd z24zAMq5Y9nyUeCews4A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYCS-00E8zV-5N; Mon, 17 May 2021 08:02:06 +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 1liY2e-00E6em-3g for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:56 +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=Nkx2+uqyyD8P2lW8edG/Qr+9UixfmlpxUcWA/EfBdEA=; b=C5okk/2h/PYzelStrrg1LlJD6H PFL4XQyJPu8wmhp4RD/vQSyyO3dxcR7s576We/DqijzVXbtvXKm0F8pkZhREvXqOUBmuVRRwz+VBu O3TPtfZFLWXONNV3ykiCW2uKmxkZMFt1dH7q+AQdM2WMlsJVR0SV1w1wPDAciS4sRPbsgoSREjofc sIqJ+DzxFRyRQULOEoCHj7kbZ6SR/RKbYV6qjzQ0fPxQ2v/Hho/IDt5dQBiAWkmO0DQX3cI5HAxUO PMqvRo+CCtsO1fWv7N6B+JNvt28+s7922wRldraWD3BRMiDAn9wR70S+VE5vJs8ORCbHhBhOgUvWJ EPO+LPxA==; Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2b-00DYze-BP for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:54 +0000 Received: by mail-wr1-x44a.google.com with SMTP id 4-20020adf80040000b029010cab735fdeso3432454wrk.14 for ; Mon, 17 May 2021 00:51:52 -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=Nkx2+uqyyD8P2lW8edG/Qr+9UixfmlpxUcWA/EfBdEA=; b=CY5x4+8QBxo0BZpimUxY5VJfeHy6Ixx5NSuD+hewnwytD0U97yW/gw9zn7SAJVxeeU NHVNBLKv6iKFXUfEhTuE3yGNDnTNEyKwS7mW493RDXckaESBAmfJ3XeYMu2FUJdfkI2A nP3J92PodrdD0C2Zkkaj5CA4suZ6UhCTcVHcTYtWzPJfhuF1/epWRy87kRKA6ye9SGOZ K/pPMqR7o5kDGBpxx1AYqOB66GYJOeLF1efQYx2LbLrJMFC3izCUVWTU+FRuX83DWUe/ 7TdxRDVDd3YAOGzVm/n+LYO3Jvt+rPWZjlwG9V+zpXFCojEnkwxb47nRue+UsEE3wjuY i+ug== 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=Nkx2+uqyyD8P2lW8edG/Qr+9UixfmlpxUcWA/EfBdEA=; b=V9hq37mPAcCA5WXT41+BP/zG3KxA53ADbnTAQQu/1wzRI8ii1OxK8txNHFMYjrO5jr 3OBKQ8yND3hcycCW9jOMy+veRGNNCOHjDjVOBK4vdwFmzQ+FQBbz3wTuGJln4/J6sW7U fskkpLg/xe2BQ/lBAN/C25DjuPCd0OjX3dNkxWaN4lC46ny5QQxNR4w9i4hXGehIw5Fm 51izVrUmrkhlylcsZDHBL1mup4dtZFwWAQMqvoQSUi3YxzJSivovPSEXQq5ca490LK+M D0no0mjzf9oB0ZPQKJdewCQtwT4Y9Uth+n4VLe92sX6dIdBRcLwzPleFiAjoyqsk/wEV XFJA== X-Gm-Message-State: AOAM532/cPW5R7YtFjZjKAUpGh6ewWEFAGd4V5Z7fo+waF5shXg3Ehjs Fsr9ijfBffbLtTQKEhojrYQJE5JJd4Fk0CyN5rETm14xj+dQo4LGe2b1gZBeFBii1gXOOiT772F XanBVAjdfAh3ocvFYofBjnJm3YQFuJww8O8hpgaZbl4nXdavORFi3AgJbiIBu3gspC8fwBapk1d eXeQ== X-Google-Smtp-Source: ABdhPJwqd+4kFVX+5QVCB3geG1h+B6qRmNo1yM6c1zwL/iUF32Sj/YoAfIKsaoitXoL+PXXErTLkLqY/PQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a5d:4536:: with SMTP id j22mr8174041wra.329.1621237911292; Mon, 17 May 2021 00:51:51 -0700 (PDT) Date: Mon, 17 May 2021 08:51:20 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-13-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 12/16] arm64: __clean_dcache_area_pop to take end parameter instead of size 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_005153_412323_CB2AA883 X-CRM114-Status: GOOD ( 13.88 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/lib/uaccess_flushcache.c | 4 ++-- arch/arm64/mm/cache.S | 9 ++++----- arch/arm64/mm/flush.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 3255878d6f30..fa5641868d65 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -61,7 +61,7 @@ extern void invalidate_icache_range(unsigned long start, unsigned long end); extern void __flush_dcache_area(unsigned long start, unsigned long end); extern void __inval_dcache_area(unsigned long start, unsigned long end); extern void __clean_dcache_area_poc(unsigned long start, unsigned long end); -extern void __clean_dcache_area_pop(void *addr, size_t len); +extern void __clean_dcache_area_pop(unsigned long start, unsigned long end); extern void __clean_dcache_area_pou(void *addr, size_t len); extern long __flush_cache_user_range(unsigned long start, unsigned long end); extern void sync_icache_aliases(void *kaddr, unsigned long len); diff --git a/arch/arm64/lib/uaccess_flushcache.c b/arch/arm64/lib/uaccess_flushcache.c index c83bb5a4aad2..62ea989effe8 100644 --- a/arch/arm64/lib/uaccess_flushcache.c +++ b/arch/arm64/lib/uaccess_flushcache.c @@ -15,7 +15,7 @@ void memcpy_flushcache(void *dst, const void *src, size_t cnt) * barrier to order the cache maintenance against the memcpy. */ memcpy(dst, src, cnt); - __clean_dcache_area_pop(dst, cnt); + __clean_dcache_area_pop((unsigned long)dst, (unsigned long)dst + cnt); } EXPORT_SYMBOL_GPL(memcpy_flushcache); @@ -33,6 +33,6 @@ unsigned long __copy_user_flushcache(void *to, const void __user *from, rc = raw_copy_from_user(to, from, n); /* See above */ - __clean_dcache_area_pop(to, n - rc); + __clean_dcache_area_pop((unsigned long)to, (unsigned long)to + n - rc); return rc; } diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 38d62cef243f..8c0707167ab2 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -205,16 +205,15 @@ SYM_FUNC_END_PI(__clean_dcache_area_poc) SYM_FUNC_END(__dma_clean_area) /* - * __clean_dcache_area_pop(kaddr, size) + * __clean_dcache_area_pop(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoP. * - * - kaddr - kernel address - * - size - size in question + * - start - virtual start address of region + * - end - virtual end address of region */ SYM_FUNC_START_PI(__clean_dcache_area_pop) - add x1, x0, x1 alternative_if_not ARM64_HAS_DCPOP b __clean_dcache_area_poc alternative_else_nop_endif diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 4e3505c2bea6..5aba7fe42d4b 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -82,7 +82,7 @@ void arch_wb_cache_pmem(void *addr, size_t size) { /* Ensure order against any prior non-cacheable writes */ dmb(osh); - __clean_dcache_area_pop(addr, size); + __clean_dcache_area_pop((unsigned long)addr, (unsigned long)addr + size); } EXPORT_SYMBOL_GPL(arch_wb_cache_pmem); From patchwork Mon May 17 07:51:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261121 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, 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 B1C7BC433B4 for ; Mon, 17 May 2021 08:05:16 +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 439246117A for ; Mon, 17 May 2021 08:05:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 439246117A 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=HwCHr6Err3ylF1SpSqy9eeieyXxZhpXrwXccT0UAUyE=; b=kqhVV//Kvke00J x7CPI9m4fZFkKOQeAGWB9jLwmTsVR5a2rjZW0sfnuTBgiX2szBnL8l3mueRu2LLBlhkIszJ6CU4lh cedSJnBRVOyO8mOW1Har/K6AGRJD3EhPEcksHdt6H9qDyIEpeItKAKw9NOAYM4l5VHx4AacmqPQyw FnRMOGG30jGVXxk7MqvROabQAON5xCSFVIJ319Bi8QNJ4hKIMeavCrgdQLT5+MiEDWihcSTSwwKe3 9gm8haVZJh0jQm9QpFJf1gSdQhrmRYjfIgiEOjNHZet2Fpc4knx1UMlwqHs6whyhpT1tnC+K1aUmx 6XlwPoB7Q+sJFSHsDT2A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYCu-00E99x-LT; Mon, 17 May 2021 08:02:40 +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 1liY2f-00E6fV-QH for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:58 +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=h0UsHrd7C41RPkjFGyYnkCI8+hNRUMgaYiYUkKIiD6g=; b=GlEUgNTbcNHlJ2Ig7LFgIZppFO yaH5Qi3RPXDwKBdAFSY3MvhQjOEvc94+gpp6Vjn5/BtmJMFCF6W0zlmjwApK6yee9VwzTaiE2Bvhy 9hpc64JRT38Ha/soP8vjNl4+4ZLL8wzO2i0LcZoXzreNjXFNWrPQyPfOCsa2UIK49ivuHIg0p6bjL cByx+fqVTAq2niyrZdl/fy9j9pzcQh1IS80vEYi7siufzaEWQVYpwB8J+vmkB9Od8A9bupmdKM50j M9lo1okLcBnA0B8PbyUZY+xp1lYRoVr0T6TFbe5GQHB6gDx8IFP9FESrveHo3mXDKhDFNRyP+fuSy 8KhJsAaQ==; Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2d-00DZ03-6q for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:56 +0000 Received: by mail-wm1-x349.google.com with SMTP id o10-20020a05600c4fcab029014ae7fdec90so1108929wmq.5 for ; Mon, 17 May 2021 00:51:54 -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=h0UsHrd7C41RPkjFGyYnkCI8+hNRUMgaYiYUkKIiD6g=; b=c9C/3YTL1MWq84gslJQnTkViFZuL/a4Svx5g19vpJQIXvWGh9iYEMw3VQX85p3WoEm tcMH9ze2q0lTpYxqD0x8o4c3PSdQsry3IHsEscCPYAF+aemJMbbytpF5X8g5HzH2+JVv G8riJ/Th3s7G6Q8gU4MtMzDAqVSEFEm9WkjXQ29RxD74uGW+hdg12AddC3hC7t54A1cl 9W+vqIhv2tT952pWfOcSfiWAC9nMMT3E6tXB43b+djIvUDLM1gX1DGCjjXUSPMeK/QIV GeMG3nSYmdVAY3FeuAqAnB5U3+9ZkkBKL28p74okE/Od97NKsfQU8nN8w6C4HSK98DB6 /M2A== 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=h0UsHrd7C41RPkjFGyYnkCI8+hNRUMgaYiYUkKIiD6g=; b=HiiNBKBs7cCl5+1MaAAuaOTRVVCCpTrabb9iQE0f2egq6Lra89EwXmJf4PfNpa2Zic XKPmsfl718aBa5/VoFtlescmLmaE8zsZDhUgQLcOYku+UEdyvx5abeqZPZ9MZhxt+EhS QJYPai7rn0EdlF3gLHGgXdnRhS/SZ6PXEzPdTvxXiAUz8Uakk+C65SL1EeZ0tvL5BpqT hNgf75L9UrPmbEZ1GIjd3gdQdHUqnafZ1rsBQlbDNaR9xI3Fj/KFGEAIURn9jrGpKWww a7CCGRPOXxLCfpb5BR69XdeqFCxicWBg7toYeljzI3ljWrAM37Ot14NkPHztgfPiZ0KO f56Q== X-Gm-Message-State: AOAM532I0+dIvwFas2+e3BwFbqoAweKr+dZkTL5CbvC9WCA+2ABuqotV 6cfU7lEPctN5G2FcZkbQ0//sm0SUwrU7I6/ECDUMV1b4VMp+NrxBE7HrusRRnednSpha/HR5Rio 3uFhz3batDaEUnL5Dw+AKbbuqiZRg0FHfR2XFDFcCrEBEn1zjM3UlC2/n2TCb9NL4IEyBBJpCZT 4hYQ== X-Google-Smtp-Source: ABdhPJz5jO69ngSt5Zgq6grmBYyb7vhj2W1zM5B5DG/FcGehJxyCXVFvphzBXMRKjmlS/wXVBYJKE03peA== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:adf:ed47:: with SMTP id u7mr26398948wro.254.1621237913217; Mon, 17 May 2021 00:51:53 -0700 (PDT) Date: Mon, 17 May 2021 08:51:21 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-14-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 13/16] arm64: __clean_dcache_area_pou to take end parameter instead of size 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_005155_270880_8D79799D X-CRM114-Status: GOOD ( 13.43 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/mm/cache.S | 9 ++++----- arch/arm64/mm/flush.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index fa5641868d65..f86723047315 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -62,7 +62,7 @@ extern void __flush_dcache_area(unsigned long start, unsigned long end); extern void __inval_dcache_area(unsigned long start, unsigned long end); extern void __clean_dcache_area_poc(unsigned long start, unsigned long end); extern void __clean_dcache_area_pop(unsigned long start, unsigned long end); -extern void __clean_dcache_area_pou(void *addr, size_t len); +extern void __clean_dcache_area_pou(unsigned long start, unsigned long end); extern long __flush_cache_user_range(unsigned long start, unsigned long end); extern void sync_icache_aliases(void *kaddr, unsigned long len); diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 8c0707167ab2..fbf003b956cc 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -124,20 +124,19 @@ SYM_FUNC_START_PI(__flush_dcache_area) SYM_FUNC_END_PI(__flush_dcache_area) /* - * __clean_dcache_area_pou(kaddr, size) + * __clean_dcache_area_pou(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoU. * - * - kaddr - kernel address - * - size - size in question + * - start - virtual start address of region + * - end - virtual end address of region */ SYM_FUNC_START(__clean_dcache_area_pou) alternative_if ARM64_HAS_CACHE_IDC dsb ishst ret alternative_else_nop_endif - add x1, x0, x1 dcache_by_line_op cvau, ish, x0, x1, x2, x3 ret SYM_FUNC_END(__clean_dcache_area_pou) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 5aba7fe42d4b..a69d745fb1dc 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -19,7 +19,7 @@ void sync_icache_aliases(void *kaddr, unsigned long len) unsigned long addr = (unsigned long)kaddr; if (icache_is_aliasing()) { - __clean_dcache_area_pou(kaddr, len); + __clean_dcache_area_pou(kaddr, kaddr + len); __flush_icache_all(); } else { /* From patchwork Mon May 17 07:51:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261123 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, 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 9B74FC433ED for ; Mon, 17 May 2021 08:05:56 +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 273E36117A for ; Mon, 17 May 2021 08:05:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 273E36117A 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=2ZUVNRwgLappwXp0OLjrofB8nVRqvj0wEXIJBE86/O4=; b=Bz6kVUSfuEk3FX KZKmmebGdhCtztP5l7zrV9JAdrI86HXxdyx6xNaF8aEofu8xibSzJQc5K7UZ8Ma5j2f5aTyxYWOiw VMtndONOzYqituOyxQGvj8IQmmz1XqALjHEYFjxzJ02Cc5l4etAXHPDdCEvAwrV8c61PZZVttZdbH OjLweDohe8OhDl2eqSYGNNVWkPUoxsgjG9dQTDRYMGC8AdgvquD6frnMsPnPA71HUxtcONEF8MF28 +HMb3pj35TyH5MrP8AnaokS6M/rt2ojrOZVGFnrkunhgUfBoIORyevIV4AJHALIdhdElua9r/nGJd WNzIouhlYkPGLhgHXHiQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYDc-00E9MX-HB; Mon, 17 May 2021 08:03:27 +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-00E6gC-HU for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:51:59 +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=tEummeh6I6frwEp3TLdr5cPM5KsDvZ8aCtlKbBiCaX4=; b=ZjY60FPuepivhYYDriPdbkC/d2 jZ4qs2f1cjOvxftqmsqk2tWy2BuC0fai0+1lGu5q6qiYp8qAcSDpqWedsQKpCvUJ1yzOzJOABJ6Zb cv7qWCnxmnCvBZA7fe59Acr6mkh3nBBN01b4TEpyww/ApOvwSLEFIBLvHlRYpHqjDCG1BFN34Yvo8 HrvOYqBs5S/aB3qMKEdZ9oM7qC55Yzqbn2XJZyOXEywUR+w3f+NArE4eO4GuPpk22h3mb1bbWbZKX wcgwwmCXrjxhA322a7JILdD+26YnZTaUZSSbHtqw36QbeYoA5lC5c99VGDgW7tQiCVpQ0CpXFLSrs kGbuXjIA==; 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 1liY2e-00DZ0L-UP for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:51:58 +0000 Received: by mail-qv1-xf49.google.com with SMTP id c5-20020a0ca9c50000b02901aede9b5061so4130492qvb.14 for ; Mon, 17 May 2021 00:51:56 -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=tEummeh6I6frwEp3TLdr5cPM5KsDvZ8aCtlKbBiCaX4=; b=DqurR5t4iQPpG8dC/UIw8m2Ivo9XY/u5dZCwSRwY35Kjiskpy1p0qHpmzVtFN2XysA 8sFsM5B3ylwZZkN7/5zJ/UFK+SF+JWrhJ2LE9+etTCJ6pYKlciyB7NXhTMTjURlzNod5 BL6k0LSyGBpieXDeImRBkNKkWJSeWtbQK/3NdmMbBpnh4MsDpy8HecybI++T3LxYTTYH 0ZGU3iyn/7E/yHeW0TtGIFm5bD6YGRuJ7uq+z/ZXO5lRVn9ETLAZhrStT9fyvOIYjIIE A/ROW7DmigxsrjBo5eIpgNxVxtOMi/qQkDj6Yo3Ct6N8H+aLpq6n+NblSTYDDcMs0ohM I0XQ== 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=tEummeh6I6frwEp3TLdr5cPM5KsDvZ8aCtlKbBiCaX4=; b=YpD1KUoNxdx0UENupu9bs7r3JqjcBFEZrM6P44YLcBxMMjAAq0ZaxVlTBlYX639lsK 68U3a5i4W3JfRGi1z0Jv/6qN/1kEyHaGtSKcN7rABSSTWLX9osQGjkYwLqSjEMGxE8H8 ly76hzK5py/pBTfS2O0CD+Vi2TXIdSJEWKNeauNH0E+0UJGZr1nXhu/XEj0kRnwimODU fLTrQ7NzyPou5eFQhtmunspmhiHCpgf29skZXT4eC3MGyTzx5LDO4CGGEC8aSzFeSkTj 7J5Ul/ZoBNtnHeQ0b6imjdixz5DGog8DVkLnQE4ud+lnHAJgvDbsF7Sr96GjNn48TCee XdiA== X-Gm-Message-State: AOAM531pvj3b4SgYIoDJhTz2uRbxUsV2yRCAqx0IP+LM0LTnCsd2j5P6 QGuAld8eL67jmLYyHeShyMthzeZg3RMynoEHTN0EY7Dgs8YF5nhs/Ad9MWRsSkVzw2L3T6CUrdO sSwcOuV0GA8bjkxoi6uoZY4dI1LFq37R0snn5Mr0mXCKrnp1qwXWXjaZP2qdRX1zYTlm8cRTZTG HBjg== X-Google-Smtp-Source: ABdhPJxYG509xtuDbTKQu3CXCBbddKTBjaTQFF+IgNijVtUKBoug0NzLwd+5x2wYI0qnWcpE8l2q8teh7w== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a0c:ee62:: with SMTP id n2mr50085669qvs.20.1621237915207; Mon, 17 May 2021 00:51:55 -0700 (PDT) Date: Mon, 17 May 2021 08:51:22 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-15-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 14/16] arm64: sync_icache_aliases to take end parameter instead of size 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_005156_999348_CE8D6C3B X-CRM114-Status: GOOD ( 14.21 ) 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 To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/kernel/probes/uprobes.c | 2 +- arch/arm64/mm/flush.c | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index f86723047315..70b389a8dea5 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -64,7 +64,7 @@ extern void __clean_dcache_area_poc(unsigned long start, unsigned long end); extern void __clean_dcache_area_pop(unsigned long start, unsigned long end); extern void __clean_dcache_area_pou(unsigned long start, unsigned long end); extern long __flush_cache_user_range(unsigned long start, unsigned long end); -extern void sync_icache_aliases(void *kaddr, unsigned long len); +extern void sync_icache_aliases(unsigned long start, unsigned long end); static inline void flush_icache_range(unsigned long start, unsigned long end) { diff --git a/arch/arm64/kernel/probes/uprobes.c b/arch/arm64/kernel/probes/uprobes.c index 2c247634552b..9be668f3f034 100644 --- a/arch/arm64/kernel/probes/uprobes.c +++ b/arch/arm64/kernel/probes/uprobes.c @@ -21,7 +21,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, memcpy(dst, src, len); /* flush caches (dcache/icache) */ - sync_icache_aliases(dst, len); + sync_icache_aliases((unsigned long)dst, (unsigned long)dst + len); kunmap_atomic(xol_page_kaddr); } diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index a69d745fb1dc..143f625e7727 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -14,28 +14,26 @@ #include #include -void sync_icache_aliases(void *kaddr, unsigned long len) +void sync_icache_aliases(unsigned long start, unsigned long end) { - unsigned long addr = (unsigned long)kaddr; - if (icache_is_aliasing()) { - __clean_dcache_area_pou(kaddr, kaddr + len); + __clean_dcache_area_pou(start, end); __flush_icache_all(); } else { /* * Don't issue kick_all_cpus_sync() after I-cache invalidation * for user mappings. */ - __flush_icache_range(addr, addr + len); + __flush_icache_range(start, end); } } static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page, - unsigned long uaddr, void *kaddr, - unsigned long len) + unsigned long uaddr, unsigned long start, + unsigned long end) { if (vma->vm_flags & VM_EXEC) - sync_icache_aliases(kaddr, len); + sync_icache_aliases(start, end); } /* @@ -48,7 +46,8 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long len) { memcpy(dst, src, len); - flush_ptrace_access(vma, page, uaddr, dst, len); + flush_ptrace_access(vma, page, uaddr, (unsigned long)dst, + (unsigned long)dst + len); } void __sync_icache_dcache(pte_t pte) @@ -56,7 +55,9 @@ void __sync_icache_dcache(pte_t pte) struct page *page = pte_page(pte); if (!test_and_set_bit(PG_dcache_clean, &page->flags)) - sync_icache_aliases(page_address(page), page_size(page)); + sync_icache_aliases((unsigned long)page_address(page), + (unsigned long)page_address(page) + + page_size(page)); } EXPORT_SYMBOL_GPL(__sync_icache_dcache); From patchwork Mon May 17 07:51:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261125 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, 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 55491C433B4 for ; Mon, 17 May 2021 08:06:30 +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 DACE861042 for ; Mon, 17 May 2021 08:06:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DACE861042 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=eCo1vQBlHR7xC19kdlgSCxfKhoTKIz/uL7rwwxUGl/8=; b=eJoQAqtMrlGczx KfoLDVSTl1+fZczqBhnNK2O+juCeKZ4nMGRbR+sDWmYR/Ij2KMjN8kydEgoSNqjloHbUNet6y4FLx uYx5vt4Bu+qP3kQn3gGLPvxf8b841udTA0SyBjGBgDW3p+6hymKmObXT62YLtlA42pyk57QMmjyjK E9O03IQv3Q7amYguaDKMLhaye57vCnEumiqwrZXX8Kyb164xovAcYWIa0Mbe0xPEGQbUnOdzkCyyF +SK0pzhTvNrd0aBwV7/zs7+pRCfHtT9mlhx/loJPW8QRgSLGyZYszAPkO9uMud9Bcqpx2A41wkWfe huAqlIHuNRjfLaBMbG9A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYEb-00E9ZH-D2; Mon, 17 May 2021 08:04:18 +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 1liY2j-00E6gw-L0 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:52:03 +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=JUJRBpAmSgW3iUmlRzcNOvrsxGJGypryDJgOqUy8erw=; b=o9TCJJ07OTAXeFvfawXobBiSl8 Ch0w/bQsX5+D6KQnGGIy1jE2FJqHvmwZfOY1/U4+w0U7qkk1DtEjlq8mJebzyQZMTDQvMFCq4G8Gh WWyvN/RnoizE/fv2CI+e+7uShSJX3Is4DOWGGpM4UUjuO8X1OazT0Og6Qyzi0MnuT9WWDeq+O+PGz Pms5jUz6VVTyshZ228JsTLEtFWGBLih2gCdMHl/L7lwBpK9VcOC8/g+klfy2tsUHiXvZcnesIglGe tJTvGKhmxZ3d5sEk9fiTLfxHyleWYbSHPZbYMqMXlSD/OnXl4EYR/XChiWuhtI7wYu22JZVhJt4yC 7CbwcKPA==; 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 1liY2g-00DZ0d-TO for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:52:00 +0000 Received: by mail-qv1-xf49.google.com with SMTP id g26-20020a0caada0000b02901b93eb92373so4175121qvb.3 for ; Mon, 17 May 2021 00:51:57 -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=JUJRBpAmSgW3iUmlRzcNOvrsxGJGypryDJgOqUy8erw=; b=N4zTbNq7K0Ua1liUMx5e8vqqF3qfhe4S8TluOn9TKCKJ3JCJYpIGMh6Q/AoNlYSeLU sAebgDYLebfjNY46/RHMW4NDW1HIq4llnzgBabNF/hp4IShXhma6S5zKosUKFh0iFoPr D0tWQpCFybyp+vFcA7h4IhfG70aWK00x3MDDMC5Y0dIwOWcIiUck+rdhK3B8uan/6EBg DiGcKRFZM/PWalLSKzRT1Er3biyiOxZHOoKx9Bag1IKSWDua0sy1OacA56Aj1y/OQDAb s0N2e7Xkm6pyBpQK8e0d9uhSrECxiyU5gPtcAKQ8dXiWyj7tc6moRQBRR0OcoQmAeMsu G5Bg== 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=JUJRBpAmSgW3iUmlRzcNOvrsxGJGypryDJgOqUy8erw=; b=LtN6/VCx6jiwzGw5krqN/qrTbqD7CiXDy2VFxfYPe6LvIB40rmSN7NBhvCzFPDPijW si4CcBeuj9d3uloAEquZxQ2Pz3aSZFAm+YmbsZ3lsjsMQCthg6KzNb7v7xyUP/MZ285h qeFtX/g1X19JGNnuaMQ1gxvIkvpo/DyKDgz0fiNICQc4ndUF0lhdmMvj76SEsyVBB7py ZWp221+AOUJGFnzPEge0vh71Obq8uOrVIU2DgE3GdWBe0LiRQnKLnzE33hCRuARlbvOi +F67ZLXI/xj5xNpDUR6RXaxtX6mT2E63pjCLRq9fdfVgera0VdeYHGV354USnFCX5eEL x0Ew== X-Gm-Message-State: AOAM532Bhkaus6qVGKQm0zpI8+gB3ccd7USkyFblYvqc4lDH8BkCSrIG tWSE5RnDizrqhHOLy3lDn22XrbxI5p0HZ68ruLmwrK0OgQ9lEbjvsAfpo7yzIvEUzSoC8NJ5kSm FYSSo5SIlkhaczYIKThQbF99rpL7rw7AUiN4FNAhkkxd5O4kzp58R59+0yHYAI1/2z3vDFbf4Ci Wx7A== X-Google-Smtp-Source: ABdhPJyASex81k3HDJucza6OcTSFv/+7eoeK0N3rkaFEUo62Na5RWQJ6bx/Zc1bpCfCMHJrbLHqnfIBsQg== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:6214:178b:: with SMTP id ct11mr31930552qvb.61.1621237917265; Mon, 17 May 2021 00:51:57 -0700 (PDT) Date: Mon, 17 May 2021 08:51:23 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-16-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 15/16] arm64: Fix cache maintenance function comments 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_005158_967770_C955DF25 X-CRM114-Status: GOOD ( 11.19 ) 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 Fix and expand comments for the cache maintenance functions in cacheflush.h. Adds comments to functions that weren't described before. Explains what the functions do using Arm Architecture Reference Manual terminology. No functional change intended. Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/cacheflush.h | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 70b389a8dea5..4b91d3530013 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -30,31 +30,44 @@ * the implementation assumes non-aliasing VIPT D-cache and (aliasing) * VIPT I-cache. * - * flush_icache_range(start, end) - * - * Ensure coherency between the I-cache and the D-cache in the - * region described by start, end. + * All functions below apply to the region described by [start, end) * - start - virtual start address * - end - virtual end address * - * invalidate_icache_range(start, end) + * __flush_icache_range(start, end) * - * Invalidate the I-cache in the region described by start, end. - * - start - virtual start address - * - end - virtual end address + * Ensure coherency between the I-cache and the D-cache region to + * the Point of Unification. * * __flush_cache_user_range(start, end) * - * Ensure coherency between the I-cache and the D-cache in the - * region described by start, end. - * - start - virtual start address - * - end - virtual end address + * Ensure coherency between the I-cache and the D-cache region to + * the Point of Unification. + * Use only if the region might access user memory. + * + * invalidate_icache_range(start, end) + * + * Invalidate I-cache region to the Point of Unification. * * __flush_dcache_area(start, end) * - * Ensure that the data held in page is written back. - * - start - virtual start address - * - end - virtual end address + * Clean and invalidate D-cache region to the Point of Coherence. + * + * __inval_dcache_area(start, end) + * + * Invalidate D-cache region to the Point of Coherence. + * + * __clean_dcache_area_poc(start, end) + * + * Clean D-cache region to the Point of Coherence. + * + * __clean_dcache_area_pop(start, end) + * + * Clean D-cache region to the Point of Persistence. + * + * __clean_dcache_area_pou(start, end) + * + * Clean D-cache region to the Point of Unification. */ extern void __flush_icache_range(unsigned long start, unsigned long end); extern void invalidate_icache_range(unsigned long start, unsigned long end); From patchwork Mon May 17 07:51:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12261129 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, 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 08ACFC433B4 for ; Mon, 17 May 2021 08:10:38 +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 5D7856117A for ; Mon, 17 May 2021 08:10:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D7856117A 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=TZpulpYiE6ISwO74YqbUFgvjrI00gO3WcKbS4f/i5Hw=; b=jeW9qTV6RhrJ+5 F32Ll369WrGkfz6eDSP34vI2n4GVM14lt0Ibuc94qdx4ppOz6HoOcYG0FeTzepSWMgpS+kVNgi3hR iJLhescdFO5kmGDAO5qmasT0ff8xwXXKw/DHHvq/AHTOtgtCaBqQHMlLYQAmIU7MRNGRxcLii9Jam xy43Afn6wfO9Z/Lpq8AXDlT3J6XesSdbBIagLMVZP58y1zy6L66tHRzsjHTlFpOaHMPoFkxkjlm6L BHCuDyb7gr2ifdqiMR9jcL+cwty78pUU0Y/oRU/ApGuDGIlRj22+Tt/+a9oe/R0DGYCngahLJsKux YnLzj/tmCyMnjIBk1HpA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liYFJ-00E9ph-Ug; Mon, 17 May 2021 08:05:03 +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 1liY2n-00E6jH-U6 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:52:06 +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=Wqkywr/ziiX3fT8JDLFQqU4winhSjx0EehV/GpsK8g4=; b=xQ+SlIv/pxik8xmcuXj9+LjAR5 5AImbsJVVKXV+o/QLLwnIsBrOjcbrGzSwTcRzFI6W6tiV/BxhColOplmoDp6aX7dh+0qswoEusj1t l4D61QkJfHfrwYi7AaSh4sV5LCFbRwSvooT5u1ZpYBfbv0RlafJUXrBV58QiWVV+trsGq4AuMBfIj 3zJwFuw1ztHQOxDQFS6QHli+b1GLSxH9ugiXB+LESdOXFyNIvkF9msgdmfS8kKcWWsbPeRk3rcXNR EbeFevgGHtBN8zGblTbNL+nJ40ZtRJZV7Ybnef5PbZ4FPjWZHSW4AAc+BPMYyJkNKIsM/+nzXEAX7 JXyheF5g==; Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liY2j-00DZ0v-Br for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:52:04 +0000 Received: by mail-wr1-x449.google.com with SMTP id j33-20020adf91240000b029010e4009d2ffso3469851wrj.0 for ; Mon, 17 May 2021 00:52:00 -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=Wqkywr/ziiX3fT8JDLFQqU4winhSjx0EehV/GpsK8g4=; b=npLFIrzDjFVWT9Pl9xZfBV2bafY6sAcOkzt8zllXwLJrNFGPhDdrZuf6+mS0ksAY9s xfvwpl6u8YREMl/xI/OhX1rLGID+mNEd4Egq1XiKiyEPmNywh4hEwdUDvZVYGEUi7RiV 2GGdRSVcFbYVpJ8FNYgoOBsrMXGi8oAvWI9tXX4EyKpvZgIFG9xvO4uoYlVrMG61Mcs+ SgL+PdBlW6xIXPiJv7cGTOKHBpyPY+AlAtfgf0jyN7tbaaEKdMtu4ziLfxmWjuvCUIQn WSzY3F6dfaR7juIFt6mpZyawsGugycncYtSS9yk5IgY3HLPZODFz/J6hIE1oWc28rh21 IK6A== 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=Wqkywr/ziiX3fT8JDLFQqU4winhSjx0EehV/GpsK8g4=; b=njYvclYywjIO/+uFYPdfhpAQ0QSJ9LUE7JXgpyPU6YQgCu/5C0WG4OJOCek0UnZqAY iy+t5UhOBEVMxOFT4m6nMx12c4pMrRmXwFvm0/uirwIOQWx1PEdP5g52BjUzk0JlRoUR QmNhgJ/KD7ym9rL/Mkh5It44AYZ8llfSJDNO3A5s5mlPInBn2zcLbdCSVNQzhdWwCnIt eR7pXvkK0K9NnQoakt+iWCVRfNSlcUol/6ldXIv8nI6Kop5gftSaGkELud6NsifkyPj+ ZLbLUMP/qmPFlx4h+GfRuTH6RgBLgU/JxJMPM4KI9p+WgoyihvFox5uT0N8WkfcRoS/D 151w== X-Gm-Message-State: AOAM533ZUyU0G+EjG40Zt4pxghuKJz6Qqz4VT1iFBGGPXfN6+LzaObni mRWrVv7j8jwQIyLuxcq1z7vu9wTpZW+iFEBNg9J1QyIokkleAPHYtRRQEy4tvRNtozqdZrZYmqd tvVEHSdcXHz5jLMQhe7530B5fbNTPL2DAI+LIZLdds69uclM+uuEOoTfuCKnWTWj/XJ/Hpv+bw9 EQVg== X-Google-Smtp-Source: ABdhPJyNavS5hZ0NFg5Yywsf0F61iACpUaemqlJH5IqwG6hZkggRoxypqetjZ7/xxJJol9mvZIBODTdkuQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a05:600c:4104:: with SMTP id j4mr1939317wmi.104.1621237919345; Mon, 17 May 2021 00:51:59 -0700 (PDT) Date: Mon, 17 May 2021 08:51:24 +0100 In-Reply-To: <20210517075124.152151-1-tabba@google.com> Message-Id: <20210517075124.152151-17-tabba@google.com> Mime-Version: 1.0 References: <20210517075124.152151-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 16/16] arm64: Rename arm64-internal cache maintenance functions 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_005201_453709_776C8AFE X-CRM114-Status: GOOD ( 25.64 ) 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 Although naming across the codebase isn't that consistent, it tends to follow certain patterns. Moreover, the term "flush" isn't defined in the Arm Architecture reference manual, and might be interpreted to mean clean, invalidate, or both for a cache. Rename arm64-internal functions to make the naming internally consistent, as well as making it consistent with the Arm ARM, by specifying whether it applies to the instruction, data, or both caches, whether the operation is a clean, invalidate, or both. Also specify which point the operation applies to, i.e., to the point of unification (PoU), coherence (PoC), or persistence (PoP). This commit applies the following sed transformation to all files under arch/arm64: "s/\b__flush_cache_range\b/caches_clean_inval_pou_macro/g;"\ "s/\b__flush_icache_range\b/caches_clean_inval_pou/g;"\ "s/\binvalidate_icache_range\b/icache_inval_pou/g;"\ "s/\b__flush_dcache_area\b/dcache_clean_inval_poc/g;"\ "s/\b__inval_dcache_area\b/dcache_inval_poc/g;"\ "s/__clean_dcache_area_poc\b/dcache_clean_poc/g;"\ "s/\b__clean_dcache_area_pop\b/dcache_clean_pop/g;"\ "s/\b__clean_dcache_area_pou\b/dcache_clean_pou/g;"\ "s/\b__flush_cache_user_range\b/caches_clean_inval_user_pou/g;"\ "s/\b__flush_icache_all\b/icache_inval_all_pou/g;" Note that __clean_dcache_area_poc is deliberately missing a word boundary check at the beginning in order to match the efistub symbols in image-vars.h. Also note that, despite its name, __flush_icache_range operates on both instruction and data caches. The name change here reflects that. No functional change intended. Signed-off-by: Fuad Tabba --- arch/arm64/include/asm/arch_gicv3.h | 2 +- arch/arm64/include/asm/cacheflush.h | 36 +++++++++--------- arch/arm64/include/asm/efi.h | 2 +- arch/arm64/include/asm/kvm_mmu.h | 6 +-- arch/arm64/kernel/alternative.c | 2 +- arch/arm64/kernel/efi-entry.S | 4 +- arch/arm64/kernel/head.S | 8 ++-- arch/arm64/kernel/hibernate-asm.S | 4 +- arch/arm64/kernel/hibernate.c | 12 +++--- arch/arm64/kernel/idreg-override.c | 2 +- arch/arm64/kernel/image-vars.h | 2 +- arch/arm64/kernel/insn.c | 2 +- arch/arm64/kernel/kaslr.c | 6 +-- arch/arm64/kernel/machine_kexec.c | 10 ++--- arch/arm64/kernel/smp.c | 4 +- arch/arm64/kernel/smp_spin_table.c | 4 +- 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 | 2 +- arch/arm64/kvm/hyp/nvhe/tlb.c | 2 +- arch/arm64/kvm/hyp/pgtable.c | 4 +- arch/arm64/lib/uaccess_flushcache.c | 4 +- arch/arm64/mm/cache.S | 58 ++++++++++++++--------------- arch/arm64/mm/flush.c | 12 +++--- 25 files changed, 98 insertions(+), 98 deletions(-) diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h index ed1cc9d8e6df..4ad22c3135db 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -125,7 +125,7 @@ static inline u32 gic_read_rpr(void) #define gic_write_lpir(v, c) writeq_relaxed(v, c) #define gic_flush_dcache_to_poc(a,l) \ - __flush_dcache_area((unsigned long)(a), (unsigned long)(a)+(l)) + dcache_clean_inval_poc((unsigned long)(a), (unsigned long)(a)+(l)) #define gits_read_baser(c) readq_relaxed(c) #define gits_write_baser(v, c) writeq_relaxed(v, c) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 4b91d3530013..885bda37b805 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -34,54 +34,54 @@ * - start - virtual start address * - end - virtual end address * - * __flush_icache_range(start, end) + * caches_clean_inval_pou(start, end) * * Ensure coherency between the I-cache and the D-cache region to * the Point of Unification. * - * __flush_cache_user_range(start, end) + * caches_clean_inval_user_pou(start, end) * * Ensure coherency between the I-cache and the D-cache region to * the Point of Unification. * Use only if the region might access user memory. * - * invalidate_icache_range(start, end) + * icache_inval_pou(start, end) * * Invalidate I-cache region to the Point of Unification. * - * __flush_dcache_area(start, end) + * dcache_clean_inval_poc(start, end) * * Clean and invalidate D-cache region to the Point of Coherence. * - * __inval_dcache_area(start, end) + * dcache_inval_poc(start, end) * * Invalidate D-cache region to the Point of Coherence. * - * __clean_dcache_area_poc(start, end) + * dcache_clean_poc(start, end) * * Clean D-cache region to the Point of Coherence. * - * __clean_dcache_area_pop(start, end) + * dcache_clean_pop(start, end) * * Clean D-cache region to the Point of Persistence. * - * __clean_dcache_area_pou(start, end) + * dcache_clean_pou(start, end) * * Clean D-cache region to the Point of Unification. */ -extern void __flush_icache_range(unsigned long start, unsigned long end); -extern void invalidate_icache_range(unsigned long start, unsigned long end); -extern void __flush_dcache_area(unsigned long start, unsigned long end); -extern void __inval_dcache_area(unsigned long start, unsigned long end); -extern void __clean_dcache_area_poc(unsigned long start, unsigned long end); -extern void __clean_dcache_area_pop(unsigned long start, unsigned long end); -extern void __clean_dcache_area_pou(unsigned long start, unsigned long end); -extern long __flush_cache_user_range(unsigned long start, unsigned long end); +extern void caches_clean_inval_pou(unsigned long start, unsigned long end); +extern void icache_inval_pou(unsigned long start, unsigned long end); +extern void dcache_clean_inval_poc(unsigned long start, unsigned long end); +extern void dcache_inval_poc(unsigned long start, unsigned long end); +extern void dcache_clean_poc(unsigned long start, unsigned long end); +extern void dcache_clean_pop(unsigned long start, unsigned long end); +extern void dcache_clean_pou(unsigned long start, unsigned long end); +extern long caches_clean_inval_user_pou(unsigned long start, unsigned long end); extern void sync_icache_aliases(unsigned long start, unsigned long end); static inline void flush_icache_range(unsigned long start, unsigned long end) { - __flush_icache_range(start, end); + caches_clean_inval_pou(start, end); /* * IPI all online CPUs so that they undergo a context synchronization @@ -135,7 +135,7 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *, #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 extern void flush_dcache_page(struct page *); -static __always_inline void __flush_icache_all(void) +static __always_inline void icache_inval_all_pou(void) { if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) return; diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 0ae2397076fd..1bed37eb013a 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -137,7 +137,7 @@ void efi_virtmap_unload(void); static inline void efi_capsule_flush_cache_range(void *addr, int size) { - __flush_dcache_area((unsigned long)addr, (unsigned long)addr + size); + dcache_clean_inval_poc((unsigned long)addr, (unsigned long)addr + size); } #endif /* _ASM_EFI_H */ diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 33293d5855af..f4cbfa9025a8 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -181,7 +181,7 @@ static inline void *__kvm_vector_slot2addr(void *base, struct kvm; #define kvm_flush_dcache_to_poc(a,l) \ - __flush_dcache_area((unsigned long)(a), (unsigned long)(a)+(l)) + dcache_clean_inval_poc((unsigned long)(a), (unsigned long)(a)+(l)) static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu) { @@ -209,12 +209,12 @@ static inline void __invalidate_icache_guest_page(kvm_pfn_t pfn, { if (icache_is_aliasing()) { /* any kind of VIPT cache */ - __flush_icache_all(); + icache_inval_all_pou(); } else if (is_kernel_in_hyp_mode() || !icache_is_vpipt()) { /* PIPT or VPIPT at EL2 (see comment in __kvm_tlb_flush_vmid_ipa) */ void *va = page_address(pfn_to_page(pfn)); - invalidate_icache_range((unsigned long)va, + icache_inval_pou((unsigned long)va, (unsigned long)va + size); } } diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index c906d20c7b52..3fb79b76e9d9 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -181,7 +181,7 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu */ if (!is_module) { dsb(ish); - __flush_icache_all(); + icache_inval_all_pou(); isb(); /* Ignore ARM64_CB bit from feature mask */ diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 72e6a580290a..6668bad21f86 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S @@ -29,7 +29,7 @@ SYM_CODE_START(efi_enter_kernel) */ ldr w1, =kernel_size add x1, x0, x1 - bl __clean_dcache_area_poc + bl dcache_clean_poc ic ialluis /* @@ -38,7 +38,7 @@ SYM_CODE_START(efi_enter_kernel) */ adr x0, 0f adr x1, 3f - bl __clean_dcache_area_poc + bl dcache_clean_poc 0: /* Turn off Dcache and MMU */ mrs x0, CurrentEL diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 8df0ac8d9123..6928cb67d3a0 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -118,7 +118,7 @@ SYM_CODE_START_LOCAL(preserve_boot_args) // MMU off add x1, x0, #0x20 // 4 x 8 bytes - b __inval_dcache_area // tail call + b dcache_inval_poc // tail call SYM_CODE_END(preserve_boot_args) /* @@ -268,7 +268,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables) */ adrp x0, init_pg_dir adrp x1, init_pg_end - bl __inval_dcache_area + bl dcache_inval_poc /* * Clear the init page tables. @@ -381,11 +381,11 @@ SYM_FUNC_START_LOCAL(__create_page_tables) adrp x0, idmap_pg_dir adrp x1, idmap_pg_end - bl __inval_dcache_area + bl dcache_inval_poc adrp x0, init_pg_dir adrp x1, init_pg_end - bl __inval_dcache_area + bl dcache_inval_poc ret x28 SYM_FUNC_END(__create_page_tables) diff --git a/arch/arm64/kernel/hibernate-asm.S b/arch/arm64/kernel/hibernate-asm.S index ef2ab7caf815..81c0186a5e32 100644 --- a/arch/arm64/kernel/hibernate-asm.S +++ b/arch/arm64/kernel/hibernate-asm.S @@ -45,7 +45,7 @@ * Because this code has to be copied to a 'safe' page, it can't call out to * other functions by PC-relative address. Also remember that it may be * mid-way through over-writing other functions. For this reason it contains - * code from __flush_icache_range() and uses the copy_page() macro. + * code from caches_clean_inval_pou() and uses the copy_page() macro. * * This 'safe' page is mapped via ttbr0, and executed from there. This function * switches to a copy of the linear map in ttbr1, performs the restore, then @@ -87,7 +87,7 @@ SYM_CODE_START(swsusp_arch_suspend_exit) copy_page x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 add x1, x10, #PAGE_SIZE - /* Clean the copied page to PoU - based on __flush_icache_range() */ + /* Clean the copied page to PoU - based on caches_clean_inval_pou() */ raw_dcache_line_size x2, x3 sub x3, x2, #1 bic x4, x10, x3 diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index b40ddce71507..46a0b4d6e251 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -210,7 +210,7 @@ static int create_safe_exec_page(void *src_start, size_t length, return -ENOMEM; memcpy(page, src_start, length); - __flush_icache_range((unsigned long)page, (unsigned long)page + length); + caches_clean_inval_pou((unsigned long)page, (unsigned long)page + length); rc = trans_pgd_idmap_page(&trans_info, &trans_ttbr0, &t0sz, page); if (rc) return rc; @@ -381,17 +381,17 @@ int swsusp_arch_suspend(void) ret = swsusp_save(); } else { /* Clean kernel core startup/idle code to PoC*/ - __flush_dcache_area((unsigned long)__mmuoff_data_start, + dcache_clean_inval_poc((unsigned long)__mmuoff_data_start, (unsigned long)__mmuoff_data_end); - __flush_dcache_area((unsigned long)__idmap_text_start, + dcache_clean_inval_poc((unsigned long)__idmap_text_start, (unsigned long)__idmap_text_end); /* Clean kvm setup code to PoC? */ if (el2_reset_needed()) { - __flush_dcache_area( + dcache_clean_inval_poc( (unsigned long)__hyp_idmap_text_start, (unsigned long)__hyp_idmap_text_end); - __flush_dcache_area((unsigned long)__hyp_text_start, + dcache_clean_inval_poc((unsigned long)__hyp_text_start, (unsigned long)__hyp_text_end); } @@ -477,7 +477,7 @@ int swsusp_arch_resume(void) * The hibernate exit text contains a set of el2 vectors, that will * be executed at el2 with the mmu off in order to reload hyp-stub. */ - __flush_dcache_area((unsigned long)hibernate_exit, + dcache_clean_inval_poc((unsigned long)hibernate_exit, (unsigned long)hibernate_exit + exit_size); /* diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 3dd515baf526..53a381a7f65d 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -237,7 +237,7 @@ asmlinkage void __init init_feature_override(void) for (i = 0; i < ARRAY_SIZE(regs); i++) { if (regs[i]->override) - __flush_dcache_area((unsigned long)regs[i]->override, + dcache_clean_inval_poc((unsigned long)regs[i]->override, (unsigned long)regs[i]->override + sizeof(*regs[i]->override)); } diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h index bcf3c2755370..c96a9a0043bf 100644 --- a/arch/arm64/kernel/image-vars.h +++ b/arch/arm64/kernel/image-vars.h @@ -35,7 +35,7 @@ __efistub_strnlen = __pi_strnlen; __efistub_strcmp = __pi_strcmp; __efistub_strncmp = __pi_strncmp; __efistub_strrchr = __pi_strrchr; -__efistub___clean_dcache_area_poc = __pi___clean_dcache_area_poc; +__efistub_dcache_clean_poc = __pi_dcache_clean_poc; #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) __efistub___memcpy = __pi_memcpy; diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index 6c0de2f60ea9..51cb8dc98d00 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c @@ -198,7 +198,7 @@ int __kprobes aarch64_insn_patch_text_nosync(void *addr, u32 insn) ret = aarch64_insn_write(tp, insn); if (ret == 0) - __flush_icache_range((uintptr_t)tp, + caches_clean_inval_pou((uintptr_t)tp, (uintptr_t)tp + AARCH64_INSN_SIZE); return ret; diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index 49cccd03cb37..cfa2cfde3019 100644 --- a/arch/arm64/kernel/kaslr.c +++ b/arch/arm64/kernel/kaslr.c @@ -72,7 +72,7 @@ u64 __init kaslr_early_init(void) * we end up running with module randomization disabled. */ module_alloc_base = (u64)_etext - MODULES_VSIZE; - __flush_dcache_area((unsigned long)&module_alloc_base, + dcache_clean_inval_poc((unsigned long)&module_alloc_base, (unsigned long)&module_alloc_base + sizeof(module_alloc_base)); @@ -172,10 +172,10 @@ u64 __init kaslr_early_init(void) module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; module_alloc_base &= PAGE_MASK; - __flush_dcache_area((unsigned long)&module_alloc_base, + dcache_clean_inval_poc((unsigned long)&module_alloc_base, (unsigned long)&module_alloc_base + sizeof(module_alloc_base)); - __flush_dcache_area((unsigned long)&memstart_offset_seed, + dcache_clean_inval_poc((unsigned long)&memstart_offset_seed, (unsigned long)&memstart_offset_seed + sizeof(memstart_offset_seed)); diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index eadb0b189348..aad4078650fd 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -72,10 +72,10 @@ int machine_kexec_post_load(struct kimage *kimage) * For execution with the MMU off and I-cache on, reloc_code needs to be * cleaned to the PoC and invalidated from the I-cache. */ - __flush_dcache_area((unsigned long)reloc_code, + dcache_clean_inval_poc((unsigned long)reloc_code, (unsigned long)reloc_code + arm64_relocate_new_kernel_size); - invalidate_icache_range((uintptr_t)reloc_code, + icache_inval_pou((uintptr_t)reloc_code, (uintptr_t)reloc_code + arm64_relocate_new_kernel_size); @@ -111,7 +111,7 @@ static void kexec_list_flush(struct kimage *kimage) unsigned long addr; /* flush the list entries. */ - __flush_dcache_area((unsigned long)entry, + dcache_clean_inval_poc((unsigned long)entry, (unsigned long)entry + sizeof(kimage_entry_t)); @@ -128,7 +128,7 @@ static void kexec_list_flush(struct kimage *kimage) break; case IND_SOURCE: /* flush the source pages. */ - __flush_dcache_area(addr, addr + PAGE_SIZE); + dcache_clean_inval_poc(addr, addr + PAGE_SIZE); break; case IND_DESTINATION: break; @@ -155,7 +155,7 @@ static void kexec_segment_flush(const struct kimage *kimage) kimage->segment[i].memsz, kimage->segment[i].memsz / PAGE_SIZE); - __flush_dcache_area( + dcache_clean_inval_poc( (unsigned long)phys_to_virt(kimage->segment[i].mem), (unsigned long)phys_to_virt(kimage->segment[i].mem) + kimage->segment[i].memsz); diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 5fcdee331087..9b4c1118194d 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -122,7 +122,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) secondary_data.task = idle; secondary_data.stack = task_stack_page(idle) + THREAD_SIZE; update_cpu_boot_status(CPU_MMU_OFF); - __flush_dcache_area((unsigned long)&secondary_data, + dcache_clean_inval_poc((unsigned long)&secondary_data, (unsigned long)&secondary_data + sizeof(secondary_data)); @@ -145,7 +145,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) pr_crit("CPU%u: failed to come online\n", cpu); secondary_data.task = NULL; secondary_data.stack = NULL; - __flush_dcache_area((unsigned long)&secondary_data, + dcache_clean_inval_poc((unsigned long)&secondary_data, (unsigned long)&secondary_data + sizeof(secondary_data)); status = READ_ONCE(secondary_data.status); diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c index 58d804582a35..7e1624ecab3c 100644 --- a/arch/arm64/kernel/smp_spin_table.c +++ b/arch/arm64/kernel/smp_spin_table.c @@ -36,7 +36,7 @@ static void write_pen_release(u64 val) unsigned long size = sizeof(secondary_holding_pen_release); secondary_holding_pen_release = val; - __flush_dcache_area((unsigned long)start, (unsigned long)start + size); + dcache_clean_inval_poc((unsigned long)start, (unsigned long)start + size); } @@ -90,7 +90,7 @@ static int smp_spin_table_cpu_prepare(unsigned int cpu) * the boot protocol. */ writeq_relaxed(pa_holding_pen, release_addr); - __flush_dcache_area((__force unsigned long)release_addr, + dcache_clean_inval_poc((__force unsigned long)release_addr, (__force unsigned long)release_addr + sizeof(*release_addr)); diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index 265fe3eb1069..db5159a3055f 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c @@ -41,7 +41,7 @@ __do_compat_cache_op(unsigned long start, unsigned long end) dsb(ish); } - ret = __flush_cache_user_range(start, start + chunk); + ret = caches_clean_inval_user_pou(start, start + chunk); if (ret) return ret; diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 1cb39c0803a4..c1953f65ca0e 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1064,7 +1064,7 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, if (!cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) stage2_unmap_vm(vcpu->kvm); else - __flush_icache_all(); + icache_inval_all_pou(); } vcpu_reset_hcr(vcpu); diff --git a/arch/arm64/kvm/hyp/nvhe/cache.S b/arch/arm64/kvm/hyp/nvhe/cache.S index 36cef6915428..958734f4d6b0 100644 --- a/arch/arm64/kvm/hyp/nvhe/cache.S +++ b/arch/arm64/kvm/hyp/nvhe/cache.S @@ -7,7 +7,7 @@ #include #include -SYM_FUNC_START_PI(__flush_dcache_area) +SYM_FUNC_START_PI(dcache_clean_inval_poc) dcache_by_line_op civac, sy, x0, x1, x2, x3 ret -SYM_FUNC_END_PI(__flush_dcache_area) +SYM_FUNC_END_PI(dcache_clean_inval_poc) diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c index 5dffe928f256..8143ebd4fb72 100644 --- a/arch/arm64/kvm/hyp/nvhe/setup.c +++ b/arch/arm64/kvm/hyp/nvhe/setup.c @@ -134,7 +134,7 @@ static void update_nvhe_init_params(void) for (i = 0; i < hyp_nr_cpus; i++) { params = per_cpu_ptr(&kvm_init_params, i); params->pgd_pa = __hyp_pa(pkvm_pgtable.pgd); - __flush_dcache_area((unsigned long)params, + dcache_clean_inval_poc((unsigned long)params, (unsigned long)params + sizeof(*params)); } } diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c index 83dc3b271bc5..38ed0f6f2703 100644 --- a/arch/arm64/kvm/hyp/nvhe/tlb.c +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c @@ -104,7 +104,7 @@ void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, * you should be running with VHE enabled. */ if (icache_is_vpipt()) - __flush_icache_all(); + icache_inval_all_pou(); __tlb_switch_to_host(&cxt); } diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 10d2f04013d4..e9ad7fb28ee3 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -841,7 +841,7 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, if (need_flush) { kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops); - __flush_dcache_area((unsigned long)pte_follow, + dcache_clean_inval_poc((unsigned long)pte_follow, (unsigned long)pte_follow + kvm_granule_size(level)); } @@ -997,7 +997,7 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, return 0; pte_follow = kvm_pte_follow(pte, mm_ops); - __flush_dcache_area((unsigned long)pte_follow, + dcache_clean_inval_poc((unsigned long)pte_follow, (unsigned long)pte_follow + kvm_granule_size(level)); return 0; diff --git a/arch/arm64/lib/uaccess_flushcache.c b/arch/arm64/lib/uaccess_flushcache.c index 62ea989effe8..baee22961bdb 100644 --- a/arch/arm64/lib/uaccess_flushcache.c +++ b/arch/arm64/lib/uaccess_flushcache.c @@ -15,7 +15,7 @@ void memcpy_flushcache(void *dst, const void *src, size_t cnt) * barrier to order the cache maintenance against the memcpy. */ memcpy(dst, src, cnt); - __clean_dcache_area_pop((unsigned long)dst, (unsigned long)dst + cnt); + dcache_clean_pop((unsigned long)dst, (unsigned long)dst + cnt); } EXPORT_SYMBOL_GPL(memcpy_flushcache); @@ -33,6 +33,6 @@ unsigned long __copy_user_flushcache(void *to, const void __user *from, rc = raw_copy_from_user(to, from, n); /* See above */ - __clean_dcache_area_pop((unsigned long)to, (unsigned long)to + n - rc); + dcache_clean_pop((unsigned long)to, (unsigned long)to + n - rc); return rc; } diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index fbf003b956cc..c74fe985c60c 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -15,7 +15,7 @@ #include /* - * __flush_cache_range(start,end) [needs_uaccess] + * caches_clean_inval_pou_macro(start,end) [needs_uaccess] * * Ensure that the I and D caches are coherent within specified region. * This is typically used when code has been written to a memory region, @@ -25,7 +25,7 @@ * - end - virtual end address of region * - needs_uaccess - (macro parameter) might access user space memory */ -.macro __flush_cache_range, needs_uaccess +.macro caches_clean_inval_pou_macro, needs_uaccess alternative_if ARM64_HAS_CACHE_IDC dsb ishst b 7f @@ -62,7 +62,7 @@ alternative_else_nop_endif .endm /* - * __flush_icache_range(start,end) + * caches_clean_inval_pou(start,end) * * Ensure that the I and D caches are coherent within specified region. * This is typically used when code has been written to a memory region, @@ -71,12 +71,12 @@ alternative_else_nop_endif * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START(__flush_icache_range) - __flush_cache_range needs_uaccess=0 -SYM_FUNC_END(__flush_icache_range) +SYM_FUNC_START(caches_clean_inval_pou) + caches_clean_inval_pou_macro needs_uaccess=0 +SYM_FUNC_END(caches_clean_inval_pou) /* - * __flush_cache_user_range(start,end) + * caches_clean_inval_user_pou(start,end) * * Ensure that the I and D caches are coherent within specified region. * This is typically used when code has been written to a memory region, @@ -85,21 +85,21 @@ SYM_FUNC_END(__flush_icache_range) * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START(__flush_cache_user_range) +SYM_FUNC_START(caches_clean_inval_user_pou) uaccess_ttbr0_enable x2, x3, x4 - __flush_cache_range needs_uaccess=1 + caches_clean_inval_pou_macro needs_uaccess=1 uaccess_ttbr0_disable x1, x2 -SYM_FUNC_END(__flush_cache_user_range) +SYM_FUNC_END(caches_clean_inval_user_pou) /* - * invalidate_icache_range(start,end) + * icache_inval_pou(start,end) * * Ensure that the I cache is invalid within specified region. * * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START(invalidate_icache_range) +SYM_FUNC_START(icache_inval_pou) alternative_if ARM64_HAS_CACHE_DIC isb ret @@ -107,10 +107,10 @@ alternative_else_nop_endif invalidate_icache_by_line x0, x1, x2, x3, 0, 0f ret -SYM_FUNC_END(invalidate_icache_range) +SYM_FUNC_END(icache_inval_pou) /* - * __flush_dcache_area(start, end) + * dcache_clean_inval_poc(start, end) * * Ensure that any D-cache lines for the interval [start, end) * are cleaned and invalidated to the PoC. @@ -118,13 +118,13 @@ SYM_FUNC_END(invalidate_icache_range) * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START_PI(__flush_dcache_area) +SYM_FUNC_START_PI(dcache_clean_inval_poc) dcache_by_line_op civac, sy, x0, x1, x2, x3 ret -SYM_FUNC_END_PI(__flush_dcache_area) +SYM_FUNC_END_PI(dcache_clean_inval_poc) /* - * __clean_dcache_area_pou(start, end) + * dcache_clean_pou(start, end) * * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoU. @@ -132,17 +132,17 @@ SYM_FUNC_END_PI(__flush_dcache_area) * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START(__clean_dcache_area_pou) +SYM_FUNC_START(dcache_clean_pou) alternative_if ARM64_HAS_CACHE_IDC dsb ishst ret alternative_else_nop_endif dcache_by_line_op cvau, ish, x0, x1, x2, x3 ret -SYM_FUNC_END(__clean_dcache_area_pou) +SYM_FUNC_END(dcache_clean_pou) /* - * __inval_dcache_area(start, end) + * dcache_inval_poc(start, end) * * Ensure that any D-cache lines for the interval [start, end) * are invalidated. Any partial lines at the ends of the interval are @@ -152,7 +152,7 @@ SYM_FUNC_END(__clean_dcache_area_pou) * - end - kernel end address of region */ SYM_FUNC_START_LOCAL(__dma_inv_area) -SYM_FUNC_START_PI(__inval_dcache_area) +SYM_FUNC_START_PI(dcache_inval_poc) /* FALLTHROUGH */ /* @@ -177,11 +177,11 @@ SYM_FUNC_START_PI(__inval_dcache_area) b.lo 2b dsb sy ret -SYM_FUNC_END_PI(__inval_dcache_area) +SYM_FUNC_END_PI(dcache_inval_poc) SYM_FUNC_END(__dma_inv_area) /* - * __clean_dcache_area_poc(start, end) + * dcache_clean_poc(start, end) * * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoC. @@ -190,7 +190,7 @@ SYM_FUNC_END(__dma_inv_area) * - end - virtual end address of region */ SYM_FUNC_START_LOCAL(__dma_clean_area) -SYM_FUNC_START_PI(__clean_dcache_area_poc) +SYM_FUNC_START_PI(dcache_clean_poc) /* FALLTHROUGH */ /* @@ -200,11 +200,11 @@ SYM_FUNC_START_PI(__clean_dcache_area_poc) */ dcache_by_line_op cvac, sy, x0, x1, x2, x3 ret -SYM_FUNC_END_PI(__clean_dcache_area_poc) +SYM_FUNC_END_PI(dcache_clean_poc) SYM_FUNC_END(__dma_clean_area) /* - * __clean_dcache_area_pop(start, end) + * dcache_clean_pop(start, end) * * Ensure that any D-cache lines for the interval [start, end) * are cleaned to the PoP. @@ -212,13 +212,13 @@ SYM_FUNC_END(__dma_clean_area) * - start - virtual start address of region * - end - virtual end address of region */ -SYM_FUNC_START_PI(__clean_dcache_area_pop) +SYM_FUNC_START_PI(dcache_clean_pop) alternative_if_not ARM64_HAS_DCPOP - b __clean_dcache_area_poc + b dcache_clean_poc alternative_else_nop_endif dcache_by_line_op cvap, sy, x0, x1, x2, x3 ret -SYM_FUNC_END_PI(__clean_dcache_area_pop) +SYM_FUNC_END_PI(dcache_clean_pop) /* * __dma_flush_area(start, size) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 143f625e7727..5fea9a3f6663 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -17,14 +17,14 @@ void sync_icache_aliases(unsigned long start, unsigned long end) { if (icache_is_aliasing()) { - __clean_dcache_area_pou(start, end); - __flush_icache_all(); + dcache_clean_pou(start, end); + icache_inval_all_pou(); } else { /* * Don't issue kick_all_cpus_sync() after I-cache invalidation * for user mappings. */ - __flush_icache_range(start, end); + caches_clean_inval_pou(start, end); } } @@ -76,20 +76,20 @@ EXPORT_SYMBOL(flush_dcache_page); /* * Additional functions defined in assembly. */ -EXPORT_SYMBOL(__flush_icache_range); +EXPORT_SYMBOL(caches_clean_inval_pou); #ifdef CONFIG_ARCH_HAS_PMEM_API void arch_wb_cache_pmem(void *addr, size_t size) { /* Ensure order against any prior non-cacheable writes */ dmb(osh); - __clean_dcache_area_pop((unsigned long)addr, (unsigned long)addr + size); + dcache_clean_pop((unsigned long)addr, (unsigned long)addr + size); } EXPORT_SYMBOL_GPL(arch_wb_cache_pmem); void arch_invalidate_pmem(void *addr, size_t size) { - __inval_dcache_area((unsigned long)addr, (unsigned long)addr + size); + dcache_inval_poc((unsigned long)addr, (unsigned long)addr + size); } EXPORT_SYMBOL_GPL(arch_invalidate_pmem); #endif