From: Arnd Bergmann <arnd@kernel.org>
To: linux-scsi@vger.kernel.org
Cc: linux-arch@vger.kernel.org,
Miquel van Smoorenburg <mikevs@xs4all.net>,
linux-parisc@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
linuxppc-dev@lists.ozlabs.org,
"Maciej W . Rozycki" <macro@orcam.me.uk>,
linux-m68k@lists.linux-m68k.org,
Denis Efremov <efremov@linux.com>,
Mark Salyzyn <salyzyn@android.com>,
Christoph Hellwig <hch@infradead.org>,
iommu@lists.linux-foundation.org, Matt Wang <wwentao@vmware.com>,
Hannes Reinecke <hare@suse.de>,
linux-alpha@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Khalid Aziz <khalid@gonehiking.org>,
Robin Murphy <robin.murphy@arm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: [PATCH v3 1/3] scsi: BusLogic remove bus_to_virt
Date: Fri, 24 Jun 2022 17:52:24 +0200 [thread overview]
Message-ID: <20220624155226.2889613-2-arnd@kernel.org> (raw)
In-Reply-To: <20220624155226.2889613-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
The BusLogic driver is the last remaining driver that relies on the
deprecated bus_to_virt() function, which in turn only works on a few
architectures, and is incompatible with both swiotlb and iommu support.
Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
the driver had a dependency on x86-32, presumably because of this
problem. However, the change introduced another bug that made it still
impossible to use the driver on any 64-bit machine.
This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
64-bit system enumeration error for Buslogic"), 8 years later, which
shows that there are not a lot of users.
Maciej is still using the driver on 32-bit hardware, and Khalid mentioned
that the driver works with the device emulation used in VirtualBox
and VMware. Both of those only emulate it for Windows 2000 and older
operating systems that did not ship with the better LSI logic driver.
Do a minimum fix that searches through the list of descriptors to find
one that matches the bus address. This is clearly as inefficient as
was indicated in the code comment about the lack of a bus_to_virt()
replacement. A better fix would likely involve changing out the entire
descriptor allocation for a simpler one, but that would be much
more invasive.
Cc: Maciej W. Rozycki <macro@orcam.me.uk>
Cc: Matt Wang <wwentao@vmware.com>
Tested-by: Khalid Aziz <khalid@gonehiking.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: Address issues pointed out by Khalid Aziz
v2: Attempt to fix the driver instead of removing it
---
drivers/scsi/BusLogic.c | 35 +++++++++++++++++++++++------------
drivers/scsi/Kconfig | 2 +-
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index a897c8f914cf..f2abffce2659 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2515,12 +2515,26 @@ static int blogic_resultcode(struct blogic_adapter *adapter,
return (hoststatus << 16) | tgt_status;
}
+/*
+ * turn the dma address from an inbox into a ccb pointer
+ * This is rather inefficient.
+ */
+static struct blogic_ccb *
+blogic_inbox_to_ccb(struct blogic_adapter *adapter, struct blogic_inbox *inbox)
+{
+ struct blogic_ccb *ccb;
+
+ for (ccb = adapter->all_ccbs; ccb; ccb = ccb->next_all)
+ if (inbox->ccb == ccb->dma_handle)
+ break;
+
+ return ccb;
+}
/*
blogic_scan_inbox scans the Incoming Mailboxes saving any
Incoming Mailbox entries for completion processing.
*/
-
static void blogic_scan_inbox(struct blogic_adapter *adapter)
{
/*
@@ -2540,17 +2554,14 @@ static void blogic_scan_inbox(struct blogic_adapter *adapter)
enum blogic_cmplt_code comp_code;
while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) {
- /*
- We are only allowed to do this because we limit our
- architectures we run on to machines where bus_to_virt(
- actually works. There *needs* to be a dma_addr_to_virt()
- in the new PCI DMA mapping interface to replace
- bus_to_virt() or else this code is going to become very
- innefficient.
- */
- struct blogic_ccb *ccb =
- (struct blogic_ccb *) bus_to_virt(next_inbox->ccb);
- if (comp_code != BLOGIC_CMD_NOTFOUND) {
+ struct blogic_ccb *ccb = blogic_inbox_to_ccb(adapter, next_inbox);
+ if (!ccb) {
+ /*
+ * This should never happen, unless the CCB list is
+ * corrupted in memory.
+ */
+ blogic_warn("Could not find CCB for dma address %x\n", adapter, next_inbox->ccb);
+ } else if (comp_code != BLOGIC_CMD_NOTFOUND) {
if (ccb->status == BLOGIC_CCB_ACTIVE ||
ccb->status == BLOGIC_CCB_RESET) {
/*
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 6e3a04107bb6..689186f3a908 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -514,7 +514,7 @@ config SCSI_HPTIOP
config SCSI_BUSLOGIC
tristate "BusLogic SCSI support"
- depends on PCI && SCSI && VIRT_TO_BUS
+ depends on PCI && SCSI
help
This is support for BusLogic MultiMaster and FlashPoint SCSI Host
Adapters. Consult the SCSI-HOWTO, available from
--
2.29.2
next prev parent reply other threads:[~2022-06-24 15:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 15:52 [PATCH v3 0/3] phase out CONFIG_VIRT_TO_BUS Arnd Bergmann
2022-06-24 15:52 ` Arnd Bergmann [this message]
2022-06-24 16:38 ` [PATCH v3 1/3] scsi: BusLogic remove bus_to_virt Khalid Aziz
2022-06-24 15:52 ` [PATCH v3 2/3] scsi: dpt_i2o: remove obsolete driver Arnd Bergmann
2022-06-24 15:52 ` [PATCH v3 3/3] arch/*/: remove CONFIG_VIRT_TO_BUS Arnd Bergmann
2022-06-24 17:08 ` [PATCH v3 0/3] phase out CONFIG_VIRT_TO_BUS Arnd Bergmann
2022-06-28 2:59 ` Martin K. Petersen
2022-06-28 11:31 ` Arnd Bergmann
2022-07-07 21:47 ` 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=20220624155226.2889613-2-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=efremov@linux.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=khalid@gonehiking.org \
--cc=kuba@kernel.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=m.szyprowski@samsung.com \
--cc=macro@orcam.me.uk \
--cc=mikevs@xs4all.net \
--cc=robin.murphy@arm.com \
--cc=salyzyn@android.com \
--cc=wwentao@vmware.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 NNTP newsgroup(s).