From patchwork Mon Jul 12 06:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 473791 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 7EF4CC11F66 for ; Mon, 12 Jul 2021 07:30:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 624FD61407 for ; Mon, 12 Jul 2021 07:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344457AbhGLHdk (ORCPT ); Mon, 12 Jul 2021 03:33:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:36898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344552AbhGLH3f (ORCPT ); Mon, 12 Jul 2021 03:29:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BB9361627; Mon, 12 Jul 2021 07:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074734; bh=/s/Wi3g9RFrPpOho4vGcaAawlTYvpho1ws/v91kSbRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXSkxh/WQW7+H4a/r+u0Q+66Dy2/gxrndFMwICF9rn+De6r2TdLH+9uQDAUdKy7nq ppTkTf1ju92SxnYvaCS3xaZyVrVT/A7AyrsiFwEXKLVMzRVvy9rS2l9bBVTxWrXwf/ aG3w3rOjxsv+7lq1hosuf4b+//9o+6Bv5s9oIlFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Guo Ren , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.12 680/700] csky: syscache: Fixup duplicate cache flush Date: Mon, 12 Jul 2021 08:12:43 +0200 Message-Id: <20210712061048.245674502@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Guo Ren [ Upstream commit 6ea42c84f33368eb3fe1ec1bff8d7cb1a5c7b07a ] The current csky logic of sys_cacheflush is wrong, it'll cause icache flush call dcache flush again. Now fixup it with a conditional "break & fallthrough". Fixes: 997153b9a75c ("csky: Add flush_icache_mm to defer flush icache all") Fixes: 0679d29d3e23 ("csky: fix syscache.c fallthrough warning") Acked-by: Randy Dunlap Co-Developed-by: Randy Dunlap Signed-off-by: Guo Ren Cc: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/csky/mm/syscache.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/csky/mm/syscache.c b/arch/csky/mm/syscache.c index 4e51d63850c4..cd847ad62c7e 100644 --- a/arch/csky/mm/syscache.c +++ b/arch/csky/mm/syscache.c @@ -12,15 +12,17 @@ SYSCALL_DEFINE3(cacheflush, int, cache) { switch (cache) { - case ICACHE: case BCACHE: - flush_icache_mm_range(current->mm, - (unsigned long)addr, - (unsigned long)addr + bytes); - fallthrough; case DCACHE: dcache_wb_range((unsigned long)addr, (unsigned long)addr + bytes); + if (cache != BCACHE) + break; + fallthrough; + case ICACHE: + flush_icache_mm_range(current->mm, + (unsigned long)addr, + (unsigned long)addr + bytes); break; default: return -EINVAL;