Skip to contentSkip to conversation

IPU6 and IPU7 driver fixes

PATCH Superseded [email protected] 3 participants 12 messages Dec 22, 2025

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover IPU6 and IPU7 driver fixes

From: Bingbu Cao <[email protected]>

This patchsets contains some fixes for IPU7 driver, and also cover a code cleanup for IPU6 driver. It also update the CPHY settings for IPU7 according to the PHY specification update.

---
v2: fix build warning: ‘cap_prog’ may be used uninitialized
---
Bingbu Cao (4):
media: staging/ipu7: ignore interrupts when device is suspended
media: staging/ipu7: call synchronous RPM suspend in probe failure
media: ipu7: update CDPHY register settings
media: ipu6/7: fix typo and coding errors in IPU mmu driver

 drivers/media/pci/intel/ipu6/ipu6-mmu.c        |  4 ++--
 drivers/staging/media/ipu7/ipu7-buttress.c     | 12 ++++++++++--
 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c | 13 ++++++++++---
 drivers/staging/media/ipu7/ipu7-mmu.c          |  2 +-
 drivers/staging/media/ipu7/ipu7.c              |  6 +++++-
 5 files changed, 28 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/4 media: staging/ipu7: ignore interrupts when device is suspended

From: Bingbu Cao <[email protected]>

IPU7 devices have shared interrupts with others. In some case when IPU7 device is suspended, driver get unexpected interrupt and invalid irq status 0xffffffff from ISR_STATUS and PB LOCAL_STATUS registers as interrupt is triggered from other device on shared irq line.

In order to avoid this issue use pm_runtime_get_if_active() to check if IPU7 device is resumed, ignore the invalid irq status and use synchronize_irq() in suspend.

Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7-buttress.c | 12 ++++++++++--
 drivers/staging/media/ipu7/ipu7.c          |  4 ++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/staging/media/ipu7/ipu7-buttress.c +10 -2
index e5707f5e300b..e4328cafe91d 100644
@@ -342,14 +342,22 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	u32 disable_irqs = 0;
 	u32 irq_status;
 	unsigned int i;
+	int active;
 
-	pm_runtime_get_noresume(dev);
+	active = pm_runtime_get_if_active(dev);
+	if (active <= 0)
+		return IRQ_NONE;
 
 	pb_irq = readl(isp->pb_base + INTERRUPT_STATUS);
 	writel(pb_irq, isp->pb_base + INTERRUPT_STATUS);
 
 	/* check btrs ATS, CFI and IMR errors, BIT(0) is unused for IPU */
 	pb_local_irq = readl(isp->pb_base + BTRS_LOCAL_INTERRUPT_MASK);
+	if (WARN_ON_ONCE(pb_local_irq == 0xffffffff)) {
+		pm_runtime_put_noidle(dev);
+		return IRQ_NONE;
+	}
+
 	if (pb_local_irq & ~BIT(0)) {
 		dev_warn(dev, "PB interrupt status 0x%x local 0x%x\n", pb_irq,
 			 pb_local_irq);
@@ -365,7 +373,7 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	}
 
 	irq_status = readl(isp->base + BUTTRESS_REG_IRQ_STATUS);
-	if (!irq_status) {
+	if (!irq_status || WARN_ON_ONCE(irq_status == 0xffffffff)) {
 		pm_runtime_put_noidle(dev);
 		return IRQ_NONE;
 	}
drivers/staging/media/ipu7/ipu7.c +4 -0
index 5cddc09c72bf..6c8c3eea44ac 100644
@@ -2684,6 +2684,10 @@ static void ipu7_pci_reset_done(struct pci_dev *pdev)
  */
 static int ipu7_suspend(struct device *dev)
 {
+	struct pci_dev *pdev = to_pci_dev(dev);
+
+	synchronize_irq(pdev->irq);
+
 	return 0;
 }
 
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v2 1/4] media: staging/ipu7: ignore interrupts when device is suspended

