Skip to contentSkip to conversation

vdpa-sim: depend on HAS_DMA

PATCH Superseded Michael S. Tsirkin 4 participants 7 messages Apr 5, 2020 – Apr 10, 2020 virtio core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vdpa-sim: depend on HAS_DMA

set_dma_ops isn't available on all architectures:

make ARCH=um
...

drivers/vdpa/vdpa_sim/vdpa_sim.c: In function 'vdpasim_create':

Quoted 1 line
Quoted 1 line

drivers/vdpa/vdpa_sim/vdpa_sim.c:324:2: error: implicit declaration of function 'set_dma_ops'; did you mean 'set_groups'?

+[-Werror=implicit-function-declaration]

     set_dma_ops(dev, &vdpasim_dma_ops);
     ^~~~~~~~~~~
     set_groups
---
 drivers/vdpa/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/Kconfig +1 -1
index 08b615f2da39..d0cb0e583a5d 100644
@@ -14,7 +14,7 @@ if VDPA_MENU
 
 config VDPA_SIM
 	tristate "vDPA device simulator"
-	depends on RUNTIME_TESTING_MENU
+	depends on RUNTIME_TESTING_MENU && HAS_DMA
 	select VDPA
 	select VHOST_RING
 	select VHOST_IOTLB
Signature · 1 line
MST
Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines · Michael S. Tsirkin

set_dma_ops isn't available on all architectures:

make ARCH=um
...

drivers/vdpa/vdpa_sim/vdpa_sim.c: In function 'vdpasim_create':

Quoted 1 line
Quoted 1 line

drivers/vdpa/vdpa_sim/vdpa_sim.c:324:2: error: implicit declaration of function 'set_dma_ops'; did you mean 'set_groups'?

+[-Werror=implicit-function-declaration]

      set_dma_ops(dev, &vdpasim_dma_ops);
      ^~~~~~~~~~~
      set_groups
---
  drivers/vdpa/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/Kconfig +0 -0
index 08b615f2da39..d0cb0e583a5d 100644

drivers/vdpa/Kconfig if VDPA_MENU · line 20

Quoted 8 lines
drivers/vdpa/Kconfig +1 -1
@@ -14,7 +14,7 @@ if VDPA_MENU
 
  config VDPA_SIM
  	tristate "vDPA device simulator"
-	depends on RUNTIME_TESTING_MENU
+	depends on RUNTIME_TESTING_MENU && HAS_DMA
  	select VDPA
  	select VHOST_RING
  	select VHOST_IOTLB
author maintainer
#3 lore raw
Quoted 2 lines · Christoph Hellwig

Pleae just drop the code - we should not add new drivers with custom DMA ops.

I'm not sure there's another way to do this: this not a driver, it's a software emulator that pretends to be an actual device. We can't have the platform supply DMA ops here since the platform is a regular x86 or whatever.

Signature · 1 line
MST
#4 lore raw
Quoted 7 lines · Michael S. Tsirkin
Quoted 2 lines · Christoph Hellwig

Pleae just drop the code - we should not add new drivers with custom DMA ops.

I'm not sure there's another way to do this: this not a driver, it's a software emulator that pretends to be an actual device. We can't have the platform supply DMA ops here since the platform is a regular x86 or whatever.

Yes, actually vdpa-sim does not depends on HAS_DMA. Maybe we can do shortcut like dev->dma_ops = vdpasim_dma_ops;

Thanks

Quoted 1 line
author maintainer
#5 lore raw
Quoted 11 lines · Jason Wang
Quoted 7 lines · Michael S. Tsirkin
Quoted 2 lines · Christoph Hellwig

Pleae just drop the code - we should not add new drivers with custom DMA ops.

I'm not sure there's another way to do this: this not a driver, it's a software emulator that pretends to be an actual device. We can't have the platform supply DMA ops here since the platform is a regular x86 or whatever.

Quoted 5 lines

Yes, actually vdpa-sim does not depends on HAS_DMA. Maybe we can do shortcut like dev->dma_ops = vdpasim_dma_ops;

Thanks

We can do that - does it them actually work - and not just compile?

Signature · 1 line
MST
Acked-by on v1 1/1
#6 lore raw
In reply to Michael S. Tsirkin

Hi Michael,

Quoted 6 lines · Michael S. Tsirkin

set_dma_ops isn't available on all architectures:

make ARCH=um
...

Quoted 8 lines

drivers/vdpa/vdpa_sim/vdpa_sim.c: In function 'vdpasim_create':

Quoted 1 line
Quoted 1 line

drivers/vdpa/vdpa_sim/vdpa_sim.c:324:2: error: implicit declaration of function 'set_dma_ops'; did you mean 'set_groups'?

+[-Werror=implicit-function-declaration]

     set_dma_ops(dev, &vdpasim_dma_ops);
     ^~~~~~~~~~~
     set_groups

As this fixes the Sun-3 all{mod,yes}-config build, which has NO_DMA=y:

However, you may want to follow Christoph's suggestion instead.

drivers/vdpa/Kconfig if VDPA_MENU · line 20

Quoted 11 lines
drivers/vdpa/Kconfig +1 -1
@@ -14,7 +14,7 @@ if VDPA_MENU
 
 config VDPA_SIM
        tristate "vDPA device simulator"
-       depends on RUNTIME_TESTING_MENU
+       depends on RUNTIME_TESTING_MENU && HAS_DMA
        select VDPA
        select VHOST_RING
        select VHOST_IOTLB

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds