Re: [PATCH v2] scsi: ibmvscsi: Use dma_alloc_noncoherent() instead of get_zeroed_page/dma_map_single()

Nathan Lynch
2021-10-14T19:25:57Z

Cai Huoqing <caihuoqing@baidu.com> writes:
> @@ -331,18 +329,12 @@ static int ibmvscsi_init_crq_queue(struct crq_queue *queue,
> int retrc;
> struct vio_dev *vdev = to_vio_dev(hostdata->dev);
>
> - queue->msgs = (struct viosrp_crq *)get_zeroed_page(GFP_KERNEL);
> -
> - if (!queue->msgs)
> - goto malloc_failed;
> queue->size = PAGE_SIZE / sizeof(*queue->msgs);
> -
> - queue->msg_token = dma_map_single(hostdata->dev, queue->msgs,
> - queue->size * sizeof(*queue->msgs),
> - DMA_BIDIRECTIONAL);
> -
> - if (dma_mapping_error(hostdata->dev, queue->msg_token))
> - goto map_failed;
> + queue->msgs = dma_alloc_noncoherent(hostdata->dev,
> + PAGE_SIZE, &queue->msg_token,
> + DMA_BIDIRECTIONAL, GFP_KERNEL);
> + if (!queue->msg)
> + goto malloc_failed;

This version appears to retain the build breakage from v1 which was
reported here:

https://lore.kernel.org/linuxppc-dev/202110121452.nWPHZeZg-lkp@intel.com/

drivers/scsi/ibmvscsi/ibmvscsi.c: In function 'ibmvscsi_init_crq_queue':
>> drivers/scsi/ibmvscsi/ibmvscsi.c:334:21: error: 'struct crq_queue' has no member named 'msg'; did you mean 'msgs'?
334 | if (!queue->msg)
| ^~~
| msgs
drivers/scsi/ibmvscsi/ibmvscsi.c:388:60: error: 'struct crq_queue' has no member named 'msg'; did you mean 'msgs'?
388 | dma_free_coherent(hostdata->dev, PAGE_SIZE, queue->msg, queue->msg_token);
| ^~~
| msgs