Hi Bingbu,

Quoted 49 lines · On Mon, Dec 22, 2025 at 03:06:26PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

IPU7 devices have shared interrupts with others. In some case when IPU7 device is suspended, driver get unexpected interrupt and invalid irq status 0xffffffff from ISR_STATUS and PB LOCAL_STATUS registers as interrupt is triggered from other device on shared irq line.

In order to avoid this issue use pm_runtime_get_if_active() to check if IPU7 device is resumed, ignore the invalid irq status and use synchronize_irq() in suspend.

Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7-buttress.c | 12 ++++++++++--
 drivers/staging/media/ipu7/ipu7.c          |  4 ++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/staging/media/ipu7/ipu7-buttress.c +9 -1
index e5707f5e300b..e4328cafe91d 100644
@@ -342,14 +342,22 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	u32 disable_irqs = 0;
 	u32 irq_status;
 	unsigned int i;
+	int active;
 
-	pm_runtime_get_noresume(dev);
+	active = pm_runtime_get_if_active(dev);
+	if (active <= 0)
+		return IRQ_NONE;
 
 	pb_irq = readl(isp->pb_base + INTERRUPT_STATUS);
 	writel(pb_irq, isp->pb_base + INTERRUPT_STATUS);
 
 	/* check btrs ATS, CFI and IMR errors, BIT(0) is unused for IPU */
 	pb_local_irq = readl(isp->pb_base + BTRS_LOCAL_INTERRUPT_MASK);
+	if (WARN_ON_ONCE(pb_local_irq == 0xffffffff)) {
+		pm_runtime_put_noidle(dev);
+		return IRQ_NONE;
+	}
+
 	if (pb_local_irq & ~BIT(0)) {
 		dev_warn(dev, "PB interrupt status 0x%x local 0x%x\n", pb_irq,
 			 pb_local_irq);

drivers/staging/media/ipu7/ipu7-buttress.c irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr) · line 378

Quoted 7 lines
drivers/staging/media/ipu7/ipu7-buttress.c +1 -1
@@ -365,7 +373,7 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	}
 
 	irq_status = readl(isp->base + BUTTRESS_REG_IRQ_STATUS);
