linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bingbu Cao <bingbu.cao@linux.intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>, bingbu.cao@intel.com
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	tomi.valkeinen@ideasonboard.com, hans@jjverkuil.nl,
	jacopo.mondi@ideasonboard.com
Subject: Re: [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release
Date: Mon, 18 Aug 2025 10:27:17 +0800	[thread overview]
Message-ID: <adf948fe-17a7-6881-d520-c71b50dc9214@linux.intel.com> (raw)
In-Reply-To: <aJ-mALzD-mA_KXsa@kekkonen.localdomain>

Sakari,

On 8/16/25 5:26 AM, Sakari Ailus wrote:
> Hi Bingbu,
> 
> Thanks for the set.
> 
> On Fri, Aug 15, 2025 at 05:20:37PM +0800, bingbu.cao@intel.com wrote:
>> From: Bingbu Cao <bingbu.cao@intel.com>
>>
>> IPU7 ISYS and PSYS auxiliary devices are released after
>> ipu7_bus_del_devices(), so driver can not reference the MMU devices
>> from ISYS and PSYS auxiliary devices, so move the MMUs cleanup before
>> releasing the auxiliary devices.
>>
>> Fixes: b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
> 
> Please also add Cc: stable tag if you have a Fixes: tag.
> 
>> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
>> ---
>>  drivers/staging/media/ipu7/ipu7.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/media/ipu7/ipu7.c b/drivers/staging/media/ipu7/ipu7.c
>> index aef931d23510..3de41b3d1ae1 100644
>> --- a/drivers/staging/media/ipu7/ipu7.c
>> +++ b/drivers/staging/media/ipu7/ipu7.c
>> @@ -2644,6 +2644,9 @@ static void ipu7_pci_remove(struct pci_dev *pdev)
>>  	if (!IS_ERR_OR_NULL(isp->fw_code_region))
>>  		vfree(isp->fw_code_region);
>>  
>> +	ipu7_mmu_cleanup(isp->isys->mmu);
>> +	ipu7_mmu_cleanup(isp->psys->mmu);
>> +
>>  	ipu7_bus_del_devices(pdev);
>>  
>>  	pm_runtime_forbid(&pdev->dev);
>> @@ -2653,8 +2656,6 @@ static void ipu7_pci_remove(struct pci_dev *pdev)
>>  
>>  	release_firmware(isp->cpd_fw);
>>  
> 
> This newline will be extra once the two lines below have been removed.
> 
> Does the same issue exist in the IPU6 driver? These calls are located in
> the same location but I haven't checked if that's the right place for them.
>

IPU6 driver fix this problem in another way.

	struct ipu6_mmu *isys_mmu = isp->isys->mmu;
	struct ipu6_mmu *psys_mmu = isp->psys->mmu;
...
	release_firmware(isp->cpd_fw);

	ipu6_mmu_cleanup(psys_mmu);
	ipu6_mmu_cleanup(isys_mmu);
	
I think cleanup MMU before releasing auxdevs make more sense.

>> -	ipu7_mmu_cleanup(isp->psys->mmu);
>> -	ipu7_mmu_cleanup(isp->isys->mmu);
>>  }
>>  
>>  static void ipu7_pci_reset_prepare(struct pci_dev *pdev)
> 

-- 
Best regards,
Bingbu Cao

      reply	other threads:[~2025-08-18  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  9:20 [PATCH 1/3] media: staging/ipu7: convert to use pci_alloc_irq_vectors() API bingbu.cao
2025-08-15  9:20 ` [PATCH 2/3] media: staging/ipu7: Don't set name for IPU7 PCI device bingbu.cao
2025-08-15  9:20 ` [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release bingbu.cao
2025-08-15 21:26   ` Sakari Ailus
2025-08-18  2:27     ` Bingbu Cao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adf948fe-17a7-6881-d520-c71b50dc9214@linux.intel.com \
    --to=bingbu.cao@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=hans@jjverkuil.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).