Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4905326iob; Mon, 9 May 2022 04:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ9J6cMjvIqK4vtstg8tVwltv/w1V/xXU81jpM7wOAc1ESW2oTWLyWLl08aeaP/08b3FSZ X-Received: by 2002:a63:84c7:0:b0:3c6:3d5b:16a8 with SMTP id k190-20020a6384c7000000b003c63d5b16a8mr12717616pgd.598.1652096016488; Mon, 09 May 2022 04:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652096016; cv=none; d=google.com; s=arc-20160816; b=m/Ozr4q6w95CjxcNW6k6GG4fjj8GVPPpNQPeT6UEeZm3iEr7+ze+UCQeSHfZDMeSDK lVzeg3gZBHdLcEmKIm3t7Gwd4wVtuXHeTwxvqe9DeNJkqf8ZlmHdboap6mYqgTb9cpRT Ui7gaqZCHJZ1VJXHpt/jwX+pZHVZnbaf1PFSGlYLx2pv+H6cGHEV99BXJWoESdtUUEJ2 +LFWyRo0+YHj1xby1rj/SkXzzersvq35p4cQUFrd5weI9ek1kGsLBfByX2BVY7DC0Jn0 lkS6JRL5SHUD7b+6sPMqMq1vOvCbOCg+xlOKt+ZmQr+N2lql/P/KAqWpCkK52hsnef6C wuyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HWB0yXDI9Uz/f9K/2OQxmglybW38tD6vXzDCgDy8K60=; b=UT1zcRuq5cRMU4VYOYsLms8GI2I4crAlbknATRbm46KDEPaQMRHnjxrgk5J9OF3i/O /Cgnxy/JhjZZ94/aRQPM3fEa7HbcdBFoJ7+n3HhNeglAoghEFNv3EtFJGPNaWnam60Xe kL91Oco8LajvV+FiWOIfTfw3MSikQ9Pzhoaa2Rqz17SNzd4L5Y7L2SLRpDvNSTvgNlmn Cs5ttgTT/5OGgP7VWg1eZi4oO9NY7MNVzLTkbOkAT0EVqpJqmytrJFDG/ZL1u21dp+wT cp7UANEHX6b0VpVtnb2Dv6GvgF2HajffQUP4Cqs0FnPYz+lMGsWqC5BXpNRN9liRA9DJ FOvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JhehAjvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s27-20020a63af5b000000b003c4a040f5bfsi14592456pgo.321.2022.05.09.04.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:33:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JhehAjvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DEFDE210884; Mon, 9 May 2022 03:38:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235418AbiEIGkM (ORCPT + 99 others); Mon, 9 May 2022 02:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235008AbiEIGec (ORCPT ); Mon, 9 May 2022 02:34:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF0A2ED for ; Sun, 8 May 2022 23:30:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0ADF2B80EA8 for ; Mon, 9 May 2022 06:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B594C385AB; Mon, 9 May 2022 06:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652077836; bh=DXieFXLBq4ieE8RkkoZNSW7FjctpJuOTdLRbxH7qdmU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JhehAjvyCcEicKiJYLuxM7jPXqRXdGrDQ7YZxKRrouELMebcz7yCCBUice324qwyw Rtuw+alC+f5y6hO4rLt3/aEMUNzSA0nsL0Ec3D8YAaapVa8uB6cO1n7txMmJPSItyk v68AKRI2x4bc98kxfcR3Ea+XijDESyg1xQUXnrQR2hdztrkqMPAGmlAPQkowRlGhNH 6QZm7MYN+sUCL1mAPqreqyfJI/M365LdiTl3Dsh4/nCGKbIknaHd9zEiVRHBZnnTv4 6M3jmnZvrev9JhCcVhJc05QjwCr5s4/qLUpJZm3z8wv7U4WaT3w+gcBZt9aWg3YwnQ Je4iUr+fKIT7Q== Date: Mon, 9 May 2022 12:00:32 +0530 From: Vinod Koul To: Bard Liao Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, srinivas.kandagatla@linaro.org, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, bard.liao@intel.com Subject: Re: [PATCH] soundwire: cadence: recheck device0 attachment after status change Message-ID: References: <20220420023039.14144-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220420023039.14144-1-yung-chuan.liao@linux.intel.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-04-22, 10:30, Bard Liao wrote: > From: Pierre-Louis Bossart > > This patch adds a status check after device0 attachment to solve race > conditions observed during attachment with multiple devices per link > > The sequence is the following > > 1) deviceA attaches as device0 > > 2) the hardware detects a device0 status change and throws an > interrupt. > > 3) the interrupt handler schedules the work function > > 4) the workqueue starts, we read the status > slave0 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT0); > slave1 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT1); > > we deal with the status change and program deviceA device number to a > non-zero value. > > 5) deviceB attaches as device0, the device0 status seen by the > hardware does not change. > > 6) we clear the CDNS_MCP_SLAVE_INTSTAT0/1 registers -> we will never detect > deviceB! > > This patch suggest re-checking in a loop the device0 status with a > PING frame, i.e. using the real device0 status instead of information > on status changes. Applied, thanks -- ~Vinod