-	if (!irq_status) {
+	if (!irq_status || WARN_ON_ONCE(irq_status == 0xffffffff)) {
 		pm_runtime_put_noidle(dev);
 		return IRQ_NONE;

Doesn't this apply to the ipu6 driver as well? E.g. on my Alder lake system the interrupt is shared with i801_smbus and processor_thermal_device_pci. It may be no interrupts are generated by those devices at inconvenient times for ipu6, but the ipu driver can't assume that.

Is the WARN_ON_ONCE() necessary? I'd use dev_warn_once() here if you'd like to write a message to the log.

Quoted 16 lines
drivers/staging/media/ipu7/ipu7-buttress.c +0 -0
 	}
drivers/staging/media/ipu7/ipu7.c +4 -0
index 5cddc09c72bf..6c8c3eea44ac 100644
@@ -2684,6 +2684,10 @@ static void ipu7_pci_reset_done(struct pci_dev *pdev)
  */
 static int ipu7_suspend(struct device *dev)
 {
+	struct pci_dev *pdev = to_pci_dev(dev);
+
+	synchronize_irq(pdev->irq);
+
 	return 0;
 }
 
Signature · 3 lines
Kind regards,

Sakari Ailus
#3 lore raw

Re: [PATCH v2 1/4] media: staging/ipu7: ignore interrupts when device is suspended

Sakari,

Thanks for the review.

Quoted 54 lines · Sakari Ailus

Hi Bingbu,

Quoted 51 lines · On Mon, Dec 22, 2025 at 03:06:26PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

IPU7 devices have shared interrupts with others. In some case when IPU7 device is suspended, driver get unexpected interrupt and invalid irq status 0xffffffff from ISR_STATUS and PB LOCAL_STATUS registers as interrupt is triggered from other device on shared irq line.

In order to avoid this issue use pm_runtime_get_if_active() to check if IPU7 device is resumed, ignore the invalid irq status and use synchronize_irq() in suspend.

Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7-buttress.c | 12 ++++++++++--
 drivers/staging/media/ipu7/ipu7.c          |  4 ++++
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/staging/media/ipu7/ipu7-buttress.c +9 -1
index e5707f5e300b..e4328cafe91d 100644
@@ -342,14 +342,22 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	u32 disable_irqs = 0;
 	u32 irq_status;
 	unsigned int i;
+	int active;
 
-	pm_runtime_get_noresume(dev);
+	active = pm_runtime_get_if_active(dev);
+	if (active <= 0)
+		return IRQ_NONE;
 
 	pb_irq = readl(isp->pb_base + INTERRUPT_STATUS);
 	writel(pb_irq, isp->pb_base + INTERRUPT_STATUS);
 
 	/* check btrs ATS, CFI and IMR errors, BIT(0) is unused for IPU */
 	pb_local_irq = readl(isp->pb_base + BTRS_LOCAL_INTERRUPT_MASK);
+	if (WARN_ON_ONCE(pb_local_irq == 0xffffffff)) {
+		pm_runtime_put_noidle(dev);
+		return IRQ_NONE;
+	}
+
 	if (pb_local_irq & ~BIT(0)) {
 		dev_warn(dev, "PB interrupt status 0x%x local 0x%x\n", pb_irq,
 			 pb_local_irq);
@@ -365,7 +373,7 @@ irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr)
 	}
 
Quoted 10 lines

drivers/staging/media/ipu7/ipu7-buttress.c irqreturn_t ipu_buttress_isr(int irq, void *isp_ptr) · line 378

Quoted 5 lines
drivers/staging/media/ipu7/ipu7-buttress.c +1 -1
 	irq_status = readl(isp->base + BUTTRESS_REG_IRQ_STATUS);
-	if (!irq_status) {
+	if (!irq_status || WARN_ON_ONCE(irq_status == 0xffffffff)) {
 		pm_runtime_put_noidle(dev);
 		return IRQ_NONE;

Doesn't this apply to the ipu6 driver as well? E.g. on my Alder lake system the interrupt is shared with i801_smbus and processor_thermal_device_pci. It may be no interrupts are generated by those devices at inconvenient times for ipu6, but the ipu driver can't assume that.

I remember that Stanislaw made a fix for IPU6.

Quoted 4 lines

Is the WARN_ON_ONCE() necessary? I'd use dev_warn_once() here if you'd like to write a message to the log.

I will update that, dev_warn_once() makes more sense.

Quoted 17 lines
Quoted 16 lines
drivers/staging/media/ipu7/ipu7-buttress.c +0 -0
 	}
drivers/staging/media/ipu7/ipu7.c +4 -0
index 5cddc09c72bf..6c8c3eea44ac 100644
@@ -2684,6 +2684,10 @@ static void ipu7_pci_reset_done(struct pci_dev *pdev)
  */
 static int ipu7_suspend(struct device *dev)
 {
+	struct pci_dev *pdev = to_pci_dev(dev);
+
+	synchronize_irq(pdev->irq);
+
 	return 0;
 }
 
Signature · 2 lines
Best regards,
Bingbu Cao
#4 lore raw

PATCH v2 2/4 media: staging/ipu7: call synchronous RPM suspend in probe failure

In reply to [email protected]

From: Bingbu Cao <[email protected]>

If firmware authentication failed during driver probe, driver call an asynchronous API to suspend the psys device but the bus device will be removed soon, thus runtime PM of bus device will be disabled soon, that will cancel the suspend request, so use synchronous suspend to make sure the runtime suspend before disabling its RPM.

IPU7 hardware has constraints that the PSYS device must be powered off before ISYS, otherwise it will cause machine check error.

Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
index 6c8c3eea44ac..fa5a1867626f 100644
@@ -2620,7 +2620,7 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp->isys->mmu))
 		ipu7_mmu_cleanup(isp->isys->mmu);
 	if (!IS_ERR_OR_NULL(isp->psys))
