From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
Sathya Prakash <sathya.prakash@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
"Juergen E. Fischer" <fischer@norbit.de>,
Xiang Chen <chenxiang66@hisilicon.com>,
HighPoint Linux Team <linux@highpoint-tech.com>,
Tyrel Datwyler <tyreld@linux.ibm.com>,
Brian King <brking@us.ibm.com>, Lee Duncan <lduncan@suse.com>,
Chris Leech <cleech@redhat.com>,
Mike Christie <michael.christie@oracle.com>,
John Garry <john.g.garry@oracle.com>,
Jason Yan <yanaijie@huawei.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Sumit Saxena <sumit.saxena@broadcom.com>,
Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
Chandrakanth patil <chandrakanth.patil@broadcom.com>,
Jack Wang <jinpu.wang@cloud.ionos.com>,
Nilesh Javali <njavali@marvell.com>,
GR-QLogic-Storage-Upstream@marvell.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alan Stern <stern@rowland.harvard.edu>,
linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
linux1394-devel@lists.sourceforge.net,
MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com,
linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org,
usb-storage@lists.one-eyed-alien.net,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host
Date: Tue, 9 Apr 2024 16:37:31 +0200 [thread overview]
Message-ID: <20240409143748.980206-7-hch@lst.de> (raw)
In-Reply-To: <20240409143748.980206-1-hch@lst.de>
While we really should be killing the block layer bounce buffering ASAP,
I even more urgently need to stop the drivers to fiddle with the limits
from ->slave_configure. Add a no_highmem flag to the Scsi_Host to
centralize this setting and switch the remaining four drivers that use
block layer bounce buffering to it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
drivers/scsi/aha152x.c | 8 +-------
drivers/scsi/imm.c | 12 +-----------
drivers/scsi/ppa.c | 8 +-------
drivers/scsi/scsi_lib.c | 3 +++
drivers/usb/storage/scsiglue.c | 10 ----------
drivers/usb/storage/usb.c | 10 ++++++++++
include/scsi/scsi_host.h | 2 ++
7 files changed, 18 insertions(+), 35 deletions(-)
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 055adb349b0e41..83f16fc14d9630 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -746,6 +746,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
/* need to have host registered before triggering any interrupt */
list_add_tail(&HOSTDATA(shpnt)->host_list, &aha152x_host_list);
+ shpnt->no_highmem = true;
shpnt->io_port = setup->io_port;
shpnt->n_io_port = IO_RANGE;
shpnt->irq = setup->irq;
@@ -2940,12 +2941,6 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
return 0;
}
-static int aha152x_adjust_queue(struct scsi_device *device)
-{
- blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
- return 0;
-}
-
static const struct scsi_host_template aha152x_driver_template = {
.module = THIS_MODULE,
.name = AHA152X_REVID,
@@ -2961,7 +2956,6 @@ static const struct scsi_host_template aha152x_driver_template = {
.this_id = 7,
.sg_tablesize = SG_ALL,
.dma_boundary = PAGE_SIZE - 1,
- .slave_alloc = aha152x_adjust_queue,
.cmd_size = sizeof(struct aha152x_cmd_priv),
};
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 180a5ddedb2cda..21339da505f1ea 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -1100,16 +1100,6 @@ static int device_check(imm_struct *dev, bool autodetect)
return -ENODEV;
}
-/*
- * imm cannot deal with highmem, so this causes all IO pages for this host
- * to reside in low memory (hence mapped)
- */
-static int imm_adjust_queue(struct scsi_device *device)
-{
- blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
- return 0;
-}
-
static const struct scsi_host_template imm_template = {
.module = THIS_MODULE,
.proc_name = "imm",
@@ -1123,7 +1113,6 @@ static const struct scsi_host_template imm_template = {
.this_id = 7,
.sg_tablesize = SG_ALL,
.can_queue = 1,
- .slave_alloc = imm_adjust_queue,
.cmd_size = sizeof(struct scsi_pointer),
};
@@ -1235,6 +1224,7 @@ static int __imm_attach(struct parport *pb)
host = scsi_host_alloc(&imm_template, sizeof(imm_struct *));
if (!host)
goto out1;
+ host->no_highmem = true;
host->io_port = pb->base;
host->n_io_port = ports;
host->dma_channel = -1;
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index d592ee9170c11f..8300f0bdddb37a 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -986,12 +986,6 @@ static int device_check(ppa_struct *dev, bool autodetect)
return -ENODEV;
}
-static int ppa_adjust_queue(struct scsi_device *device)
-{
- blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
- return 0;
-}
-
static const struct scsi_host_template ppa_template = {
.module = THIS_MODULE,
.proc_name = "ppa",
@@ -1005,7 +999,6 @@ static const struct scsi_host_template ppa_template = {
.this_id = -1,
.sg_tablesize = SG_ALL,
.can_queue = 1,
- .slave_alloc = ppa_adjust_queue,
.cmd_size = sizeof(struct scsi_pointer),
};
@@ -1111,6 +1104,7 @@ static int __ppa_attach(struct parport *pb)
host = scsi_host_alloc(&ppa_template, sizeof(ppa_struct *));
if (!host)
goto out1;
+ host->no_highmem = true;
host->io_port = pb->base;
host->n_io_port = ports;
host->dma_channel = -1;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 1deca84914e87a..f1936f98abe3e2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1995,6 +1995,9 @@ void scsi_init_limits(struct Scsi_Host *shost, struct queue_limits *lim)
*/
lim->dma_alignment = max(4, dma_get_cache_alignment()) - 1;
+ if (shost->no_highmem)
+ lim->bounce = BLK_BOUNCE_HIGH;
+
dma_set_seg_boundary(dev, shost->dma_boundary);
dma_set_max_seg_size(dev, shost->max_segment_size);
}
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 12cf9940e5b675..1d14c678f3d3e3 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -40,7 +40,6 @@
#include <scsi/scsi_eh.h>
#include "usb.h"
-#include <linux/usb/hcd.h>
#include "scsiglue.h"
#include "debug.h"
#include "transport.h"
@@ -130,15 +129,6 @@ static int slave_configure(struct scsi_device *sdev)
min_t(size_t, queue_max_hw_sectors(sdev->request_queue),
dma_max_mapping_size(dev) >> SECTOR_SHIFT));
- /*
- * Some USB host controllers can't do DMA; they have to use PIO.
- * For such controllers we need to make sure the block layer sets
- * up bounce buffers in addressable memory.
- */
- if (!hcd_uses_dma(bus_to_hcd(us->pusb_dev->bus)) ||
- (bus_to_hcd(us->pusb_dev->bus)->localmem_pool != NULL))
- blk_queue_bounce_limit(sdev->request_queue, BLK_BOUNCE_HIGH);
-
/*
* We can't put these settings in slave_alloc() because that gets
* called before the device type is known. Consequently these
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index d1ad6a2509ab7f..a49a31639f6f0c 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -47,6 +47,7 @@
#include <scsi/scsi_device.h>
#include "usb.h"
+#include <linux/usb/hcd.h>
#include "scsiglue.h"
#include "transport.h"
#include "protocol.h"
@@ -961,6 +962,15 @@ int usb_stor_probe1(struct us_data **pus,
if (result)
goto BadDevice;
+ /*
+ * Some USB host controllers can't do DMA; they have to use PIO.
+ * For such controllers we need to make sure the block layer sets
+ * up bounce buffers in addressable memory.
+ */
+ if (!hcd_uses_dma(bus_to_hcd(us->pusb_dev->bus)) ||
+ bus_to_hcd(us->pusb_dev->bus)->localmem_pool)
+ host->no_highmem = true;
+
/* Get the unusual_devs entries and the descriptors */
result = get_device_info(us, id, unusual_dev);
if (result)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b259d42a1e1aff..6d77c48e8311fb 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -665,6 +665,8 @@ struct Scsi_Host {
/* The transport requires the LUN bits NOT to be stored in CDB[1] */
unsigned no_scsi2_lun_in_cdb:1;
+ unsigned no_highmem:1;
+
/*
* Optional work queue to be utilized by the transport
*/
--
2.39.2
next prev parent reply other threads:[~2024-04-09 14:38 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 14:37 convert SCSI to atomic queue limits, part 1 (v3) Christoph Hellwig
2024-04-09 14:37 ` [PATCH 01/23] block: add a helper to cancel atomic queue limit updates Christoph Hellwig
2024-04-09 14:43 ` John Garry
2024-04-09 15:06 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue Christoph Hellwig
2024-04-09 15:06 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 03/23] mpi3mr: " Christoph Hellwig
2024-04-09 15:06 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue Christoph Hellwig
2024-04-09 15:08 ` Johannes Thumshirn
2024-05-15 21:50 ` Guenter Roeck
2024-05-15 22:16 ` John Garry
2024-05-15 23:52 ` Guenter Roeck
2024-05-16 13:08 ` John Garry
2024-05-16 14:50 ` Guenter Roeck
2024-04-09 14:37 ` [PATCH 05/23] scsi_transport_fc: add a max_bsg_segments field to struct fc_function_template Christoph Hellwig
2024-04-09 15:08 ` Johannes Thumshirn
2024-04-09 14:37 ` Christoph Hellwig [this message]
2024-04-09 15:10 ` [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 07/23] scsi: add a dma_alignment field to the host and host template Christoph Hellwig
2024-04-09 15:10 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 08/23] ufs-exynos: move setting the the dma alignment to the init method Christoph Hellwig
2024-04-09 15:11 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 09/23] scsi: use the atomic queue limits API in scsi_add_lun Christoph Hellwig
2024-04-09 15:12 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 10/23] scsi: add a device_configure method to the host template Christoph Hellwig
2024-04-09 15:13 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 11/23] megaraid_sas: switch to using ->device_configure Christoph Hellwig
2024-04-09 15:16 ` Johannes Thumshirn
2024-04-10 5:46 ` Hannes Reinecke
2024-04-09 14:37 ` [PATCH 12/23] mpt3sas: " Christoph Hellwig
2024-04-09 15:16 ` Johannes Thumshirn
2024-04-10 5:48 ` Hannes Reinecke
2024-04-09 14:37 ` [PATCH 13/23] sbp2: " Christoph Hellwig
2024-04-09 15:18 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 14/23] hptiop: " Christoph Hellwig
2024-04-09 15:18 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 15/23] ipr: " Christoph Hellwig
2024-04-09 15:19 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 16/23] pmcraid: " Christoph Hellwig
2024-04-09 15:19 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 17/23] usb-storage: " Christoph Hellwig
2024-04-09 15:20 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 18/23] sata_nv: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 19/23] pata_macio: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 20/23] libata: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 21/23] mpi3mr: " Christoph Hellwig
2024-04-09 15:34 ` Johannes Thumshirn
2024-04-10 4:25 ` Christoph Hellwig
2024-04-10 4:27 ` [PATCH 21/23 v3.1] " Christoph Hellwig
2024-04-10 8:01 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 22/23] uas: switch to using ->device_configure to configure queue limits Christoph Hellwig
2024-04-09 15:26 ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 23/23] block: remove now unused queue limits helpers Christoph Hellwig
2024-04-09 15:26 ` Johannes Thumshirn
2024-04-12 2:04 ` convert SCSI to atomic queue limits, part 1 (v3) Martin K. Petersen
2024-04-25 1:57 ` Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2024-04-02 13:06 convert SCSI to atomic queue limits, part 1 (v2) Christoph Hellwig
2024-04-02 13:06 ` [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host Christoph Hellwig
2024-04-03 6:52 ` Hannes Reinecke
2024-04-04 17:01 ` Bart Van Assche
2024-03-24 23:54 convert SCSI to atomic queue limits, part 1 Christoph Hellwig
2024-03-24 23:54 ` [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host Christoph Hellwig
2024-03-25 7:26 ` Damien Le Moal
2024-03-26 6:09 ` Christoph Hellwig
2024-03-27 15:03 ` John Garry
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=20240409143748.980206-7-hch@lst.de \
--to=hch@lst.de \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=axboe@kernel.dk \
--cc=brking@us.ibm.com \
--cc=bvanassche@acm.org \
--cc=cassel@kernel.org \
--cc=chandrakanth.patil@broadcom.com \
--cc=chenxiang66@hisilicon.com \
--cc=cleech@redhat.com \
--cc=dlemoal@kernel.org \
--cc=fischer@norbit.de \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.de \
--cc=jinpu.wang@cloud.ionos.com \
--cc=john.g.garry@oracle.com \
--cc=kashyap.desai@broadcom.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lduncan@suse.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=linux@highpoint-tech.com \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=michael.christie@oracle.com \
--cc=mpi3mr-linuxdrv.pdl@broadcom.com \
--cc=njavali@marvell.com \
--cc=o-takashi@sakamocchi.jp \
--cc=sathya.prakash@broadcom.com \
--cc=shivasharan.srikanteshwara@broadcom.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=stern@rowland.harvard.edu \
--cc=suganath-prabu.subramani@broadcom.com \
--cc=sumit.saxena@broadcom.com \
--cc=tyreld@linux.ibm.com \
--cc=usb-storage@lists.one-eyed-alien.net \
--cc=yanaijie@huawei.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).