Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2517298pxa; Mon, 17 Aug 2020 11:36:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfeQOf5D3gul5tdi44yVKPqPLd+4Iepw1V1E4+y59OVaZnVeiccIle+eLzvD7k6bwm0j8S X-Received: by 2002:a05:6402:339:: with SMTP id q25mr15550554edw.268.1597689376486; Mon, 17 Aug 2020 11:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597689376; cv=none; d=google.com; s=arc-20160816; b=yZg8PPHlGLfiu7vI1+rh40rxLXaXMigqQDbrqVKjm7zSGf3wSf6LUo7551w2EXlZQX tGCw3/yNM4D1TDkSZMn+SfBZTJlFmnwJMVLSlDRWmVMisNhj8w0912MdbWWPH+XjAHiF u/bR3YeSzCAwm+Z74sGzleNHtYV1x0IYtT2vBj3zn83M98UTY2Xxwxl4cWaf7aDtaQLe EJkgicOw9lOL1HVMorDjngrSTygPiofLIOiNLBzIt7Pg+P5nGzZ6NdjsY80+BiA/EcPv DMyyr+MHHIJDc/K1MVOq0T0MGJTNMo+ovRcm5ZOyj1pNlz25niWxTgwR9dombhnSv9f+ Nsdw== 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=N1YrmSuxo1KVinvNSEr/7G2grutvSCRpgEaDuE3TmFTXp3IwXb+x4m6PJQwGBamPUb b0mFSuy8wIS148eAVYhcSiv4WyspTBXi5dEU9bTZGTvSykLIeIiX8WVs7qTkqjGrGeXH 1mmB8sviub2yxX38K5Uo2/aWpzYy+t65js0gUnTeIbkqm2ohQvx10wo05bCPnAQpP6Ds PuHR/CPrBFsMhHZKwvOOSB00h6DKvatiyxyDbhKUzekQYbGgyutk8y80uM9woks3c13V thOXBGWpMC3PDRK7vHrATIzm9E7kargw32QXEPzg5US36sv/1ViWZD9dht1kZzeT/3it 1vtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jcyUZR5B; 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 b31si12601176edf.456.2020.08.17.11.35.53; Mon, 17 Aug 2020 11:36:16 -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=jcyUZR5B; 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 S2391225AbgHQSeF (ORCPT + 99 others); Mon, 17 Aug 2020 14:34:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:47702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731012AbgHQQAW (ORCPT ); Mon, 17 Aug 2020 12:00:22 -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 758A6208E4; Mon, 17 Aug 2020 16:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680022; bh=LgP2OlZL56NdcDzxmOX1Pp5E0+D4FDy8ClRGYt4r8wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcyUZR5BktA4pA7fiRMXb9XgNw05HKDpJ6n3dumJST+Uwm/Cx+v/RJGFaBIKUA+ec vSUqU/HStijoeXRSsYlrM1e5Tifu7xIk17VVHK152IBZTI8487AxCTLR2YlReI7Evy 89wuZUa2LHFqYLFkkm9UQ+SEfh7E7KPe1ZL6xfsk= 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.4 022/270] m68k: mac: Dont send IOP message until channel is idle Date: Mon, 17 Aug 2020 17:13:43 +0200 Message-Id: <20200817143756.888470754@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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