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 2809D2FC89D for ; Fri, 15 Aug 2025 10:02:29 +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=1755252151; cv=none; b=N/H2GY/1V6sygx02tXYUwur10kjgUVAkXJnuP7Nkjo2qzpbgxTStIXyIB4mvjcGap53LY34p1+f/7d0Da6DGVQZKRjLpVqwCSLfUEpJlVxrB/9uuQmWsZlvuUyDDEEbPLD+DYV+27I3OROAY5v9eYFQ7RHLIgy5kbuRfyRVmxNU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755252151; c=relaxed/simple; bh=jqU3SqBG7XPhIgtzSjKPmZ/lJRXF0DpiU6+ltmy6zmU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D6K5/Opq6pAQ5gxp0+ZfK1991HJJinQCLp8ouCB0D+J+sIPRgw3XWJgXWo8t/sl4LDsUygNYSrIzidnMouSpW2ZHMe8y57fxT571lJHY0RMgzrI68KSJHoqdar6TLdwByeSp+MvvHoK2stD+Qb4DH/sfE0P6DTbpezoNxBralaM= 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 48231168F; Fri, 15 Aug 2025 03:02:21 -0700 (PDT) Received: from [10.1.29.14] (e122027.cambridge.arm.com [10.1.29.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 70ABA3F738; Fri, 15 Aug 2025 03:02:27 -0700 (PDT) Message-ID: <020f8735-06d0-4df3-b0bb-224692e06527@arm.com> Date: Fri, 15 Aug 2025 11:02:25 +0100 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 v9 6/7] drm/panthor: Make MMU cache maintenance use FLUSH_CACHES command To: Liviu Dudau , Daniel Stone Cc: Karunika Choo , dri-devel@lists.freedesktop.org, nd@arm.com, Boris Brezillon , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org, Chia-I Wu References: <20250807162633.3666310-1-karunika.choo@arm.com> <20250807162633.3666310-7-karunika.choo@arm.com> From: Steven Price Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 14/08/2025 23:58, Liviu Dudau wrote: > On Fri, Aug 08, 2025 at 11:50:27AM +0100, Daniel Stone wrote: >> Hi Karunika, >> >> >> On Thu, 7 Aug 2025 at 17:27, Karunika Choo wrote: >>> @@ -585,6 +615,9 @@ static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr, >>> if (op != AS_COMMAND_UNLOCK) >>> lock_region(ptdev, as_nr, iova, size); >>> >>> + if (op == AS_COMMAND_FLUSH_MEM || op == AS_COMMAND_FLUSH_PT) >>> + return mmu_hw_do_flush_on_gpu_ctrl(ptdev, as_nr, op); >> >> Given that FLUSH_MEM and FLUSH_PT are the only ops which are ever >> used, the below becomes dead code. Could you please just inline these, >> so it's more clear what's actually going on? The (op != >> AS_COMMAND_UNLOCK) branch can also become unconditional, perhaps with >> a WARN_ON() around unknown ops. > > Hmm, the commit message says that FLUSH_MEM and FLUSH_PT are going to be > deprecated and replaced with FLUSH_CACHES so the first are clearly not the > only ones ever used (at least not in the future). I'm not sure why you > think this code is not correct. The code is "correct" (it does the right thing), but Daniel is also correct that as things stand the code below that "return" is all dead. The only code paths call with op either AS_COMMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT. But I think this patch set has been through enough revisions already, and we've now got the firmware upstream[1]. So rather than do another wrong, I'm going to merge this to drm-misc-next and I'll post a separate patch cleaning up the dead code. Thanks, Steve [1] https://gitlab.com/kernel-firmware/linux-firmware/-/commit/930ef9046e3848df688d98b7d5e68154b031dc66 > Best regards, > Liviu > >> >> Cheers, >> Daniel >