All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Introduce new SATA queued commands
@ 2013-08-23  9:40 Marc C
  2013-08-23  9:40 ` [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field Marc C
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Marc C @ 2013-08-23  9:40 UTC (permalink / raw)
  To: tj, linux-ide; +Cc: Marc C

From: Marc C <marc.ceeeee@gmail.com>

This patch series updates the libata driver with some additional
commands which are specified in the more recent versions of the
SATA and ATA specifications. These commands are:

        SEND FPDMA QUEUED
        RECEIVE FPDMA QUEUED.

The new queued commands augment the existing READ and WRITE FPDMA
QUEUED commands. The commands are intended to transport non-media
data to/from a device in a non-blocking manner.

One application of these commands include a queued-style DSM TRIM
operation. The current DSM TRIM command is non-queued, and requires
the initiator to empty out the queue before issuance. The new DSM TRIM
allows the initiator to keep the queue full.

These patches have been validated on an Intel SATA AHCI controller,
on a Micron M500 SSD, using "postmark," "fstrim," and "fsck."

Version history:

v4:
- put "auxiliary" field back into taskfile struct
- add ATA controller flag to indicate support (default on) for new
field
- style cleanups

v3:
- rebased to libata/for-3.12
- put H2D FIS "auxiliary" field changes in separate patch
- added "auxiliary" field population to all FIS-based SATA drivers

v2:
- rebased to 3.11-rc4
- moved auxiliary field to ata_queued_cmd struct
- updated signoff name

v1:
- initial

Marc Carino (3):
  libata: Populate host-to-device FIS "auxiliary" field
  libata: Add support for SEND/RECEIVE FPDMA QUEUED
  libata: Add support for queued DSM TRIM

 drivers/ata/ahci.c        |  8 ++++++++
 drivers/ata/libata-core.c | 30 ++++++++++++++++++++++++++----
 drivers/ata/libata-scsi.c | 25 +++++++++++++++++++------
 include/linux/ata.h       | 23 +++++++++++++++++++++++
 include/linux/libata.h    | 20 ++++++++++++++++++++
 5 files changed, 96 insertions(+), 10 deletions(-)

-- 
1.8.1.2


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

* [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field
  2013-08-23  9:40 [PATCH v4 0/3] Introduce new SATA queued commands Marc C
@ 2013-08-23  9:40 ` Marc C
  2013-08-23 12:27   ` Sergei Shtylyov
  2013-08-23  9:40 ` [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED Marc C
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Marc C @ 2013-08-23  9:40 UTC (permalink / raw)
  To: tj, linux-ide; +Cc: Marc Carino

From: Marc Carino <marc.ceeeee@gmail.com>

SATA 3.1 added an "auxiliary" field to the host-to-device FIS.
Populate the host-to-device FIS with the new field via the
taskfile struct.

Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
---
 drivers/ata/ahci.c        |  8 ++++++++
 drivers/ata/libata-core.c | 10 ++++++----
 include/linux/libata.h    |  5 +++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 5064f3e..8d41c57 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1288,6 +1288,14 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		 */
 		if (!(hpriv->flags & AHCI_HFLAG_NO_FPDMA_AA))
 			pi.flags |= ATA_FLAG_FPDMA_AA;
+
+		/*
+		 * All AHCI controllers should be forward-compatible
+		 * with the new auxiliary field. This code should be
+		 * conditionalized if any buggy AHCI controllers are
+		 * encountered.
+		 */
+		pi.flags |= ATA_FLAG_FPDMA_AUX;
 	}
 
 	if (hpriv->cap & HOST_CAP_PMP)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c24354d..9062aa0 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -546,6 +546,8 @@ int atapi_cmd_type(u8 opcode)
  */
 void ata_tf_to_fis(const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis)
 {
+	const __le32 aux = cpu_to_le32(tf->auxiliary);
+
 	fis[0] = 0x27;			/* Register - Host to Device FIS */
 	fis[1] = pmp & 0xf;		/* Port multiplier number*/
 	if (is_cmd)
@@ -569,10 +571,10 @@ void ata_tf_to_fis(const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis)
 	fis[14] = 0;
 	fis[15] = tf->ctl;
 
-	fis[16] = 0;
-	fis[17] = 0;
-	fis[18] = 0;
-	fis[19] = 0;
+	fis[16] = aux & 0xff;
+	fis[17] = (aux >> 8) & 0xff;
+	fis[18] = (aux >> 16) & 0xff;
+	fis[19] = (aux >> 24) & 0xff;
 }
 
 /**
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 283d66b..6539c50 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -223,6 +223,7 @@ enum {
 	ATA_FLAG_ACPI_SATA	= (1 << 17), /* need native SATA ACPI layout */
 	ATA_FLAG_AN		= (1 << 18), /* controller supports AN */
 	ATA_FLAG_PMP		= (1 << 19), /* controller supports PMP */
