From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9B0683B6C18; Thu, 17 Sep 2026 18:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668360; cv=none; b=DrREPQMp3nySnwUoJlxHXd33K9FQq/6b+XHkKL4whLHUvU6+Ob/jmtnPDta/zp1dj0sJiYex3zm7UqqFcrphO9kDjn78KtHe4R3Eihjlrl2dGaSer2WjlbNkZ00bXqY1sh94FQnNDTpdhma1zvFi4f/IGaEimAUN3j7r5YLQxb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668360; c=relaxed/simple; bh=ZvT0IZLU0KvtFKNM9/vd3Y5ySCFC/G/QusaoOMRvqz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tWYHZhQEFHH8aggz/D9GXWF8658eJaeI5mnFd+9HFnAVd/R14niEzIw3jXq2HThIf4oBF1pdN0IckcyUdSZtLdc3Vq7KNfGtTq5PhpGSdFRk8vlPHqSAd1rM/F+3R2S9Y8aopDbOEvkRX4s4hIwLD2mFGpoDNDNnxYBDOmla1qY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e8GU9TVC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="e8GU9TVC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED8AF1F000FF; Thu, 17 Sep 2026 18:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789668359; bh=A6rJFrMIua96U/C0LEWQvmDodlkosgBLMXFTA1g9Cnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e8GU9TVCHD67QerD3bhn+LPq7bJ44AMmXaNwCIkeuXX46hzOnzCqU89EF/qlVRM+/ CTbmoMflzVUhDigmmqMZfW1heXxA+K2NL9Hb5oq8jWZCeKJPkoLXE9323kdduF5jwn EI9bkU3hifBYbdqzYcRajNr6QotXmtmqQYxIRXwE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Liang Hao , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.12 0398/1102] gpio: dwapb: Mask interrupts at hardware initialization Date: Thu, 17 Sep 2026 16:05:41 +0100 Message-ID: <20260917151549.651976094@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liang Hao [ Upstream commit aaf7766ba3b99a3834319e7cf939838afc705574 ] GPIO interrupts may retain stale state across warm reboots when peripherals remain powered. If a GPIO line is not explicitly configured for interrupts, this can result in interrupt storms due to missing handlers. Fix this by ensuring all interrupts are masked and disabled at hardware initialization time via the init_hw() callback. Pending interrupts are also cleared to start from a known-safe state. Interrupts will be unmasked only when explicitly configured by userspace or kernel drivers. Signed-off-by: Liang Hao Link: https://patch.msgid.link/20260705074759.47863-1-haohlliang@gmail.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-dwapb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 798235791f701..4ab26c0775ea1 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -199,6 +199,22 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs) dwapb_write(gpio, GPIO_INT_POLARITY, pol); } +static int dwapb_irq_init_hw(struct gpio_chip *gc) +{ + struct dwapb_gpio *gpio = to_dwapb_gpio(gc); + + /* + * GPIO interrupts may retain stale state across warm reboots when + * peripherals stay powered. Force a known-safe state before the GPIO + * irqchip and irq domain are set up. + */ + dwapb_write(gpio, GPIO_INTEN, 0); + dwapb_write(gpio, GPIO_INTMASK, 0xffffffff); + dwapb_write(gpio, GPIO_PORTA_EOI, 0xffffffff); + + return 0; +} + static u32 dwapb_do_irq(struct dwapb_gpio *gpio) { struct gpio_chip *gc = &gpio->ports[0].gc; @@ -461,6 +477,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, girq = &gc->irq; girq->handler = handle_bad_irq; girq->default_type = IRQ_TYPE_NONE; + girq->init_hw = dwapb_irq_init_hw; port->pirq = pirq; -- 2.53.0