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: 1908487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=JeN5Qjsm; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-ide+bounces-729-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCFq6LZnz1yX3 for ; Wed, 6 Mar 2024 10:58:55 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4413128A024 for ; Tue, 5 Mar 2024 23:58:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16C2F12F5BA; Tue, 5 Mar 2024 23:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JeN5Qjsm" X-Original-To: linux-ide@vger.kernel.org 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 2B88912E1DA for ; Tue, 5 Mar 2024 23:58:31 +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=1709683114; cv=none; b=UsVXpO9YGak83MTU+DIV+nCv+Xe8SLLMUvap6BdOJihIMn6mZ3hsW4FhCNv5cnlQL1JGC3qdVKrCSWJ+q4VuqIDMbXdw9kyPotAq3SyVZ27gbASLd6zHMtb7zK48mj8364oyH2VHG97W4vbSiVu7jRgjYxV62Xe16yU+7nryHrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683114; c=relaxed/simple; bh=HdE6FN0o7wTsTE4Ul3fnw6MLY1Eiy7U6ACIH7VY572U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=l/VToghVODcJPAmIepXXec48CMQA8m2rffqqsnS4GbeupsZVkmQk6fFaUjrXfG8PLVNCmHZsGsJpHVzWT7EMod1YJCCmhB/zaopNAg2i85TVZhW2nbQsrBdx/rNBKuUAfMyOmijm7fB7DVkobztrdvx3v76JAj28FJFKZc3IoTg= 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.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 Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607e613a1baso7466857b3.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=A+uxx0pjIj+88UZG7Ge3YkaFKTweFYsBi1l1fuTl4sIsEjrc15Y2HIOvAYvXZc34jB H71KzSe4zaGr7DMVogXeMvwGCbjnOiH609a7tEvPfPDLBjRuGEq3ram5qozYXMvXWBrI FK/OrANZ8+L0VVSEd4cQc/j78UK1qBcSSfZDaHazczUNW1CYodmngtT8I3cJEAz+au9W 1Wyxt4f5/3KmC6a6gqBt5jpyz8/JznKv3wXCZJIdgG6xX1RH+IVXXpnDbz5quozh8laA J3wBg96YkOsCEwBYlOKV8SAMbEc7vfJVrc2Gumt4WKS+zfbLuv2d5She07DrGJtlQ/7I pFvg== X-Forwarded-Encrypted: i=1; AJvYcCWDJ0M+FgAX3cVcmbbbjSiQn2csWqqX2i1o7U0sGi2nBU39RyAvK3/PP/NylPq9QAtDEpzx7M+AuQpZUEq3LR9TO9tpCl1l5/Z0 X-Gm-Message-State: AOJu0YwjRmgTOthAB0PlfcFqV4cd0kwmts4NzPYC8uNKXal7BWV9XVbg BUQzZH4jH4cXiNFVt710YA33CQziIolhPxScEfa95Lvagw4rBVSm/D2oOaI0jeJre5ySNN5xrD6 gx/3oAPHFvQ== 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-ide@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 Reviewed-by: Hannes Reinecke --- 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: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: 1908488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=sx8lDWtT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ide+bounces-730-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCG035qDz1yX3 for ; Wed, 6 Mar 2024 10:59:04 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0173B28A984 for ; Tue, 5 Mar 2024 23:59:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40B1512FF6C; Tue, 5 Mar 2024 23:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sx8lDWtT" X-Original-To: linux-ide@vger.kernel.org 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 5B87112EBD0 for ; Tue, 5 Mar 2024 23:58:34 +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=1709683116; cv=none; b=vEaZXIWAxgCM3cMGcseMFGTWutaurSwrpAhVHoC7rPIEbbNNeU4cY/zSFA8Q/4uY5564kSyEJXqXMLOE4/Vya7iTbidlTm7KsEwthNSl3Xo2pv7EbyTW6vh284x6KZwG5PXIeAItf1DBH1VgUdtdeYMnQRE4HMVn39V7UClaoBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683116; c=relaxed/simple; bh=tljO3YNKojGQKl4/nogEVW1mt1rHvPdAvzEjzTFZ6pc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qlEh9MPU5VIc831fW7z4917m+iHLglW8ydgf/WEsBONPd2pFnjz89qpkewzfIihOv/zzCjnzOIxRYU7OwwC0U+iG6QaWJdECCQr6A+HQwaIRMgm5zaLek51wMJt4dQ+SbQ5f2/TRsWyyhlx3snsW+/7t3g/DpdugJe958D69Les= 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=sx8lDWtT; 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 Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dcbfe1a42a4so12186577276.2 for ; Tue, 05 Mar 2024 15:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683113; x=1710287913; 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=3IbqjAWtZG0ah6rSd6ZSYfM1o+jFUFiPix71IOwviDA=; b=sx8lDWtT4hWa48qP3Am/fxk3aVUl83KAOHLkcAwFfGv3O+PiAWZ8MglWGRCS2a4SH9 FRICui0TbGKzjycyfE6abJdBxx4ZfU4+MVN7M+Wwh/4AMjbZTieg0WtW1r3tDkpj08pj aT04dYWsnVgMUuTo/FIoT9j941FgjAJJqmcStZtIG/rgfHQPb0iznU+/yjIm9Iv0qowC 1TqBavTYHYL6Ok0UoMO8WOTsWtU22lLfRpqtGF4jxruSrQLjEQcJld+zqB7FIw+UufQJ hAyOH+uRkGb8fTRS5VkVw6MhfPQSe9iws+ts5VoYZfBJDBEc1C3Fn/PkJvoWzlAEyEOc X34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683113; x=1710287913; 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=3IbqjAWtZG0ah6rSd6ZSYfM1o+jFUFiPix71IOwviDA=; b=E8zB3U/IVXYcH/xs456UtO0iqgNtSEUnrlZdroGc/2EGRz10bEKV7IvYZ8XPVJAb6r Juxs6TQRR9noVjRg9Gwd1Xbpm7YukkEn7161WcNkCKYJp1HkxGQKn6fFgVkmNf8LrBXJ MVqFk9g/ury39tRF337J+Tj9C6pqNOn2azkayrcfi1fXaLIe4bYjdSdpzY0ajZ8K4lHl 86C+7YecTByJRwXoBxs/bPWZhSPVSgca8HHrq3x/TLxo6TDa+hHuTf6nV1aM7ix5OSw9 gseMGO4eFAn2Sw0RBBqT60o6e0UaiI0fM3zq3S8wFjinMbLzIETHb081SwTb6fP2gupe nDRA== X-Forwarded-Encrypted: i=1; AJvYcCWP/G5IBp12MHjQijwLZqOH1QwE1cxfV8mdmcGQwuMp6dI519Ery/UaccHUCXqLhhc86C1K4ZCzN/bgBhmFB5T/y+4y3RPK/CK7 X-Gm-Message-State: AOJu0Yy28IUszQ3/3l1CVpH571AX7RIzZUxR2Uj5i2v6s5mf4jebhrVW ZigzLbob+fZmFmpSz2v72SufsjU5KGyi/85PIx758zlJF5pMswAOQqxCzsfDn7LN5F4WJK79wT9 Eevompvs+JA== X-Google-Smtp-Source: AGHT+IFXxAYiJwdVSZE8mHvAfunpdCHDxq3qHZGle0aN74vGiPj3t3l+o4Wf8Kbr7CjkWhD3mljTyMnh9hhPgw== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:724:b0:dcc:5a91:aee9 with SMTP id l4-20020a056902072400b00dcc5a91aee9mr3344267ybt.7.1709683113424; Tue, 05 Mar 2024 15:58:33 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:17 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-ide@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-3-ipylypiv@google.com> Subject: [PATCH v6 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 | 94 +++++++++++++++++++++++++++++++++++ include/scsi/sas_ata.h | 6 +++ 2 files changed, 100 insertions(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 12e2653846e3..04b0bd9a4e01 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -964,3 +964,97 @@ 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; + + /* This attribute shall be visible for SATA devices only */ + if (WARN_ON_ONCE(!dev_is_sata(ddev))) + return -EINVAL; + + 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; + + /* This attribute shall be visible for SATA devices only */ + if (WARN_ON_ONCE(!dev_is_sata(ddev))) + return -EINVAL; + + 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; + + /* This attribute shall be visible for SATA devices only */ + if (WARN_ON_ONCE(!dev_is_sata(ddev))) + return -EINVAL; + + 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..59a75cd8b5e0 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h @@ -39,6 +39,8 @@ 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 +125,10 @@ static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *p sas_ata_disabled_notice(); return -ENODEV; } + +static const struct attribute_group sas_ata_sdev_attr_group __maybe_unused = { + .attrs = NULL, +}; #endif #endif /* _SAS_ATA_H_ */ 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: 1908489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=IqN1Tz+T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-ide+bounces-731-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCGN5W1bz1yX3 for ; Wed, 6 Mar 2024 10:59:24 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0C5C51C218AC for ; Tue, 5 Mar 2024 23:59:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4955D13173F; Tue, 5 Mar 2024 23:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IqN1Tz+T" X-Original-To: linux-ide@vger.kernel.org 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 8C79112FF80 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 Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-609a1063919so25483597b3.0 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=dwYuynEtRsCcAgB4HDErImr3wj5l6Rl+eGIxBQcRgklLJNSIegsPnK50m9SHwBTXxz gN05JzKb0nkhmDIfJUb+v7Pzd3HUqzqI/fcgeSeHsyoQodX+IlHujguGVA1OCSiVAAPL 0Yg1ATE7UnXXLccRJfXm3JrQ1GMDskkmSufAziWwCpGTE5ywAvmWEIentUhyIbGxE4zC sIKwF4s8OCA2OwyC/2des0nEs93jSrzIvluigyAAAzRRc1Lnu3MyrlwvkkOu9vi1tFZz 3dulmloFQ5kzv+B8g5zKvwVOFL63G7TU/+I57OnA2RzWpC8DfQGUYHuFzQBkKcQJjpCW 2cqQ== X-Forwarded-Encrypted: i=1; AJvYcCXQ5hLH5mjjz1/gU1mQZLCRBX3TzK32GpSyacw2IN8c2jcZEX+ND9bUzkMMzUUQ+Dq1ONOgQZKiP7MWxvFlLxIEArnvc2Y+Y19h X-Gm-Message-State: AOJu0Yw/PRdS94WrcvcYIj6bX2eRvb09eqHJPUg9FjcN+QBgeQXq+29y Ig8+JcrwjtFyD14WJj/VTb062DcMERKLmBgYGreHDUKlXozFYUnerhfJiXIy+ZiK0XQsnM7Ud+j aB2l92btLng== 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-ide@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 Reviewed-by: Hannes Reinecke --- 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:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 1908490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=3PfmTzhw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-ide+bounces-732-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCGt3ySxz1yX3 for ; Wed, 6 Mar 2024 10:59:50 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4C309B20AE2 for ; Tue, 5 Mar 2024 23:59:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83BDB133991; Tue, 5 Mar 2024 23:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3PfmTzhw" X-Original-To: linux-ide@vger.kernel.org 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 D1472132C1B for ; Tue, 5 Mar 2024 23:58:38 +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=1709683120; cv=none; b=KrqOsT+NvbCYhNaYdf4ZLBtq2HyjE6HvZgBCWWftDFk9ncLc2lXuHr74cjLeox3EBjRDcuLJp0FCfhvYsV9SXk2MEMWYfw8jltP9LkY07ziKc8jNLU283kUQAgijlPdtsHk52v94hHDWYZukYPU5s3N1KW3qiXQqoTlmQX8fhdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683120; c=relaxed/simple; bh=wcg4s+VBRSyuqCYnMen4yuigKnSiE8NtEjtig8qUC2o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ax0VqclVTOWLgmAgKSLXGGpeJa/J5+DigAaOCSp2d0+Z967JbLNIIWn/Lm+kRog2IkDmbNbxmlpQX6812zSexlq7KN01rDr2tJme51dv/E9tT73krtw6RWVmBaIH8xLb3iTXWOLIjLXQhYwZwlpagufDd6WQTN2IzGPQc360iHs= 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=3PfmTzhw; 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 Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcd1779adbeso2390938276.3 for ; Tue, 05 Mar 2024 15:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683118; x=1710287918; 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=xvuQ4kezab1KlrTxoR3eIfXTgSjXQ9ZPEoqhGuVUIVQ=; b=3PfmTzhwDKA93OixEyrwssx1reDbrAso4vCUSVvzOAlxljbFw+Wk41SC08uwKmUFqZ TUoXGviboMm+Y7rUnSh+Iuw80yr5e96qJK3lMmdOzy3fxxEovTHnt5fh79gmMEs4yN/X 7+WfAG1v1hnwV7CGntih9yCpJ31uAYFib5lKX+52f1sTYos/XO4jXUiOQhms5qtheU5E bgiQAYk6MuXRteAfBicI/2doHzzjz0oi9gJs5xCNdZtC8C5LHP1cymbM7hPuh9i+6QzE QoELo6Iu/XfY28HY5woEAJsSxaJRD/3hKX3N5JoBjaZG3S+MHkkF7EUHoVFIs0z3zX4U U/eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683118; x=1710287918; 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=xvuQ4kezab1KlrTxoR3eIfXTgSjXQ9ZPEoqhGuVUIVQ=; b=SDSMabrRB4DIp+coKXlIcCGsAJD1yq7dumnOMzLvx7n9ltMDSqTPZw/bbBC9W8j4RF Fhv4kOquWAIHs+IoYW70/+9EoHX+fWPS53ZyKCXJZBQY01v9F89q2/LUae3PoZA7+yYy i2zhl17C2v7CbWZ/3hDi2qFseVFS0BSjKn52EqpfkaK5BiTlbIlpZtJhplKrBbZ4WYYR swqrJk55JsJJMrK7jvD4ObT8njD6CGNmWMj2NjJGQlnZ8vwGishSVW+upvd0oa2sulAy vC6p51EfBxvrKTJv8ir5qMK98HRuON6i+7pgMl8k6b5Ag5oDdbHAVwo6pE7k3HpDCQgT DUmg== X-Forwarded-Encrypted: i=1; AJvYcCUs+BEX4iC9CHM5XtCH3y7hEgo3EDD5thCvh7fkZRuvqJtF0cfsQTyH/QVMKhPUMDFkRZQGgjD7ugic0c/6sm+sWKbz4ZnhwUbf X-Gm-Message-State: AOJu0YwdU5WOA7U3AyFoO4huMTiBszunI/s1xjhP7EHYPEQr4yPodpGF lBq5yH47K4jEI3minye4FsVXXRyOx59tUtZKLTtzNG2Q7qiDw5boGIvsAlAeZN3t7wlix3tyEpi 8O087v1r5+g== X-Google-Smtp-Source: AGHT+IH1hHkf29V1XyPDBt0CQu2LWVM63bBNgWVVRoBOTORS8w/8zocs5xCBpGV/hvXRoCTlFFp4aWovjESAlA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1081:b0:dcd:3172:7279 with SMTP id v1-20020a056902108100b00dcd31727279mr3670994ybu.8.1709683117944; Tue, 05 Mar 2024 15:58:37 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:19 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-ide@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-5-ipylypiv@google.com> Subject: [PATCH v6 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 Signed-off-by: Igor Pylypiv Reviewed-by: Hannes Reinecke --- 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 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: 1908491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=jCp0S8X3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-733-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCHM1T3Wz1yWw for ; Wed, 6 Mar 2024 11:00:15 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3E0ED1F24C7D for ; Wed, 6 Mar 2024 00:00:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9669D134CC2; Tue, 5 Mar 2024 23:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jCp0S8X3" X-Original-To: linux-ide@vger.kernel.org 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 C88231339A5 for ; Tue, 5 Mar 2024 23:58:40 +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=1709683122; cv=none; b=hMhhSZvB1w+15oqJ1CRJ+ujneo1Sco1t8vTHfbXWMruAq4Si5U8AzBdkHEclO3O6iE4+f2kk9NOaT552A2+Xakwq9EmLdejXM4UEf7mmq0Yl/GSe5OHKo1dkjcktV3aDD3UMDODM7k27jW+rx8UxNucNB2cdmXslTaRoLTKGprw= 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.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 Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dcd1779adbeso2390992276.3 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=XQgoF70wj9KxvbSBjnIME+O4L17GpkWHuf/EztAG7RgPyw75VjjgLWH5Bx+m2E+ko9 2639u11+X/QKDrDtV4bXrnUQeKKHy/MqPqKCuR687MOoa8/d3j+N520vPA+xbLoDWIou hXpfRXUIyPViYJRMhlxzEy3XUMHovdapPM+374Bs6AaM4wxYNbYhGfPBKa3bx5xBmvqv rk3OP3wPTezFWPPKASOg4QC/zic6GxNocGUpWj9tLGkXOb9TXEHIIdK/mgE7a8OyyodT IxoEiVzVUEGY+vi/+XBSOM1jWH4+VfRce+xnzRwOcEPZFn+xhzB94m0+0nQS3NxhIzsX ZT3A== X-Forwarded-Encrypted: i=1; AJvYcCV81FQ313BIOZXPXhwFhxAtefGZqvgvyyIGSmqqv04Ezvy29C4NTHPbfL6+bB424on+j4Fkkp3HrY+ZeDikkcHO135/criQxXFP X-Gm-Message-State: AOJu0YxZRg1l/hCw6OQyEO5j+Xig5Kcqw8H+QBzXoaDB6I5BkiOkOkbn komz+gy2H6Fkq6F9Mnruv/mfQB7XjR3Bpuice/SDlSr1NyaluAzZAyp4MqW7CXXxw1qQmEZIUnJ 54OembO46zg== 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-ide@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 Reviewed-by: Hannes Reinecke --- 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:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 1908492 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=obb3hSn9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-734-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCHf6vYXz1yWw for ; Wed, 6 Mar 2024 11:00:30 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 58FFD1F24CB6 for ; Wed, 6 Mar 2024 00:00:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 757F61350D8; Tue, 5 Mar 2024 23:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="obb3hSn9" X-Original-To: linux-ide@vger.kernel.org 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 C1400134CCA for ; Tue, 5 Mar 2024 23:58:42 +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=1709683124; cv=none; b=cyh7KQCrS6eV169bLuOl5JCv+zTCFDC0qYILA1naO4s4hUCfp8I2f8RyvgGoGV39tE0MPLWrJGpkzyN/8HIk+/GN07im6THNmmAud3HMI7h/fnV5t2SQy38fJ+FWr46V6U70b59DZOWBHLiv5hFR3Xea3vCNs7o4TPMebKpe48o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709683124; c=relaxed/simple; bh=G9sVD8mPANACI8XvBa42u5K2t+gtYc3kf7MUNETx/FI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=A0Xaw3Hz5oPC5SD/BxfEbSafmUAl+M4ZqKS6HrbKO+7i7OjjC25hyU04Pb17JzgGs0zD2BrCCcFPDS6eOU+Laj42P9PM9OKznRY2Vn3AJV9R9xf7yuA5Ahb+Nl+uAIzb+efL8+N0hLDc0IK7EV4Kw/LnRBNchSuv1p0fcALojOk= 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=obb3hSn9; 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 Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b269686aso9316126276.1 for ; Tue, 05 Mar 2024 15:58:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709683122; x=1710287922; 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=RQNseeqHGtqWgtmESvK7C+bOjnnAotGHLghFADtiiV8=; b=obb3hSn9jvFIgJFV1G9xQmFb1V+ziNTojM59NIGGUk1cQSUwePPY/dx6w7R0FgHKg7 pFZt4/iggdytxHt560AMymqfzpUCG8TnyB5rE0illMmA6Pz2orJQL5Jj30w2urKyiJ6o GEiiS2OiAo6fbRlW01D2E77hplwRiABs1H0JjZ7Rr+vAlz4epZ2VYoQJ5Vs6LR5wjgUo p00xCOmkdvSTKbmfb9mzvvdKILenz9chanMjtCqChTPewCukNWkQpVOMT+ELYPA5n9w5 DWKSgfB4OokSyqa1sJegGLoC+wxQPYTcg+dzecGvOh/1iejLQJOt1EHXmnNRAIALaBpq C/kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709683122; x=1710287922; 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=RQNseeqHGtqWgtmESvK7C+bOjnnAotGHLghFADtiiV8=; b=qxxxWiRNTxXvEuGf5MF4UYeRRTCpQ814bU/c98UYruA+ZMDqNUi19Wvv4sDgPwRyE4 RN7g87fPtHdSC5iE+rg7ZhMIFkex91eE/bypyQiqyrRZlZfOJJBiT1GMJqQUDWkXxYGn ie+Km3JPiZypiPYXK7XWJZMBJUol5Q0MxUs9wvUWhq3C+F+aI7uAGNTVUeuh3rxoRGh6 lq21BT/zjQjBj/lAgpNCcVlwQVgk3B1CIK17JlyU4DB5uyEBxmY5XYs+sgpS+CslxZA3 Kvs9NjSOWpltmJhryprRySApeMtQk1ZcIv6nEZlPVEbJZvXc7fM/h/iGdOULMKdKfLcP Cp5g== X-Forwarded-Encrypted: i=1; AJvYcCWyV0GT0ATRnCf8ADB27T1lNA8MeOtOkwD3x+SNqX9I2X0dcLl3gdDSIVN/eKiyiCWtdSxP64OWPLgVAOfBPhlfchXkka4akr/Y X-Gm-Message-State: AOJu0Yz3oWuuKnwhpVq2Wqi+EsCbm6MWhQwCVQgS1bd//D7Z56vlYmRs WDNI4xV85470pPJgrXS50ipeRf9Esi2QONN2X8VlXWh7womJHHTunTHv0xv7Y4nUqr3CjPWLRD9 1X2XbpOO+dQ== X-Google-Smtp-Source: AGHT+IHaquBcMiTxzYXCHsL6kDeJ0KhsQhgDryCyWCWhVsJvol4BTI3/dpyBoM2x0YMxdYD9SKzVxCeFdg6qVw== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:69ff:df2c:aa81:7b74]) (user=ipylypiv job=sendgmr) by 2002:a25:dc4c:0:b0:dc6:d1d7:d03e with SMTP id y73-20020a25dc4c000000b00dc6d1d7d03emr586973ybe.8.1709683122054; Tue, 05 Mar 2024 15:58:42 -0800 (PST) Date: Tue, 5 Mar 2024 15:58:21 -0800 In-Reply-To: <20240305235823.3308225-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-ide@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-7-ipylypiv@google.com> Subject: [PATCH v6 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 Signed-off-by: Igor Pylypiv Reviewed-by: Hannes Reinecke --- 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 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: 1908493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=1FLFJf6l; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-ide+bounces-735-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqCJ05VX1z1yWw for ; Wed, 6 Mar 2024 11:00:48 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7DFC8B260C5 for ; Wed, 6 Mar 2024 00:00:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2AA61361BC; Tue, 5 Mar 2024 23:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1FLFJf6l" X-Original-To: linux-ide@vger.kernel.org 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 143BF134CEC for ; Tue, 5 Mar 2024 23:58:44 +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=1709683126; cv=none; b=RnrszV92igFHNfvJxyeV4Am3OEPcXTI/MzVKoOoOKM2B7pJ/lU827Vqr0Nj4VyQQwdZ7iOyKRyknG5YEO2gAc29/iwfI9qKcoU57BMSkWMnAMY7PRLQK65Vcvyd7ygr6wkmL6VSQhpng7B4vSFcTSzzhl5UUZUqPD1XoL+sEsaA= 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.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 Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc4563611cso9753042276.3 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=mAF/BXexZNheKNWNqLLJyehyTAlUfU4dPBKfqWQrKB5N2c9JGz7HRE27Y2Fw3yHs+G e03HrRpuJ0R04istngmfFPPXUGDwgvRWpPxMMQahzUJAdr7NulgszvUILSMEGK0hm04G HeDGo2ifwGpZNd2wxWPfH+eZVS4qzjgODI1/sm3KF3jLL5b76p1mZt7DMPI84slvo/dm hAjUf8PXxfrw/5FcMtue/U/7E8I+CmebfEZMrbfWv8E1rxcK11dB6/1YuHzc0Q5zTH9S eFUNq8FutJFC4soR5L9vraB0bydubu2feRm60T/tKedS8FHtTi817ElJ1eF+iaX+2NaL DYiQ== X-Forwarded-Encrypted: i=1; AJvYcCU7HC0RoM+r9xYh3BpAFNL8G/5N4UB9ptXwcaED9MWWgBt+bNf/iXeZ8xKsDLA+fNM2wCs5+RVuAmwfkGPK5/Su39lDdCJxYIoT X-Gm-Message-State: AOJu0Yz1SQgSg7qptj4DGScsGGTkNoa8N2THa2s2Sb4kpHwBiKBQdmfL jppLTBK6BBOQHBLYqe7o72SHr8MkwTZzu3frPpPwa7xSEhBf30vBlhyEKWl4q767Oz0qPdSm2Ks o6P/MLBlxEQ== 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-ide@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 Reviewed-by: Hannes Reinecke --- 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, };