2024-03-05 00:52:45

by Igor Pylypiv

[permalink] [raw]
Subject: [PATCH v5 0/7] NCQ Priority sysfs sttributes for libsas

This patch series adds sas_ncq_prio_supported and sas_ncq_prio_enable
sysfs sttributes for libsas managed SATA devices. Existing libata sysfs
attributes cannot be used directly because the ata_port location is
different for libsas.

Changes since v4:
- Updated sas_ncq_prio_* sysfs functions to use WARN_ON_ONCE() instead
of WARN_ON().

Changes since v3:
- Changed ata_ncq_prio_supported() and ata_ncq_prio_enabled() to store
the result into a boolean variable passed by address.
- Removed the "usable with both libsas and libata" wording from
ata_ncq_prio_* helper's function comments.
- Removed the unlikely() in ata_ncq_prio_enable() because the function
is not in a fastpath.
- Dropped hisi_sas v1 HW driver changes because it doesn't support SATA.

Changes since v2:
- Added libsas SATA sysfs attributes to aic94xx and isci.

Changes since v1:
- Dropped the "sas_" prefix to align sysfs sttributes naming with AHCI.
- Dropped ternary operators to make the code more readable.
- Corrected the formatting %u -> %d in sysfs_emit().
- Changed kstrtol() to kstrtobool() in [ata|sas]_ncq_prio_enable_store().
- Changed comments to use the "/* */" style instead of "//".
- Added libsas SATA sysfs attributes to mvsas and hisi_sas.
- Dropped the 'Reviewed-by' tags because they were not sent in-reply
to the patch emails.

Igor Pylypiv (7):
ata: libata-sata: Factor out NCQ Priority configuration helpers
scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices
scsi: pm80xx: Add libsas SATA sysfs attributes group
scsi: mvsas: Add libsas SATA sysfs attributes group
scsi: hisi_sas: Add libsas SATA sysfs attributes group
scsi: aic94xx: Add libsas SATA sysfs attributes group
scsi: isci: Add libsas SATA sysfs attributes group

drivers/ata/libata-sata.c | 140 ++++++++++++++++++-------
drivers/scsi/aic94xx/aic94xx_init.c | 8 ++
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 6 ++
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 ++
drivers/scsi/isci/init.c | 6 ++
drivers/scsi/libsas/sas_ata.c | 94 +++++++++++++++++
drivers/scsi/mvsas/mv_init.c | 7 ++
drivers/scsi/pm8001/pm8001_ctl.c | 5 +
drivers/scsi/pm8001/pm8001_init.c | 1 +
drivers/scsi/pm8001/pm8001_sas.h | 1 +
include/linux/libata.h | 6 ++
include/scsi/sas_ata.h | 6 ++
12 files changed, 247 insertions(+), 39 deletions(-)

--
2.44.0.278.ge034bb2e1d-goog



2024-03-05 00:53:08

by Igor Pylypiv

[permalink] [raw]
Subject: [PATCH v5 7/7] scsi: isci: Add libsas SATA sysfs attributes group

The added sysfs attributes group enables the configuration of NCQ Priority
feature for HBAs that rely on libsas to manage SATA devices.

