All of lore.kernel.org
 help / color / mirror / Atom feed
* [REGRESSION] OCTEON MMC driver failure with v4.19
@ 2018-10-26 20:54 Aaro Koskinen
  2018-11-05 22:06 ` Aaro Koskinen
  0 siblings, 1 reply; 5+ messages in thread
From: Aaro Koskinen @ 2018-10-26 20:54 UTC (permalink / raw)
  To: Robin Murphy, Christoph Hellwig, linux-mips, linux-kernel

Hi,

OCTEON (MIPS64) MMC driver probe fails with v4.19, because with

commit 6c2fb2ea76361da9b420a8e23a2a19e7842cbdda
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Mon Jul 23 23:16:09 2018 +0100

    of/device: Set bus DMA mask as appropriate

we now get a default 32-bit bus DMA mask, and the device itself has
64-bit mask, so it gets rejected.

With the current mainline, the driver is again working (probably
because of b4ebe6063204 ("dma-direct: implement complete bus_dma_mask
handling")). But I think this is just because I happen to have < 4 GB RAM,
and it probably could still fail on bigger systems..?

A.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [REGRESSION] OCTEON MMC driver failure with v4.19
  2018-10-26 20:54 [REGRESSION] OCTEON MMC driver failure with v4.19 Aaro Koskinen
@ 2018-11-05 22:06 ` Aaro Koskinen
  2018-11-06  6:27   ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Aaro Koskinen @ 2018-11-05 22:06 UTC (permalink / raw)
  To: Robin Murphy, Christoph Hellwig, Rob Herring, Paul Burton,
	linux-mips, linux-kernel

Hi,

