From patchwork Fri Mar 1 01:37:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 208588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp796759dyb; Thu, 29 Feb 2024 17:38:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUX7EZOVVOg24glkMZxQqiZhc5KFhP1U5PkSCZoIpm/gKmj/OIeqUy6AijDI0/dZ8HYqRosvyNHdRKu8zuJgYhlyloUzA== X-Google-Smtp-Source: AGHT+IHtUx2QZkSTnbM0zg5vi13xjFpo50H0GjyRmGiDVfYPAoXlu/Kxvc5Wq7rTgyP8bIYjizqi X-Received: by 2002:a05:622a:144:b0:42e:be3b:2494 with SMTP id v4-20020a05622a014400b0042ebe3b2494mr269505qtw.54.1709257135619; Thu, 29 Feb 2024 17:38:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709257135; cv=pass; d=google.com; s=arc-20160816; b=NDwp6TsnpQMLyWDeL92WAtvDdHKRV+TLXuKmtDAWe2LvIFZrsQy1uomoQSMhQtD7xp 2VUtbnClMAoGVUM+4PJJ2IxiwWuOAhovvcs341TMthb95/xSPEK9M94yeFJjxnLPCmo5 c49uFOTkegLZkuWXMHg4nZxLoXxO++67dRIGdHGQV1KIaIP/0pkJ5SCX3ZvJ4VJs9yxS zklPdl4NKcEwugSWJdQSs3BfFzIGQIvmgOmCAJ9I7uJ9TZakzPLwo5gnevMR7Qz9NyWJ /1g74OjKuypkg7jR8NUdzphXkgy7mKXwsi7Bcly0bdt6TcWici475nMyJiuuwthEEq5+ VQXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=IDkT/7hqQtX4FOcw/2DmNvRmQOdZa31qDgMRBQViLvw=; fh=Z5ASUul4gLVBzsLHx/bBxAbx8qWLiYZ1+AteKjwXbWM=; b=N9k75eWDR35wa8sIGF0VQbUxVDbJf0mf24ZIrT8Uuch5H1Uy2f11+2RLhJ8gqibIc4 0tp1+YFVLmxb146yyQlZjZdVnb/BLV7WckZHbL5r9RiNitPpFnKTu7tKU447dmQuvrWg VeKH7QsiyK80I+xELgQiYvZK98Oq+WTs2iyE3ig5+qWRV9CI8BvQ58qf7n2Ld/Nb9eGZ 4aohBL65cvvVamPS8sAQEm7ALjxFBZzOdzC7JGD0lc9vOYF+Xh9qajd8Xw4z2g3iniLb mV48VRzhfIsWubHlgYCMVj4eciu60PAswMNLt65wOiL0NPtconAXL5OganI8BCz6ga4H 9PxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LJOk0s1m; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87783-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f17-20020ac87f11000000b0042c2eac1cf6si2880474qtk.720.2024.02.29.17.38.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 17:38:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LJOk0s1m; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87783-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87783-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 4BE981C20C84 for ; Fri, 1 Mar 2024 01:38:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 941B3381B9; Fri, 1 Mar 2024 01:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LJOk0s1m" 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 5114C2C68F for ; Fri, 1 Mar 2024 01:38:27 +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=1709257109; cv=none; b=mYpM4WHKyci4lHfevl4DcBw55ZTVsf369UJpo6aVgoV08jLRlYFdkNMC3WAHzf4dsl33VbvOui+w49Ku8JLhsOOiUaFBOco4LzezAxev3nS7PdZEn0T0Tc1iKfYDFdanAUasG2Bm1yVO+ouz5BfSKGcjCiHqRsUxstxcSHr6Yr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709257109; c=relaxed/simple; bh=mtBbiWcmZwxQCRaOzE/9koGDdChW/PDs00KLcj5CSkc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=X+BA/ESvd3Ysuklo/N7rUlxfvabuBtsxgvBZbf1LdGZF/NRUrMR1VDEFihpqu1M+ef/lareMem9FEbFqmtYcTCazH1CeCXTZYRveeZcQ1rvOlsYhNSorlL069BDCAp4XOCHKbX8onaaXsYdszJCHViMfLO7NHEqlvcp4uL7BGsY= 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=LJOk0s1m; 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-6097cdb2d5aso12090817b3.3 for ; Thu, 29 Feb 2024 17:38:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709257106; x=1709861906; 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=IDkT/7hqQtX4FOcw/2DmNvRmQOdZa31qDgMRBQViLvw=; b=LJOk0s1mxgkfrZTG6s2qp/xYwHJrpo4prNDT/u+1Kg0gSjB7kVIBYMqt2D638l/Gvi K9kxeRTfUyoaH29T1d6/5VVMWGFAr2gcuGUgWwSPgF4BiboQJwU8H/1lI0a+oBIpm78t JLGAzj7o52UAuaVID3MFIcQyc7N9wGjeHlwC+uxtedyVmNjvrzvR7rmqSZj1YaOXCdV9 Phdvq54FfV18IWXZVAUMUU1eWeZYDKMPxEit7ZpRtK0TUfdLQM0YQYdR+lImgfbLXz52 3IDT5wTGpEqGyPI170doBpXtUFl51W15SdMnGMqwgpuDxjwhi37195+iQ1aU7ukx4sqz LYug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709257106; x=1709861906; 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=IDkT/7hqQtX4FOcw/2DmNvRmQOdZa31qDgMRBQViLvw=; b=EtkPpGjtzwVDkoh0br0ZO3QC37d50RKoLXK1cj9r3TgNeVeoBGVcp4VAurDA1Ad0m2 EaIAh94JjlJBoorA4NXoHiH31MEdD5gQ7phD8jezOFWAq5+0l+h6vEGwJIbyUZHKxGTx GGjToR5pDgmXuPToRv7UwXuxCKw8lK+tiMleNZ/vgfrw+6pgewS6uhu1qwk958QrMmL5 CSjD7z/iK7Cd0IyfAjDVFQyxfS9NPmp7DBjBYkqsbj+azm1SEcHcCcO5EjkGdopw84QJ 4TwCrP5cvJKpvXIxI32qnUZrHmUMY4pZkZsJbNf00lqZfpfzN38TWq8OU/pb9hBccLlo pgSw== X-Forwarded-Encrypted: i=1; AJvYcCVgqeDBujWAS1P3dtBtY1yOZxfUTulYO4rbbqzRd9TmuHg3qKyk+oUw/4ewFHCTCCvUc00Id5ZeEGKtfb/7vfBzm9xFaeFqaIqZqm+q X-Gm-Message-State: AOJu0YxL0zxuSkUIk5s+8QikdJFZFjTKTmOBhBPzoVLjS6w9NYcDF0x9 CGXETVQoXrjShE+2mqL+Y0M9zfPP4SHOg6JouqMFH6CkIbeK2at1+2nKryotbkBaeDtQBHahfYh EbDeAxIz2zw== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:3564:51b2:6cdf:92fb]) (user=ipylypiv job=sendgmr) by 2002:a05:690c:338c:b0:608:e70d:8215 with SMTP id fl12-20020a05690c338c00b00608e70d8215mr61639ywb.5.1709257105531; Thu, 29 Feb 2024 17:38:25 -0800 (PST) Date: Thu, 29 Feb 2024 17:37:57 -0800 In-Reply-To: <20240301013759.516817-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240301013759.516817-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240301013759.516817-2-ipylypiv@google.com> Subject: [PATCH 1/3] 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 Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv , TJ Adams X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792286010136078344 X-GMAIL-MSGID: 1792286010136078344 Export libata NCQ Priority configuration helpers to be reused for libsas managed SATA devices. Signed-off-by: Igor Pylypiv Reviewed-by: TJ Adams --- drivers/ata/libata-sata.c | 130 +++++++++++++++++++++++++------------- include/linux/libata.h | 4 ++ 2 files changed, 90 insertions(+), 44 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 0fb1934875f2..9c6c69d7feab 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -848,80 +848,104 @@ 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); +/** + * ata_ncq_prio_supported - Check if device supports NCQ Priority + * @ap: ATA port of the target device + * @sdev: SCSI device + * + * Helper to check if device supports NCQ Priority feature, + * usable with both libsas and libata. + */ +int ata_ncq_prio_supported(struct ata_port *ap, struct scsi_device *sdev) +{ + struct ata_device *dev; + unsigned long flags; + int rc; + + spin_lock_irqsave(ap->lock, flags); + dev = ata_scsi_find_dev(ap, sdev); + rc = dev ? !!(dev->flags & ATA_DFLAG_NCQ_PRIO) : -ENODEV; + 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); - struct ata_device *dev; - bool ncq_prio_supported; - int rc = 0; - - spin_lock_irq(ap->lock); - 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); + int rc = ata_ncq_prio_supported(ap, sdev); - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_supported); + return (rc < 0) ? rc : sysfs_emit(buf, "%u\n", rc); } - DEVICE_ATTR(ncq_prio_supported, S_IRUGO, ata_ncq_prio_supported_show, NULL); EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_supported); +/** + * ata_ncq_prio_enabled - Check if NCQ Priority is enabled + * @ap: ATA port of the target device + * @sdev: SCSI device + * + * Helper to check if NCQ Priority feature is enabled, + * usable with both libsas and libata. + */ +int ata_ncq_prio_enabled(struct ata_port *ap, struct scsi_device *sdev) +{ + struct ata_device *dev; + unsigned long flags; + int rc; + + spin_lock_irqsave(ap->lock, flags); + dev = ata_scsi_find_dev(ap, sdev); + rc = dev ? !!(dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) : -ENODEV; + spin_unlock_irqrestore(ap->lock, flags); + return rc; +} +EXPORT_SYMBOL_GPL(ata_ncq_prio_enabled); + 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 = ata_shost_to_port(sdev->host); - struct ata_device *dev; - bool ncq_prio_enable; - int rc = 0; - - spin_lock_irq(ap->lock); - 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); + int rc = ata_ncq_prio_enabled(ap, sdev); - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_enable); + return (rc < 0) ? rc : sysfs_emit(buf, "%u\n", rc); } -static ssize_t ata_ncq_prio_enable_store(struct device *device, - struct device_attribute *attr, - const char *buf, size_t len) +/** + * 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, usable with both + * libsas and libata. + */ +int ata_ncq_prio_enable(struct ata_port *ap, struct scsi_device *sdev, + bool enable) { - struct scsi_device *sdev = to_scsi_device(device); - struct ata_port *ap; struct ata_device *dev; - long int input; + unsigned long flags; int rc = 0; - rc = kstrtol(buf, 10, &input); - if (rc) - return rc; - if ((input < 0) || (input > 1)) - return -EINVAL; + spin_lock_irqsave(ap->lock, flags); - ap = ata_shost_to_port(sdev->host); dev = ata_scsi_find_dev(ap, sdev); - if (unlikely(!dev)) - return -ENODEV; - - spin_lock_irq(ap->lock); + if (unlikely(!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 +958,27 @@ 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); + long input; + int rc = 0; + + rc = kstrtol(buf, 10, &input); + if (rc) + return rc; + if ((input < 0) || (input > 1)) + return -EINVAL; - return rc ? rc : len; + return ata_ncq_prio_enable(ap, sdev, input) ? : len; } DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR, diff --git a/include/linux/libata.h b/include/linux/libata.h index 26d68115afb8..f3ff2bf3ec6b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1157,6 +1157,10 @@ 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); +extern int ata_ncq_prio_enabled(struct ata_port *ap, struct scsi_device *sdev); +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 Fri Mar 1 01:37:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 208593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp797378dyb; Thu, 29 Feb 2024 17:40:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8LZr+iOug5ObmCWJl7psoXPgtApSmRjgWWHZX+exDj1GELcGVmZCNkEWKKsv1GOnNyz4NJN5YVCFjJac9opch7axOXA== X-Google-Smtp-Source: AGHT+IGEdXpxVgi1z+gy5LJlBUHVx5vemG9toPOZ/IK4hrlx23qJ21xqh3hgCWq1JUkve7WY3MqL X-Received: by 2002:a05:6870:f686:b0:220:65ba:ca3a with SMTP id el6-20020a056870f68600b0022065baca3amr299912oab.14.1709257235256; Thu, 29 Feb 2024 17:40:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709257235; cv=pass; d=google.com; s=arc-20160816; b=KE3OmFL1lXtrL/U1EjuxbcWOwMnlxMEmOK5Geha3lfRJ+afcLDNSXJ/czSw5kPtWaO uGe0nlsd20uOu5sDZlNP2D77dyAY2SnUqggvWP302eNdhwZ17ETnYxVmvOLTXC6IMevr ghSJMyk/Z0hgH4/T/nLYjYElrpIsn/mNsu2HQ1i27OqgGjyu041bzsKL+H64fXWQeFTx DbSpNx5z39m/Se0I/zYF6kZe1Xx0Di9mKOOGFBKFlH0QRAof9VPg41BhidwhU0M0FMdo 0nRstIiaE9qbpcyrKKduNzWIoZkGxsSPjVq1mfRA/VAxPzlFZO9lFYhFC4aKGeATO6mj lAxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=vq3k5LtaA6RfQgw3thOdumiq5cQzFEQyUv+IanRfVV0=; fh=yY5sF3zkDtuk2Gz/pMbnnQuOAa8baLbGRGHts5tfFMQ=; b=oZGBVd35AYeaYSdNMTTguVwzD2W8x2v6BAsefB6xxuHeAwPoW6hNS2IekKrSkll65a V6Uet9qQcDmljC9izK0XJp0HvdnMMbQuHy2wtmuqvDGXcLVRgDlVhC0aAGIL5b/vQPNX q/aCaTmqlO7m4ejMzKB6upPPtd8t5Zc6FrTnlbjp4ho8jTaZCfzB34MLF04RmyaI5+1n iYA3/IinAubkQFh2TR7/s9VuTdhL2B4txgUEGca+TZefy/r+gUfJqw6QswROew9mcBUc 4QBeE4xeE1PMJbD2371n463ViLVmuLkr8qhD8Erf+T6KZSgkWsFojg9QY0dsyWEAodZ3 UCZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rgrZpb5A; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87784-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87784-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w5-20020a056a0014c500b006e39d08caeasi2458158pfu.232.2024.02.29.17.40.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 17:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87784-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rgrZpb5A; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87784-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87784-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 37841B22FAF for ; Fri, 1 Mar 2024 01:39:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A364539AC9; Fri, 1 Mar 2024 01:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rgrZpb5A" 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 81C8337718 for ; Fri, 1 Mar 2024 01:38:32 +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=1709257114; cv=none; b=FlTJgRsqXaeCi8kpDuVyk2O2liTGG2x94kVlAwCAjtVhv2SNkR+uDBgtcUom5XdGUPyHpd/ixUia6nSgdR0vRE5I9Ju1/3qJEjLS3h0CBtMl6AqBpaNn7v7LpDpNbu8SbU9bTxeGw6QkoM4aQB+2h4mX9GA7IYqoQ73ARl1xkcM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709257114; c=relaxed/simple; bh=b5qJ6alfFk5gLcVcBzAlcYXOHCF2Ivt3yvp+GD4igj0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cRxj7GnbpvG/sB+20MkQUbQhewz4Z3o1E+8d9SrMyry5V0hH11W6WVWhrtTQih+9x1yPh3Hdigk9s3Df+G87mjoGhaXW3a4uQERWZqTVBpJhB6gQxJ5A2sQNclgEa0ks/MrOOngtH2ZV5IIVPzvAOMoN/7lIBiRFhM+GeLPfWEg= 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=rgrZpb5A; 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-60983922176so1878127b3.0 for ; Thu, 29 Feb 2024 17:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709257111; x=1709861911; 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=vq3k5LtaA6RfQgw3thOdumiq5cQzFEQyUv+IanRfVV0=; b=rgrZpb5AKE7o4O3XwlB+TJYUIAkdjOUQHpVSQj7QoeRkMtYDI5714Jq8Q24rMmBg29 6fevqyq6RpHJhYQ6lVF8dtBNi96dua7U47SYlEOY2Eh/uw8FQx+zlMmGixKe6Vd6XJmW rjeZw7AW/syM8djPQ3TitMGl4H+TZ3HVVuMLKejrBGvQ0Ts8FPwqlf0svvPQaMhZtyx8 A08pyHF8LRUdd8evphy/zs8Liwb39ynbXxpzj60iVmrecq1Xd8XXXE2NjwuWI9LApGlw v0oXR9qD7Kd6Kwv4L4aTR2BCvOkQOH50TvJmTNGiNzOF5ShlTHw9Xpu34VFOGkjvTaTm qPEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709257111; x=1709861911; 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=vq3k5LtaA6RfQgw3thOdumiq5cQzFEQyUv+IanRfVV0=; b=XjZ+IsYvhiX4BFz1fp+VrUQ37OYyzXXhsCLfXg6ZpbCUifpbRf89dpn/I+Od7WGADD qnWEToJemVicZTFlELZTJ/KOQjgdBO1T+sW0xpuQtsfvybgJ9Q1z70LXKZpZ+XyIbs4F TDUlhLgiPb+tylW3w9fsbyEW9YMKQNYgCPQUwg7vnA0eNzGDNkumTkiAKAWoQpLXNTB3 h0Oq3cWgNTFqh7eysYrEzKFm+LTErPLCDZFssd5x39eYIodHQqzixetQBRmrcNa/JhDb cxmG9QG50tHL00+5okMSJ2jlkE6ezikJpjW/sXkhJ31fK8UCxk+ItfEmWmoSWTN69Ap0 0UTg== X-Forwarded-Encrypted: i=1; AJvYcCUBbqCbLGg3RugZeb5F07hWQNONyrgIwBwmfS3jYj6JrML9hTAo6+3xc6HqBF6GpATC4gBy4VdCacj6TXFg3Eqf3DLDPHUpRagEER3d X-Gm-Message-State: AOJu0Yx5yDEjgV9B1+e3Ibzyv4r5hbue9aMTrYlckBkIsRHARzWITyqs LqlFuTZ/7HDscp/gZWfHPvCwr0GMGwZFHnBt5eW9zP15Sx7Q98s259t8VNLZQ+v5andwo9zxePg hLyp8UqvCEA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:3564:51b2:6cdf:92fb]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1101:b0:dc6:fec4:1c26 with SMTP id o1-20020a056902110100b00dc6fec41c26mr42186ybu.1.1709257111635; Thu, 29 Feb 2024 17:38:31 -0800 (PST) Date: Thu, 29 Feb 2024 17:37:58 -0800 In-Reply-To: <20240301013759.516817-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240301013759.516817-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240301013759.516817-3-ipylypiv@google.com> Subject: [PATCH 2/3] 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 Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv , TJ Adams X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792286114665230636 X-GMAIL-MSGID: 1792286114665230636 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/*/device/sas_ncq_prio_enable - /sys/block/*/device/sas_ncq_prio_supported The newly defined attributes will pass the correct ata_port to libata helper functions. Signed-off-by: Igor Pylypiv Reviewed-by: TJ Adams --- drivers/scsi/libsas/sas_ata.c | 87 +++++++++++++++++++++++++++++++++++ include/scsi/sas_ata.h | 6 +++ 2 files changed, 93 insertions(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 12e2653846e3..e0b19eee09b5 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -964,3 +964,90 @@ 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); + int res; + + // This attribute shall be visible for SATA devices only + if (WARN_ON(!dev_is_sata(ddev))) + return -EINVAL; + + res = ata_ncq_prio_supported(ddev->sata_dev.ap, sdev); + if (res < 0) + return res; + + return sysfs_emit(buf, "%u\n", res); +} +static DEVICE_ATTR_RO(sas_ncq_prio_supported); + +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); + int res; + + // This attribute shall be visible for SATA devices only + if (WARN_ON(!dev_is_sata(ddev))) + return -EINVAL; + + res = ata_ncq_prio_enabled(ddev->sata_dev.ap, sdev); + if (res < 0) + return res; + + return sysfs_emit(buf, "%u\n", res); +} + +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); + long input; + int res; + + // This attribute shall be visible for SATA devices only + if (WARN_ON(!dev_is_sata(ddev))) + return -EINVAL; + + res = kstrtol(buf, 10, &input); + if (res) + return res; + if ((input < 0) || (input > 1)) + return -EINVAL; + + return ata_ncq_prio_enable(ddev->sata_dev.ap, sdev, input) ? : len; +} +static DEVICE_ATTR_RW(sas_ncq_prio_enable); + +static struct attribute *sas_ata_sdev_attrs[] = { + &dev_attr_sas_ncq_prio_supported.attr, + &dev_attr_sas_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..cded782fdf33 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 = { + .attrs = NULL, +}; #endif #endif /* _SAS_ATA_H_ */ From patchwork Fri Mar 1 01:37:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 208589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp796970dyb; Thu, 29 Feb 2024 17:39:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbR/DDPuljChp2b60OEL3ij5F6RfM493SSVDqzrr4S+EdZcKvmB3ouumWsPP0uee48DIxcwsKs2I5WuqG2QqQJrQbZqg== X-Google-Smtp-Source: AGHT+IHE5CIW4uEW4wiw+j7/Za6oDKGfZfvPTZEVWSNQMmi+eojHRzK4SugCnR2QMdITIBGTrctD X-Received: by 2002:a05:6402:2318:b0:565:1049:c013 with SMTP id l24-20020a056402231800b005651049c013mr165695eda.10.1709257173283; Thu, 29 Feb 2024 17:39:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709257173; cv=pass; d=google.com; s=arc-20160816; b=oFcL50Zydz5hPeSUxUCMaL+dKiva9ui4GUVYZWL/8j6+yJefjw51WNrFs2y/vTab1C E4VM+1fy7cfQp64RxZLL6dU87lYFXqb+PjSKRiAcrPlGqlk+SGNDrpfJbzd8+ZnErkjM +ACTS8EsSY+z2+TQEC3ensCrsvATbUZAHAc2Szpl536Rej9wnrbXoLrO9pn/11u1RNe+ NeAbNvcNPbVZyAguHyCEbJERtjytMe+hwKWI88+EUYMIxv5CWxj5NQf3jnQlkAE7hoAn Jpuui+i1+FlvIaIiTg7fJ7mKEe+uyp6vrumlsw8KzDkLt1j+hdLLqhne1JoVcOef/4iT F48w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=avuTBfkDXK1hv1D4bL2KM6unjJu36TT8oh9Ptp0s5ao=; fh=E/ngHokSlMeplD11w8YCwEmwHwq+OYJKMx/fkxvrogs=; b=oUoJgMld2L1RR2oO/skw8c4Afk9xB9ElTMRqtqphztJ0ImsEM/MGR+3zs/7+6MFEMV ez869JBQFS+4f3UbRgaqBThlV/Cs1fBJPilkaKXj1/8NzmAgQq/IqsKQ4vgo2qo3hIbQ YRaW2PxkWYu9VpVh2NdFa4IAPm2agrOHwzEGJI7Sb43i5KLJRBqYdrejfpYCScFfu9qj uZ9LjsyYeT6erzyksb8N92XYFIb3MWNKBEjn9ybW/j5g3t5sF3DGctSiE32NzNZIqzmx dD7c2ogEDxIDHVoLffprZ/uihNPRLjSQz0+PJ8PqTFUW0hwXmUogUEB4Fpg/T6VbO08p pBkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=I5p8Jb4k; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87785-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l19-20020a056402125300b00565bb493d75si1033642edw.363.2024.02.29.17.39.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 17:39:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=I5p8Jb4k; arc=pass (i=1 spf=pass spfdomain=flex--ipylypiv.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-87785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87785-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 DD0121F22541 for ; Fri, 1 Mar 2024 01:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD0E639AF3; Fri, 1 Mar 2024 01:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I5p8Jb4k" 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 833F6383AA for ; Fri, 1 Mar 2024 01:38:34 +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=1709257116; cv=none; b=ieYXcNfJp9TUgj9fJF8MB0NEgPBIdUDOBmMCGfx2TkcDBRQvlq5GRwjdAAl+M502hwR+ZhLpwf7V4vP+imMdHJL3Ep/oG2QHTKlFI10YGFTcTasV+mqjBtcbHXP4eaTfem6+DO7+56tZoQ1BgX+IzT54KXUZAfV6f4U+m0t5bT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709257116; c=relaxed/simple; bh=BHm3bafsiy1rPpFyzr2QCqwbYutNJj2AhwXm2Nw+tbo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=CzPJV/Wo/uQplLfiECExeNyD2BH1nTKnWs4hvl88d8O4VfqrYxWhdrVfVXOZlu0EVUr8OtFb1xGnZZDXpPHSg9YIB8Xu0dvYogszJSrnw+TfjTo+8EDLnd0OMi2jAaZAQ92KFCCgQrumtuylRhyC0NUF29k7F4uGmkzEw7ImaFY= 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=I5p8Jb4k; 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-607c9677a91so25849197b3.2 for ; Thu, 29 Feb 2024 17:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709257113; x=1709861913; 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=avuTBfkDXK1hv1D4bL2KM6unjJu36TT8oh9Ptp0s5ao=; b=I5p8Jb4kUHB/kLPAWKq9jA7ke/gbWnb0Uq+9Pbk8Xztvg1Ynnmc9sa6PLKrZVe/Ana rhdi8bD2VD0yf5uyomkqWk0zU+W9NKANjNEInWkUuPyDHsuKLgkjv7Loxtx3Xp4UAiZt t2sgCv4J/Ed/YupGQLzM4RCF2krnEazj3lDGEyt99/VRxLexDffy4TJUZp5QW8VDViKu 3BIXKQY42/mSgqdLv2URhNoY5f011FGbfwP93nlxA+JghadG7jhnoMH5cQd2rfvlWNDJ GDWmi3AhXuBYqnlFdqssK0+PFa1cRRNyIj7Z9zJa2QuduAtaoxcabUxKOKYbZRFbecam M8GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709257113; x=1709861913; 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=avuTBfkDXK1hv1D4bL2KM6unjJu36TT8oh9Ptp0s5ao=; b=aACzEwM5LRbksdvi7i6E2r5+MoxWFJbgGd0MW73XR3oljLa9i5b8GaI2cDMWWdJXTt J1R9j4s01imzwEj6+vaS7YEEGHBQUheA5HdHFpJjZsOgQ1ymF6I4k5lPap1/BNam8FxD a4mczJvJVxanOLYBhi4+9fv/7HjpWIYto0aQB8Kkj9jhOdJ7p51enLAz9U4CAkxykyJn VcrL6/9XZJYjt6LRj1l7I5BOITzXArqpnwCGftmDKeXur5ud1OQqkj9RlXmUxBVfWak9 9Bhr8ErgK8vOOnxCPbdqrNELJyhd2uYdAyYqBeu+hpz2aYqEw17oalpoamyh4p3duWHK PC3w== X-Forwarded-Encrypted: i=1; AJvYcCXKWNTCKBtVRxxx/Ou6uTGVrMF8U3r8btvCyXewDIeUjhyOhuA1CUdcF99MOrsFkg8ZmOKuzuNpsY0sLtbRYQcurj89vJLHNWdXgUum X-Gm-Message-State: AOJu0YzpRRenKup+0fukQgYpDN2owGGrrrCOET9RopeZCxAwIMKE/qYu dFajEzfXi/YWb1+1uDMOlaDta5wK6Ld195l1WcT5H2BaSpWafm7hu4LeBF0SyohrP9N19pUfMKi wX4lmD/5blA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:3564:51b2:6cdf:92fb]) (user=ipylypiv job=sendgmr) by 2002:a05:690c:e18:b0:609:247a:bdc5 with SMTP id cp24-20020a05690c0e1800b00609247abdc5mr59222ywb.4.1709257113724; Thu, 29 Feb 2024 17:38:33 -0800 (PST) Date: Thu, 29 Feb 2024 17:37:59 -0800 In-Reply-To: <20240301013759.516817-1-ipylypiv@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240301013759.516817-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240301013759.516817-4-ipylypiv@google.com> Subject: [PATCH 3/3] 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 Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv , TJ Adams X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792286049883117021 X-GMAIL-MSGID: 1792286049883117021 The added sysfs attributes group enables the configuration of NCQ Priority feature for HBAs that rely on libsas to manage SATA devices. Signed-off-by: Igor Pylypiv Reviewed-by: TJ Adams --- 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)