Skip to contentSkip to conversation

gpu: host1x: Do not setup DMA for virtual devices

PATCH In review Thierry Reding 2 participants 4 messages Mar 14, 2024 – Apr 8, 2024

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

PATCH 1/1 gpu: host1x: Do not setup DMA for virtual devices

From: Thierry Reding <[email protected]>

The host1x devices are virtual compound devices and do not perform DMA accesses themselves, so they do not need to be set up for DMA.

Ideally we would also not need to set up DMA masks for the virtual devices, but we currently still need those for legacy support on old hardware.

---
 drivers/gpu/host1x/bus.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/host1x/bus.c +0 -8
index 783975d1384f..7c52757a89db 100644
@@ -351,11 +351,6 @@ static int host1x_device_uevent(const struct device *dev,
 	return 0;
 }
 
-static int host1x_dma_configure(struct device *dev)
-{
-	return of_dma_configure(dev, dev->of_node, true);
-}
-
 static const struct dev_pm_ops host1x_device_pm_ops = {
 	.suspend = pm_generic_suspend,
 	.resume = pm_generic_resume,
@@ -369,7 +364,6 @@ const struct bus_type host1x_bus_type = {
 	.name = "host1x",
 	.match = host1x_device_match,
 	.uevent = host1x_device_uevent,
-	.dma_configure = host1x_dma_configure,
 	.pm = &host1x_device_pm_ops,
 };
 
@@ -458,8 +452,6 @@ static int host1x_device_add(struct host1x *host1x,
 	device->dev.bus = &host1x_bus_type;
 	device->dev.parent = host1x->dev;
 
-	of_dma_configure(&device->dev, host1x->dev->of_node, true);
-
 	device->dev.dma_parms = &device->dma_parms;
 	dma_set_max_seg_size(&device->dev, UINT_MAX);
 
Signature · 1 line
2.44.0
maintainer Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 39 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The host1x devices are virtual compound devices and do not perform DMA accesses themselves, so they do not need to be set up for DMA.

Ideally we would also not need to set up DMA masks for the virtual devices, but we currently still need those for legacy support on old hardware.

---
  drivers/gpu/host1x/bus.c | 8 --------
  1 file changed, 8 deletions(-)
drivers/gpu/host1x/bus.c +0 -6
index 783975d1384f..7c52757a89db 100644
@@ -351,11 +351,6 @@ static int host1x_device_uevent(const struct device *dev,
  	return 0;
  }
 
-static int host1x_dma_configure(struct device *dev)
-{
-	return of_dma_configure(dev, dev->of_node, true);
-}
-
  static const struct dev_pm_ops host1x_device_pm_ops = {
  	.suspend = pm_generic_suspend,
  	.resume = pm_generic_resume,
@@ -369,7 +364,6 @@ const struct bus_type host1x_bus_type = {
  	.name = "host1x",
  	.match = host1x_device_match,
  	.uevent = host1x_device_uevent,
-	.dma_configure = host1x_dma_configure,
  	.pm = &host1x_device_pm_ops,
  };
 

drivers/gpu/host1x/bus.c static int host1x_device_add(struct host1x *host1x, · line 457

Quoted 8 lines
drivers/gpu/host1x/bus.c +0 -2
@@ -458,8 +452,6 @@ static int host1x_device_add(struct host1x *host1x,
  	device->dev.bus = &host1x_bus_type;
  	device->dev.parent = host1x->dev;
 
-	of_dma_configure(&device->dev, host1x->dev->of_node, true);
-
  	device->dev.dma_parms = &device->dma_parms;
  	dma_set_max_seg_size(&device->dev, UINT_MAX);
 

Thanks!
Jon

Signature · 1 line
nvpublic
maintainer
#2 lore raw

Hi Thierry,

Quoted 42 lines · Jon Hunter
Quoted 40 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The host1x devices are virtual compound devices and do not perform DMA accesses themselves, so they do not need to be set up for DMA.

Ideally we would also not need to set up DMA masks for the virtual devices, but we currently still need those for legacy support on old hardware.

---
  drivers/gpu/host1x/bus.c | 8 --------

  1 file changed, 8 deletions(-)
drivers/gpu/host1x/bus.c +0 -6
index 783975d1384f..7c52757a89db 100644
@@ -351,11 +351,6 @@ static int host1x_device_uevent(const struct 
 device *dev,
       return 0;
   }
-static int host1x_dma_configure(struct device *dev)
-{
-    return of_dma_configure(dev, dev->of_node, true);
-}
-
   static const struct dev_pm_ops host1x_device_pm_ops = {
       .suspend = pm_generic_suspend,
       .resume = pm_generic_resume,
@@ -369,7 +364,6 @@ const struct bus_type host1x_bus_type = {
       .name = "host1x",
       .match = host1x_device_match,
       .uevent = host1x_device_uevent,
-    .dma_configure = host1x_dma_configure,
       .pm = &host1x_device_pm_ops,
   };
@@ -458,8 +452,6 @@ static int host1x_device_add(struct host1x *host1x,
       device->dev.bus = &host1x_bus_type;
       device->dev.parent = host1x->dev;
Quoted 8 lines

drivers/gpu/host1x/bus.c static int host1x_device_add(struct host1x *host1x, · line 456

Quoted 4 lines
drivers/gpu/host1x/bus.c +0 -2
-    of_dma_configure(&device->dev, host1x->dev->of_node, true);
-
       device->dev.dma_parms = &device->dma_parms;
       dma_set_max_seg_size(&device->dev, UINT_MAX);

I don't see this in -next yet?

Ideally, if we don't see any issues with this we should pull this into v6.8.y stable branch because I am now seeing the warning there. Should we apply a fixes tag to this?

Thanks
Jon

Signature · 1 line
nvpublic
#3 lore raw
Quoted 55 lines · Jon Hunter

Hi Thierry,

Quoted 42 lines · Jon Hunter
Quoted 40 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The host1x devices are virtual compound devices and do not perform DMA accesses themselves, so they do not need to be set up for DMA.

Ideally we would also not need to set up DMA masks for the virtual devices, but we currently still need those for legacy support on old hardware.

---
  drivers/gpu/host1x/bus.c | 8 --------

  1 file changed, 8 deletions(-)
drivers/gpu/host1x/bus.c +0 -6
index 783975d1384f..7c52757a89db 100644
@@ -351,11 +351,6 @@ static int host1x_device_uevent(const struct 
 device *dev,
       return 0;
   }
-static int host1x_dma_configure(struct device *dev)
-{
-    return of_dma_configure(dev, dev->of_node, true);
-}
-
   static const struct dev_pm_ops host1x_device_pm_ops = {
       .suspend = pm_generic_suspend,
       .resume = pm_generic_resume,
@@ -369,7 +364,6 @@ const struct bus_type host1x_bus_type = {
       .name = "host1x",
       .match = host1x_device_match,
       .uevent = host1x_device_uevent,
-    .dma_configure = host1x_dma_configure,
       .pm = &host1x_device_pm_ops,
   };
@@ -458,8 +452,6 @@ static int host1x_device_add(struct host1x *host1x,
       device->dev.bus = &host1x_bus_type;
       device->dev.parent = host1x->dev;
Quoted 8 lines

drivers/gpu/host1x/bus.c static int host1x_device_add(struct host1x *host1x, · line 456

Quoted 4 lines
drivers/gpu/host1x/bus.c +0 -2
-    of_dma_configure(&device->dev, host1x->dev->of_node, true);
-
       device->dev.dma_parms = &device->dma_parms;
       dma_set_max_seg_size(&device->dev, UINT_MAX);
Quoted 5 lines

I don't see this in -next yet?

Ideally, if we don't see any issues with this we should pull this into v6.8.y stable branch because I am now seeing the warning there. Should we apply a fixes tag to this?

I was finally able to run some finally tests on this and pushed it to drm-misc-fixes, so it should go into linux-next and then Linus' tree sometime soon.

I decided against adding a Fixes tag because it's difficult to backport this all the way to the release which contains the commit that added the issue. Adding a Fixes tag to the commit that ended up exposing the issue didn't seem right either, so let's get this into mainline first and then manually ask stable maintainers to pick this up.

Thierry