From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66AF4C38142 for ; Mon, 23 Jan 2023 14:55:00 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8DDC5325D; Mon, 23 Jan 2023 15:54:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8DDC5325D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674485697; bh=Dwj6Ee3++ZsVsGR3kk+/mfURagVWWjWW+pweIvXcf6M=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=U7jG+ULzvxY8YBvK3eBwLIQJGFcMPdFiFi1M2aDxd6fxDbh8/vsluuSXeAzP+V+sw ON97QOiDeQ5FWUbbMiBmnham1kyXYPLVHwD3tRyxCDzCLd3R6D1vLY0P1PehUp5lbN m69CkmOYVFrbHyNgv1yy1pkUyKgXy+WKXQfXbt3k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 34383F804A9; Mon, 23 Jan 2023 15:54:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 412A5F804C2; Mon, 23 Jan 2023 15:54:06 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9F8C7F80132 for ; Mon, 23 Jan 2023 15:53:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F8C7F80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=cirrus.com header.i=@cirrus.com header.a=rsa-sha256 header.s=PODMain02222019 header.b=EnwT3GLe Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30NAP68i007057; Mon, 23 Jan 2023 08:53:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=Bx/RMP4XHYqKD8cltwOGavnKoMUm1WeokLMyFEzYkts=; b=EnwT3GLekMNE27UUzOrp6DZ2Vjkhi2ZvEpJrI9kkuTY9t8lcMaW6n7KMirCNhT8rjbpR UrBiCugy0hOKDvF/Gbl1/ktSCJsBQDPZJaedO7O9ozJu4Hz74zyUCAwav2M1ijubMLur PiTj+JB8y8JspEY8MtXDVjGPGibxfvlHw8NLAYk79omkcAo7eL9xhryRneEFdExZ2OmZ ykK5dsqNhLOlZO4jUega2QNfmQwkewBf4GQf/+rSYs1OBMD1iKYC6/lJsxjViG89/HRS GrDqGIkK7oxchyKAm2Orcx5Di/XU5F6cfAaeaTJkSayFTb8w1YiA+4G4ysiK0iIENIFF LQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3n8eb5u624-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jan 2023 08:53:55 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Mon, 23 Jan 2023 08:53:53 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.7 via Frontend Transport; Mon, 23 Jan 2023 08:53:53 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 1BD48B06; Mon, 23 Jan 2023 14:53:53 +0000 (UTC) Date: Mon, 23 Jan 2023 14:53:53 +0000 From: Charles Keepax To: Pierre-Louis Bossart Subject: Re: [PATCH 2/2] soundwire: bus: Allow SoundWire peripherals to register IRQ handlers Message-ID: <20230123145353.GX36097@ediswmail.ad.cirrus.com> References: <20230119165104.3433290-1-ckeepax@opensource.cirrus.com> <20230119165104.3433290-2-ckeepax@opensource.cirrus.com> <20230120095941.GL36097@ediswmail.ad.cirrus.com> <881088ad-95d7-2462-20d2-72a6a9d3ba68@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <881088ad-95d7-2462-20d2-72a6a9d3ba68@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-GUID: 3UlUz6r3RxxsCUMhUMY3bY03itKLaihM X-Proofpoint-ORIG-GUID: 3UlUz6r3RxxsCUMhUMY3bY03itKLaihM X-Proofpoint-Spam-Reason: safe X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, vkoul@kernel.org, sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, Jan 20, 2023 at 10:20:50AM -0600, Pierre-Louis Bossart wrote: > On 1/20/23 03:59, Charles Keepax wrote: > > On Thu, Jan 19, 2023 at 11:12:04AM -0600, Pierre-Louis Bossart wrote: > >> There should be an explanation and something checking that both are not > >> used concurrently. > > > > I will try to expand the explanation a litte, but I dont see any > > reason to block calling both handlers, no ill effects would come > > for a driver having both and it is useful if any soundwire > > specific steps are needed that arn't on other control buses. > > I think it's problematic if the peripheral tries to wake-up the manager > from clock-stop with both an in-band wake (i.e. drive the data line > high) and a separate GPIO-based interrupt. It's asking for trouble IMHO. > We spent hours in the MIPI team to make sure there were no races between > the manager-initiated restarts and peripheral-initiated restarts, adding > a 3rd mechanism in the mix gives me a migraine already. Apologies but I am struggling see why this has any bearing on the case of a device that does both an in-band and out-of-band wake. The code we are adding in this patch will only be called in the in-band case. handle_nested_irq doesn't do any hardware magic or schedule any threads, it just calls a function that was provided when the client called request_threaded_irq. The only guarantee of atomicity you have on the interrupt_callback is sdw_dev_lock and that is being held across both calls after the patch. Could you be a little more specific on what you mean by this represents a 3rd mechanism, to me this isn't a new mechanism just an extra callback? Say for example this patch added an interrupt_callback_early to sdw_slave_ops that is called just before interrupt_callback. @@ -1681,6 +1681,9 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) struct device *dev = &slave->dev; struct sdw_driver *drv = drv_to_sdw_driver(dev->driver); + if (drv->ops && drv->ops->interrupt_callback_early) + drv->ops->interrupt_callback_early(slave); + if (drv->ops && drv->ops->interrupt_callback) { slave_intr.sdca_cascade = sdca_cascade; slave_intr.control_port = clear; Would that similarly worry you? As in is it the client driver writer dealing with 2 points of entry that worries you, or something deeper relating to the IRQs? Also if it helps I could go over in a little more detail how the IRQs on our device works and why that means I would prefer to have the option to use both. There are alternatives but they arn't really as pretty. Thanks, Charles