From patchwork Mon Aug 17 15:09:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 D2226C433E5 for ; Mon, 17 Aug 2020 19:50:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98FFA20658 for ; Mon, 17 Aug 2020 19:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597693808; bh=hmGUy8w0cLtdEL/msXrPDeDPNv/L7vWmHiRZZOHBCTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fiFij5a2jjNkSJo8KpecmELls+yEgWS7Q0G/SPfw2ce3B5SPBmsx5w+LctrrqG+Xj MqSsLUWpITBQfsiGZWhJxoNraFGwkBF6jhz4l0VQGyoS99bF9AZCqeYoAdnluVoOa5 ReyixsaMzLdu2i+DnBpaAZS0BcxNn76PH4cPH3Kg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404405AbgHQTuH (ORCPT ); Mon, 17 Aug 2020 15:50:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:41178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729233AbgHQPTh (ORCPT ); Mon, 17 Aug 2020 11:19:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7845220709; Mon, 17 Aug 2020 15:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677576; bh=hmGUy8w0cLtdEL/msXrPDeDPNv/L7vWmHiRZZOHBCTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D63MBAEa1yi+Tk3Yg1hd+WfNtykA5Xyi8g3zDfelTphxNRPAEHZmIimCgHi2MPlyZ aqHNkxS9fXQ+fygjUbxmO2QDKoYEm8sqSHBf0nL/4j0dK8Sl3GfIQgafVcsNQ0d8bO N/3siVHexl+W1uoijeBySSCEBXjZC97ngplj4mSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Finn Thain , Stan Johnson , Joshua Thompson , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.8 032/464] m68k: mac: Dont send IOP message until channel is idle Date: Mon, 17 Aug 2020 17:09:45 +0200 Message-Id: <20200817143835.291235577@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Finn Thain [ Upstream commit aeb445bf2194d83e12e85bf5c65baaf1f093bd8f ] In the following sequence of calls, iop_do_send() gets called when the "send" channel is not in the IOP_MSG_IDLE state: iop_ism_irq() iop_handle_send() (msg->handler)() iop_send_message() iop_do_send() Avoid this by testing the channel state before calling iop_do_send(). When sending, and iop_send_queue is empty, call iop_do_send() because the channel is idle. If iop_send_queue is not empty, iop_do_send() will get called later by iop_handle_send(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Finn Thain Tested-by: Stan Johnson Cc: Joshua Thompson Link: https://lore.kernel.org/r/6d667c39e53865661fa5a48f16829d18ed8abe54.1590880333.git.fthain@telegraphics.com.au Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/mac/iop.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index d3775afb0f076..754f6478c30d0 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -415,7 +415,8 @@ static void iop_handle_send(uint iop_num, uint chan) msg->status = IOP_MSGSTATUS_UNUSED; msg = msg->next; iop_send_queue[iop_num][chan] = msg; - if (msg) iop_do_send(msg); + if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) + iop_do_send(msg); } /* @@ -489,16 +490,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, if (!(q = iop_send_queue[iop_num][chan])) { iop_send_queue[iop_num][chan] = msg; + iop_do_send(msg); } else { while (q->next) q = q->next; q->next = msg; } - if (iop_readb(iop_base[iop_num], - IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) { - iop_do_send(msg); - } - return 0; }