Reviewed-by: John Garry <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Signed-off-by: Igor Pylypiv <[email protected]>
---
drivers/scsi/isci/init.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 6277162a028b..8658dcd61b87 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -149,6 +149,11 @@ static struct attribute *isci_host_attrs[] = {

ATTRIBUTE_GROUPS(isci_host);

+static const struct attribute_group *isci_sdev_groups[] = {
+ &sas_ata_sdev_attr_group,
+ NULL
+};
+
static const struct scsi_host_template isci_sht = {

.module = THIS_MODULE,
@@ -176,6 +181,7 @@ static const struct scsi_host_template isci_sht = {
.compat_ioctl = sas_ioctl,
#endif
.shost_groups = isci_host_groups,
+ .sdev_groups = isci_sdev_groups,
.track_queue_depth = 1,
};

--
2.44.0.278.ge034bb2e1d-goog


2024-03-05 00:53:53

by Igor Pylypiv

[permalink] [raw]
Subject: [PATCH v5 5/7] scsi: hisi_sas: Add libsas SATA sysfs attributes group

The added sysfs attributes group enables the configuration of NCQ Priority
feature for HBAs that rely on libsas to manage SATA devices.

Reviewed-by: John Garry <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Signed-off-by: Igor Pylypiv <[email protected]>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 6 ++++++
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 ++++++
2 files changed, 12 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 73b378837da7..b5d379ebe05d 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -3544,6 +3544,11 @@ static struct attribute *host_v2_hw_attrs[] = {

ATTRIBUTE_GROUPS(host_v2_hw);

+static const struct attribute_group *sdev_groups_v2_hw[] = {
+ &sas_ata_sdev_attr_group,
+ NULL
+};
+
static void map_queues_v2_hw(struct Scsi_Host *shost)
{
struct hisi_hba *hisi_hba = shost_priv(shost);
@@ -3585,6 +3590,7 @@ static const struct scsi_host_template sht_v2_hw = {
.compat_ioctl = sas_ioctl,
#endif
.shost_groups = host_v2_hw_groups,
+ .sdev_groups = sdev_groups_v2_hw,
.host_reset = hisi_sas_host_reset,
.map_queues = map_queues_v2_hw,
.host_tagset = 1,
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index b56fbc61a15a..9b69ea16a1e6 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2929,6 +2929,11 @@ static struct attribute *host_v3_hw_attrs[] = {

ATTRIBUTE_GROUPS(host_v3_hw);

+static const struct attribute_group *sdev_groups_v3_hw[] = {
+ &sas_ata_sdev_attr_group,
+ NULL
+};
+
#define HISI_SAS_DEBUGFS_REG(x) {#x, x}

struct hisi_sas_debugfs_reg_lu {
@@ -3340,6 +3345,7 @@ static const struct scsi_host_template sht_v3_hw = {
.compat_ioctl = sas_ioctl,
#endif
.shost_groups = host_v3_hw_groups,
+ .sdev_groups = sdev_groups_v3_hw,
.tag_alloc_policy = BLK_TAG_ALLOC_RR,
.host_reset = hisi_sas_host_reset,
.host_tagset = 1,
--
2.44.0.278.ge034bb2e1d-goog


2024-03-05 00:54:17

by Igor Pylypiv

[permalink] [raw]
Subject: [PATCH v5 6/7] scsi: aic94xx: Add libsas SATA sysfs attributes group

The added sysfs attributes group enables the configuration of NCQ Priority
feature for HBAs that rely on libsas to manage SATA devices.

Reviewed-by: John Garry <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Signed-off-by: Igor Pylypiv <[email protected]>
---
drivers/scsi/aic94xx/aic94xx_init.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 8a3340d8d7ad..ccccd0eb6275 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -14,6 +14,7 @@
#include <linux/firmware.h>
#include <linux/slab.h>

+#include <scsi/sas_ata.h>
#include <scsi/scsi_host.h>

#include "aic94xx.h"
@@ -34,6 +35,7 @@ MODULE_PARM_DESC(use_msi, "\n"
static struct scsi_transport_template *aic94xx_transport_template;
static int asd_scan_finished(struct Scsi_Host *, unsigned long);
static void asd_scan_start(struct Scsi_Host *);
+static const struct attribute_group *asd_sdev_groups[];

static const struct scsi_host_template aic94xx_sht = {
.module = THIS_MODULE,
@@ -60,6 +62,7 @@ static const struct scsi_host_template aic94xx_sht = {
.compat_ioctl = sas_ioctl,
#endif
.track_queue_depth = 1,
+ .sdev_groups = asd_sdev_groups,
};

static int asd_map_memio(struct asd_ha_struct *asd_ha)
@@ -951,6 +954,11 @@ static void asd_remove_driver_attrs(struct device_driver *driver)
driver_remove_file(driver, &driver_attr_version);
}

+static const struct attribute_group *asd_sdev_groups[] = {
+ &sas_ata_sdev_attr_group,
+ NULL
+};
+
static struct sas_domain_function_template aic94xx_transport_functions = {
.lldd_dev_found = asd_dev_found,
.lldd_dev_gone = asd_dev_gone,
--
2.44.0.278.ge034bb2e1d-goog


2024-03-05 02:46:23

by Jason Yan

[permalink] [raw]
Subject: Re: [PATCH v5 5/7] scsi: hisi_sas: Add libsas SATA sysfs attributes group

On 2024/3/5 8:51, Igor Pylypiv wrote:
> The added sysfs attributes group enables the configuration of NCQ Priority
> feature for HBAs that rely on libsas to manage SATA devices.
>
> Reviewed-by: John Garry<[email protected]>
> Reviewed-by: Damien Le Moal<[email protected]>
> Signed-off-by: Igor Pylypiv<[email protected]>
> ---
> drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 6 ++++++
> drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 ++++++
> 2 files changed, 12 insertions(+)

Reviewed-by: Jason Yan <[email protected]>

2024-03-05 02:52:08

by Jason Yan

[permalink] [raw]
Subject: Re: [PATCH v5 6/7] scsi: aic94xx: Add libsas SATA sysfs attributes group

On 2024/3/5 8:51, Igor Pylypiv wrote:
> The added sysfs attributes group enables the configuration of NCQ Priority
> feature for HBAs that rely on libsas to manage SATA devices.
>
> Reviewed-by: John Garry<[email protected]>
> Reviewed-by: Damien Le Moal<[email protected]>
> Signed-off-by: Igor Pylypiv<[email protected]>
> ---
> drivers/scsi/aic94xx/aic94xx_init.c | 8 ++++++++
> 1 file changed, 8 insertions(+)

Reviewed-by: Jason Yan <[email protected]>

2024-03-05 02:52:24

by Jason Yan

[permalink] [raw]
Subject: Re: [PATCH v5 7/7] scsi: isci: Add libsas SATA sysfs attributes group

On 2024/3/5 8:51, Igor Pylypiv wrote:
> The added sysfs attributes group enables the configuration of NCQ Priority
> feature for HBAs that rely on libsas to manage SATA devices.
>
> Reviewed-by: John Garry<[email protected]>
> Reviewed-by: Damien Le Moal<[email protected]>
> Signed-off-by: Igor Pylypiv<[email protected]>
> ---
> drivers/scsi/isci/init.c | 6 ++++++
> 1 file changed, 6 insertions(+)

Reviewed-by: Jason Yan <[email protected]>