* [PATCH 1/3] media: staging/ipu7: convert to use pci_alloc_irq_vectors() API
@ 2025-08-15 9:20 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
0 siblings, 2 replies; 5+ messages in thread
From: bingbu.cao @ 2025-08-15 9:20 UTC (permalink / raw)
To: linux-media, sakari.ailus, laurent.pinchart
Cc: tomi.valkeinen, hans, jacopo.mondi, bingbu.cao, bingbu.cao
From: Bingbu Cao <bingbu.cao@intel.com>
pci_enable_msi() is a deprecated API, thus switch to use modern
pci_alloc_irq_vectors().
Fixes: b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
---
drivers/staging/media/ipu7/ipu7.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/media/ipu7/ipu7.c b/drivers/staging/media/ipu7/ipu7.c
index 1b4f01db13ca..a8e8b0e23198 100644
--- a/drivers/staging/media/ipu7/ipu7.c
+++ b/drivers/staging/media/ipu7/ipu7.c
@@ -2248,20 +2248,13 @@ void ipu7_dump_fw_error_log(const struct ipu7_bus_device *adev)
}
EXPORT_SYMBOL_NS_GPL(ipu7_dump_fw_error_log, "INTEL_IPU7");
-static int ipu7_pci_config_setup(struct pci_dev *dev)
+static void ipu7_pci_config_setup(struct pci_dev *dev)
{
u16 pci_command;
- int ret;
pci_read_config_word(dev, PCI_COMMAND, &pci_command);
pci_command |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
-
- ret = pci_enable_msi(dev);
- if (ret)
- dev_err(&dev->dev, "Failed to enable msi (%d)\n", ret);
-
- return ret;
}
static int ipu7_map_fw_code_region(struct ipu7_bus_device *sys,
@@ -2510,13 +2503,15 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
dma_set_max_seg_size(dev, UINT_MAX);
- ret = ipu7_pci_config_setup(pdev);
- if (ret)
- return ret;
+ ipu7_pci_config_setup(pdev);
+
+ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Failed to alloc irq vector\n");
ret = ipu_buttress_init(isp);
if (ret)
- return ret;
+ goto pci_irq_free;
dev_info(dev, "firmware cpd file: %s\n", isp->cpd_fw_name);
@@ -2632,6 +2627,8 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
release_firmware(isp->cpd_fw);
buttress_exit:
ipu_buttress_exit(isp);
+pci_irq_free:
+ pci_free_irq_vectors(pdev);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] media: staging/ipu7: Don't set name for IPU7 PCI device
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 ` bingbu.cao
2025-08-15 9:20 ` [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release bingbu.cao
1 sibling, 0 replies; 5+ messages in thread
From: bingbu.cao @ 2025-08-15 9:20 UTC (permalink / raw)
To: linux-media, sakari.ailus, laurent.pinchart
Cc: tomi.valkeinen, hans, jacopo.mondi, bingbu.cao, bingbu.cao
From: Bingbu Cao <bingbu.cao@intel.com>
Driver better not dev_set_name() to change the PCI device
name, so remove it.
Fixes: b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
---
drivers/staging/media/ipu7/ipu7.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/media/ipu7/ipu7.c b/drivers/staging/media/ipu7/ipu7.c
index a8e8b0e23198..aef931d23510 100644
--- a/drivers/staging/media/ipu7/ipu7.c
+++ b/drivers/staging/media/ipu7/ipu7.c
@@ -2428,7 +2428,6 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!isp)
return -ENOMEM;
- dev_set_name(dev, "intel-ipu7");
isp->pdev = pdev;
INIT_LIST_HEAD(&isp->devices);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release
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 ` bingbu.cao
2025-08-15 21:26 ` Sakari Ailus
1 sibling, 1 reply; 5+ messages in thread
From: bingbu.cao @ 2025-08-15 9:20 UTC (permalink / raw)
To: linux-media, sakari.ailus, laurent.pinchart
Cc: tomi.valkeinen, hans, jacopo.mondi, bingbu.cao, bingbu.cao
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")
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);
- ipu7_mmu_cleanup(isp->psys->mmu);
- ipu7_mmu_cleanup(isp->isys->mmu);
}
static void ipu7_pci_reset_prepare(struct pci_dev *pdev)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release
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
0 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2025-08-15 21:26 UTC (permalink / raw)
To: bingbu.cao
Cc: linux-media, laurent.pinchart, tomi.valkeinen, hans, jacopo.mondi,
bingbu.cao
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.
> - ipu7_mmu_cleanup(isp->psys->mmu);
> - ipu7_mmu_cleanup(isp->isys->mmu);
> }
>
> static void ipu7_pci_reset_prepare(struct pci_dev *pdev)
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] media: staging/ipu7: cleanup the MMU correctly in IPU7 driver release
2025-08-15 21:26 ` Sakari Ailus
@ 2025-08-18 2:27 ` Bingbu Cao
0 siblings, 0 replies; 5+ messages in thread
From: Bingbu Cao @ 2025-08-18 2:27 UTC (permalink / raw)
To: Sakari Ailus, bingbu.cao
Cc: linux-media, laurent.pinchart, tomi.valkeinen, hans, jacopo.mondi
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-18 2:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).