On Fri, Oct 26, 2018 at 11:54:23PM +0300, Aaro Koskinen wrote:
> OCTEON (MIPS64) MMC driver probe fails with v4.19, because with
> 
> commit 6c2fb2ea76361da9b420a8e23a2a19e7842cbdda
> Author: Robin Murphy <robin.murphy@arm.com>
> Date:   Mon Jul 23 23:16:09 2018 +0100
> 
>     of/device: Set bus DMA mask as appropriate
> 
> we now get a default 32-bit bus DMA mask, and the device itself has
> 64-bit mask, so it gets rejected.
> 
> With the current mainline, the driver is again working (probably
> because of b4ebe6063204 ("dma-direct: implement complete bus_dma_mask
> handling")). But I think this is just because I happen to have < 4 GB RAM,
> and it probably could still fail on bigger systems..?

With the below change, the MMC card probe seems to with v4.19. But it
feels a bit hackish, don't you think... Is there some obvious simple
fix that I'm missing? Any comments?

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 807cadaf554e..31fab09fadcc 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -1067,8 +1067,29 @@ int __init octeon_prune_device_tree(void)
 	return 0;
 }
 
+static int octeon_device_notifier_call(struct notifier_block *nb,
+				       unsigned long event, void *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	if (event != BUS_NOTIFY_ADD_DEVICE ||
+	    !pdev || !pdev->dev.dma_mask || !pdev->dev.of_node)
+		return NOTIFY_DONE;
+
+	if (of_device_is_compatible(pdev->dev.of_node,
+				     "cavium,octeon-6130-mmc"))
+		*pdev->dev.dma_mask = DMA_BIT_MASK(64);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block platform_nb = {
+	.notifier_call = octeon_device_notifier_call,
+};
+
 static int __init octeon_publish_devices(void)
 {
+	bus_register_notifier(&platform_bus_type, &platform_nb);
 	return of_platform_populate(NULL, octeon_ids, NULL, NULL);
 }
 arch_initcall(octeon_publish_devices);

A.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [REGRESSION] OCTEON MMC driver failure with v4.19
  2018-11-05 22:06 ` Aaro Koskinen
@ 2018-11-06  6:27   ` Christoph Hellwig
  2018-11-06  9:05     ` Aaro Koskinen
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2018-11-06  6:27 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Robin Murphy, Christoph Hellwig, Rob Herring, Paul Burton,
	linux-mips, linux-kernel

On Tue, Nov 06, 2018 at 12:06:32AM +0200, Aaro Koskinen wrote:
> With the below change, the MMC card probe seems to with v4.19. But it
> feels a bit hackish, don't you think... Is there some obvious simple
> fix that I'm missing? Any comments?

Please just use dma_coerce_mask_and_coherent in the platform drivers
instead.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [REGRESSION] OCTEON MMC driver failure with v4.19
  2018-11-06  6:27   ` Christoph Hellwig
@ 2018-11-06  9:05     ` Aaro Koskinen
  2018-11-06 21:51       ` Aaro Koskinen
  0 siblings, 1 reply; 5+ messages in thread
From: Aaro Koskinen @ 2018-11-06  9:05 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Robin Murphy, Rob Herring, Paul Burton, linux-mips, linux-kernel

Hi,

On Tue, Nov 06, 2018 at 07:27:24AM +0100, Christoph Hellwig wrote:
> On Tue, Nov 06, 2018 at 12:06:32AM +0200, Aaro Koskinen wrote:
> > With the below change, the MMC card probe seems to with v4.19. But it
> > feels a bit hackish, don't you think... Is there some obvious simple
> > fix that I'm missing? Any comments?
> 
> Please just use dma_coerce_mask_and_coherent in the platform drivers
> instead.

Tried, but that doesn't help with v4.19:

[    1.290698] octeon_mmc 1180000002000.mmc: dma_coerce_mask_and_coherent(): -5
[    1.297825] octeon_mmc: probe of 1180000002000.mmc failed with error -5

A.

diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
index 22aded1065ae..f7ce26ba6936 100644
--- a/drivers/mmc/host/cavium-octeon.c
+++ b/drivers/mmc/host/cavium-octeon.c
@@ -232,7 +232,8 @@ static int octeon_mmc_probe(struct platform_device *pdev)
 	 */
 	host->reg_off_dma = -0x20;
 
-	ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
+	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	dev_err(&pdev->dev, "dma_coerce_mask_and_coherent(): %d", ret);
 	if (ret)
 		return ret;
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [REGRESSION] OCTEON MMC driver failure with v4.19
  2018-11-06  9:05     ` Aaro Koskinen
@ 2018-11-06 21:51       ` Aaro Koskinen
  0 siblings, 0 replies; 5+ messages in thread
From: Aaro Koskinen @ 2018-11-06 21:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Robin Murphy, Rob Herring, Paul Burton, linux-mips, linux-kernel

Hi,

On Tue, Nov 06, 2018 at 11:05:11AM +0200, Aaro Koskinen wrote:
> On Tue, Nov 06, 2018 at 07:27:24AM +0100, Christoph Hellwig wrote:
> > On Tue, Nov 06, 2018 at 12:06:32AM +0200, Aaro Koskinen wrote:
> > > With the below change, the MMC card probe seems to with v4.19. But it
> > > feels a bit hackish, don't you think... Is there some obvious simple
> > > fix that I'm missing? Any comments?
> > 
> > Please just use dma_coerce_mask_and_coherent in the platform drivers
> > instead.
> 
> Tried, but that doesn't help with v4.19:
> 
> [    1.290698] octeon_mmc 1180000002000.mmc: dma_coerce_mask_and_coherent(): -5
> [    1.297825] octeon_mmc: probe of 1180000002000.mmc failed with error -5
> 
> A.

Just for the archives, the fix is: https://patchwork.kernel.org/patch/10670177/

A.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-06 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 20:54 [REGRESSION] OCTEON MMC driver failure with v4.19 Aaro Koskinen
2018-11-05 22:06 ` Aaro Koskinen
2018-11-06  6:27   ` Christoph Hellwig
2018-11-06  9:05     ` Aaro Koskinen
2018-11-06 21:51       ` Aaro Koskinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.