linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fix ATAPI support for libsas drivers
@ 2020-06-15  6:46 Christoph Hellwig
  2020-06-15  6:46 ` [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Christoph Hellwig @ 2020-06-15  6:46 UTC (permalink / raw)
  To: martin.petersen
  Cc: brking, jinpu.wang, John Garry, mpe, linux-scsi, linux-ide

Hi all,

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA
  2020-06-15  6:46 fix ATAPI support for libsas drivers Christoph Hellwig
@ 2020-06-15  6:46 ` Christoph Hellwig
  2020-06-16  3:46   ` Martin K. Petersen
  2020-06-15  6:46 ` [PATCH 2/2] scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers Christoph Hellwig
  2020-06-18  9:02 ` fix ATAPI support for libsas drivers John Garry
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2020-06-15  6:46 UTC (permalink / raw)
  To: martin.petersen
  Cc: brking, jinpu.wang, John Garry, mpe, linux-scsi, linux-ide

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/libata.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index af832852e62044..042e584daca73e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers
  2020-06-15  6:46 fix ATAPI support for libsas drivers Christoph Hellwig
  2020-06-15  6:46 ` [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA Christoph Hellwig
@ 2020-06-15  6:46 ` Christoph Hellwig
  2020-06-18  9:02 ` fix ATAPI support for libsas drivers John Garry
  2 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2020-06-15  6:46 UTC (permalink / raw)
  To: martin.petersen
  Cc: brking, jinpu.wang, John Garry, mpe, linux-scsi, linux-ide

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.

Fixes: cc97923a5bcc ("block: move dma drain handling to scsi")
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Acked-by: John Garry <john.garry@huawei.com>
---
 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(+)

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index d022407e5645c7..bef47f38dd0dbc 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -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,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 2e1718f9ade218..09a7669dad4c67 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -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,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index e7e7849a4c14e2..968d3870235359 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -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,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 3e6b78a1f993b9..55e2321a65bc5f 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -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,
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 7d77997d26d457..7d86f4ca266c86 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -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,
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 974c3b9116d5ba..085e285f427d93 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -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,
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 5973eed9493820..b0de3bdb01db06 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -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,
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index a8f5344fdfda2a..9e99262a2b9dd3 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -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,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA
  2020-06-15  6:46 ` [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA Christoph Hellwig
@ 2020-06-16  3:46   ` Martin K. Petersen
  0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2020-06-16  3:46 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K . Petersen, John Garry, linux-scsi, brking, jinpu.wang,
	mpe, linux-ide

On Mon, 15 Jun 2020 08:46:23 +0200, Christoph Hellwig wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fix ATAPI support for libsas drivers
  2020-06-15  6:46 fix ATAPI support for libsas drivers Christoph Hellwig
  2020-06-15  6:46 ` [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA Christoph Hellwig
  2020-06-15  6:46 ` [PATCH 2/2] scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers Christoph Hellwig
@ 2020-06-18  9:02 ` John Garry
  2020-06-18 15:28   ` Christoph Hellwig
  2 siblings, 1 reply; 8+ messages in thread
From: John Garry @ 2020-06-18  9:02 UTC (permalink / raw)
  To: Christoph Hellwig, martin.petersen
  Cc: brking, jinpu.wang, mpe, linux-scsi, linux-ide

On 15/06/2020 07:46, Christoph Hellwig wrote:
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fix ATAPI support for libsas drivers
  2020-06-18  9:02 ` fix ATAPI support for libsas drivers John Garry
@ 2020-06-18 15:28   ` Christoph Hellwig
  2020-06-22  6:28     ` Hannes Reinecke
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2020-06-18 15:28 UTC (permalink / raw)
  To: John Garry
  Cc: Christoph Hellwig, martin.petersen, brking, jinpu.wang, mpe,
	linux-scsi, linux-ide

On Thu, Jun 18, 2020 at 10:02:58AM +0100, John Garry wrote:
> On 15/06/2020 07:46, Christoph Hellwig wrote:
>> 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).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fix ATAPI support for libsas drivers
  2020-06-18 15:28   ` Christoph Hellwig
@ 2020-06-22  6:28     ` Hannes Reinecke
  2020-06-23 11:44       ` John Garry
  0 siblings, 1 reply; 8+ messages in thread
From: Hannes Reinecke @ 2020-06-22  6:28 UTC (permalink / raw)
  To: Christoph Hellwig, John Garry
  Cc: martin.petersen, brking, jinpu.wang, mpe, linux-scsi, linux-ide

On 6/18/20 5:28 PM, Christoph Hellwig wrote:
> On Thu, Jun 18, 2020 at 10:02:58AM +0100, John Garry wrote:
>> On 15/06/2020 07:46, Christoph Hellwig wrote:
>>> 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).
> 
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
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fix ATAPI support for libsas drivers
  2020-06-22  6:28     ` Hannes Reinecke
@ 2020-06-23 11:44       ` John Garry
  0 siblings, 0 replies; 8+ messages in thread
From: John Garry @ 2020-06-23 11:44 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig
  Cc: martin.petersen, brking, jinpu.wang, mpe, linux-scsi, linux-ide

On 22/06/2020 07:28, Hannes Reinecke wrote:
> On 6/18/20 5:28 PM, Christoph Hellwig wrote:
>> On Thu, Jun 18, 2020 at 10:02:58AM +0100, John Garry wrote:
>>> On 15/06/2020 07:46, Christoph Hellwig wrote:
>>>> 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).
>>
> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-23 11:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  6:46 fix ATAPI support for libsas drivers Christoph Hellwig
2020-06-15  6:46 ` [PATCH 1/2] libata: provide a ata_scsi_dma_need_drain stub for !CONFIG_ATA Christoph Hellwig
2020-06-16  3:46   ` Martin K. Petersen
2020-06-15  6:46 ` [PATCH 2/2] scsi: wire up ata_scsi_dma_need_drain for SAS HBA drivers Christoph Hellwig
2020-06-18  9:02 ` fix ATAPI support for libsas drivers John Garry
2020-06-18 15:28   ` Christoph Hellwig
2020-06-22  6:28     ` Hannes Reinecke
2020-06-23 11:44       ` John Garry

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).