-		pm_runtime_put(&isp->psys->auxdev.dev);
+		pm_runtime_put_sync(&isp->psys->auxdev.dev);
 	ipu7_bus_del_devices(pdev);
 	release_firmware(isp->cpd_fw);
 buttress_exit:
Signature · 1 line
2.34.1
maintainer
#5 lore raw

Re: [PATCH v2 2/4] media: staging/ipu7: call synchronous RPM suspend in probe failure

Hi Bingbu,

Thanks for the patchset.

Quoted 10 lines · On Mon, Dec 22, 2025 at 03:06:27PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

If firmware authentication failed during driver probe, driver call an asynchronous API to suspend the psys device but the bus device will be removed soon, thus runtime PM of bus device will be disabled soon, that will cancel the suspend request, so use synchronous suspend to make sure the runtime suspend before disabling its RPM.

IPU7 hardware has constraints that the PSYS device must be powered off before ISYS, otherwise it will cause machine check error.

How does this differ from IPU6? In the ipu6 driver this has been addressed by making the PSYS a child of ISYS. Would this work on IPU7, too?

Quoted 21 lines
Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
index 6c8c3eea44ac..fa5a1867626f 100644
@@ -2620,7 +2620,7 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp->isys->mmu))
 		ipu7_mmu_cleanup(isp->isys->mmu);
 	if (!IS_ERR_OR_NULL(isp->psys))
-		pm_runtime_put(&isp->psys->auxdev.dev);
+		pm_runtime_put_sync(&isp->psys->auxdev.dev);
 	ipu7_bus_del_devices(pdev);
 	release_firmware(isp->cpd_fw);
 buttress_exit:
Signature · 3 lines
Kind regards,

Sakari Ailus
#6 lore raw

Re: [PATCH v2 2/4] media: staging/ipu7: call synchronous RPM suspend in probe failure

Sakari,

Thanks for the review.

Quoted 13 lines · Sakari Ailus

Hi Bingbu,

Thanks for the patchset.

Quoted 8 lines · On Mon, Dec 22, 2025 at 03:06:27PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

If firmware authentication failed during driver probe, driver call an asynchronous API to suspend the psys device but the bus device will be removed soon, thus runtime PM of bus device will be disabled soon, that will cancel the suspend request, so use synchronous suspend to make sure the runtime suspend before disabling its RPM.

Quoted 5 lines
Quoted 2 lines

IPU7 hardware has constraints that the PSYS device must be powered off before ISYS, otherwise it will cause machine check error.

How does this differ from IPU6? In the ipu6 driver this has been addressed by making the PSYS a child of ISYS. Would this work on IPU7, too?

For both IPU6 and IPU7, PSYS is child of ISYS. It can guarantee that PSYS auxiliary device will be powered off before ISYS except the probe failure case. Runtime PM disabling(in ipu7_bus_del_devices) may cancel the pending PSYS suspend request which cause machine check error on PTL which has clock hardware constraint.

Quoted 23 lines
Quoted 22 lines
Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
index 6c8c3eea44ac..fa5a1867626f 100644
@@ -2620,7 +2620,7 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp->isys->mmu))
 		ipu7_mmu_cleanup(isp->isys->mmu);
 	if (!IS_ERR_OR_NULL(isp->psys))
-		pm_runtime_put(&isp->psys->auxdev.dev);
+		pm_runtime_put_sync(&isp->psys->auxdev.dev);
 	ipu7_bus_del_devices(pdev);
 	release_firmware(isp->cpd_fw);
 buttress_exit:
