From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCDC03F5BD0 for ; Fri, 26 Jun 2026 13:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782479624; cv=none; b=aRhovM/4f1cSoLe1xfsLeW8jJuKc8W0ioSS7M9sNuent8Ahw/Li9MUJAQdDzavNuDRIn8ozVWK07qGrwAllXgnpEaT4GMIGepci2S4PSTVkFkbLjYmnnmBrvrwEmciXlv5QyEmJsqUKQrxWztEe9FWw8mSGJxwTHIDrio00r9Yc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782479624; c=relaxed/simple; bh=KZm+A3dUTVk2rUvBJtk9nlzzGKmjPS2+xc9eht5/ax4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lF42rOGCazVKSKb0Fl97bPr0XacaFeV6SjN9ZRQ6c4tZWOcT3eMw3L/1rFe2/g/WAHQ75xOY08KB4/7/pi9NX0EN4/S4vuuwdK9K75saTEbdJ0C/ocepoNSZuYu7eQfakqfLtjEhvho7TFY1tYHlanODh2W3Q2sViDJpD4i8kbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=XeG2pkGF; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="XeG2pkGF" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD02416A3 for ; Fri, 26 Jun 2026 06:13:34 -0700 (PDT) Received: from [192.168.0.1] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0341C3F632 for ; Fri, 26 Jun 2026 06:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782479619; bh=KZm+A3dUTVk2rUvBJtk9nlzzGKmjPS2+xc9eht5/ax4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XeG2pkGFVklnsQnyYp9Q3W1tLTEXRqJKsmPOMIK7jV+BlHq7RutHU8EiEHLipMnZr APdnkMSOthGDDYCkH7skhMuNoL0D6oiAXlntBZi/2Pgo7lMZvPSAn1iC9CJ7OYOou0 GXsjnlSYw8TD+Jsp4k0orAtOLPhP3e9IUcfLlNME= Date: Fri, 26 Jun 2026 14:13:27 +0100 From: Liviu Dudau To: Boris Brezillon 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: References: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> <20260625-panthor-misc-fixes-v1-5-b67ed973fea6@collabora.com> <20260626134028.518607ea@fedora-2.home> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260626134028.518607ea@fedora-2.home> On Fri, Jun 26, 2026 at 01:40:28PM +0200, Boris Brezillon wrote: > 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/ I see. Reviewed-by: Liviu Dudau Best regards, Liviu -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