Skip to contentSkip to conversation

fix ATAPI support for libsas drivers

PATCH Applied Christoph Hellwig 5 participants 9 messages Jun 15, 2020 – Jun 23, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Hi all,

this series fixes the ATAPI DMA drain refactoring for SAS HBAs that use libsas.

#1 lore raw

PATCH 1/2 libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA

SAS drivers can be compiled with ata support disabled. Provide a stub so that the drivers don't have to ifdef around wiring up ata_scsi_dma_need_drain.

---
 include/linux/libata.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/libata.h +4 -0
index af832852e62044..042e584daca73e 100644
@@ -1092,7 +1092,11 @@ extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd,
 #define ATA_SCSI_COMPAT_IOCTL /* empty */
 #endif
 extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
+#if IS_ENABLED(CONFIG_ATA)
 bool ata_scsi_dma_need_drain(struct request *rq);
+#else
+#define ata_scsi_dma_need_drain NULL
+#endif
 extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
 			    unsigned int cmd, void __user *arg);
 extern bool ata_link_online(struct ata_link *link);
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA

Quoted 3 lines · Christoph Hellwig

SAS drivers can be compiled with ata support disabled. Provide a stub so that the drivers don't have to ifdef around wiring up ata_scsi_dma_need_drain.

Applied to 5.8/scsi-fixes, thanks!

[1/2] scsi: libata: Provide an ata_scsi_dma_need_drain stub for !CONFIG_ATA

      https://git.kernel.org/mkp/scsi/c/7bb7ee8704fe
[2/2] scsi: Wire up ata_scsi_dma_need_drain for SAS HBA drivers
      https://git.kernel.org/mkp/scsi/c/b8f1d1e05817
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw

PATCH 2/2 scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers

In reply to Christoph Hellwig

We need ata_scsi_dma_need_drain for all drivers wired up to drive ATAPI devices through libata. That also includes the SAS HBA drivers in addition to native libata HBA drivers.

---
 drivers/scsi/aic94xx/aic94xx_init.c    | 1 +
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 1 +
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 +
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
 drivers/scsi/ipr.c                     | 1 +
 drivers/scsi/isci/init.c               | 1 +
 drivers/scsi/mvsas/mv_init.c           | 1 +
 drivers/scsi/pm8001/pm8001_init.c      | 1 +
 8 files changed, 8 insertions(+)