Signature · 2 lines
Best regards,
Bingbu Cao
maintainer
#7 lore raw

Re: [PATCH v2 2/4] media: staging/ipu7: call synchronous RPM suspend in probe failure

Hi Bingbu,

Quoted 21 lines · Bingbu Cao

Sakari,

Thanks for the review.

Quoted 16 lines · Sakari Ailus

Hi Bingbu,

Thanks for the patchset.

Quoted 10 lines · On Mon, Dec 22, 2025 at 03:06:27PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

If firmware authentication failed during driver probe, driver call an asynchronous API to suspend the psys device but the bus device will be removed soon, thus runtime PM of bus device will be disabled soon, that will cancel the suspend request, so use synchronous suspend to make sure the runtime suspend before disabling its RPM.

IPU7 hardware has constraints that the PSYS device must be powered off before ISYS, otherwise it will cause machine check error.

Quoted 8 lines
Quoted 2 lines

How does this differ from IPU6? In the ipu6 driver this has been addressed by making the PSYS a child of ISYS. Would this work on IPU7, too?

For both IPU6 and IPU7, PSYS is child of ISYS. It can guarantee that PSYS auxiliary device will be powered off before ISYS except the probe failure case. Runtime PM disabling(in ipu7_bus_del_devices) may cancel the pending PSYS suspend request which cause machine check error on PTL which has clock hardware constraint.

Thanks for the explanation.

The ipu6 driver is actually missing any pm_runtime_put*() in its probe error path. :-o

Quoted 25 lines
Quoted 24 lines
Quoted 23 lines
Fixes b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
---
 drivers/staging/media/ipu7/ipu7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu7/ipu7.c +1 -1
index 6c8c3eea44ac..fa5a1867626f 100644
@@ -2620,7 +2620,7 @@ static int ipu7_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!IS_ERR_OR_NULL(isp->isys) && !IS_ERR_OR_NULL(isp->isys->mmu))
 		ipu7_mmu_cleanup(isp->isys->mmu);
 	if (!IS_ERR_OR_NULL(isp->psys))
-		pm_runtime_put(&isp->psys->auxdev.dev);
+		pm_runtime_put_sync(&isp->psys->auxdev.dev);
 	ipu7_bus_del_devices(pdev);
 	release_firmware(isp->cpd_fw);
 buttress_exit:
Signature · 3 lines
Kind regards,

Sakari Ailus
#8 lore raw

PATCH v2 3/4 media: ipu7: update CDPHY register settings

In reply to [email protected]

From: Bingbu Cao <[email protected]>

Some CPHY settings needs to updated according to the latest guide from SNPS. Program 45ohm for tuning resistance to fix CPHY problem and update the ITMINRX and GMODE for CPHY.

Fixes a516d36bdc3d ("media: staging/ipu7: add IPU7 input system device driver")
---
 drivers/staging/media/ipu7/ipu7-isys-csi-phy.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c +10 -3
index 2d5717883518..3f15af3b4c79 100644
@@ -124,6 +124,7 @@ static const struct cdr_fbk_cap_prog_params table7[] = {
 	{ 1350, 1589, 4 },
 	{ 1590, 1949, 5 },
 	{ 1950, 2499, 6 },
+	{ 2500, 3500, 7 },
 	{ }
 };
 
@@ -838,9 +839,10 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
 		dwc_phy_write_mask(isys, id, reg + 0x400 * i,
 				   reset_thresh, 9, 11);
 
+	/* Tuning ITMINRX to 2 for CPHY */
 	reg = CORE_DIG_CLANE_0_RW_LP_0;
 	for (i = 0; i < trios; i++)
-		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 1, 12, 15);
+		dwc_phy_write_mask(isys, id, reg + 0x400 * i, 2, 12, 15);
 
 	reg = CORE_DIG_CLANE_0_RW_LP_2;
 	for (i = 0; i < trios; i++)
