Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp637054pxb; Tue, 5 Apr 2022 16:50:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Z3u2Ehpq88DMgk8mMmsDVSRTikKDxa2l4JfRsgvMCJzYvJ4/8m/agSdEvAGiHwVK/r0L X-Received: by 2002:a17:902:a60f:b0:155:efbf:1291 with SMTP id u15-20020a170902a60f00b00155efbf1291mr5810737plq.152.1649202604001; Tue, 05 Apr 2022 16:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649202603; cv=none; d=google.com; s=arc-20160816; b=ODjT3zE5D+wFewoWuEHpUVramutC3rQaglUXuQ5JIh7QPM2JqCUsU8TizrEtWecE9R xf0Y7nT3mwC0aR9vMY0X5pcoghEExtXMaH6/AqS9uauBMy2vTod/WDnLsrSQcb6Vrnhs kFI3G9/AI0U4rPFUwNhl2J8xdmKdkbaxdfIIE/UpAPKDWSFSbmkTYKx+isrVA7fqICye 8QjHorY0MXfGS7pnHoSpymuzdjSs0AmJH4CZJOfZs9oeoKlK7ID/P7nKjVVHd8FWSHhL nsh50nLsWYroLLjzSQPTofzealmqQ4Vt2CQdaFGZffLmz0U83giaAJr3UqYW6h94Q9qg otXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ndo8zFAUxl2wvyu+neEoHKWczf8UIWRjYsp1p00VkcQ=; b=elHHcNYrkqbPbWu4AZ72hU0vnp8upvtByJgmLCw+hy4ofDSCPhVsvxGmf3cqB25tSV Z04nBiSkn6HI2MUhptNJsxd8nSjsqksy75q3IYFUcwgvuAPWd7XoT38ZTOZIzdKxh1vf Tl/lHmESOxRHNZfSx2WSLBFahhKrEuljZCmzbfe4pNxk7eCmm/R6hoqtOwvOUXWV6pvi Pz4iuJE6VresGX+Vm2OKqY4JJTJSBEQgm5QwqVGzCj3xi3d3GMwfhS9mylEO/biKrXWM WZy0K0UlPuWNGUcPBGX3wsqX63GG3QmnJAdZxjykMP08M2KgKcIbfSF21zYYNuM+ggYk CElA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AEF9oBQu; 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=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m7-20020a1709026bc700b001567af75e5bsi1958753plt.517.2022.04.05.16.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:50:03 -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=@intel.com header.s=Intel header.b=AEF9oBQu; 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=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E5461168FF; Tue, 5 Apr 2022 16:34:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbiDEHR3 (ORCPT + 99 others); Tue, 5 Apr 2022 03:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231433AbiDEHPz (ORCPT ); Tue, 5 Apr 2022 03:15:55 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94BD11140; Tue, 5 Apr 2022 00:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649142829; x=1680678829; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gVevFzET9ycXC2k6vi+6fMLZJPIT3zjfXlIjZtaxpYQ=; b=AEF9oBQuzYCNFUjyz9UMl4Q7vfdSLJNzbbzzaAKwajkSNuzZrqYXG6W7 3fdDJq8qKFY9MBqT+LGIwYXWhKNlqmVjE5n799Em7ou5B0gOWDE0sHM4c dbPIqvpOk+i6i2Tmo4xZueG/JjKVL+orA4oYyQe4ZkD8Nrymh3sLw+Mjy XQ141iT3j0mDq3BwYxqecnzxYB6YLh9REXfE55Eg3XSZKTx3VDMzs4kaC QEfLHbqN+gS5M4cFSlylj4cBgdwTA+obhpkWDKxBA+Wj+a5HbwfYrXLMt eEPMtxndMC/dBg0XMzuSj+t4EpkJj1d3lwZ/27Gmlx2pDRJcl8CQ1m9cn g==; X-IronPort-AV: E=McAfee;i="6200,9189,10307"; a="241268903" X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="241268903" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 00:13:49 -0700 X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="641500699" Received: from smile.fi.intel.com ([10.237.72.59]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 00:13:43 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nbdNH-00DBjy-VC; Tue, 05 Apr 2022 10:13:11 +0300 Date: Tue, 5 Apr 2022 10:13:11 +0300 From: Andy Shevchenko To: Avi Fishman Cc: Tali Perry , Tyrone Ting , Tomer Maimon , Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Krzysztof Kozlowski , yangyicong@hisilicon.com, semen.protsenko@linaro.org, Wolfram Sang , jie.deng@intel.com, sven@svenpeter.dev, bence98@sch.bme.hu, Lukas Bulwahn , Arnd Bergmann , olof@lixom.net, Tali Perry , Avi Fishman , Tomer Maimon , KWLIU@nuvoton.com, JJLIU0@nuvoton.com, kfting@nuvoton.com, OpenBMC Maillist , Linux I2C , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v3 09/11] i2c: npcm: Handle spurious interrupts Message-ID: References: <20220303083141.8742-1-warp5tw@gmail.com> <20220303083141.8742-10-warp5tw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Apr 04, 2022 at 08:03:44PM +0300, Avi Fishman wrote: > On Thu, Mar 3, 2022 at 4:14 PM Andy Shevchenko > wrote: > > On Thu, Mar 03, 2022 at 02:48:20PM +0200, Tali Perry wrote: > > > > On Thu, Mar 3, 2022 at 12:37 PM Andy Shevchenko wrote: > > > > > On Thu, Mar 03, 2022 at 04:31:39PM +0800, Tyrone Ting wrote: > > > > > > From: Tali Perry > > > > > > > > > > > > In order to better handle spurious interrupts: > > > > > > 1. Disable incoming interrupts in master only mode. > > > > > > 2. Clear end of busy (EOB) after every interrupt. > > > > > > 3. Return correct status during interrupt. > > > > > > > > > > This is bad commit message, it doesn't explain "why" you are doing these. > > > > ... > > > > > BMC users connect a huge tree of i2c devices and muxes. > > > This tree suffers from spikes, noise and double clocks. > > > All these may cause spurious interrupts to the BMC. (1) > > > If the driver gets an IRQ which was not expected and was not handled > > > by the IRQ handler, > > > there is nothing left to do but to clear the interrupt and move on. > > > > Yes, the problem is what "move on" means in your case. > > If you get a spurious interrupts there are possibilities what's wrong: > > 1) HW bug(s) > > 2) FW bug(s) > > 3) Missed IRQ mask in the driver > > 4) Improper IRQ mask in the driver > > > > The below approach seems incorrect to me. > > Andy, What about this explanation: > On rare cases the i2c gets a spurious interrupt which means that we > enter an interrupt but in > the interrupt handler we don't find any status bit that points to the > reason we got this interrupt. > This may be a rare case of HW issue that is still under investigation. > In order to overcome this we are doing the following: > 1. Disable incoming interrupts in master mode only when slave mode is > not enabled. > 2. Clear end of busy (EOB) after every interrupt. > 3. Clear other status bits (just in case since we found them cleared) > 4. Return correct status during the interrupt that will finish the transaction. > On next xmit transaction if the bus is still busy the master will > issue a recovery process before issuing the new transaction. This sounds better, thanks. One thing to clarify, the (1) states that the HW "issue" is known and becomes a PCB level one, i.e. noisy environment that has not been properly shielded. So, if it is known, please put the reason in the commit message. Also would be good to see numbers of "rare". Is it 0.1%? > > > If the transaction failed, driver has a recovery function. > > > After that, user may retry to send the message. > > > > > > Indeed the commit message doesn't explain all this. > > > We will fix and add to the next patchset. > > > > > > > > > + /* > > > > > > + * if irq is not one of the above, make sure EOB is disabled and all > > > > > > + * status bits are cleared. > > > > > > > > > > This does not explain why you hide the spurious interrupt. > > > > > > > > > > > + */ -- With Best Regards, Andy Shevchenko