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 E69802139CE for ; Wed, 10 Dec 2025 15:56:05 +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=1765382167; cv=none; b=qlVVeHvmaNhF8JQrpmOdvNY11SNZjLfj7ancvcjs/T3X7fxc69hK7fH0flxmqWJdPiVYOiWIyQ2C//NS9DqbEBqUM/UJNrqcA29ddMfzKsaHsKm6dlTT3Gs7kW5ttCJEWT0LCCQ7Q1Hzt4LipN6GurXdTTsBDaspAVU4UigyGKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765382167; c=relaxed/simple; bh=Iz5UyD7nP6ofLXV9qmcXhnOTU7cHxax/ZdERoiDTNF4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=B9XtKTUT80vKNvhtW9tTl/Xexm2pjyZHzZ1af84zNJu+h2t9CAKhwvbQVMFtn0pGR4tGLQkT2UzTVWqZCio2am4dLfkJGyLfmcPF1NyZIKcNilKHrRA1bVdwUD4FYH8ei7ztXrJlLH8teplVsAk2SK5J2sIDOdgK44FxGyFXDyE= 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; 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 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 B2203153B; Wed, 10 Dec 2025 07:55:57 -0800 (PST) Received: from [10.57.45.72] (unknown [10.57.45.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39B923F73B; Wed, 10 Dec 2025 07:56:01 -0800 (PST) Message-ID: <6b49886e-2290-4d27-b85a-3cccd65441b2@arm.com> Date: Wed, 10 Dec 2025 15:55:58 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] drm/panthor: Add panthor_*_irq_mask_set helper To: Nicolas Frattaroli , Boris Brezillon , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chia-I Wu , Karunika Choo Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20251210-panthor-tracepoints-v2-0-ace2e29bad0f@collabora.com> <20251210-panthor-tracepoints-v2-1-ace2e29bad0f@collabora.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20251210-panthor-tracepoints-v2-1-ace2e29bad0f@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/12/2025 14:30, Nicolas Frattaroli wrote: > Add a function to modify an IRQ's mask. If the IRQ is currently active, > it will write to the register, otherwise it will only set the struct > member. > > There's no locking done to guarantee exclusion with the other two > functions that touch the IRQ mask, and it should only be called from a > context where the circumstances guarantee no concurrent access is > performed. > > Signed-off-by: Nicolas Frattaroli Usually it's best to add the helper at the same time as the first user (especially if it's small like this), otherwise it's really difficult to see whether the helper is the right shape. The comment about no locking is worrying without the context to check if this is reasonable. Thanks, Steve > --- > drivers/gpu/drm/panthor/panthor_device.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h > index f35e52b9546a..894d28b3eb02 100644 > --- a/drivers/gpu/drm/panthor/panthor_device.h > +++ b/drivers/gpu/drm/panthor/panthor_device.h > @@ -470,6 +470,13 @@ static int panthor_request_ ## __name ## _irq(struct panthor_device *ptdev, \ > panthor_ ## __name ## _irq_threaded_handler, \ > IRQF_SHARED, KBUILD_MODNAME "-" # __name, \ > pirq); \ > +} \ > + \ > +static inline void panthor_ ## __name ## _irq_mask_set(struct panthor_irq *pirq, u32 mask) \ > +{ \ > + pirq->mask = mask; \ > + if (!atomic_read(&pirq->suspended)) \ > + gpu_write(pirq->ptdev, __reg_prefix ## _INT_MASK, mask); \ > } > > extern struct workqueue_struct *panthor_cleanup_wq; >