@@ -860,7 +862,11 @@ static void ipu7_isys_cphy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
 	for (i = 0; i < (lanes + 1); i++) {
 		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_9 + 0x400 * i;
 		dwc_phy_write_mask(isys, id, reg, 4U, 0, 2);
-		dwc_phy_write_mask(isys, id, reg, 0U, 3, 4);
+		/* Set GMODE to 2 when CPHY >= 1.5Gsps */
+		if (mbps >= 1500)
+			dwc_phy_write_mask(isys, id, reg, 2U, 3, 4);
+		else
+			dwc_phy_write_mask(isys, id, reg, 0U, 3, 4);
 
 		reg = CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_7 + 0x400 * i;
 		dwc_phy_write_mask(isys, id, reg, cap_prog, 10, 12);
@@ -930,8 +936,9 @@ static int ipu7_isys_phy_config(struct ipu7_isys *isys, u8 id, u8 lanes,
 			   7, 12, 14);
 	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_7,
 			   0, 8, 10);
+	/* resistance tuning: 1 for 45ohm, 0 for 50ohm */
 	dwc_phy_write_mask(isys, id, CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_5,
-			   0, 8, 8);
+			   1, 8, 8);
 
 	if (aggregation)
 		phy_mode = isys->csi2[0].phy_mode;
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 4/4 media: ipu6/7: fix typo and coding errors in IPU mmu driver

In reply to [email protected]

From: Bingbu Cao <[email protected]>

Fix the coding errors in ipu6-mmu.c and ipu7-mmu.c, it has no impact on current driver functionality, however it needs a fix.

Fixes 9163d83573e4 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table")
Fixes 71d81c25683a ("media: staging/ipu7: add IPU7 DMA APIs and MMU mapping")
---
 drivers/media/pci/intel/ipu6/ipu6-mmu.c | 4 ++--
 drivers/staging/media/ipu7/ipu7-mmu.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-mmu.c +2 -2
index 6d1c0b90169d..85cc6d5b4dd1 100644
@@ -102,7 +102,7 @@ static void page_table_dump(struct ipu6_mmu_info *mmu_info)
 		if (mmu_info->l1_pt[l1_idx] == mmu_info->dummy_l2_pteval)
 			continue;
 
-		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx];)
+		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx]);
 		dev_dbg(mmu_info->dev,
 			"l1 entry %u; iovas 0x%8.8x-0x%8.8x, at %pap\n",
 			l1_idx, iova, iova + ISP_PAGE_SIZE, &l2_phys);
@@ -248,7 +248,7 @@ static u32 *alloc_l2_pt(struct ipu6_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
drivers/staging/media/ipu7/ipu7-mmu.c +1 -1
index ded1986eb8ba..ea35cce4830a 100644
@@ -231,7 +231,7 @@ static u32 *alloc_l2_pt(struct ipu7_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
Signature · 1 line
2.34.1
maintainer
#10 lore raw

Re: [PATCH v2 4/4] media: ipu6/7: fix typo and coding errors in IPU mmu driver

Hi Bingbu,

Quoted 5 lines · On Mon, Dec 22, 2025 at 03:06:29PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

Fix the coding errors in ipu6-mmu.c and ipu7-mmu.c, it has no impact on current driver functionality, however it needs a fix.

Please wrap paragraphs (using your $EDITOR perhaps?) to use as much as possible but still at most 75 characters per line. The above should look like:

Fix the coding errors in ipu6-mmu.c and ipu7-mmu.c, it has no impact on current driver functionality, however it needs a fix.

Quoted 3 lines
Fixes 9163d83573e4 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table")
Fixes 71d81c25683a ("media: staging/ipu7: add IPU7 DMA APIs and MMU mapping")

Could you split this into two separate patches, please?

Quoted 41 lines
---
 drivers/media/pci/intel/ipu6/ipu6-mmu.c | 4 ++--
 drivers/staging/media/ipu7/ipu7-mmu.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-mmu.c +2 -2
index 6d1c0b90169d..85cc6d5b4dd1 100644
@@ -102,7 +102,7 @@ static void page_table_dump(struct ipu6_mmu_info *mmu_info)
 		if (mmu_info->l1_pt[l1_idx] == mmu_info->dummy_l2_pteval)
 			continue;
 
-		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx];)
+		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx]);
 		dev_dbg(mmu_info->dev,
 			"l1 entry %u; iovas 0x%8.8x-0x%8.8x, at %pap\n",
 			l1_idx, iova, iova + ISP_PAGE_SIZE, &l2_phys);
