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 012173B71CA for ; Fri, 26 Jun 2026 11:40:34 +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=1782474036; cv=none; b=ohVyzHDaaeUGsWrzWlz7/+cybN60gVobRA+xDX+lrU5/Mdh2jO9HW6R1TFa+VPSQ1Axhu/3jEtzJbjNDSnDWlyibfM7qtnqGAM44Sb7HsHpfQ1TYSowYQjhUXqsoT4RyxsNJWL/i3mNj148soLugO68dHjNUxnKKLM3V+FxZ5y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782474036; c=relaxed/simple; bh=ItFHcTXy/Z84JIIJJfgIO2Thrx6FCmqfpef5CRmRZc8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lpfmyIqYRhyefXuUv4qPoiTm3SzuS+e6DuUgObQ7N3R3116FWpxeDy5jbKEziTQLBmCYJQ4UuutkqJvRx9PGOGzXJuGylPV0glSPz6EQPXBK+HZN91SWntA1xFBTBt5l9tg37926ClTiNTDnD8rHU78UZpX+amKsI44EpoLbxLc= 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=jGwD1bJR; 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="jGwD1bJR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1782474033; bh=ItFHcTXy/Z84JIIJJfgIO2Thrx6FCmqfpef5CRmRZc8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jGwD1bJRrj5LfWL2ZYzurU1hT0UPXZpiPM018loMgNPA0jjtHMe++LPIbW7xFhMPS 58e/bYa09pzp4fnyQVWSD7y2KzMRx6hOJ2FasPGuI4gPwQmKlcvWHWlVrDcssqX8Ws sNqfNsYW4n4bdNQMmqDiAObrknW26W1kbeRumro5qAnh0JRr6QEcr34FNX1SgIVg+Y TIIdFBwPvb+U2vMbPZbzbkmD5UKR5Ce5y6EyWE3N8dMmdOqjRnN7S92plX3euZdk1v mXIKz68FMM2Na/9EHopPNzLWjkL++SBtHzFJ7capdAEGLeL2lih0y7C5WKnCLRkW0/ Xb25gxtqH1BMg== 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 ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 9B17517E018C; Fri, 26 Jun 2026 13:40:32 +0200 (CEST) Date: Fri, 26 Jun 2026 13:40:28 +0200 From: Boris Brezillon To: Liviu Dudau Cc: Steven Price , 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, sashiko-bot@kernel.org Subject: Re: [PATCH 05/11] drm/panthor: Fix theoretical IOMEM access in suspended state Message-ID: <20260626134028.518607ea@fedora-2.home> In-Reply-To: References: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> <20260625-panthor-misc-fixes-v1-5-b67ed973fea6@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 26 Jun 2026 10:29:54 +0100 Liviu Dudau wrote: > On Thu, Jun 25, 2026 at 02:40:31PM +0200, Boris Brezillon wrote: > > 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; \ > > + } \ > > Hmm, > > I get it that you're trying to revert the effect of the previous atomic_cmpxchg() here but it feels > like a better option would be to not do the swap at all if the state is not ACTIVE. That's what [1] does, but it's not possible until we've made this atomic -> lock-based transition, and I want a fix that's not dependent on non-Fixes patches so we can backport it. [1]https://lore.kernel.org/dri-devel/20260625-panthor-signal-from-irq-v5-8-8836a74e0ef9@collabora.com/