From patchwork Tue Mar 5 23:58:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778224 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3086812DDA2 for ; Tue, 5 Mar 2024 23:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683113; cv=none; b=h9DK7MlJ1jcvPHbid+dmYCRd2ijkpPwvfxlgUukSVypdYiIKXiguUIpC8KFhfiBOFETed+kbYrnjeKzZNF0LNve9zhY8eCkk1+AsA7mhXnLXL+Gt+iDeow41+mURbJ47zEAmkFE//IT2d8uc8Q+Du4vDSkLmD5fEu9k1lu7SI6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683113; c=relaxed/simple; bh=HdE6FN0o7wTsTE4Ul3fnw6MLY1Eiy7U6ACIH7VY572U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=q0+qWMZWpcu9jBislfk9+0MuOdj3+9xk9gQMGKtkC3PeQK/Y+U3oI9HSdHwuU9xS0dY2owAoFo0XGTzudftj1ITec3O0x/9UWmBf5IKB55+0l6D3LAh0YnPHEJHwaBqTZdcA/qn4ekgxC6kTBNJaMX7bFJvWZippTAutPtlDqf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JeN5Qjsm; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JeN5Qjsm" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-607e613a1baso7466867b3.1 for ; Tue, 05 Mar 2024 15:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683111; x=1710287911; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hWaHPf3ur6A4qCJxa5rb9778tyG9D1zv7n6pTIOMylY=; b=JeN5QjsmIlqLodtcnkjRW3oJa/IDe9PhhqhzzOhfrO8Mu6vNV0UYANTACU35SETqYO 2up2/Y/0WCO8j9j9GwXH0f3qRDBgtlwUXhv7ILjr8+7My5IwReqLkk/3cmuTv6Z1yTsc O+prXphKvFgbBdkbLG4OsrWDYHXA6M5AHAYtfcffyXTo1dT3AWm7dFdWWN67/jyveDLX YJ5SjbFC/oudB+QpkySXNXqUzcwWcP4Se9i3lTwC4EdvGL10BSlojapnzHhGPCELDxa8 j3U3gQsgbb/kuoxSzP+9FzhxyQPztxfBkFFbYO14PoWmWOBRevz3GphOQwbnvfZNVPDB JW4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683111; x=1710287911; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hWaHPf3ur6A4qCJxa5rb9778tyG9D1zv7n6pTIOMylY=; b=DgKnMK8zBTsyCdlUZM8r0DVv5m+tw2J3b5z4OGvA12fyChyulxVlVkq9zp+g3wUk78 cghaR4Bn7XdEJk71ruWz/Qa2RmGtYG+PVyRoZFXYR079qB8rfztKLW679n06YpB38M4v g6/gubHiDQ67T3UAVTRxGPLj4zNaGQYxwJn4JuvKhVXM3KKcnZO8aHm6zzQLR4KFnHGa 2C4n5jdzeVw7elndaE4HseAPMEefHGgm2bng13XkJUxbN/YC0yEbh9spwbRyQo9AdW0K 2Ng9MDv3cgHZ6Ag8u/Siw5Rta+6WnwzYhmJ3V5Dq9S0ZodHkSMtqkS2o4JFm1sFmhuvt m/fg== X-Forwarded-Encrypted: i=1; AJvYcCUSWE97hvPdSJj4fGqfv0nxD+xk/Aj4MeR5e2CKB4nckg+uI4UUOgDX/8bDLwFbgwShXdH0eqRVZUXIvhd5AFWDfoNjG2w3EQ/bjw== X-Gm-Message-State: AOJu0YzOfLsQorf1h74skU1PqEmlFNs1Fij2YgkT5zEZs54zFbjRJ00U BhpynWX5VFb1JQbh8EVelHtbxxn7FA19r4Ssx84jJ9qQsVgPM51nSTS5kpfLFUMYw+ckkv0Cmw6 r3GFxl4hx2A== X-Google-Smtp-Source: AGHT+IGYrZkpjlcd/jeR04Crh0TnpaIv8pW4dEIDVWMEmrFqO3TasW9heENuaIGt/q3UXgosr+ql87w/7XuOiA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a05:690c:c17:b0:609:3834:e0f4 with SMTP id cl23-20020a05690c0c1700b006093834e0f4mr4148681ywb.7.1709683111203; Tue, 05 Mar 2024 15:58:31 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:16 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305235823.3308225-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240305235823.3308225-2-ipylypiv@google.com> Subject: [PATCH v6 1/7] ata: libata-sata: Factor out NCQ Priority configuration helpers From: Igor Pylypiv To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" , Jack Wang , Hannes Reinecke , Xiang Chen , Artur Paszkiewicz , Bart Van Assche Cc: TJ Adams , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv Export libata NCQ Priority configuration helpers to be reused for libsas managed SATA devices. Acked-by: Damien Le Moal Reviewed-by: Jason Yan Signed-off-by: Igor Pylypiv --- drivers/ata/libata-sata.c | 140 +++++++++++++++++++++++++++----------- include/linux/libata.h | 6 ++ 2 files changed, 107 insertions(+), 39 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 0fb1934875f2..f00dd02dc6f8 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -848,80 +848,122 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, ata_scsi_lpm_show, ata_scsi_lpm_store); EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); -static ssize_t ata_ncq_prio_supported_show(struct device *device, - struct device_attribute *attr, - char *buf) +/** + * ata_ncq_prio_supported - Check if device supports NCQ Priority + * @ap: ATA port of the target device + * @sdev: SCSI device + * @supported: Address of a boolean to store the result + * + * Helper to check if device supports NCQ Priority feature. + */ +int ata_ncq_prio_supported(struct ata_port *ap, struct scsi_device *sdev, + bool *supported) { - struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; - bool ncq_prio_supported; + unsigned long flags; int rc = 0; - spin_lock_irq(ap->lock); + spin_lock_irqsave(ap->lock, flags); dev = ata_scsi_find_dev(ap, sdev); if (!dev) rc = -ENODEV; else - ncq_prio_supported = dev->flags & ATA_DFLAG_NCQ_PRIO; - spin_unlock_irq(ap->lock); + *supported = dev->flags & ATA_DFLAG_NCQ_PRIO; + spin_unlock_irqrestore(ap->lock, flags); + return rc; +} +EXPORT_SYMBOL_GPL(ata_ncq_prio_supported); + +static ssize_t ata_ncq_prio_supported_show(struct device *device, + struct device_attribute *attr, + char *buf) +{ + struct scsi_device *sdev = to_scsi_device(device); + struct ata_port *ap = ata_shost_to_port(sdev->host); + bool supported; + int rc; - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_supported); + rc = ata_ncq_prio_supported(ap, sdev, &supported); + if (rc) + return rc; + + return sysfs_emit(buf, "%d\n", supported); } DEVICE_ATTR(ncq_prio_supported, S_IRUGO, ata_ncq_prio_supported_show, NULL); EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_supported); -static ssize_t ata_ncq_prio_enable_show(struct device *device, - struct device_attribute *attr, - char *buf) +/** + * ata_ncq_prio_enabled - Check if NCQ Priority is enabled + * @ap: ATA port of the target device + * @sdev: SCSI device + * @enabled: Address of a boolean to store the result + * + * Helper to check if NCQ Priority feature is enabled. + */ +int ata_ncq_prio_enabled(struct ata_port *ap, struct scsi_device *sdev, + bool *enabled) { - struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; - bool ncq_prio_enable; + unsigned long flags; int rc = 0; - spin_lock_irq(ap->lock); + spin_lock_irqsave(ap->lock, flags); dev = ata_scsi_find_dev(ap, sdev); if (!dev) rc = -ENODEV; else - ncq_prio_enable = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED; - spin_unlock_irq(ap->lock); - - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_enable); + *enabled = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED; + spin_unlock_irqrestore(ap->lock, flags); + return rc; } +EXPORT_SYMBOL_GPL(ata_ncq_prio_enabled); -static ssize_t ata_ncq_prio_enable_store(struct device *device, - struct device_attribute *attr, - const char *buf, size_t len) +static ssize_t ata_ncq_prio_enable_show(struct device *device, + struct device_attribute *attr, + char *buf) { struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap; - struct ata_device *dev; - long int input; - int rc = 0; + struct ata_port *ap = ata_shost_to_port(sdev->host); + bool enabled; + int rc; - rc = kstrtol(buf, 10, &input); + rc = ata_ncq_prio_enabled(ap, sdev, &enabled); if (rc) return rc; - if ((input < 0) || (input > 1)) - return -EINVAL; - ap = ata_shost_to_port(sdev->host); - dev = ata_scsi_find_dev(ap, sdev); - if (unlikely(!dev)) - return -ENODEV; + return sysfs_emit(buf, "%d\n", enabled); +} + +/** + * ata_ncq_prio_enable - Enable/disable NCQ Priority + * @ap: ATA port of the target device + * @sdev: SCSI device + * @enable: true - enable NCQ Priority, false - disable NCQ Priority + * + * Helper to enable/disable NCQ Priority feature. + */ +int ata_ncq_prio_enable(struct ata_port *ap, struct scsi_device *sdev, + bool enable) +{ + struct ata_device *dev; + unsigned long flags; + int rc = 0; + + spin_lock_irqsave(ap->lock, flags); - spin_lock_irq(ap->lock); + dev = ata_scsi_find_dev(ap, sdev); + if (!dev) { + rc = -ENODEV; + goto unlock; + } if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) { rc = -EINVAL; goto unlock; } - if (input) { + if (enable) { if (dev->flags & ATA_DFLAG_CDL_ENABLED) { ata_dev_err(dev, "CDL must be disabled to enable NCQ priority\n"); @@ -934,9 +976,29 @@ static ssize_t ata_ncq_prio_enable_store(struct device *device, } unlock: - spin_unlock_irq(ap->lock); + spin_unlock_irqrestore(ap->lock, flags); + return rc; +} +EXPORT_SYMBOL_GPL(ata_ncq_prio_enable); + +static ssize_t ata_ncq_prio_enable_store(struct device *device, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct scsi_device *sdev = to_scsi_device(device); + struct ata_port *ap = ata_shost_to_port(sdev->host); + bool enable; + int rc; + + rc = kstrtobool(buf, &enable); + if (rc) + return rc; + + rc = ata_ncq_prio_enable(ap, sdev, enable); + if (rc) + return rc; - return rc ? rc : len; + return len; } DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR, diff --git a/include/linux/libata.h b/include/linux/libata.h index 26d68115afb8..6dd9a4f9ca7c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1157,6 +1157,12 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth); extern int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, int queue_depth); +extern int ata_ncq_prio_supported(struct ata_port *ap, struct scsi_device *sdev, + bool *supported); +extern int ata_ncq_prio_enabled(struct ata_port *ap, struct scsi_device *sdev, + bool *enabled); +extern int ata_ncq_prio_enable(struct ata_port *ap, struct scsi_device *sdev, + bool enable); extern struct ata_device *ata_dev_pair(struct ata_device *adev); extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); From patchwork Tue Mar 5 23:58:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778223 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C75512FF78 for ; Tue, 5 Mar 2024 23:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683118; cv=none; b=N278F1RaIkvhOuPvqyJqFYlyXAtEk4i38P/XtrAVVGh5lEvWqdIKNXakR+cYO9GiAFir8nbKQ+u529WvWK5hJ1c/+9y0xOMSkYeYKS9LIluQfmC4TeciyLAJxftQRcZuICMs+WlmkLBQPZEcc9emLP6eqGurbziqgYfPrqhbeiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683118; c=relaxed/simple; bh=eNWF6foC4RAjM/7mIBIDm6Ws+q1aoKRiMrqNZ34dkrM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UVEBA1DsAGJq843e1sAkkpf0qy+yEdi4Cz+nS3oVtSdpqnyxI46ZVMP8DcBA+SkApCAujc5baOVmrU3TbfwbSMzS9QRYSkNB9QOc71ad70eo6gJ1CiGEIdFvgU9gWCEANybs74lG8TCbIB9SBteIGd3UPlD/SKDjvwmO4JSz6Z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=IqN1Tz+T; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IqN1Tz+T" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6099e707622so23292347b3.3 for ; Tue, 05 Mar 2024 15:58:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683115; x=1710287915; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=djrkg2o6GYfOpuFfrfroOSUyfmqyZMD72kLam/QnMds=; b=IqN1Tz+Th0zlG2zBpaT3KhC4plYBPUY2bUj/kHTI+J7lHDzIrAm8zX7l0cppi2D2Nr OSB0Ehf2daZHEVGdc8xvJea/tzHQD79/zXYzP3SN8494Y2bbO4G9ndTGTFjgfBY9QwUw Tq132MDnkd8L//LwKFc2SIq1+vVeOOkquiLebv5naBoeo8kKQQmzy+hVOaYCW+/xLsQc B/QnC1s6YluANwwWSoh7vjQJtqZJNjAv/5SioL4dEZztDTOcDCw7l2oxinEH5ND4Iqqe PAXmBgoRtLWtQhO4dvZiIdBT0ZZLPxkT0sJ9GRZL+FXfKNJcf2JivPG4BuV5dVQoy740 JeTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683115; x=1710287915; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=djrkg2o6GYfOpuFfrfroOSUyfmqyZMD72kLam/QnMds=; b=S1H3vazTGmeCLKsUONzV1QFPNyCnqqC7xifn6a6aOp8yHpFLu8GsK3vt4aDvtJRykw qKzy6nuulGpYpdgbDvw6c+hq0UtUr8Vc9oYa2NtryhwXGtbjeE4RbBjWoJUytl+3iTCV 9oY0FwVcoc7DByMwI4EsJ86/94x6OOporFbZGFeyH9iVNsZXV889qUwm/bFhqiWJsXrl mBF5oiAqMqJFGdZvryrPwHnCA0ZhtUXns+0nLuZ3GnkB37Lh3YiAyF54snd6HiAxhlwt f1quf2Hbh+adt87tirQoCYGWFuAP8WqFuCBEX30NDtBsV3xMX8XoJ+ti71yl/iJiG/NE N+BA== X-Forwarded-Encrypted: i=1; AJvYcCX3va7omc5UAmk7uUjvZlaXS01veMAEANrLieSH53mzgU0+dNgcB//lwdtGEO2UrHyj9YyCBxJGhw/GCkJ2kMLtg4acqx2u402Ldg== X-Gm-Message-State: AOJu0YzOAXi0bAQWxYVKoI3iiWeMnYTTeCNM14vC0uXq50nmVep8vtb6 LBnAKPergPGnDlhF/9XIY2wL0ANQvTWH3iFWIfr2biHwL7iztpaKC1KykqFUM3DUOAi6Sp6blbp 0leUxb8jMYg== X-Google-Smtp-Source: AGHT+IEGRE78DRGidpai8zoLT+qXHBTo746+ICXMSaJINQRusZb3EuPG16i9dA++aY4fqmbiHtlbI26s1cfbWQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a81:7908:0:b0:609:2cab:1bd7 with SMTP id u8-20020a817908000000b006092cab1bd7mr3874602ywc.1.1709683115682; Tue, 05 Mar 2024 15:58:35 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:18 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305235823.3308225-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240305235823.3308225-4-ipylypiv@google.com> Subject: [PATCH v6 3/7] scsi: pm80xx: Add libsas SATA sysfs attributes group From: Igor Pylypiv To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" , Jack Wang , Hannes Reinecke , Xiang Chen , Artur Paszkiewicz , Bart Van Assche Cc: TJ Adams , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv , Jack Wang The added sysfs attributes group enables the configuration of NCQ Priority feature for HBAs that rely on libsas to manage SATA devices. Acked-by: Jack Wang Reviewed-by: John Garry Reviewed-by: Damien Le Moal Reviewed-by: Jason Yan Signed-off-by: Igor Pylypiv --- drivers/scsi/pm8001/pm8001_ctl.c | 5 +++++ drivers/scsi/pm8001/pm8001_init.c | 1 + drivers/scsi/pm8001/pm8001_sas.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 5c26a13ffbd2..9ffe1a868d0f 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -1039,3 +1039,8 @@ const struct attribute_group *pm8001_host_groups[] = { &pm8001_host_attr_group, NULL }; + +const struct attribute_group *pm8001_sdev_groups[] = { + &sas_ata_sdev_attr_group, + NULL +}; diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index ed6b7d954dda..e6b1108f6117 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -134,6 +134,7 @@ static const struct scsi_host_template pm8001_sht = { .compat_ioctl = sas_ioctl, #endif .shost_groups = pm8001_host_groups, + .sdev_groups = pm8001_sdev_groups, .track_queue_depth = 1, .cmd_per_lun = 32, .map_queues = pm8001_map_queues, diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 3ccb7371902f..ced6721380a8 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -717,6 +717,7 @@ int pm80xx_fatal_errors(struct pm8001_hba_info *pm8001_ha); void pm8001_free_dev(struct pm8001_device *pm8001_dev); /* ctl shared API */ extern const struct attribute_group *pm8001_host_groups[]; +extern const struct attribute_group *pm8001_sdev_groups[]; #define PM8001_INVALID_TAG ((u32)-1) From patchwork Tue Mar 5 23:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778222 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF25C1339B1 for ; Tue, 5 Mar 2024 23:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683122; cv=none; b=ebZEC/xuBOeIpuSyNRlUSPLHc5XR+U2wcY21SWthJSr7CqcgwNCkwgvm+Qa1L3U/PlzaJ2yNR0rlLfjZiWIx4mwJk83NAGKkrsXXQ7FyWpsTvDKioBRI2aHhgANRxazFbx8MDAdF8l74R9NEbxW8GNRLUzSTvHGlG1fMZmJuk0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683122; c=relaxed/simple; bh=maF5o+8NzF6pdVwJjN4aGBE4hXXZ0tcVypbGypFOmGg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WIWJo65BaxL2cnTSi3dvw7f1BPBg10PMvseNVShbst+JQB6tnlGTnwic6QFXF9KSLQEghNLmyOCRjJ8B8QbM9SypPNoJTwTvln3A6d46B6Ku5WJ/GiIBJyF5mDOUBeeZ1aAmDyQc/8eTVKPZZAR6hPWYuXc0pvvIilAJ6umoDTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jCp0S8X3; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jCp0S8X3" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60804b369c7so17994927b3.2 for ; Tue, 05 Mar 2024 15:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683120; x=1710287920; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9D3wwHTaGXoUxTIIC0KnLIe431yjbfic0tFZoCaTHSU=; b=jCp0S8X3jV5Lg50a9vWe6OJgOTTJ6EwUYuswLsLlR8xvQW96O82khoeYtHREYeN9cX 2YUXEYrWm+rGxlU93htoNICPi8piYw4t7eFnqsq5Hj4G3iWfwkWoA1/M8WN2J61vDq6B h7Vdd9fG1KzmX+iy1RTK4LFeE4/ZRYhs5879ygIH4YMphhyKBm0wvF/paHY/OmROt2LH UKZBp05oidfKiZRXnnNfaWVJsuR72eRZpHd+wMGSknaG2inCkkpgF8g1VIv1tVH5avMb 7g0WU0op1ZxU9vRy2wKr2UlwK2L/pXtqQdySsEuRnjsxudlMapPSEv3bqHrKKwVYZ2ui 2Gtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683120; x=1710287920; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9D3wwHTaGXoUxTIIC0KnLIe431yjbfic0tFZoCaTHSU=; b=sE0vjbk3Jzb1hdEBz2bUMRRFKy27P7V9U82r0ShDd18bgIrZtunpR6eXTYcknsBF51 LdwVrOuAbw6gKTPqMtX2xgSgCkzLGv4HqJ6nwhRG16iTsdl6HCu5nW+cAEMFZwyijFFR rY7cYOL8gYjXramWlsPrvGZB34H1sJYsmTbZFb/Wmk1hMWeW9KJgHNlcsnjdQkWsprXP Gq7nkhvZ7sFxy1Cj8f31QHeuipsXyXtISgp6F3WEUaLwi0Swx1HJUIJhTZEg9fG7jthr MYkJgMFkzo7ImXbIIKdw4ayh5p7CsUGL3TjMoKgek+zkU0KYz6dfq4cFfmit4We+X5nL D/Kw== X-Forwarded-Encrypted: i=1; AJvYcCXzR5hT2WQXdn4LTCU277Xi4TQuLwfScdJ9FEJksfhFuHxSIxi/gGxhZDkzy7mGoOvGEzyT68iQ238VXhu4YYfBdu5Y+y3e9DGQuw== X-Gm-Message-State: AOJu0YxBwWtSCOIDQUcw4hH0vne54wjVPM4ckYhFt7YhPmlIhfdE5pl+ Ps7WIoKTxfJgy7QOwOWiyp5/qK3+ESg/UdKQmXW+ZSTVG7J808cSKWj8LFHPx40tCJV7CCNGi/B CVC9XdH9NLw== X-Google-Smtp-Source: AGHT+IEh4EOkCQAW7SnanA8bB430w4xh23BQshDhLIDYxxe1IBICBWObTrhgrFis2i70uNCJX6d2c6KwUnqvMg== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:150d:b0:dc6:fa35:b42 with SMTP id q13-20020a056902150d00b00dc6fa350b42mr3669159ybu.2.1709683119712; Tue, 05 Mar 2024 15:58:39 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:20 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305235823.3308225-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240305235823.3308225-6-ipylypiv@google.com> Subject: [PATCH v6 5/7] scsi: hisi_sas: Add libsas SATA sysfs attributes group From: Igor Pylypiv To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" , Jack Wang , Hannes Reinecke , Xiang Chen , Artur Paszkiewicz , Bart Van Assche Cc: TJ Adams , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv 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 Reviewed-by: Damien Le Moal Reviewed-by: Jason Yan Signed-off-by: Igor Pylypiv --- 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, From patchwork Tue Mar 5 23:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778221 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2345C1353EC for ; Tue, 5 Mar 2024 23:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683126; cv=none; b=bTnALHZQG6CoLBwSnouNSoEy0Urh6iHKbeA3WLAAyiAOgcZVX6+e4RkNDr8zSdp5AeeL8x99Am46JQN7I+6hCr84aCeAFl7EdATkxgoIKCdIQ/iTsPuhYcSCEi7S5pqhRTex9ybabbxki3Q+P8EJ5oPkOCKkups5r1b77zsO2jk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683126; c=relaxed/simple; bh=ZQgGWVSWytcgK5MJZ6jggoBjQfFJugefhTJSzcVcgYk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rggp95OLKU35eSmIPD81X2UjMCAzMMddjEhPMivkhs8BJTRq2sgU1D2ZRL03O+5Y/Prjh5jXYmK3ePFYTBoFVm4lsxAVpM5t7xh+22aPbOtjr/dANodRjSzp4Vv7me4RCRAvmLA5GoTmiEdagK9+ADfzkiNfK4YSL95VvFBT54U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1FLFJf6l; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1FLFJf6l" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6ceade361so10457494276.0 for ; Tue, 05 Mar 2024 15:58:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683124; x=1710287924; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iW4+YjuNAKvAoJg+NmQ5C96xY/u5WzV8UruESW/Bs4M=; b=1FLFJf6lYz6MXkeWmkVOPVP/dTbCxipBlQKRRdIQQrIYT5xVRz2QD10+XwMkhELTOO A4bGpVLhcmi5j+DnbpFoSzd4qZy7nptJpe1yKBTq/h3HhcClu/RlxuWKpoH35rVoeUDN TEytp1a72dm/AWNBXa6KmfCNWxBk2r5PzZnEkgRNkWpbBygTujZQslKPMjWF4AwGSs6Y uhovgu9ZM/lL1czkaTMxO7dyD7W4XstRdBTElHPp7UafjG1xNJbmsc6XrgK6QNR93jZ4 TrBbGjYn6qCWRNdf7Mcr9hTZiuPEU+DRpRD4KN8rWLyQg2u9P8lyCJgU/vuRphq/21lo w/IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683124; x=1710287924; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iW4+YjuNAKvAoJg+NmQ5C96xY/u5WzV8UruESW/Bs4M=; b=Sl3uJTMUk2fAfMpkzna+TY26zNyHVdrojtZyGgMecSFcYpzUPEGO6i7OjYPd11h38I PfTD4kP6hyGyHOlOMs6hPLPL2+VDT0Qu1nCF6yh9yFF7BeHi326bxIBx86h1BMK3xeRw fb+rHApYQ3jUa0zvaag1YtKuB/9CMjIMVwFZQuJrcj7omGFcf7Dpe9tK7CPD73mXxb5x iWEmxwa/nfAz7cl/tmzKibE5Xf25rrQRbk2B7jyyqD/SkIl/mnUAIeVbK/ifdN8H3tXs rHnH6wKCdVnj9PnTgKD9+oGuUxcf0FloGrG3zy/f3tj5EWFpQmavVDrGHp/kaIKkFk1o F/Kg== X-Forwarded-Encrypted: i=1; AJvYcCXSQ+Rj9VFcKY2TKUkB9jHpySt1vpfYa7gQsrM6JvwL1PZNc+XSmDFz2dQFJ6jyjot0nnE8IGhhqNbAGb7G5ohsz/a2eYpcCTfjjw== X-Gm-Message-State: AOJu0Yy6CBvzVuLIRpgRKnE8zLc0q04VlWofHViu0N3EFSDH4GEFPbIL Lhfc04tOKeP2ent+V3uemD2cAWmI8zjq9aIS/MAYl31UPcZ2m7lpW2hPzzb7UDEVIb4frljNhtN 3CZat14b5Iw== X-Google-Smtp-Source: AGHT+IHCo10p/LCIUXuR4X0ieD7GA4BMa+s0Kua3rnoaoX1L1KdO+HKSNyVkjWeL08MQ/A07Bzu15QUgFpNe/A== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:728:b0:dc2:1f34:fac4 with SMTP id l8-20020a056902072800b00dc21f34fac4mr3509623ybt.2.1709683124213; Tue, 05 Mar 2024 15:58:44 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:22 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305235823.3308225-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240305235823.3308225-8-ipylypiv@google.com> Subject: [PATCH v6 7/7] scsi: isci: Add libsas SATA sysfs attributes group From: Igor Pylypiv To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" , Jack Wang , Hannes Reinecke , Xiang Chen , Artur Paszkiewicz , Bart Van Assche Cc: TJ Adams , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv 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 Reviewed-by: Damien Le Moal Reviewed-by: Jason Yan Signed-off-by: Igor Pylypiv --- 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, };