From patchwork Thu Mar 7 21:44:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778768 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 E56B513B7A7 for ; Thu, 7 Mar 2024 21:44:26 +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=1709847869; cv=none; b=fx9N1CeUjz2jDf65ixWPWatbhpQLk7e8MqJdzAIzoeZ3t+jXZV3kMsEaCAgYCwXzZEY7wAYzHFPtpAEbUL3xiO0P963uLWJbKnOcOm0vXdKEcQvxMxu/MgE/OCPdukXx3ITcgv6LPl/kU9BWDQej+TrkTbkU48WfhVezTazz2zc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847869; c=relaxed/simple; bh=G0ZUJP/ZkBCOmzQOJc1xI74aPKgFFLAXayJWxtULjxc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=F5R9Jcgbj/muBjNvRC5Je1zDVe6pN0pf+WAZVFT3pQynVvCMXduukaUE+9D2ecgUjRwwsrmgLfxOHzKko5pLztL3IAn8Pxv/tbvi+t52f0b8mUnUYEW1P8QbmbtntbKn3z75pGJvyG7HsbYuFIdVDkm0sqt57z2E9hO6AMSeUtM= 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=NBcSLfu1; 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="NBcSLfu1" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-609f015e386so22192087b3.3 for ; Thu, 07 Mar 2024 13:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847866; x=1710452666; 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=6LhSYtY6QZt6fH5eAYaAFVA5m0RDdwnpK0pNKamW+So=; b=NBcSLfu1DLWTObnvS35sATCi8ie+/+raGwP2HjT+e32a757kLP7q+JNHbd/dphXARy 6gK7WnjH/lIugobtSSeQMTRTWSDeQH4zP9O1c11EOHH73kb1QxZdHe8PNBawWCBy2RVV ACqGFm6L/nTH/r2NSyVjH0a4/LSxJRMt8gu5KKW0Gzs77aAxEYl19Z5e8+cpmCgRBVPN 2trFWG/N5M7TAW5RBC8o2yRnAeZ4vD6CQCifH2FXO3XJKeBEa5MMpevJNwcHztIrU21E u0rdTEiowvo6lilOyVTHzOISuLfdxfJy4OEtXfmybHqOQD2aefzV5gFgBAjQs9gxKNh8 e4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847866; x=1710452666; 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=6LhSYtY6QZt6fH5eAYaAFVA5m0RDdwnpK0pNKamW+So=; b=t8MipaqajPCneTi21+88sa+yz1gEcvLussbR0EjJRDHLj1iHBtB7+7zkrshKmaY3wK 4wSFnZ7vE5o+wVc/VUVX1lH95yAbQI0ysJ11Xx72cxt6vcvVv4dEBHtFvBMz/0+1Ijj9 fb4a6yUYt7lxTiUoHwV8h1czy+x3sUZKVfPMDIvmzFZiZuAZgejWQGM622L1e6PeLHLA BFEL8y4TIJJ9GIEEZRnszNMqCx68kTlHpgw25O7eWIcAw1lf33bzqtAOeyaywgA9Ki1q 1j34ad5yD7Yx6by6Y/4glNMCGXYlobWvc3MGILHQ8OCbqdX3lt3vN6sGv5SS3goJujdB 4QVA== X-Forwarded-Encrypted: i=1; AJvYcCXkWiGMewPNAgaAsg1QST+brkw3eZcO7Xg3vuxnDuh7R3czva/QlECZIzIHKK6LiE5CV9VeNOZVgsZCHv0vep88+yXgVma2lc3+Pg== X-Gm-Message-State: AOJu0YxGWaJNzImq5U8HJJuQeaKjlTxOwjE68cLVaPmHG/NXSU3Zf1HR haCh+16lhAgAdQx+iwxQTigd89vM9YHomi/9LTrkr0R1MvraOG37H6kN0ULVc/4R5kNVKZUxtl5 uOtTf8aPwwQ== X-Google-Smtp-Source: AGHT+IH27M/JdvXhcgEPeKFtc+MyRJkzfUjHkwRS3/BAdp+NGrPpYuJmdjyCUfGJsC+OS42qDiD9lhL2aaJPzg== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a0d:d801:0:b0:609:ed23:8658 with SMTP id a1-20020a0dd801000000b00609ed238658mr944033ywe.8.1709847866113; Thu, 07 Mar 2024 13:44:26 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:12 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-2-ipylypiv@google.com> Subject: [PATCH v8 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. Switched locking from spin_lock_irq() to spin_lock_irqsave(). In the future someone might call these helper functions when interrupts are disabled. spin_unlock_irq() could lead to a premature re-enabling of interrupts, whereas spin_unlock_irqrestore() restores the interrupt state to its condition prior to the spin_lock_irqsave() call. Acked-by: Damien Le Moal Reviewed-by: Jason Yan Reviewed-by: Hannes Reinecke Signed-off-by: Igor Pylypiv Reviewed-by: Niklas Cassel --- drivers/ata/libata-sata.c | 160 +++++++++++++++++++++++++++++--------- include/linux/libata.h | 6 ++ 2 files changed, 128 insertions(+), 38 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 0fb1934875f2..a8d773003d74 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -848,80 +848,143 @@ 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. + * + * Context: Any context. Takes and releases @ap->lock. + * + * Return: + * * %0 - OK. Status is stored into @supported + * * %-ENODEV - Failed to find the ATA device + */ +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; + + rc = ata_ncq_prio_supported(ap, sdev, &supported); + if (rc) + return rc; - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_supported); + 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. + * + * Context: Any context. Takes and releases @ap->lock. + * + * Return: + * * %0 - OK. Status is stored into @enabled + * * %-ENODEV - Failed to find the ATA device + */ +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); + *enabled = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED; + spin_unlock_irqrestore(ap->lock, flags); - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_enable); + 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. + * + * Context: Any context. Takes and releases @ap->lock. + * + * Return: + * * %0 - OK. Status is stored into @enabled + * * %-ENODEV - Failed to find the ATA device + * * %-EINVAL - NCQ Priority is not supported or CDL is enabled + */ +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 +997,30 @@ 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 Thu Mar 7 21:44:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 779620 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 4417E13E7CD for ; Thu, 7 Mar 2024 21:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847872; cv=none; b=h4/C+lvg2j67GyaE1HeL6quwfG0+MhYzBNfZlJGJt2j5iOjvGckgLgxATz9UlYmTgWVFHMxkTOVosI2uR/7Ah3pMw0m2cc5x7zQQIg4sZUdz+Nuvm0BomZ7uf6XYyk2A1AekLm38zuBT0w1GOEiDrxgtR+sJ55HCj46Wx2oABnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847872; c=relaxed/simple; bh=YSRhJbkprUQQfCWFGDumNRfHglngYq6Oc0DzcoBcuzk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HUjYI+sylnbBU7Q07N3c/M+ATywGSlHuqrJRv87UHYEFSq+FQEBp8ciQ2VnrEAJCPKHC2x65QtArdrCB8oATjmgXu8Cif31wj9w5jg6w6MDGKWhY/s1hXDA0fEKLr5CnQ1falylZuxtCB03gkHuitvf/PQt+4x3hF6MUQf0wqEk= 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=UNg3IrAZ; arc=none smtp.client-ip=209.85.219.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="UNg3IrAZ" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc691f1f83aso658998276.1 for ; Thu, 07 Mar 2024 13:44:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847868; x=1710452668; 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=D/UjozYWsvAN/C5p7VPWLV1GhNI2WpC2ansFPUNxUuY=; b=UNg3IrAZIrKJGu0prw6rH31+vj6uMSMTvHYqHzzrTwsCiFFMY6hNGdMSSKRXFILu/8 hWToUy1UiPES++7Yg5l6bQeDmz9y7l2U5m275rV2L/DY/4T1eTr0JjmOw3Nf2eQns8+l b9qiHu68JlaQBCwsAwQt1X/Hlwrzsegg+3Q937fxUsF6WePy5A4seEiT4eht9yWIo6/L A8bFBaq8JnUQKkI0y2ogPt8euS/02lVhX25TDLA4IRZuiFKJo+hXC0fQ2WfEhWrFdgeb 3at+1xADEjBTquij7n0qq6cqvJB7Hi4MSevX8i3zrl2hxr4OpYW62CGl+6P817mxSyuT ENuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847868; x=1710452668; 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=D/UjozYWsvAN/C5p7VPWLV1GhNI2WpC2ansFPUNxUuY=; b=twW434sXTgxc+biiFOvcCJb2bRjXkUYH17UfuL3lq5zeyqvai6LWtbxvVlCUwlTPgi W9kv/YmTLdo8MJzoAJfqZgZm9FmyJxceKjOwmQeWKHXi17680MjJqCOuA8Epmgy54Dl7 bG9gU9nB1+VI6i9aMCqZPGn1sWd8uJIecBDKr66Ok2gSOaTARWUAI9Ls1Xra974vjQ9a XP/m2SZZKuyGrs5mCterGlBmFJNliK39Q1F8oyx88z5yL5D/QA3931o7KbqbNEZYtRXn PoLbLOpaSIv6De+CuJ+1DLYzSn6QCml3jyJNU6/HIf14ZfCgj8VPf2UjCS0M6tt3qorM 8oIA== X-Forwarded-Encrypted: i=1; AJvYcCVEWB5BtVL4ZE6kVF2foIThhkrb6Q+4TVFidLGbH8cMGOl/5F+dfpYoTS8E6U7zz5uUovMFVN4T7EoS1W1Wh4gcCJk1uAhAEC8erQ== X-Gm-Message-State: AOJu0Yx+iW2CXOZodS4TRyLwYPSNGUYvCROO15y9rR5offBYKXR4IcNu ZeFBEhvBr/aGs9GXA2TYcQVfoU54XEv++wcISIr0U13ElAzR3NNAtcNi9svLU57UuDTlrbfC7u1 Wamodg6lAWg== X-Google-Smtp-Source: AGHT+IFw8QcatIQRdLsa6m2Kc7Ojj+5jjhwEI1+rXhke6KtmZMw7oScCyZHQIs5JY2TCjpz6Lgak40Ld5ysn2w== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a25:4d45:0:b0:dc6:e884:2342 with SMTP id a66-20020a254d45000000b00dc6e8842342mr731884ybb.5.1709847868286; Thu, 07 Mar 2024 13:44:28 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:13 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-3-ipylypiv@google.com> Subject: [PATCH v8 2/7] scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices 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 Libata sysfs attributes cannot be used for libsas managed SATA devices because the ata_port location is different for libsas. Defined sysfs attributes (visible for SATA devices only): - /sys/block/sda/device/ncq_prio_enable - /sys/block/sda/device/ncq_prio_supported The newly defined attributes will pass the correct ata_port to libata helper functions. Reviewed-by: John Garry Reviewed-by: Damien Le Moal Reviewed-by: Jason Yan Signed-off-by: Igor Pylypiv --- drivers/scsi/libsas/sas_ata.c | 82 +++++++++++++++++++++++++++++++++++ include/scsi/sas_ata.h | 6 +++ 2 files changed, 88 insertions(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 12e2653846e3..b57c041a5544 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -964,3 +964,85 @@ int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, int force_phy_id) force_phy_id, &tmf_task); } EXPORT_SYMBOL_GPL(sas_execute_ata_cmd); + +static ssize_t sas_ncq_prio_supported_show(struct device *device, + struct device_attribute *attr, + char *buf) +{ + struct scsi_device *sdev = to_scsi_device(device); + struct domain_device *ddev = sdev_to_domain_dev(sdev); + bool supported; + int rc; + + rc = ata_ncq_prio_supported(ddev->sata_dev.ap, sdev, &supported); + if (rc) + return rc; + + return sysfs_emit(buf, "%d\n", supported); +} + +DEVICE_ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL); + +static ssize_t sas_ncq_prio_enable_show(struct device *device, + struct device_attribute *attr, + char *buf) +{ + struct scsi_device *sdev = to_scsi_device(device); + struct domain_device *ddev = sdev_to_domain_dev(sdev); + bool enabled; + int rc; + + rc = ata_ncq_prio_enabled(ddev->sata_dev.ap, sdev, &enabled); + if (rc) + return rc; + + return sysfs_emit(buf, "%d\n", enabled); +} + +static ssize_t sas_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 domain_device *ddev = sdev_to_domain_dev(sdev); + bool enable; + int rc; + + rc = kstrtobool(buf, &enable); + if (rc) + return rc; + + rc = ata_ncq_prio_enable(ddev->sata_dev.ap, sdev, enable); + if (rc) + return rc; + + return len; +} + +DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR, + sas_ncq_prio_enable_show, sas_ncq_prio_enable_store); + +static struct attribute *sas_ata_sdev_attrs[] = { + &dev_attr_ncq_prio_supported.attr, + &dev_attr_ncq_prio_enable.attr, + NULL +}; + +static umode_t sas_ata_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int i) +{ + struct device *dev = kobj_to_dev(kobj); + struct scsi_device *sdev = to_scsi_device(dev); + struct domain_device *ddev = sdev_to_domain_dev(sdev); + + if (!dev_is_sata(ddev)) + return 0; + + return attr->mode; +} + +const struct attribute_group sas_ata_sdev_attr_group = { + .attrs = sas_ata_sdev_attrs, + .is_visible = sas_ata_attr_is_visible, +}; +EXPORT_SYMBOL_GPL(sas_ata_sdev_attr_group); diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index 2f8c719840a6..92e27e7bf088 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h @@ -39,6 +39,9 @@ int smp_ata_check_ready_type(struct ata_link *link); int sas_discover_sata(struct domain_device *dev); int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, struct domain_device *child, int phy_id); + +extern const struct attribute_group sas_ata_sdev_attr_group; + #else static inline void sas_ata_disabled_notice(void) @@ -123,6 +126,9 @@ static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *p sas_ata_disabled_notice(); return -ENODEV; } + +#define sas_ata_sdev_attr_group ((struct attribute_group) {}) + #endif #endif /* _SAS_ATA_H_ */ From patchwork Thu Mar 7 21:44:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 778767 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 7888113F45B for ; Thu, 7 Mar 2024 21:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847873; cv=none; b=IR5v35qyKIx8ECeV8AjExNHDviOxkw1gIhrscwnqAJZ5RRjs9+eoY3jPY0Cw8HZR8xprrNhznoEpaVJPJdf3CbVSwajLO3bXWDlbDaJsFCmsHiCJeOHqBtpS50B84X5twq1wWYells/x1TZrTzm36SPLcodpgYUeAKlApJtCcuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847873; c=relaxed/simple; bh=kXKDe8j9cFkvG0Qo2NNWFPNOx8lWfLmANEVe8Lz+sfQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fg7JFjR7QO5QR/MRUwmp9umGDRSTEnRTRBUODoWuFBbngy/6JVhCwVLgtjtjZQUQ253mBppDLoGWpzk1JerklzJqLgjNER+uSvBJ5rH9ak/oPqQJ6UWxUYF6Kjwt63rCLvNmUVet5OV8GpESKtypvtT0flVriUC2I2unxajzK3E= 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=D1DpE+ab; arc=none smtp.client-ip=209.85.219.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="D1DpE+ab" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcbfe1a42a4so2509873276.2 for ; Thu, 07 Mar 2024 13:44:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847870; x=1710452670; 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=DmnC3uyU6x6FeNu8iM8omlazV5ryfMaj3jlXFhUGyaE=; b=D1DpE+ab+naWXQGjUzfPh4S+YlIk9qcfq8LDHSB/f1uQ9eUR8Ygi+mN6oF/Lc7VdPF CatRjXqAkrTeqZ1RK/umviv3x5Xtxv2h0E8oYXbmJg9zETztI2mPu/a568tCcs/ouXFO k4aTNmdcfspyXKrT93aEA14zPP2fOFpY3TKRbiQ10NHnDX3Op7arGzcnHtnahPxG5duv lSCOO2kG34dwqYgueUiWshmJEM4M1iJwWDZEj/YpK/xta9xUSHZbjSFI5EYX+POahYcK HDbAyRGHnjLqSwlH/rwC6T0L+vbEWP5MBcst7dledXwMJMIRADqvgOSghpWttN+I1/9O 39bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847870; x=1710452670; 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=DmnC3uyU6x6FeNu8iM8omlazV5ryfMaj3jlXFhUGyaE=; b=JyquBp2s5jrUh0s4VXm2TRBXEbI3aJmt0ncpgGcaDLM3+3LHoQ/1t3z/2RFvWeoSZx 05S5ocYbEKO2BrXjI6jRngjWjy6buXkGSUpHxS47BpUueJqYUvuc6kjUQ2lSH0gFwdaS BD9vgKX4Ks7UMIdYMjGe+29103UgssFAMqx6bsDrkcGy4Kz4GYmQmssG/oCYHZ3FcvvQ TVgKGDe78qr0u8tARcB56aK+iTKcl2vsRnvwHGJ1t53P3gZaq61igp0Ocm4AQHzMjNGI efgF4MF8J+4+ItuiHgIGFx4YEfaTNZmApP3R/I/3c5uJXP30Mq7i6uYLJkIfVnE8zjZk 1tlA== X-Forwarded-Encrypted: i=1; AJvYcCWGn368WyFC8HPihapXcPObFBPe43oxRc6g+odHbHozeSmZTyZ/c1UMfrKw5+F+fkhbIphUMNcIe32PdP4UhCfbWik/fLDJvtx8cQ== X-Gm-Message-State: AOJu0YykbyUc+FVNW2ruxF+lsCh94Uu5zSiGFhDN2l6nXO24juvVlx1c Q9Pc/PJegJGnX3dDTICxqI6HfWvd9c0ZtyLZgL4El0HgIayuj5Pg6jE+2AIXPABVIe4OixDUkX8 aQ6MNbk6Rmg== X-Google-Smtp-Source: AGHT+IGtgGYTjr9pq4RmsTDLnlYdDyhrwsA9Ej+IKG1Z6YxiyO5O6tRc0vDyQXeFVxteRRR1yu9MazcedogGQA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1004:b0:dc2:3441:897f with SMTP id w4-20020a056902100400b00dc23441897fmr4675217ybt.6.1709847870576; Thu, 07 Mar 2024 13:44:30 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:14 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-4-ipylypiv@google.com> Subject: [PATCH v8 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 Reviewed-by: Hannes Reinecke Reviewed-by: Niklas Cassel 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 Thu Mar 7 21:44:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 779619 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 46C18140E25 for ; Thu, 7 Mar 2024 21:44:33 +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=1709847875; cv=none; b=rPdmEkf9e8aoiJYHUc4bU3yQlr7D5NQloozWWWGvJh601kgKfgrQ8fBDICQ7jNFh1VbUzURmr7qPXdEVuZnvGQeQiHmPyE3J80dneUyOTpsBKFEdjvUm6/kBslLglbgWqyy77WHW8MjC4ruyY/CXTy3WQqfaAE7Dr7uaAhg0RUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847875; c=relaxed/simple; bh=2cCuW0dKXiDPC1nTNSQxTi3GScOXsxTSOfJ1DyyKmYo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ROLIz8N64Jb1BnwqsEWMKFtRlLUguer3H60BkOr+S08WuYrVHQPznz44oyhWNLQBMWm2lsMV0OTz/gyGNJIouEuVO0WpD2MjMyzM04xiJtw5akmC/P9hhozalN9grzIU6nsrGYkVebti8FumucUmp+OijKESVmSuDrhM7eiGYAg= 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=DbowNptD; 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="DbowNptD" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60971264c48so24183407b3.0 for ; Thu, 07 Mar 2024 13:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847872; x=1710452672; 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=xCVD89QW7GNEyZMm3uxDu0K7SFt0NpK9jCVrU7O98fk=; b=DbowNptDu6GvfsIZLO4YQ2liRah+Fqru+SdAchb/1kbO6ATGPXFMWAABtOZb+Wv/ac ysVlcDkKiUmTamNNsu0E4QyFhfhE0eUDSye22dmEXTgBENkVn2R7k4b6sTQNZj9SteFZ GnO1kvIEg1AtJn89E3PvxoHxy698YepXVHU6Pi6vqMBUvilbytJSe/mdA743WwDckPZn T49OdtSvKRqz7o8kHO9br/jRQpb+/A7FfNK34MYtXiAqs68Hcm3hhbq1MgkjQFPQM/+5 0mKaGjsdIAmKe/8iJj21GiGU6zn7uUFXErZC+F0iztbXY7mwN3rzIIiyDKAKFnj9euYF WuIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847872; x=1710452672; 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=xCVD89QW7GNEyZMm3uxDu0K7SFt0NpK9jCVrU7O98fk=; b=oJSBMT/V7RfG7whgyHYxoNkhctIwAAjuSd50u+x0MTokEC/FzBc0n69MCcDrNBJGL9 o7h6Y3In3pZdDpEm4ZsjOC2uoPiGPCOsBLuL2gm0N8aVDlYC4Nr+Zo3izvFwV80fnDqL FuZ27tzwJaOXzUrtqeDLzSNAD0vDaavrBaP46/C60ouLasjcVyc+fwC072iBxBus6PVT GfgHdVoYgx9ibBsgzzdyyN/3Jb4Hs53njAVCR/O2mM3Kl6hLVxdTpeWLlZoD0WYk1Eyj 41dVaK7i6PQbAAz+e+X/wSuSjw8aUqeMtatp5ndlo+G8osguzgdmw/6vtKCIXEEaw0GC l5Cg== X-Forwarded-Encrypted: i=1; AJvYcCUYy+EqnUMzq5m/+9K7ZtL9ilNYxgaAagsL3x/X7R3DQKJ4kZii6W1MNmeu9U+7KyrqMIM0M+jQEheud56EBCJFMR5RraYkJy0LGQ== X-Gm-Message-State: AOJu0YyRq7CMx2NznC0J2id1wchoVoeaPwvqCCgtP+fr7yq+J3POiwyn uAVAraKXIGx987b4gyXDHT7ggqTWHd6ED/BfNYEVKrCEaqu0i7tVDAG0qwYniTF1jJHggCBtHOs woQGz4AsvIA== X-Google-Smtp-Source: AGHT+IHFQpQPPxJUddGyW0JiXEzVAvGBFFo64g+1nPyj7FNywLHMbgXYRR0N15fZG9B2KbpTYVn4kNRzaytYCg== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a05:690c:d0c:b0:607:d300:77c1 with SMTP id cn12-20020a05690c0d0c00b00607d30077c1mr4165254ywb.4.1709847872495; Thu, 07 Mar 2024 13:44:32 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:15 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-5-ipylypiv@google.com> Subject: [PATCH v8 4/7] scsi: mvsas: 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 Reviewed-by: Hannes Reinecke Signed-off-by: Igor Pylypiv --- drivers/scsi/mvsas/mv_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 43ebb331e216..f1090bb5f2c9 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -26,6 +26,7 @@ static const struct mvs_chip_info mvs_chips[] = { }; static const struct attribute_group *mvst_host_groups[]; +static const struct attribute_group *mvst_sdev_groups[]; #define SOC_SAS_NUM 2 @@ -53,6 +54,7 @@ static const struct scsi_host_template mvs_sht = { .compat_ioctl = sas_ioctl, #endif .shost_groups = mvst_host_groups, + .sdev_groups = mvst_sdev_groups, .track_queue_depth = 1, }; @@ -779,6 +781,11 @@ static struct attribute *mvst_host_attrs[] = { ATTRIBUTE_GROUPS(mvst_host); +static const struct attribute_group *mvst_sdev_groups[] = { + &sas_ata_sdev_attr_group, + NULL +}; + module_init(mvs_init); module_exit(mvs_exit); From patchwork Thu Mar 7 21:44: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: 778766 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 99356142636 for ; Thu, 7 Mar 2024 21:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847877; cv=none; b=mOj640PyXA3fIa7qHtIpkd+Fr1Z6A1LPXyx/6xDSGPmx0sfChENF9lsBKyK83ZLeGhMON43ytfwEncwy267cOXF0OYKvFvvSw2rFv7nR70VVjDjAr82hpEDGjwxRQM9B7Jm5odtrC21SS9MllUAZZ30v/RQY7dt7xxjxxum0Mrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847877; c=relaxed/simple; bh=kCUyYic0llMdCDm2+Ue48zOf2WyrmeyB/4BoGeE0niE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mxIA+YnlAh5Dc/uLOn1xP5ZrLV3ShiRnwwrGbhywAryQqkTexef1y6ruxA4v+54JtHD2FFjwZEVThQM1QkfQ4/7Y6yXVjNtcNzwjOcGqGQRgA5tcw2LBTirfO3pheKQcFtrst0fZo2bHhLnP/8OIvrpgzkUwvZl4dbwavVOQHKo= 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=eTf1iMg5; arc=none smtp.client-ip=209.85.219.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="eTf1iMg5" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc743cc50a6so2095882276.2 for ; Thu, 07 Mar 2024 13:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847874; x=1710452674; 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=FNHEYmkbDz44hYs4zD+M5ZgpK+WL/ZuC9mDgGa4D+bI=; b=eTf1iMg57mQ4/JCiUJ7Nuotf3smmBrRbtU2SVGdND6v7bkC15iFwiUnhy+msB/m3C9 6uy84ky5YtTTlDI13rgnYz7XbqoMXougOd38vtCxF0Av6rGLn7n380MWlHnhgax6TWhL IaW0hJkJyU6+2cV6A13DDVZjQv7+6x/ZUQhhWbW7NJYkIS1PhqiXkDJZG4X4/JovSkFM MEL1hSVuDX2iO3ilaXMvPeGfmysbLaJq5wxIx3e1ldQFdcho14EpiYK+0BoOwQXSb8Yj 6ZHHMLTzF+Hvk5tUMsH/XOMRVDA7Aljha1Jjy9qQUygZV+QGRma/yH8nn0TYE3Zs/PIO lcnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847874; x=1710452674; 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=FNHEYmkbDz44hYs4zD+M5ZgpK+WL/ZuC9mDgGa4D+bI=; b=Zlt4oJGRiHo4vvHcWD7f+bb/3tEy3xABIm9wOIDy3ITRYBIWPhH67CXDaKa8pJcwHi P1niiGGdb9dUAT32OLmOyXDO427ZgAOMkDbfrlvnYZ/fASm8iKRyIylB1ZdBFCaar8WN E3wX37zmHM+K6YooT7XpI5MPd8feYX3+OJZGlNqdMEWudiInJYJzEYQXSaegX642cQUj i9Vbmu+NpQugLQCwBaqJU1u6H0pOgL0OGyX7jCriJRtVzyOpC8hK6oW7p8EuZeaxbYO1 xXZLFVOtS8RcYDoe7cJJgdZIk5lKficww7IMgmKkSkwqjjgu3XjCBp4Y2yCzf/vSWjzd Oe0A== X-Forwarded-Encrypted: i=1; AJvYcCWeHCa0IUampuce4Ui1eUX5Mpc4P7cPgcAy/XO9gTS8wexaiwxf5OpFHBmjn84K3i3taAlTmEmEPn2W0k3GSSS7H3cv6ZJO+/0G4Q== X-Gm-Message-State: AOJu0YxRLQOQP4EpqW5tumCWau2AkCpdE3M8q2UltXAq/WX3OXbL/8es eU3DRcyRhHFSVPNQNuZeKOIi3m1Hw1Tzd8957pdCqeeYzujaV3Y9Jaz/qYP/fPOsORFJ2M9Aybj b//Y7wq9fng== X-Google-Smtp-Source: AGHT+IFtnbGMiVxBhyZl+UF8YJm4Nl++uoxkJhVo05Ue3MkENEDojQCqlrApHQ4o+1Clhjzk7BciZ1hWB3GZfw== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a25:f307:0:b0:dc7:4af0:8c6c with SMTP id c7-20020a25f307000000b00dc74af08c6cmr784505ybs.6.1709847874683; Thu, 07 Mar 2024 13:44:34 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:16 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-6-ipylypiv@google.com> Subject: [PATCH v8 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. Omitted hisi_sas_v1_hw.c because v1 HW doesn't support SATA. Reviewed-by: John Garry Reviewed-by: Damien Le Moal Reviewed-by: Jason Yan Reviewed-by: Hannes Reinecke Signed-off-by: Igor Pylypiv Reviewed-by: Niklas Cassel --- 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 Thu Mar 7 21:44:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 779618 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 7DC3A142629 for ; Thu, 7 Mar 2024 21:44:37 +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=1709847879; cv=none; b=qaesXpn8rlr4JZ0c1eHf7bJSHaNuqsOC+0uyvYNANZBFfAq0jaLBWC8usyN7kAA4wRkZGa0OHH3X3zu7PWoR0JjgE9TdLHmzQmGk5MwwS42K/aGmFoeKcNA/g+xMv+/i301pLxxXRD8U5HBdjxXzgyE88I/6Q2LKvJRAVI/R+N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847879; c=relaxed/simple; bh=3IHdm2Kbt7Oqnq7hLlZmkndR1cR6l2HysmJJhv/D7aw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=e2y/LiDQx8wlDt1wfzctwMflN7N3pxdnXoY3Mp9lnEazNNF4x2YHXP3BBvJPDzoMdxkIs+mxurGpVAy6mQtsnuVuT2qeFSXG73WemhQkqDRrtBptuLQ9EUt4KEIJ2YUuvu1lodP/YsbZFeIHifQir4PDgaka3CkMrJ7kKIlmLdQ= 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=t12Sbg0f; 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="t12Sbg0f" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dcf22e5b70bso463416276.1 for ; Thu, 07 Mar 2024 13:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847876; x=1710452676; 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=bwEvId1GeDg0DYsAPfhWaL+EMmX4DxPU1q6ezkgbZrY=; b=t12Sbg0fmiaJ8ZPu1iNR/moz/Rv7t0woY9Uo/tp3vQRv3UYDh+D9Mz37JF4+D2vR8d gGL6Hd5oT741qaEVFSpJVAOXrlAhgrwQSXvkaIHINhnV87bbHBvUp9p/+bf+Noxs5H0i 7XRRQZsqZPmvS8wi8b1Ran6Ern7ffGEV5XEkbPqNiXUI/PjhI/VOuRhaRBmbMXrtEgR4 2hsbygjgg8akvUdHVewVHGQZ2/I9d4QpcN0B3ZJTNsW0Y1GGwYfp7/CY7nxgNsN4RPxL AOkjER25vHQcwAk0qdGv7eDY8NZAPzAUuTZ6OocIgLz5Co5MjCpSeQt8oIswcVBublTn nrTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847876; x=1710452676; 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=bwEvId1GeDg0DYsAPfhWaL+EMmX4DxPU1q6ezkgbZrY=; b=BW1Yj3LxyS4o5rb1An5eYygzoxzXVqNiIdVXXalWd0olGoBryRMFQSV5+qI43bDZVZ AXdejLqxYGG/U96IjchZo0UkEQ/BzPkrLNUPi5Qoo/9d7yc2ZLD3KkIrpfH2GmbQLkoX aCd0/pI43HNhjYSj4RM4VghB3WO/Op6yJQVJD7tnIr0/HBGFy6Ogupcw8IFy0b1qQLFo XKTV16cRPQ7xYgUCSFog3HUfIKYvwcjhrh6H1si8tRCOSigU2dQJD60akn8W/2kcD6BU STrA1z+bALKlvSE9wfwrFswO9jJkrSK/9xmpVIhK7mVeEXc9rW2bTbXH3QHM9oGdhb+n joMg== X-Forwarded-Encrypted: i=1; AJvYcCXvyytf5+NDH0jj+CMVqNVJvsVIBN0zZxNs1dJt85/U0m/rrYyDLy2MpaMrDRaJwn6b7QN1xXNMVMnA4bEAeAgyESiBJ2sYgnSRlg== X-Gm-Message-State: AOJu0YwCnrDd89ouUFhcRuPT6QEs00MOIZ73+unH2Sxk5ZW6cIuKcUqE a3TT2eRJuWtl2iWvHQ0yx2cG8/Q1FtjQ3DHG1/0C7vfGVYFxsQvHRTtvz6Uym3PoO3dnlRdx3+k 52qkjDVGBFg== X-Google-Smtp-Source: AGHT+IFayAfHaKkEPZo+rNikCLiHI2VeVbBzc8tGK0HM4m0xNsouXgxkmZIRd60W1RhGlE+CFfrrZUPbCKvAZQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1209:b0:dc6:e20f:80cb with SMTP id s9-20020a056902120900b00dc6e20f80cbmr701381ybu.3.1709847876592; Thu, 07 Mar 2024 13:44:36 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:17 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-7-ipylypiv@google.com> Subject: [PATCH v8 6/7] scsi: aic94xx: 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 Reviewed-by: Hannes Reinecke Signed-off-by: Igor Pylypiv --- 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 #include +#include #include #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, From patchwork Thu Mar 7 21:44: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: 778765 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 C1BDD13DB9A for ; Thu, 7 Mar 2024 21:44:39 +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=1709847881; cv=none; b=A9sCRfYKdGtYkkE2JKODuhqi8MevhXK8FgKoz747fFvFYdXc6wHWM48eMJ+ZHHYLBejz57icuq3NnTXAImxNWAeXC7G60RnmHB7+U8mMnkWvwXGRwGFKOVq3NYSA7A+eMxul18WuggHRhAGnGM/fGzU9Csm1zw01m0cfZqnf8YQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709847881; c=relaxed/simple; bh=oKUWwFJtdtWNhMzwdWgAICCV9qWEtrIx7hjp1hett1A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tf+fM5Cj2aCoktOfXiGNbowfAi++qwPEw1yOp12vcFeTmhIlykqFu01mwbEbdZmsFqJOLmqpmwwTF5/1nJLr5o7AsR5QRWp+dM/FuaCdfPodJTmzY85iEQKBeu85JssFdAbQCm4Na9RBFXJuFEcm3n/wJ2wn0sQflKfEZ9LpsYU= 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=q7lLRLLL; 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="q7lLRLLL" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6b267bf11so423559276.2 for ; Thu, 07 Mar 2024 13:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709847878; x=1710452678; 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=2vpzIuphj8BSvlf66XaaBIKXyJGCME8GN7Op/FUvHdM=; b=q7lLRLLLqj4ZixcWweKKNskOKVXZYteWJ2f6RkN2f18wlyun41QTyc/lZd7UOpdT+D xEa0hyQtbsXCoK7Z9w4+jgv2M6zAJV+FEeMUK5aqLq0dmkl79bSF0M60VYy/EGHaOoNF vDAqT47BnwLK4wZ0Mm2+ilSBUaMcrPKuDIxzDdQzBu8QkBFYTjMt2RA010cHSEMlEiKT gR/Q6gD11MhTmpRYbBM8PbRbH2f+FRE5vrYLWTxYCnywtF35vTe2q5PdHbOQcwgyxWut XRFv2MqTMY25YDDHfns1TzHISy3dhAR395zZ8w/wqHTujVvy/anEjgZjUYSIrbDkzXZT wFbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847878; x=1710452678; 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=2vpzIuphj8BSvlf66XaaBIKXyJGCME8GN7Op/FUvHdM=; b=YDHHqJVF2XNbtHO+zXpHOD9F72L5h/yd7Tvgd3V9ssJNQj9EaY3LL16fm7hx0d+VT9 nUnJuD85+JCFk5LBwnQNtxuJbT5Lx+THLa3nBG7FmF1M5PnsPJcPxlylb3WmT8tvVh5F /aiU9Qv/Ek/F3h6tmPfKGtN2vc8U+fp9K/gTsSln3D3emapSXK2k2FglGZU6NwfIud3d UkQHqZHMIPNnM7XyE1HXTI1G5qduj2tLmNtHKRHxQ8Hu1rc1RZrhJRSfxFYVON9U2Q6T LaaGAFDc1hfqwrkOUzjMNaaLuA7At+oAE1OswgNYPRgOQyJ5rt8L+mCjm/gPF2gPV4ly HtdA== X-Forwarded-Encrypted: i=1; AJvYcCV9CojAVHCe39hINC3YHUxWvbJtZK4hTS2EfOsORFQ8a8bO+6J9tuUqEt9tUeDXk0Ry7z/cUPOi4EFrI9ufSYXVZsk9GYVzhGiExw== X-Gm-Message-State: AOJu0Yz1AaFcRrSxkTT2eT4Z5j24lYgVQIKzwLXqW2YAeKogOB5jIMyN Wz1cBubbB0GS2wJXCgKGvPx6DfzYolJEBRjoEB14BeZvujzDvfTSxwxyb+j4ZJd6Ltvy06OLP+A qZdKOfhfawg== X-Google-Smtp-Source: AGHT+IEJLNyfct4IVxJM1xng3J7p5UWMEzEo7qnqC43CO2vkdOobv3kRmpH4aDa8M7rwEpAdkiwZw+qBIcq8/Q== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69c0:c447:593d:278c]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1009:b0:dbe:387d:a8ef with SMTP id w9-20020a056902100900b00dbe387da8efmr656689ybt.1.1709847878739; Thu, 07 Mar 2024 13:44:38 -0800 (PST) Date: Thu, 7 Mar 2024 13:44:18 -0800 In-Reply-To: <20240307214418.3812290-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: <20240307214418.3812290-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307214418.3812290-8-ipylypiv@google.com> Subject: [PATCH v8 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 Reviewed-by: Hannes Reinecke Reviewed-by: Niklas Cassel 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, };