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 3D3B430BBAC for ; Thu, 2 Oct 2025 10:41: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=1759401700; cv=none; b=rpZFEzBTAm3TBvWaMgbV4IJmzrA9DtSF5pJwg7xNo9uhIoZywvUu8GXFCVz1chUuXkjONWrk2gPQ0cVotJRRUwVLdpYM0fjRtPqrH9r3TUkyY1ztp+W5Co3kaEpsb2JuWW9WHDQM+r0Y9Ghe1KW3ligWoIAzghg/mU+iuuxYHTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759401700; c=relaxed/simple; bh=5Gu+GS/KQ+KJJTAKlTFT0cZQbCAscs42GBKqgMRW9jM=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=HF2T8+gK6qoSqQgGmswVdEAhSjEeCWTJofiensQv+4g7HcHV5A/N2EGTJCc5Nb54FwEkE0yp/tlgv/f4BEoiA4Bvu0cJpaf9pd/dBRtcda6M2IYnvuAn79zmMGD2dBf07DDbHt/3VWUtU5Lgb+w5H1qXoIhS+iYdCGJHeS2DbmU= 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 6F5061692; Thu, 2 Oct 2025 03:41:30 -0700 (PDT) Received: from [10.57.2.240] (unknown [10.57.2.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 357893F66E; Thu, 2 Oct 2025 03:41:36 -0700 (PDT) Message-ID: Date: Thu, 2 Oct 2025 11:41:33 +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 05/10] drm/panthor: rename and document mmu_hw_do_operation_locked To: Chia-I Wu , Boris Brezillon , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Grant Likely , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20250916210823.4033529-1-olvaffe@gmail.com> <20250916210823.4033529-6-olvaffe@gmail.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20250916210823.4033529-6-olvaffe@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 16/09/2025 22:08, Chia-I Wu wrote: > Rename mmu_hw_do_operation_locked to mmu_hw_flush_caches. This is confusing, you've renamed the _locked variant and left the wrapper mmu_hw_do_operation() with the old name. I agree "do operation" isn't a great name, although "flush caches" sounds to me like it's a function which does the whole cache flush dance in one go, but it's still the same "one part of a cache flush operation" code. Thanks, Steve > > Signed-off-by: Chia-I Wu > --- > drivers/gpu/drm/panthor/panthor_mmu.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c > index 727339d80d37e..7d1645a24129d 100644 > --- a/drivers/gpu/drm/panthor/panthor_mmu.c > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c > @@ -622,8 +622,20 @@ static void mmu_hw_cmd_unlock(struct panthor_device *ptdev, u32 as_nr) > write_cmd(ptdev, as_nr, AS_COMMAND_UNLOCK); > } > > -static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr, > - u64 iova, u64 size, u32 op) > +/** > + * mmu_hw_cmd_flush_caches() - Flush and invalidate L2/MMU/LSC caches > + * @ptdev: Device. > + * @as_nr: AS to issue command to. > + * @iova: Start of the region. > + * @size: Size of the region. > + * @op: AS_COMMAND_FLUSH_* > + * > + * Issue LOCK/GPU_FLUSH_CACHES/UNLOCK commands in order to flush and > + * invalidate L2/MMU/LSC caches for a region. > + * > + * Return: 0 on success, a negative error code otherwise. > + */ > +static int mmu_hw_flush_caches(struct panthor_device *ptdev, int as_nr, u64 iova, u64 size, u32 op) > { > const u32 l2_flush_op = CACHE_CLEAN | CACHE_INV; > u32 lsc_flush_op; > @@ -680,7 +692,7 @@ static int mmu_hw_do_operation(struct panthor_vm *vm, > int ret; > > mutex_lock(&ptdev->mmu->as.slots_lock); > - ret = mmu_hw_do_operation_locked(ptdev, vm->as.id, iova, size, op); > + ret = mmu_hw_flush_caches(ptdev, vm->as.id, iova, size, op); > mutex_unlock(&ptdev->mmu->as.slots_lock); > > return ret; > @@ -691,7 +703,7 @@ static int panthor_mmu_as_enable(struct panthor_device *ptdev, u32 as_nr, > { > int ret; > > - ret = mmu_hw_do_operation_locked(ptdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > + ret = mmu_hw_flush_caches(ptdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > if (ret) > return ret; > > @@ -702,7 +714,7 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr) > { > int ret; > > - ret = mmu_hw_do_operation_locked(ptdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > + ret = mmu_hw_flush_caches(ptdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > if (ret) > return ret; >