[{"id":3681279,"web_url":"http://patchwork.ozlabs.org/comment/3681279/","msgid":"<20260423061319.GF557136@black.igk.intel.com>","list_archive_url":null,"date":"2026-04-23T06:13:19","subject":"Re: [PATCH v2] i2c: designware: Handle active slave and shutdown\n cleanly","submitter":{"id":14534,"url":"http://patchwork.ozlabs.org/api/people/14534/","name":"Mika Westerberg","email":"mika.westerberg@linux.intel.com"},"content":"Hi,\n\nOn Wed, Apr 22, 2026 at 05:51:05PM -0700, William A. Kennington III wrote:\n> When the I2C master attempts a new transaction while the slave\n> controller is shutting down or restarting, it can lead to bus lockups\n> and system bootloops if the hardware enters an inconsistent state.\n> \n> Address this by ensuring that the internal state machines are properly\n> cleared when disabling the controller if slave activity is detected.\n> \n> Additionally, add a shutdown hook that gracefully sets the slave\n> disable bit before disabling the controller. This guarantees that any\n> incoming requests from the master are immediately NACKed during\n> shutdown, preventing the bus from hanging.\n\nCan you split this into two patches? One that deals with the host side and\nthe other that deals with the target shutdown.\n\nThe code itself looks good to me.","headers":{"Return-Path":"\n <linux-i2c+bounces-17135-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-i2c@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=BVcS/Ll7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-i2c+bounces-17135-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"BVcS/Ll7\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=192.198.163.14","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1Qky5t4Sz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 16:13:30 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 3FB993016481\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 06:13:27 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 420E838F926;\n\tThu, 23 Apr 2026 06:13:24 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.14])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 418381D6BB;\n\tThu, 23 Apr 2026 06:13:22 +0000 (UTC)","from fmviesa007.fm.intel.com ([10.60.135.147])\n  by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Apr 2026 23:13:21 -0700","from black.igk.intel.com ([10.91.253.5])\n  by fmviesa007.fm.intel.com with ESMTP; 22 Apr 2026 23:13:20 -0700","by black.igk.intel.com (Postfix, from userid 1001)\n\tid 5277E95; Thu, 23 Apr 2026 08:13:19 +0200 (CEST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776924803; cv=none;\n b=fYvY/CKUo1lGbTMibi9dv2kZZDoSY2pORN/1898oG1ASlbMAHhLXp75tn67oCQ8c4Dzh6JGHpBI34BOvZbegxwmiC8AlTNNasFqiObAGFb16dXk4QqJRljQZB1BSsq7/TcJMWPipwtEEuHR2SyirQudw65sszSIEUIKhEfJ9sQg=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776924803; c=relaxed/simple;\n\tbh=5b2ItsEOgcrpNt0Dj/TgBabMgHWL6V3RlJmmFOodDvA=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=VRAnqYqBwv5Rw7pjlKT9d6kjDEGFI2yfBpnK7Lhlc1p2FEbtTQ55J4hp1j1UsYiytllLgssAU9J9/tYyrUFCljON6CAieB4T5jI0k5Ahtt4/dCpxS/tcx+5/cw7m9q6EPFIfN5I/uUv4huIc13rPJ2GZN+Z427LRU8yp3AhkOYM=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=BVcS/Ll7; arc=none smtp.client-ip=192.198.163.14","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1776924802; x=1808460802;\n  h=date:from:to:cc:subject:message-id:references:\n   mime-version:in-reply-to;\n  bh=5b2ItsEOgcrpNt0Dj/TgBabMgHWL6V3RlJmmFOodDvA=;\n  b=BVcS/Ll7kH8Cf9J9zT62nwa1Am3eCCF50J+APPhVyr0elBKTvXZgAvr5\n   CopfJWHFD4Ura76cWucoVE49CjTN7wZv/wT5JURCtFxo/lD2euTHIYIHn\n   +ivhcqaUaOuHLiXJmxV2JniY1g2bD4QibL6HT5S8LQ0N6t6NCsx0fWqDM\n   AMKhkxAEiZ0CfKwWW6JF9i5iV/SaiszmX6HWXKmN/JP2jd+GzznENubs1\n   Znj60FKveP96kVxv/ifT5acFHtYejwCXaXn+lH4WC7ZIwCiYi25ifQyw1\n   8P8VZ9lSnB7y7DkFHHvAA451cuIOT20qth9mYnH2tLf/MghLD/6CQ05j2\n   g==;","X-CSE-ConnectionGUID":["PtXfH+ufTxytLcPC/8YrRw==","RQ6g6nP6QT6e/snlAYtd6g=="],"X-CSE-MsgGUID":["zV8nLrlBTFGSyF30IBvdPA==","7oGI0EWsR22f4gIlwy9kJQ=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11764\"; a=\"77947132\"","E=Sophos;i=\"6.23,194,1770624000\";\n   d=\"scan'208\";a=\"77947132\"","E=Sophos;i=\"6.23,194,1770624000\";\n   d=\"scan'208\";a=\"229384630\""],"X-ExtLoop1":"1","Date":"Thu, 23 Apr 2026 08:13:19 +0200","From":"Mika Westerberg <mika.westerberg@linux.intel.com>","To":"\"William A. Kennington III\" <william@wkennington.com>","Cc":"Andy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tJan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,\n\tlinux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"Re: [PATCH v2] i2c: designware: Handle active slave and shutdown\n cleanly","Message-ID":"<20260423061319.GF557136@black.igk.intel.com>","References":"<20260423002838.83171-1-william@wkennington.com>\n <20260423005241.89054-1-william@wkennington.com>","Precedence":"bulk","X-Mailing-List":"linux-i2c@vger.kernel.org","List-Id":"<linux-i2c.vger.kernel.org>","List-Subscribe":"<mailto:linux-i2c+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-i2c+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260423005241.89054-1-william@wkennington.com>"}},{"id":3681309,"web_url":"http://patchwork.ozlabs.org/comment/3681309/","msgid":"<aenNnI4XGHMHr9-I@ashevche-desk.local>","list_archive_url":null,"date":"2026-04-23T07:43:24","subject":"Re: [PATCH v2] i2c: designware: Handle active slave and shutdown\n cleanly","submitter":{"id":8583,"url":"http://patchwork.ozlabs.org/api/people/8583/","name":"Andy Shevchenko","email":"andriy.shevchenko@linux.intel.com"},"content":"On Wed, Apr 22, 2026 at 05:51:05PM -0700, William A. Kennington III wrote:\n> When the I2C master attempts a new transaction while the slave\n> controller is shutting down or restarting, it can lead to bus lockups\n> and system bootloops if the hardware enters an inconsistent state.\n> \n> Address this by ensuring that the internal state machines are properly\n> cleared when disabling the controller if slave activity is detected.\n> \n> Additionally, add a shutdown hook that gracefully sets the slave\n> disable bit before disabling the controller. This guarantees that any\n> incoming requests from the master are immediately NACKed during\n> shutdown, preventing the bus from hanging.\n\n\nDo not send a new version:\n- inside the same email thread as the previous one(s)\n- too early, give 24h+ _at least_ to others to have a chance to look into it\n\nAccording to the split I think you can do it in a way that it goes like this\n- introducing shutdown exported function (and use it as is)\n- convert PCI driver to use it\n- convert platform driver to use it\n- do something for target case\n\n...\n\n>  static struct pci_driver dw_i2c_driver = {\n>  \t.name\t\t= DRIVER_NAME,\n>  \t.probe\t\t= i2c_dw_pci_probe,\n>  \t.remove\t\t= i2c_dw_pci_remove,\n\n> -\t.driver         = {\n> +\t.driver\t\t= {\n\nStray change.\n\n...","headers":{"Return-Path":"\n <linux-i2c+bounces-17140-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-i2c@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=msCoAUHB;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-i2c+bounces-17140-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"msCoAUHB\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=192.198.163.17","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1SnK6HT9z1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 17:45:41 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 62605301051B\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 07:43:31 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 3398830C61B;\n\tThu, 23 Apr 2026 07:43:30 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6989C21CC5A;\n\tThu, 23 Apr 2026 07:43:28 +0000 (UTC)","from fmviesa005.fm.intel.com ([10.60.135.145])\n  by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Apr 2026 00:43:28 -0700","from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost)\n ([10.245.244.163])\n  by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Apr 2026 00:43:26 -0700"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776930209; cv=none;\n b=CL9LDAj0e8eHfhI0pRLqHC13yOai5LEGgEKuC2femASZWSxLYCovPwqoicSHNo9Fkq+TSQ3691is1UL+Tgod05mUywfcdQmPb4ELrbW9jZMhYGBWA+P3E974Ssfj/3jAdVzqzHwAnG+49DYP715JkSLazKsh8Dp+F4/KbPxT0bI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776930209; c=relaxed/simple;\n\tbh=J4dHfOTUKeJ9GEIQxOV2nPqCssixcNbK2lkF7nAVRgM=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=OGXTkr0oFWWYl+lxcR0rS2NY2BqbRFEmgMpljCz+57me3am14J8R0/LHPThgX67+Jdh5PtHdG8uhxEV3MudO8BjUEVlIlS0CJKGG/S9a+RXD2KwmyG449J6dxTak6YyU6mHgpwdLoa5Yqytwc0FrFQU0WddBn9bS1OZtKAPba0M=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=msCoAUHB; arc=none smtp.client-ip=192.198.163.17","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1776930208; x=1808466208;\n  h=date:from:to:cc:subject:message-id:references:\n   mime-version:in-reply-to;\n  bh=J4dHfOTUKeJ9GEIQxOV2nPqCssixcNbK2lkF7nAVRgM=;\n  b=msCoAUHBofioRTQxSPRxq7KdItz9Qyei9WAGABFNrcYa4CNnNUteeTPD\n   Be0c2tXfqJBuY+fTra4794QYurEezAEkHfJuuHv2TZEmfstdBUpSV7qgs\n   IiMDP6ZoHVmKhbsHv1XUyBIWwkGkrdBvfv1lqBa865Oh9+Cp5LFLjZZKR\n   gv44irPXLpL3IXhMf3Rd5OPr5SeYmU7LhcEYG4Aru1zkKReefzrBuQxLg\n   8k/uMuSz89ZslY9ohY9Jw1cQtxPP79Xjlrhem+jodPQUSRkk0Q2qoi8JL\n   nicIDY5LOplCShw7fVkzrisfiDMVxJI5hvlsdgRvRViRkUNwWmrA9BL1d\n   g==;","X-CSE-ConnectionGUID":["oJT8S/rhTFqFE2M/+MGhdA==","C/qPYpEET06KVb2dKuFEUQ=="],"X-CSE-MsgGUID":["lxET+Is3RpGcOrRMF13p8g==","HPMHtiCCQx2ax9C7kB3EJw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11764\"; a=\"77771792\"","E=Sophos;i=\"6.23,194,1770624000\";\n   d=\"scan'208\";a=\"77771792\"","E=Sophos;i=\"6.23,194,1770624000\";\n   d=\"scan'208\";a=\"237568776\""],"X-ExtLoop1":"1","Date":"Thu, 23 Apr 2026 10:43:24 +0300","From":"Andy Shevchenko <andriy.shevchenko@linux.intel.com>","To":"\"William A. Kennington III\" <william@wkennington.com>","Cc":"Mika Westerberg <mika.westerberg@linux.intel.com>,\n\tJan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,\n\tlinux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"Re: [PATCH v2] i2c: designware: Handle active slave and shutdown\n cleanly","Message-ID":"<aenNnI4XGHMHr9-I@ashevche-desk.local>","References":"<20260423002838.83171-1-william@wkennington.com>\n <20260423005241.89054-1-william@wkennington.com>","Precedence":"bulk","X-Mailing-List":"linux-i2c@vger.kernel.org","List-Id":"<linux-i2c.vger.kernel.org>","List-Subscribe":"<mailto:linux-i2c+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-i2c+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260423005241.89054-1-william@wkennington.com>","Organization":"Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6\n krs, Bertel Jungin Aukio 5, 02600 Espoo"}}]