Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2655102pxa; Mon, 17 Aug 2020 15:38:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzk+CSqga6+rJvRFkp9u0Xgt43LtGnBbACc5GMTHIWJy1Xcu671f8Ws4y+PvNJqwwRHe847 X-Received: by 2002:a17:906:d187:: with SMTP id c7mr17692939ejz.196.1597703938131; Mon, 17 Aug 2020 15:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703938; cv=none; d=google.com; s=arc-20160816; b=RrCLkQbRD/IYAjx6RMYD1OxkNTUAvoeDUVon4hTq8/cMl2SEf85rJle72p3QhG5Crb 50pleTwfdlcALCO8VIOC9flW7VBczmTXp8WAyDlVfxji6I+lJez1mwB2srTL14kyo3I6 qkfo/Zn8C72UvAV3T5BPlHhBWC+NoNEh6pTd68dqY0mNKg8bbvtpK30+AI8ynm9zKlhN mUzgiyid7VZ+hI59DfbjrPNKKvL8JYhqfdWjfD8H3i0vp/RyGCFQWmCVb6w0h2Q++q00 C4pz6LAsACJizn+YLnjY7aqE5lMJy4dy/KU9Nm/W+eefwrZmELFgAnhZKQ3eZW6LdVCb hEiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xVr85ziSF1ow5TM7lUdQMc4GVlHFNu4u0cTvWb/xHkY=; b=wsOSRUX0GX/TK1tn+vVAjvkD4OEzr2nKZNcUUvtcWyKoLhPKppBdgX0iQJQ5uPKQL4 fPHFnAseU4U9sldkS26AprTsvT5XnWMZGlbWGr6ihgeFmgbydxYyTGnK9Rpv3Pb+aZ2k VrbQNO4rrYPRDSGAiAuTDPKrw3KfDcrxc66crobkIov5UzSEVFym4RriJhBMlGoCev4R RS3qKWXrI6+op331XMci+slAc0N7YD+sE7JSaeLtb1iwe5WYFvh3kq74ka+fkMHOghvq 9uD5MgNch1UaFNoy9NX9NcrLCVqM+uojqCGdiM+X8DNeA3aTcKdmOfjUSPazSko+OSS6 xreQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GZf9oWdc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fx18si12084304ejb.235.2020.08.17.15.38.34; Mon, 17 Aug 2020 15:38:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GZf9oWdc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731665AbgHQRyH (ORCPT + 99 others); Mon, 17 Aug 2020 13:54:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388619AbgHQQL2 (ORCPT ); Mon, 17 Aug 2020 12:11:28 -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 2D1DB22BEB; Mon, 17 Aug 2020 16:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680685; bh=LgP2OlZL56NdcDzxmOX1Pp5E0+D4FDy8ClRGYt4r8wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZf9oWdc69xAQqsgqxqbqTMJWEzNyJriEF/LwEaionSm1WC4Zm9zng71nbvW0Cld2 2H14oEIjJgS3GksKqXWHCUritoPLX/GajMfa+UYGUvHQDnrvVONzyDHSey1WlZ2q6R iU+DizbBqmISZM5jbLI/IINAy6qaR1pDkBqn8j+k= 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 4.19 016/168] m68k: mac: Dont send IOP message until channel is idle Date: Mon, 17 Aug 2020 17:15:47 +0200 Message-Id: <20200817143734.536808820@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 9bfa170157688..d8f2282978f9c 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -416,7 +416,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); } /* @@ -490,16 +491,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; } -- 2.25.1