From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 34E8A3E3D9A for ; Thu, 25 Jun 2026 12:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782391241; cv=none; b=MuV3MI2xEwuEKkqsy7CNCEnONT4R+tzVAeLR4MWCR2phyi1HXFfryIn7MxGNa1no2nZ0I3FZx1BnwM469bt/Edxrt6ON+qMJcVVTiJ7e6bCufn79dcFY2b+ZjqvBXRFRZ2TJUujv4bpY1guYdFuVZjo+IzrUuKfPjV9GkrmaVCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782391241; c=relaxed/simple; bh=8FQRBaZNq7IzG4werkwkDR5b324eM5qckDb+vhtZ8WE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nP4mG0jFORa4dvZ7tSnDN/LnvLFRu979Rdr6cMeq+tLne5aqtmAN/mDighOxTSgb1px83gSHTfgdoDFTH//P9TFiVOw8W01ugpuwUMeghs2wNfosFA2bGj13odDxOYTEL7Rfw7upyVZoS9nmyNoC3Vt77iKCVnYxxxHXSH1CMuA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=WGv3oOvj; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="WGv3oOvj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1782391233; bh=8FQRBaZNq7IzG4werkwkDR5b324eM5qckDb+vhtZ8WE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WGv3oOvjPl4+pGv86VWSNAy06OShKJewULyiIzOdtrbviROsKSMuBdqkN8PmrDsnF 5XlVbsR4UkNseiFMqjEq8W2rX5sSs/z45H33EOHi6LA5mDllMSDNLzPBuct2rwiNGP MSCIUBCAR6vb2eXkWTYUwEMiILRD+qJ8KbEAKJsumviROOGhDxX2tZgKG0ozv5iEE7 zDtU+fLUyQsI2RFcZeCW786JbTl3RKutk2dMZsedEQqRfLClmIIqCnk2zLL2NZ6L5y /v3R3ayBYbjj59NUzaRMSWD+V4QWkybs4UapY7SOXsaqukXYS48n0+OCT4tITCC5bh NFCHgNOSFCPOg== Received: from fedora-2.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id E2E6C17E10FC; Thu, 25 Jun 2026 14:40:32 +0200 (CEST) From: Boris Brezillon Date: Thu, 25 Jun 2026 14:40:31 +0200 Subject: [PATCH 05/11] drm/panthor: Fix theoretical IOMEM access in suspended state Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260625-panthor-misc-fixes-v1-5-b67ed973fea6@collabora.com> References: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> In-Reply-To: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> To: Steven Price , Liviu Dudau Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Nicolas Frattaroli , Chia-I Wu , Karunika Choo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Boris Brezillon , sashiko-bot@kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1782391229; l=2117; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=8FQRBaZNq7IzG4werkwkDR5b324eM5qckDb+vhtZ8WE=; b=EVeWGGQR6QubyOrJS4vjd67iiditdRBtHSEfX6Sjysc5BuDjkUl6G9YQo+VqEWwRHLkY0zygQ CLBebdN76jqCKxCf0MGEnCkrE+71PaqWBGl0ErCxtslsK/tzPVceZ7A X-Developer-Key: i=boris.brezillon@collabora.com; a=ed25519; pk=eN+ORdOgQY7d5U+0kA8h5bf67XdD8bhKbjD/TCHexSY= In theory, our hardirq handler can be called while the device (and thus the panthor_irq) is suspended, because the IRQ line is shared. In practice though, in all the designs we've seen, the line is only shared within the GPU, and because sub-component suspend state is consistent (all-suspended or all-resumed), we shouldn't end up with an interrupt triggered while we're suspended. Fix the problem anyway, if nothing else, for our sanity. Fixes: 0b2d86670a84 ("drm/panthor: Rework panthor_irq::suspended into panthor_irq::state") Reported-by: sashiko-bot@kernel.org Closes: https://sashiko.dev/#/patchset/20260625-panthor-signal-from-irq-v4-0-3d2908912afa@collabora.com?part=1 Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h index 35679bfa1f3a..a39386bd6382 100644 --- a/drivers/gpu/drm/panthor/panthor_device.h +++ b/drivers/gpu/drm/panthor/panthor_device.h @@ -512,9 +512,6 @@ static irqreturn_t panthor_ ## __name ## _irq_raw_handler(int irq, void *data) struct panthor_irq *pirq = data; \ enum panthor_irq_state old_state; \ \ - if (!gpu_read(pirq->iomem, INT_STAT)) \ - return IRQ_NONE; \ - \ guard(spinlock_irqsave)(&pirq->mask_lock); \ old_state = atomic_cmpxchg(&pirq->state, \ PANTHOR_IRQ_STATE_ACTIVE, \ @@ -522,6 +519,13 @@ static irqreturn_t panthor_ ## __name ## _irq_raw_handler(int irq, void *data) if (old_state != PANTHOR_IRQ_STATE_ACTIVE) \ return IRQ_NONE; \ \ + if (!gpu_read(pirq->iomem, INT_STAT)) { \ + atomic_cmpxchg(&pirq->state, \ + PANTHOR_IRQ_STATE_PROCESSING, \ + PANTHOR_IRQ_STATE_ACTIVE); \ + return IRQ_NONE; \ + } \ + \ gpu_write(pirq->iomem, INT_MASK, 0); \ return IRQ_WAKE_THREAD; \ } \ -- 2.54.0