drivers/scsi/aic94xx/aic94xx_init.c +1 -0
index d022407e5645c7..bef47f38dd0dbc 100644
@@ -40,6 +40,7 @@ static struct scsi_host_template aic94xx_sht = {
 	/* .name is initialized */
 	.name			= "aic94xx",
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= sas_slave_configure,
 	.scan_finished		= asd_scan_finished,
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1 -0
index 2e1718f9ade218..09a7669dad4c67 100644
@@ -1756,6 +1756,7 @@ static struct scsi_host_template sht_v1_hw = {
 	.proc_name		= DRV_NAME,
 	.module			= THIS_MODULE,
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= hisi_sas_slave_configure,
 	.scan_finished		= hisi_sas_scan_finished,
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -0
index e7e7849a4c14e2..968d3870235359 100644
@@ -3532,6 +3532,7 @@ static struct scsi_host_template sht_v2_hw = {
 	.proc_name		= DRV_NAME,
 	.module			= THIS_MODULE,
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= hisi_sas_slave_configure,
 	.scan_finished		= hisi_sas_scan_finished,
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
index 3e6b78a1f993b9..55e2321a65bc5f 100644
@@ -3075,6 +3075,7 @@ static struct scsi_host_template sht_v3_hw = {
 	.proc_name		= DRV_NAME,
 	.module			= THIS_MODULE,
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= hisi_sas_slave_configure,
 	.scan_finished		= hisi_sas_scan_finished,
drivers/scsi/ipr.c +1 -0
index 7d77997d26d457..7d86f4ca266c86 100644
@@ -6731,6 +6731,7 @@ static struct scsi_host_template driver_template = {
 	.compat_ioctl = ipr_ioctl,
 #endif
 	.queuecommand = ipr_queuecommand,
+	.dma_need_drain = ata_scsi_dma_need_drain,
 	.eh_abort_handler = ipr_eh_abort,
 	.eh_device_reset_handler = ipr_eh_dev_reset,
 	.eh_host_reset_handler = ipr_eh_host_reset,
drivers/scsi/isci/init.c +1 -0
index 974c3b9116d5ba..085e285f427d93 100644
@@ -153,6 +153,7 @@ static struct scsi_host_template isci_sht = {
 	.name				= DRV_NAME,
 	.proc_name			= DRV_NAME,
 	.queuecommand			= sas_queuecommand,
+	.dma_need_drain			= ata_scsi_dma_need_drain,
 	.target_alloc			= sas_target_alloc,
 	.slave_configure		= sas_slave_configure,
 	.scan_finished			= isci_host_scan_finished,
drivers/scsi/mvsas/mv_init.c +1 -0
index 5973eed9493820..b0de3bdb01db06 100644
@@ -33,6 +33,7 @@ static struct scsi_host_template mvs_sht = {
 	.module			= THIS_MODULE,
 	.name			= DRV_NAME,
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= sas_slave_configure,
 	.scan_finished		= mvs_scan_finished,
drivers/scsi/pm8001/pm8001_init.c +1 -0
index a8f5344fdfda2a..9e99262a2b9dd3 100644
@@ -87,6 +87,7 @@ static struct scsi_host_template pm8001_sht = {
 	.module			= THIS_MODULE,
 	.name			= DRV_NAME,
 	.queuecommand		= sas_queuecommand,
+	.dma_need_drain		= ata_scsi_dma_need_drain,
 	.target_alloc		= sas_target_alloc,
 	.slave_configure	= sas_slave_configure,
 	.scan_finished		= pm8001_scan_finished,
Signature · 1 line
2.26.2
#4 lore raw

Re: [PATCH 2/2] scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers

I love your patch! Yet something to improve:

Hi Christoph,

I love your patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[cannot apply to mkp-scsi/for-next scsi/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Christoph-Hellwig/libata-provide-a-ata_scsi_dma_need_drain-stub-for-CONFIG_ATA/20200615-155912
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: arm64-randconfig-r012-20200615 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> aarch64-linux-ld: drivers/scsi/aic94xx/aic94xx_init.o:(.data+0xcf0): undefined reference to `ata_scsi_dma_need_drain'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

Hi all,

this series fixes the ATAPI DMA drain refactoring for SAS HBAs that use libsas.
.

Something I meant to ask before and was curious about, specifically since ipr doesn't actually use libsas: Why not wire up other SAS HBAs, like megaraid_sas?

Thanks,
John

#6 lore raw
Quoted 11 lines · John Garry
Quoted 6 lines · Christoph Hellwig

Hi all,

this series fixes the ATAPI DMA drain refactoring for SAS HBAs that use libsas.
.

Something I meant to ask before and was curious about, specifically since ipr doesn't actually use libsas: Why not wire up other SAS HBAs, like megaraid_sas?

megaraid_sas and mpt3sas don't use the libata code at all. ipr actually is a special case and uses libata directly instead of libsas (something I hadn't realized, but which doesn't change anything for the patches itself, just possibly the commit log).

#7 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · John Garry
Quoted 6 lines · Christoph Hellwig

Hi all,

this series fixes the ATAPI DMA drain refactoring for SAS HBAs that use libsas.
.

Quoted 9 lines
Quoted 3 lines

Something I meant to ask before and was curious about, specifically since ipr doesn't actually use libsas: Why not wire up other SAS HBAs, like megaraid_sas?

megaraid_sas and mpt3sas don't use the libata code at all. ipr actually is a special case and uses libata directly instead of libsas (something I hadn't realized, but which doesn't change anything for the patches itself, just possibly the commit log).

More to the point, megaraid_sas and mpt3sas have their own SATL in firmware so there is no need to use libata here.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
#8 lore raw
Quoted 14 lines · Hannes Reinecke
Quoted 13 lines · Christoph Hellwig
Quoted 11 lines · John Garry
Quoted 6 lines · Christoph Hellwig

Hi all,

this series fixes the ATAPI DMA drain refactoring for SAS HBAs that use libsas.
.

Something I meant to ask before and was curious about, specifically since ipr doesn't actually use libsas: Why not wire up other SAS HBAs, like megaraid_sas?

Quoted 6 lines
Quoted 5 lines

megaraid_sas and mpt3sas don't use the libata code at all.  ipr actually is a special case and uses libata directly instead of libsas (something I hadn't realized, but which doesn't change anything for the patches itself, just possibly the commit log).

More to the point, megaraid_sas and mpt3sas have their own SATL in firmware so there is no need to use libata here.

ok.

BTW, @Christoph, I have no setup to verify this refactoring for anything which uses libsas (that I know about, anyway).

Thanks