+	ATA_FLAG_FPDMA_AUX	= (1 << 20), /* controller supports H2DFIS aux field */
 	ATA_FLAG_EM		= (1 << 21), /* driver supports enclosure
 					      * management */
 	ATA_FLAG_SW_ACTIVITY	= (1 << 22), /* driver supports sw activity
@@ -555,6 +556,10 @@ struct ata_taskfile {
 	u8			device;
 
 	u8			command;	/* IO operation */
+
+	u32			auxiliary;	/* auxiliary field */
+						/* from SATA 3.1 and */
+						/* ATA-8 ACS-3 */
 };
 
 #ifdef CONFIG_ATA_SFF
-- 
1.8.1.2


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

* [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED
  2013-08-23  9:40 [PATCH v4 0/3] Introduce new SATA queued commands Marc C
  2013-08-23  9:40 ` [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field Marc C
@ 2013-08-23  9:40 ` Marc C
  2013-08-23 12:43   ` Sergei Shtylyov
  2013-08-23 16:06   ` Tejun Heo
  2013-08-23  9:40 ` [PATCH v4 3/3] libata: Add support for queued DSM TRIM Marc C
  2013-08-23 16:08 ` [PATCH v4 0/3] Introduce new SATA queued commands Tejun Heo
  3 siblings, 2 replies; 9+ messages in thread
From: Marc C @ 2013-08-23  9:40 UTC (permalink / raw)
  To: tj, linux-ide; +Cc: Marc Carino

From: Marc Carino <marc.ceeeee@gmail.com>

Add support for the following ATA opcodes, which are present
in SATA 3.1 and T13 ATA ACS-3:

        SEND FPDMA QUEUED
        RECEIVE FPDMA QUEUED

Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
---
 drivers/ata/libata-core.c | 20 ++++++++++++++++++++
 include/linux/ata.h       | 23 +++++++++++++++++++++++
 include/linux/libata.h    |  4 ++++
 3 files changed, 47 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9062aa0..34ccadb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2141,6 +2141,26 @@ static int ata_dev_config_ncq(struct ata_device *dev,
 	else
 		snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
 			ddepth, aa_desc);
+
+	if ((ap->flags & ATA_FLAG_FPDMA_AUX) &&
+		ata_id_has_ncq_send_and_recv(dev->id)) {
+		err_mask = ata_read_log_page(dev,
+					     ATA_LOG_NCQ_SEND_RECV,
+					     0,
+					     ap->sector_buf,
+					     1);
+		if (err_mask) {
+			ata_dev_dbg(dev,
+				    "failed to get NCQ Send/Recv Log "
+				    "Emask 0x%x\n",
+				    err_mask);
+		} else {
+			dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
+			memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
+				ATA_LOG_NCQ_SEND_RECV_SIZE);
+		}
+	}
+
 	return 0;
 }
 
