From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4954F2572 for ; Tue, 18 Apr 2023 12:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3B1FC433D2; Tue, 18 Apr 2023 12:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681821627; bh=zKIvtOe1Alz4MwME8rOlBXRtWuePbmqJq7eVf7NcSKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhxNMBWcBGFUlTDwjkBVDuZqnyl+SilnETXgrR7eHY5EZOfCgIuax6vNa6oBGuncb yEeHUTmUjkM3A9/bnMbXhxs1Ld2YRCHgXS9P/1P2cexsDLOsWMBTdtsdF9vc2BtzYW qZm+vZ675a9Q/jeGMg21V70bslOnziBEMzpkluFg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sheng Feng , Yicong Yang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 42/91] i2c: hisi: Avoid redundant interrupts Date: Tue, 18 Apr 2023 14:21:46 +0200 Message-Id: <20230418120307.040358252@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418120305.520719816@linuxfoundation.org> References: <20230418120305.520719816@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Yicong Yang [ Upstream commit cc9812a3096d1986caca9a23bee99effc45c08df ] After issuing all the messages we can disable the TX_EMPTY interrupts to avoid handling redundant interrupts. For doing a sinlge bus detection (i2cdetect -y -r 0) we can reduce ~97% interrupts (before ~12000 after ~400). Signed-off-by: Sheng Feng Signed-off-by: Yicong Yang Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-hisi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c index 72e43ecaff133..1f406e6f4ece3 100644 --- a/drivers/i2c/busses/i2c-hisi.c +++ b/drivers/i2c/busses/i2c-hisi.c @@ -315,6 +315,13 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr) max_write == 0) break; } + + /* + * Disable the TX_EMPTY interrupt after finishing all the messages to + * avoid overwhelming the CPU. + */ + if (ctlr->msg_tx_idx == ctlr->msg_num) + hisi_i2c_disable_int(ctlr, HISI_I2C_INT_TX_EMPTY); } static irqreturn_t hisi_i2c_irq(int irq, void *context) -- 2.39.2