@@ -248,7 +248,7 @@ static u32 *alloc_l2_pt(struct ipu6_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
drivers/staging/media/ipu7/ipu7-mmu.c +1 -1
index ded1986eb8ba..ea35cce4830a 100644
@@ -231,7 +231,7 @@ static u32 *alloc_l2_pt(struct ipu7_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
Signature · 3 lines
Regards,

Sakari Ailus
#11 lore raw

Re: [PATCH v2 4/4] media: ipu6/7: fix typo and coding errors in IPU mmu driver

Sakari,

Thanks for the review.

Quoted 9 lines · Sakari Ailus

Hi Bingbu,

Quoted 5 lines · On Mon, Dec 22, 2025 at 03:06:29PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

Fix the coding errors in ipu6-mmu.c and ipu7-mmu.c, it has no impact on current driver functionality, however it needs a fix.

Quoted 6 lines

Please wrap paragraphs (using your $EDITOR perhaps?) to use as much as possible but still at most 75 characters per line. The above should look like:

Fix the coding errors in ipu6-mmu.c and ipu7-mmu.c, it has no impact on current driver functionality, however it needs a fix.

Thanks, I will.

Quoted 6 lines
Quoted 4 lines
Fixes 9163d83573e4 ("media: intel/ipu6: add IPU6 DMA mapping API and MMU table")
Fixes 71d81c25683a ("media: staging/ipu7: add IPU7 DMA APIs and MMU mapping")

Could you split this into two separate patches, please?

Yes, I will update in v3.

Quoted 43 lines
Quoted 42 lines
---
 drivers/media/pci/intel/ipu6/ipu6-mmu.c | 4 ++--
 drivers/staging/media/ipu7/ipu7-mmu.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-mmu.c +2 -2
index 6d1c0b90169d..85cc6d5b4dd1 100644
@@ -102,7 +102,7 @@ static void page_table_dump(struct ipu6_mmu_info *mmu_info)
 		if (mmu_info->l1_pt[l1_idx] == mmu_info->dummy_l2_pteval)
 			continue;
 
-		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx];)
+		l2_phys = TBL_PHYS_ADDR(mmu_info->l1_pt[l1_idx]);
 		dev_dbg(mmu_info->dev,
 			"l1 entry %u; iovas 0x%8.8x-0x%8.8x, at %pap\n",
 			l1_idx, iova, iova + ISP_PAGE_SIZE, &l2_phys);
@@ -248,7 +248,7 @@ static u32 *alloc_l2_pt(struct ipu6_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
drivers/staging/media/ipu7/ipu7-mmu.c +1 -1
index ded1986eb8ba..ea35cce4830a 100644
@@ -231,7 +231,7 @@ static u32 *alloc_l2_pt(struct ipu7_mmu_info *mmu_info)
 
 	dev_dbg(mmu_info->dev, "alloc_l2: get_zeroed_page() = %p\n", pt);
 
-	for (i = 0; i < ISP_L1PT_PTES; i++)
+	for (i = 0; i < ISP_L2PT_PTES; i++)
 		pt[i] = mmu_info->dummy_page_pteval;
 
 	return pt;
Signature · 2 lines
Best regards,
Bingbu Cao