diff --git a/include/linux/ata.h b/include/linux/ata.h
index f63fb1a..f9a0465 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -239,6 +239,8 @@ enum {
 	ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
 	ATA_CMD_FPDMA_READ	= 0x60,
 	ATA_CMD_FPDMA_WRITE	= 0x61,
+	ATA_CMD_FPDMA_SEND	= 0x64,
+	ATA_CMD_FPDMA_RECV	= 0x65,
 	ATA_CMD_PIO_READ	= 0x20,
 	ATA_CMD_PIO_READ_EXT	= 0x24,
 	ATA_CMD_PIO_WRITE	= 0x30,
@@ -293,8 +295,13 @@ enum {
 	/* marked obsolete in the ATA/ATAPI-7 spec */
 	ATA_CMD_RESTORE		= 0x10,
 
+	/* Subcmds for ATA_CMD_FPDMA_SEND */
+	ATA_SUBCMD_FPDMA_SEND_DSM            = 0x00,
+	ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT = 0x02,
+
 	/* READ_LOG_EXT pages */
 	ATA_LOG_SATA_NCQ	= 0x10,
+	ATA_LOG_NCQ_SEND_RECV	  = 0x13,
 	ATA_LOG_SATA_ID_DEV_DATA  = 0x30,
 	ATA_LOG_SATA_SETTINGS	  = 0x08,
 	ATA_LOG_DEVSLP_OFFSET	  = 0x30,
@@ -305,6 +312,15 @@ enum {
 	ATA_LOG_DEVSLP_VALID	  = 0x07,
 	ATA_LOG_DEVSLP_VALID_MASK = 0x80,
 
+	/* NCQ send and receive log */
+	ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET	= 0x00,
+	ATA_LOG_NCQ_SEND_RECV_SUBCMDS_DSM	= (1 << 0),
+	ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET	= 0x04,
+	ATA_LOG_NCQ_SEND_RECV_DSM_TRIM		= (1 << 0),
+	ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET	= 0x08,
+	ATA_LOG_NCQ_SEND_RECV_WR_LOG_OFFSET	= 0x0C,
+	ATA_LOG_NCQ_SEND_RECV_SIZE		= 0x10,
+
 	/* READ/WRITE LONG (obsolete) */
 	ATA_CMD_READ_LONG	= 0x22,
 	ATA_CMD_READ_LONG_ONCE	= 0x23,
@@ -772,6 +788,13 @@ static inline int ata_id_rotation_rate(const u16 *id)
 	return val;
 }
 
+static inline bool ata_id_has_ncq_send_and_recv(const u16 *id)
+{
+	if (id[ATA_ID_SATA_CAPABILITY_2] & BIT(6))
+		return true;
+	return false;
+}
+
 static inline bool ata_id_has_trim(const u16 *id)
 {
 	if (ata_id_major_version(id) >= 7 &&
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6539c50..b925504 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -172,6 +172,7 @@ enum {
 	ATA_DFLAG_DUBIOUS_XFER	= (1 << 16), /* data transfer not verified */
 	ATA_DFLAG_NO_UNLOAD	= (1 << 17), /* device doesn't support unload */
 	ATA_DFLAG_UNLOCK_HPA	= (1 << 18), /* unlock HPA */
+	ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
 	ATA_DFLAG_INIT_MASK	= (1 << 24) - 1,
 
 	ATA_DFLAG_DETACH	= (1 << 24),
@@ -704,6 +705,9 @@ struct ata_device {
 	/* DEVSLP Timing Variables from Identify Device Data Log */
 	u8			devslp_timing[ATA_LOG_DEVSLP_SIZE];
 
+	/* NCQ send and receive log subcommand support */
+	u8			ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_SIZE];
+
 	/* error history */
 	int			spdn_cnt;
 	/* ering is CLEAR_END, read comment above CLEAR_END */
-- 
1.8.1.2


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

* [PATCH v4 3/3] libata: Add support for queued DSM TRIM
  2013-08-23  9:40 [PATCH v4 0/3] Introduce new SATA queued commands Marc C
  2013-08-23  9:40 ` [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field Marc C
  2013-08-23  9:40 ` [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED Marc C
@ 2013-08-23  9:40 ` Marc C
  2013-08-23 16:07   ` Tejun Heo
  2013-08-23 16:08 ` [PATCH v4 0/3] Introduce new SATA queued commands Tejun Heo
  3 siblings, 1 reply; 9+ messages in thread
From: Marc C @ 2013-08-23  9:40 UTC (permalink / raw)
  To: tj, linux-ide; +Cc: Marc Carino

From: Marc Carino <marc.ceeeee@gmail.com>

Some new SSDs support the queued version of the DSM TRIM command.
Let the driver use the new command if supported.

Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
---
 drivers/ata/libata-scsi.c | 25 +++++++++++++++++++------
 include/linux/libata.h    | 11 +++++++++++
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 83c0890..0c807a9 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3098,12 +3098,25 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
 	buf = page_address(sg_page(scsi_sglist(scmd)));
 	size = ata_set_lba_range_entries(buf, 512, block, n_block);
 
-	tf->protocol = ATA_PROT_DMA;
-	tf->hob_feature = 0;
-	tf->feature = ATA_DSM_TRIM;
-	tf->hob_nsect = (size / 512) >> 8;
-	tf->nsect = size / 512;
-	tf->command = ATA_CMD_DSM;
+	if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
+		/* Newer devices support queued TRIM commands */
+		tf->protocol = ATA_PROT_NCQ;
+		tf->command = ATA_CMD_FPDMA_SEND;
+		tf->hob_nsect = ATA_SUBCMD_FPDMA_SEND_DSM & 0x1f;
+		tf->nsect = qc->tag << 3;
+		tf->hob_feature = (size / 512) >> 8;
+		tf->feature = size / 512;
+
+		tf->auxiliary = 1;
+	} else {
+		tf->protocol = ATA_PROT_DMA;
+		tf->hob_feature = 0;
+		tf->feature = ATA_DSM_TRIM;
+		tf->hob_nsect = (size / 512) >> 8;
+		tf->nsect = size / 512;
+		tf->command = ATA_CMD_DSM;
+	}
+
 	tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 |
 		     ATA_TFLAG_WRITE;
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b925504..69d1b8b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1608,6 +1608,17 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
 			      ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
 }
 
+static inline int ata_fpdma_dsm_supported(struct ata_device *dev)
+{
+	if ((dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&
+	    (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &
+	     ATA_LOG_NCQ_SEND_RECV_DSM_TRIM)) {
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
 static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
 {
 	qc->tf.ctl |= ATA_NIEN;
-- 
1.8.1.2


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

* Re: [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field
  2013-08-23  9:40 ` [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field Marc C
@ 2013-08-23 12:27   ` Sergei Shtylyov
  0 siblings, 0 replies; 9+ messages in thread
From: Sergei Shtylyov @ 2013-08-23 12:27 UTC (permalink / raw)
  To: Marc C; +Cc: tj, linux-ide

On 23-08-2013 13:40, Marc C wrote:

> From: Marc Carino <marc.ceeeee@gmail.com>

> SATA 3.1 added an "auxiliary" field to the host-to-device FIS.
> Populate the host-to-device FIS with the new field via the
> taskfile struct.

> Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
> ---
>   drivers/ata/ahci.c        |  8 ++++++++
>   drivers/ata/libata-core.c | 10 ++++++----
>   include/linux/libata.h    |  5 +++++
>   3 files changed, 19 insertions(+), 4 deletions(-)

> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 5064f3e..8d41c57 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1288,6 +1288,14 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   		 */
>   		if (!(hpriv->flags & AHCI_HFLAG_NO_FPDMA_AA))
>   			pi.flags |= ATA_FLAG_FPDMA_AA;
> +
> +		/*
> +		 * All AHCI controllers should be forward-compatible
> +		 * with the new auxiliary field. This code should be
> +		 * conditionalized if any buggy AHCI controllers are
> +		 * encountered.
> +		 */
> +		pi.flags |= ATA_FLAG_FPDMA_AUX;
[...]
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 283d66b..6539c50 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -223,6 +223,7 @@ enum {
>   	ATA_FLAG_ACPI_SATA	= (1 << 17), /* need native SATA ACPI layout */
>   	ATA_FLAG_AN		= (1 << 18), /* controller supports AN */
>   	ATA_FLAG_PMP		= (1 << 19), /* controller supports PMP */
> +	ATA_FLAG_FPDMA_AUX	= (1 << 20), /* controller supports H2DFIS aux field */

    I think adding this flag is a matter of a separate patch.

WBR, Sergei


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

* Re: [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED
  2013-08-23  9:40 ` [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED Marc C
@ 2013-08-23 12:43   ` Sergei Shtylyov
  2013-08-23 16:06   ` Tejun Heo
  1 sibling, 0 replies; 9+ messages in thread
From: Sergei Shtylyov @ 2013-08-23 12:43 UTC (permalink / raw)
  To: Marc C; +Cc: tj, linux-ide

Hello.

On 23-08-2013 13:40, Marc C wrote:

> From: Marc Carino <marc.ceeeee@gmail.com>

> Add support for the following ATA opcodes, which are present
> in SATA 3.1 and T13 ATA ACS-3:

>          SEND FPDMA QUEUED
>          RECEIVE FPDMA QUEUED

> Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
[...]

> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 9062aa0..34ccadb 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -2141,6 +2141,26 @@ static int ata_dev_config_ncq(struct ata_device *dev,
>   	else
>   		snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
>   			ddepth, aa_desc);
> +
> +	if ((ap->flags & ATA_FLAG_FPDMA_AUX) &&
> +		ata_id_has_ncq_send_and_recv(dev->id)) {

     Please start this line under the second ( above. It's the style preferred 
in libata as it's easier on the eyes.

> +		err_mask = ata_read_log_page(dev,
> +					     ATA_LOG_NCQ_SEND_RECV,
> +					     0,
> +					     ap->sector_buf,
> +					     1);
> +		if (err_mask) {
> +			ata_dev_dbg(dev,
> +				    "failed to get NCQ Send/Recv Log "
> +				    "Emask 0x%x\n",
> +				    err_mask);
> +		} else {
> +			dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
> +			memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
> +				ATA_LOG_NCQ_SEND_RECV_SIZE);
> +		}
> +	}
> +

WBR, Sergei


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

* Re: [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED
  2013-08-23  9:40 ` [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED Marc C
  2013-08-23 12:43   ` Sergei Shtylyov
@ 2013-08-23 16:06   ` Tejun Heo
  1 sibling, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2013-08-23 16:06 UTC (permalink / raw)
  To: Marc C; +Cc: linux-ide

Hello, Marc.

On Fri, Aug 23, 2013 at 02:40:46AM -0700, Marc C wrote:
> From: Marc Carino <marc.ceeeee@gmail.com>
> 
> Add support for the following ATA opcodes, which are present
> in SATA 3.1 and T13 ATA ACS-3:
> 
>         SEND FPDMA QUEUED
>         RECEIVE FPDMA QUEUED
> 
> Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
> ---
>  drivers/ata/libata-core.c | 20 ++++++++++++++++++++
>  include/linux/ata.h       | 23 +++++++++++++++++++++++
>  include/linux/libata.h    |  4 ++++
>  3 files changed, 47 insertions(+)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 9062aa0..34ccadb 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -2141,6 +2141,26 @@ static int ata_dev_config_ncq(struct ata_device *dev,
>  	else
>  		snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
>  			ddepth, aa_desc);
> +
> +	if ((ap->flags & ATA_FLAG_FPDMA_AUX) &&
> +		ata_id_has_ncq_send_and_recv(dev->id)) {
> +		err_mask = ata_read_log_page(dev,
> +					     ATA_LOG_NCQ_SEND_RECV,
> +					     0,
> +					     ap->sector_buf,
> +					     1);

Can you please fill to 80 col instead?  I know the other invocation is
breaking line for each argument but let's not spread that.

> +		if (err_mask) {
> +			ata_dev_dbg(dev,
> +				    "failed to get NCQ Send/Recv Log "
> +				    "Emask 0x%x\n",

And no need to break line for format strings.

> +static inline bool ata_id_has_ncq_send_and_recv(const u16 *id)
> +{
> +	if (id[ATA_ID_SATA_CAPABILITY_2] & BIT(6))
> +		return true;
> +	return false;
> +}

 return id[ATA_ID_SATA_CAPABILITY_2] & BIT(6);

thanks.

-- 
tejun

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

* Re: [PATCH v4 3/3] libata: Add support for queued DSM TRIM
  2013-08-23  9:40 ` [PATCH v4 3/3] libata: Add support for queued DSM TRIM Marc C
@ 2013-08-23 16:07   ` Tejun Heo
  0 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2013-08-23 16:07 UTC (permalink / raw)
  To: Marc C; +Cc: linux-ide

On Fri, Aug 23, 2013 at 02:40:47AM -0700, Marc C wrote:
> +static inline int ata_fpdma_dsm_supported(struct ata_device *dev)

bool?

> +{
> +	if ((dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&
> +	    (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &
> +	     ATA_LOG_NCQ_SEND_RECV_DSM_TRIM)) {
> +		return 1;
> +	} else {
> +		return 0;
> +	}

And again, you can just use a return statement.

-- 
tejun

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

* Re: [PATCH v4 0/3] Introduce new SATA queued commands
  2013-08-23  9:40 [PATCH v4 0/3] Introduce new SATA queued commands Marc C
                   ` (2 preceding siblings ...)
  2013-08-23  9:40 ` [PATCH v4 3/3] libata: Add support for queued DSM TRIM Marc C
@ 2013-08-23 16:08 ` Tejun Heo
  3 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2013-08-23 16:08 UTC (permalink / raw)
  To: Marc C; +Cc: linux-ide

Hello,

On Fri, Aug 23, 2013 at 02:40:44AM -0700, Marc C wrote:
> From: Marc C <marc.ceeeee@gmail.com>
> 
> This patch series updates the libata driver with some additional
> commands which are specified in the more recent versions of the
> SATA and ATA specifications. These commands are:

Generally looks good to me other than the cosmetic points.  Can you
please update the series to Sergei's and my comments?

Thanks!

-- 
tejun

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

end of thread, other threads:[~2013-08-23 16:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23  9:40 [PATCH v4 0/3] Introduce new SATA queued commands Marc C
2013-08-23  9:40 ` [PATCH v4 1/3] libata: Populate host-to-device FIS "auxiliary" field Marc C
2013-08-23 12:27   ` Sergei Shtylyov
2013-08-23  9:40 ` [PATCH v4 2/3] libata: Add support for SEND/RECEIVE FPDMA QUEUED Marc C
2013-08-23 12:43   ` Sergei Shtylyov
2013-08-23 16:06   ` Tejun Heo
2013-08-23  9:40 ` [PATCH v4 3/3] libata: Add support for queued DSM TRIM Marc C
2013-08-23 16:07   ` Tejun Heo
2013-08-23 16:08 ` [PATCH v4 0/3] Introduce new SATA queued commands Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.