Skip to contentSkip to conversation

bus: mhi: host: pci_generic: fix MHI BAR mapping

PATCH Applied Johan Hovold 3 participants 4 messages Dec 1, 2024 – Dec 2, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mhi: host: pci_generic: fix MHI BAR mapping

A recent change converting the MHI pci_generic driver to use pcim_iomap_region() failed to update the BAR parameter which is an index rather than a mask.

This specifically broke the modem on machines like the Lenovo ThinkPad X13s and x1e80100 CRD:

	mhi-pci-generic 0004:01:00.0: failed to map pci region: -22
	mhi-pci-generic 0004:01:00.0: probe with driver mhi-pci-generic failed with error -22
Fixes bd23e836423e ("bus: mhi: host: pci_generic: Use pcim_iomap_region() to request and map MHI BAR")
Cc Manivannan Sadhasivam <[email protected]>
Cc Mayank Rana <[email protected]>

---

The offending patch was marked as "Compile tested only", but that just makes you wonder *why* the patch was never tested...

	https://lore.kernel.org/all/[email protected]/

Johan

#regzbot introduced: bd23e836423e

 drivers/bus/mhi/host/pci_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +1 -1
index 07645ce2119a..56ba4192c89c 100644
@@ -917,7 +917,7 @@ static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
 		return err;
 	}
 
-	mhi_cntrl->regs = pcim_iomap_region(pdev, 1 << bar_num, pci_name(pdev));
+	mhi_cntrl->regs = pcim_iomap_region(pdev, bar_num, pci_name(pdev));
 	if (IS_ERR(mhi_cntrl->regs)) {
 		err = PTR_ERR(mhi_cntrl->regs);
 		dev_err(&pdev->dev, "failed to map pci region: %d\n", err);
Signature · 1 line
2.45.2
#1 lore raw

[ Forgot to CC the regressions list ]

Quoted 14 lines · Johan Hovold

A recent change converting the MHI pci_generic driver to use pcim_iomap_region() failed to update the BAR parameter which is an index rather than a mask.

This specifically broke the modem on machines like the Lenovo ThinkPad X13s and x1e80100 CRD:

	mhi-pci-generic 0004:01:00.0: failed to map pci region: -22
	mhi-pci-generic 0004:01:00.0: probe with driver mhi-pci-generic failed with error -22
Fixes bd23e836423e ("bus: mhi: host: pci_generic: Use pcim_iomap_region() to request and map MHI BAR")
Cc Manivannan Sadhasivam <[email protected]>
Cc Mayank Rana <[email protected]>
Quoted 6 lines

---

The offending patch was marked as "Compile tested only", but that just makes you wonder *why* the patch was never tested...

	https://lore.kernel.org/all/[email protected]/

#regzbot ^introduced: bd23e836423e

Johan

Reviewed-by on v1 1/1
#2 lore raw
In reply to Johan Hovold
Quoted 4 lines · Johan Hovold

A recent change converting the MHI pci_generic driver to use pcim_iomap_region() failed to update the BAR parameter which is an index rather than a mask.

That's silly on me. Thanks for the fix!

Quoted 10 lines

This specifically broke the modem on machines like the Lenovo ThinkPad X13s and x1e80100 CRD:

	mhi-pci-generic 0004:01:00.0: failed to map pci region: -22
	mhi-pci-generic 0004:01:00.0: probe with driver mhi-pci-generic failed with error -22
Fixes bd23e836423e ("bus: mhi: host: pci_generic: Use pcim_iomap_region() to request and map MHI BAR")
Cc Manivannan Sadhasivam <[email protected]>
Cc Mayank Rana <[email protected]>
Quoted 5 lines

---

The offending patch was marked as "Compile tested only", but that just makes you wonder *why* the patch was never tested...

Because I didn't had a modem platform to test my change and since it was a simple API conversion, I merged it after some time.

- Mani

Quoted 27 lines
	https://lore.kernel.org/all/[email protected]/

Johan

#regzbot introduced: bd23e836423e

 drivers/bus/mhi/host/pci_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +1 -1
index 07645ce2119a..56ba4192c89c 100644
@@ -917,7 +917,7 @@ static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
 		return err;
 	}
 
-	mhi_cntrl->regs = pcim_iomap_region(pdev, 1 << bar_num, pci_name(pdev));
+	mhi_cntrl->regs = pcim_iomap_region(pdev, bar_num, pci_name(pdev));
 	if (IS_ERR(mhi_cntrl->regs)) {
 		err = PTR_ERR(mhi_cntrl->regs);
 		dev_err(&pdev->dev, "failed to map pci region: %d\n", err);
Signature · 1 line
2.45.2
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#3 lore raw
In reply to Johan Hovold
Quoted 7 lines · Johan Hovold

A recent change converting the MHI pci_generic driver to use pcim_iomap_region() failed to update the BAR parameter which is an index rather than a mask.

This specifically broke the modem on machines like the Lenovo ThinkPad X13s and x1e80100 CRD:

Quoted 7 lines
	mhi-pci-generic 0004:01:00.0: failed to map pci region: -22
	mhi-pci-generic 0004:01:00.0: probe with driver mhi-pci-generic failed with error -22
Fixes bd23e836423e ("bus: mhi: host: pci_generic: Use pcim_iomap_region() to request and map MHI BAR")
Cc Manivannan Sadhasivam <[email protected]>
Cc Mayank Rana <[email protected]>

Applied to mhi-fixes!

- Mani

Quoted 32 lines

---

The offending patch was marked as "Compile tested only", but that just makes you wonder *why* the patch was never tested...

	https://lore.kernel.org/all/[email protected]/

Johan

#regzbot introduced: bd23e836423e

 drivers/bus/mhi/host/pci_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +1 -1
index 07645ce2119a..56ba4192c89c 100644
@@ -917,7 +917,7 @@ static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
 		return err;
 	}
 
-	mhi_cntrl->regs = pcim_iomap_region(pdev, 1 << bar_num, pci_name(pdev));
+	mhi_cntrl->regs = pcim_iomap_region(pdev, bar_num, pci_name(pdev));
 	if (IS_ERR(mhi_cntrl->regs)) {
 		err = PTR_ERR(mhi_cntrl->regs);
 		dev_err(&pdev->dev, "failed to map pci region: %d\n", err);
Signature · 1 line
2.45.2
Signature · 1 line
மணிவண்ணன் சதாசிவம்