Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp919833pxm; Thu, 3 Mar 2022 07:08:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJypRmUE+097PfE2Ut6LgN96lgsDozpPyVG1PpdiG89Kbo7pC0++mTc2Dzw/AmFmq6NiJ/Ou X-Received: by 2002:aa7:8256:0:b0:4e0:78ad:eb81 with SMTP id e22-20020aa78256000000b004e078adeb81mr38510814pfn.30.1646320092005; Thu, 03 Mar 2022 07:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646320091; cv=none; d=google.com; s=arc-20160816; b=OYSFplZZ/GxYMMh5Qg1hoqHvbC5mKocpmXxD2rGEyOxPL3XQG/McrBXcboEaXpBqPd Fwbm8n2rrqL0V0zE7lzrvqUSYv1/jv/0iVijCro/mmhnSPqW3Ouhm7QEmLEbg4Ch5BhW oxIWmsurlB5UGgRoEUgOkvU4DCbs2PmI/0MxTlF66bcO/T9Z1mcoPcQYSVUJTztStflL jKyLDss8Y/3EsveDyDUeCP7RjM7k+1jQKO3lYMZtDi9eFVx5dBZUIf9SSyA7HNxlDeiQ VfrPvCLVz+igc08Bac1nny8rfs1q4QOJyavm4lJ1bk7WvnK60juX0shPDM7ICkv0IE4x oZ9A== 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=fc3vLEogp0+yexQHdghKVF3rCbiaqj5I1VVBSOdxJ7Y=; b=VloIIBsy2cFC7KbguSZXanfhvTBYVf6QLuBLWdLpwwPaC89CKWOYL3RBIICkTz6dcP l4OQQoU7aXnZkRUZphT/oiy8YF7zWu7y3p4fHEG2hJzlvZykiqs/CqB5fqT1424d8i5g KukCshN320d6JW5trkBG0NmXKuU5ByMPXemfUj/VZ0Qu7eJjA3JvYR32SVmYPG4+LqFa iZuS0sxKfaa6CGaJxoKpNJ5Nve1NKQ0YaJK8AzmoKYqb9mF/XO+jXLdV5jqL3hdtkS5n AFlj8S20pyGDTSwTSI/nSdHUU9WvHJj09HKq7FTiCE4EBMdkHCijgMQBWxWPs9OQaLK2 UDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LbxnWVSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a17090a431000b001bc717613easi1923532pjg.85.2022.03.03.07.07.50; Thu, 03 Mar 2022 07:08:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LbxnWVSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232480AbiCCOPQ (ORCPT + 99 others); Thu, 3 Mar 2022 09:15:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbiCCOPO (ORCPT ); Thu, 3 Mar 2022 09:15:14 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691FA18C7B4; Thu, 3 Mar 2022 06:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646316869; x=1677852869; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5QG9h5lx2anIO5uIyhVHkmCiySJytsOAX/CGcMce8NM=; b=LbxnWVSe5MLrk+r0E9HQpM3q9hRl+sToWPrC+eziFpgNYkhGwgHOisJy Yskv1fe5pwch43V6V2lZ3SSv3cmdJ7eoJnLrJ6qcRaHC3b/N6SH1akHoY 1blNHAgunH0GSoB2qlXd3fit6HMGZbE6R6ZgtdrMFW8XLILNt+6ZT6TWx 2Dt2ghoVS7Ds7hUb0MFs3FGCObASTm0tnfMgGqhLAEt8GEpoq2c8FMMHI 9vnwBnGMyCSbjb0FtCQ7QHcf15xB2NKymHX86Y8DmuCcSkPAXQe/XieJV aeAS2snnVB71ewA2X92snXNkwM6nNHbwye4ZuGSl9ed31/scJlWNZLP5n Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="251258796" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="251258796" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:29 -0800 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="511442309" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:22 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nPmD0-00ApIt-Ho; Thu, 03 Mar 2022 16:13:34 +0200 Date: Thu, 3 Mar 2022 16:13:34 +0200 From: Andy Shevchenko To: Tali Perry Cc: Tyrone Ting , avifishman70@gmail.com, 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@gmail.com, arnd@arndb.de, olof@lixom.net, Tali Perry , Avi Fishman , tomer.maimon@nuvoton.com, 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=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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. > > 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. > 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. > > > > > > > + */ > > > > + if (ret == IRQ_NONE) { > > > > + npcm_i2c_eob_int(bus, false); > > > > + npcm_i2c_clear_master_status(bus); > > > > + } > > > > + > > > > + return IRQ_HANDLED; -- With Best Regards, Andy Shevchenko