Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/virtio_ccw: Fix dma_parm pointer not set up

At least since commit 334304ac2bac ("dma-mapping: don't return errors
from dma_set_max_seg_size") setting up device.dma_parms is basically
mandated by the DMA API. As of now Channel (CCW) I/O in general does not
utilize the DMA API, except for virtio. For virtio-ccw however the
common virtio DMA infrastructure is such that most of the DMA stuff
hinges on the virtio parent device, which is a CCW device.

So lets set up the dma_parms pointer for the CCW parent device and hope
for the best!

Fixes: 334304ac2bac ("dma-mapping: don't return errors from dma_set_max_seg_size")
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Link: https://lore.kernel.org/r/20241007201030.204028-1-pasic@linux.ibm.com
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Halil Pasic and committed by
Heiko Carstens
14c75793 61997c1e

+4
+4
drivers/s390/virtio/virtio_ccw.c
··· 58 58 struct virtio_device vdev; 59 59 __u8 config[VIRTIO_CCW_CONFIG_SIZE]; 60 60 struct ccw_device *cdev; 61 + /* we make cdev->dev.dma_parms point to this */ 62 + struct device_dma_parameters dma_parms; 61 63 __u32 curr_io; 62 64 int err; 63 65 unsigned int revision; /* Transport revision */ ··· 1305 1303 unregister_virtio_device(&vcdev->vdev); 1306 1304 spin_lock_irqsave(get_ccwdev_lock(cdev), flags); 1307 1305 dev_set_drvdata(&cdev->dev, NULL); 1306 + cdev->dev.dma_parms = NULL; 1308 1307 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); 1309 1308 return 0; 1310 1309 } ··· 1369 1366 } 1370 1367 vcdev->vdev.dev.parent = &cdev->dev; 1371 1368 vcdev->cdev = cdev; 1369 + cdev->dev.dma_parms = &vcdev->dma_parms; 1372 1370 vcdev->dma_area = ccw_device_dma_zalloc(vcdev->cdev, 1373 1371 sizeof(*vcdev->dma_area), 1374 1372 &vcdev->dma_area_addr);