From: Christoph Hellwig <hch@lst.de>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Sagi Grimberg <sagi@grimberg.me>,
Max Gurtovoy <maxg@mellanox.com>,
Bart Van Assche <bvanassche@acm.org>,
linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org,
megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] scsi: add a host / host template field for the virt boundary
Date: Mon, 17 Jun 2019 14:19:53 +0200 [thread overview]
Message-ID: <20190617122000.22181-2-hch@lst.de> (raw)
In-Reply-To: <20190617122000.22181-1-hch@lst.de>
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>
---
drivers/scsi/hosts.c | 3 +++
drivers/scsi/scsi_lib.c | 3 ++-
include/scsi/scsi_host.h | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index ff0d8c6a8d0c..55522b7162d3 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -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;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 65d0a10c76ad..d333bb6b1c59 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1775,7 +1775,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),
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a5fcdad4a03e..cc139dbd71e5 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -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.
*
--
2.20.1
next prev parent reply other threads:[~2019-06-17 12:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 12:19 properly communicate queue limits to the DMA layer v2 Christoph Hellwig
2019-06-17 12:19 ` Christoph Hellwig [this message]
2019-06-17 20:51 ` [PATCH 1/8] scsi: add a host / host template field for the virt boundary Bart Van Assche
2019-06-18 0:35 ` Ming Lei
2019-06-20 6:17 ` Kashyap Desai
2019-06-17 12:19 ` [PATCH 2/8] scsi: take the DMA max mapping size into account Christoph Hellwig
2019-06-17 20:56 ` Bart Van Assche
2019-07-22 6:00 ` Ming Lei
2019-07-22 6:18 ` Dexuan-Linux Cui
2019-07-22 7:40 ` Damien Le Moal
2019-06-17 12:19 ` [PATCH 3/8] ufshcd: set max_segment_size in the scsi host template Christoph Hellwig
2019-06-17 20:58 ` Bart Van Assche
2019-06-17 12:19 ` [PATCH 4/8] storvsc: set virt_boundary_mask " Christoph Hellwig
2019-06-17 20:59 ` Bart Van Assche
2019-06-17 12:19 ` [PATCH 5/8] IB/iser: set virt_boundary_mask in the scsi host Christoph Hellwig
2019-06-17 17:34 ` Sagi Grimberg
2019-06-24 22:32 ` Max Gurtovoy
2019-06-17 12:19 ` [PATCH 6/8] IB/srp: " Christoph Hellwig
2019-06-17 17:35 ` Sagi Grimberg
2019-06-17 21:01 ` Bart Van Assche
2019-06-24 22:33 ` Max Gurtovoy
2019-06-17 12:19 ` [PATCH 7/8] mpt3sas: set an unlimited max_segment_size for SAS 3.0 HBAs Christoph Hellwig
2019-06-18 0:46 ` Ming Lei
2019-06-20 7:04 ` Suganath Prabu Subramani
2019-06-20 7:08 ` Suganath Prabu Subramani
2019-06-17 12:20 ` [PATCH 8/8] megaraid_sas: set an unlimited max_segment_size Christoph Hellwig
2019-07-15 16:58 ` properly communicate queue limits to the DMA layer v2 Christoph Hellwig
2019-07-15 17:33 ` Martin K. Petersen
2019-07-15 17:46 ` Christoph Hellwig
2019-07-17 3:07 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190617122000.22181-2-hch@lst.de \
--to=hch@lst.de \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=bvanassche@acm.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=maxg@mellanox.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).