scsi: core: add a host / host template field for the virt boundary
authorChristoph Hellwig <hch@lst.de>
Mon, 17 Jun 2019 12:19:53 +0000 (14:19 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 17 Jul 2019 03:01:49 +0000 (23:01 -0400)
This allows drivers setting it up easily instead of branching out to block
layer calls in slave_alloc, and ensures the upgraded max_segment_size
setting gets picked up by the DMA layer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Kashyap Desai < kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_lib.c
include/scsi/scsi_host.h

index 96ed248..f98509d 100644 (file)
@@ -462,6 +462,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
        else
                shost->dma_boundary = 0xffffffff;
 
+       if (sht->virt_boundary_mask)
+               shost->virt_boundary_mask = sht->virt_boundary_mask;
+
        device_initialize(&shost->shost_gendev);
        dev_set_name(&shost->shost_gendev, "host%d", shost->host_no);
        shost->shost_gendev.bus = &scsi_bus_type;
index 420e235..404e5e2 100644 (file)
@@ -1791,7 +1791,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
        dma_set_seg_boundary(dev, shost->dma_boundary);
 
        blk_queue_max_segment_size(q, shost->max_segment_size);
-       dma_set_max_seg_size(dev, shost->max_segment_size);
+       blk_queue_virt_boundary(q, shost->virt_boundary_mask);
+       dma_set_max_seg_size(dev, queue_max_segment_size(q));
 
        /*
         * Set a reasonable default alignment:  The larger of 32-byte (dword),
index a5fcdad..cc139db 100644 (file)
@@ -369,6 +369,8 @@ struct scsi_host_template {
         */
        unsigned long dma_boundary;
 
+       unsigned long virt_boundary_mask;
+
        /*
         * This specifies "machine infinity" for host templates which don't
         * limit the transfer size.  Note this limit represents an absolute
@@ -587,6 +589,7 @@ struct Scsi_Host {
        unsigned int max_sectors;
        unsigned int max_segment_size;
        unsigned long dma_boundary;
+       unsigned long virt_boundary_mask;
        /*
         * In scsi-mq mode, the number of hardware queues supported by the LLD.
         *