From patchwork Sat Mar 2 20:16:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp637845dyc; Sat, 2 Mar 2024 12:17:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLawTSL1xRJQCe4JpRR+X4lDEvhVuTkdDfGRJRGpwTACIm9a8W4C/O8BOa9oRC9pF3kfzBIyfMZ7G7dKegDG3seVPqjA== X-Google-Smtp-Source: AGHT+IGN3CeKvWlEcLFYytyxD6LpsQeyTSnyNppKmr6oohbQmw5ncui6g0ZffxDrTEV6Qts6rVfa X-Received: by 2002:a17:903:1208:b0:1dc:af70:9f78 with SMTP id l8-20020a170903120800b001dcaf709f78mr5874756plh.46.1709410650048; Sat, 02 Mar 2024 12:17:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410650; cv=pass; d=google.com; s=arc-20160816; b=n57ONQCqk+BCkIk1yG7+WxKTFabks9Hbq+Olp84dI+AnB1mk93qPEsOP+97wslCtUk XVrtEXKiZx8xEoOkUY4fwPKV/bxZCso5a/xbPJoabu4VdzFLooHh+pLtN6Nb2Vx5Xx3W AmL0tncdN4XhFUhbyYiKFASdnpTH/aMLbWFPMUFk86k/zMLQGZ3i3NygW2p4yV+DFp5O O/8hRwQQi4lfNlhnB++HE/HKbtl9Ak0pTaMi8vzc1nHxWksqbSL8KZ/wwb+YqN/MBrXK nPGqrllZ2NNOUa9ZpwRpzfi+DKjX7sXg6IcTecL23j0SE3mJWTKQv4mu5Z9kAqqqFEYx PpYQ== 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=z4qRVCwUT6U2lE1it/3KAP9Dql1inh3yxdaUzH18pmU=; fh=MhOf/sXGef0s6kKURv7fFDAoOPmP/l1HBtmJdIz2OoQ=; b=UvL99SFaDGjQnD5WEUXhUwFEB1hbDj/gEAa+Ow1x510UJ0OdeVdkg8bgjmuvOXF2yW 1KZGCqe3zG8XNZtL+440KI2vqhQTKFhyuA0WMHvwLXl5UOIegl444kENtWG4OplW4MNH xUN08kIBGRbQbZhkJLQ9eDK+H9fnZhU1VlRmKrRgozIlaQ0m6zw9isety84i+SWd8TSF uU8qIWf/6D9kZGExPjGc2EjrCME31HFXPyhFoZhmmIflw1t8GYQEI2r1QkkzfatOkTc3 +hiMdPylSpSTC+wmAADLl8nkEt5tZTXqUUCsutaVOh93Ui+Geq4hRjZ+Zfim2YKwRzZJ yINQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4oie5CDw; 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-89579-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89579-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t4-20020a170902e84400b001dc76bf0f7fsi6136554plg.138.2024.03.02.12.17.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89579-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4oie5CDw; 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-89579-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89579-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D55DF2816EF for ; Sat, 2 Mar 2024 20:17:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DBD04436C; Sat, 2 Mar 2024 20:16:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="4oie5CDw" 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 951A640866 for ; Sat, 2 Mar 2024 20:16:51 +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=1709410613; cv=none; b=YQun+/f3Zcq0J6z1hDVnExsrTUat/ib2c0VJRwf9bhAyTdPutr0RDMJq0YtOGgHYPrmiVep75GRuX7ymo9pGNSxFrl8HXSK4Shv8v4go1pAG5oSeP+S3nw4aXA7wIvsq/JO9KaoMxCUJSoculpjmPQIzXvB06obE9u5mqkNGRWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410613; c=relaxed/simple; bh=Dr1gHME6UhZzljl3CDtFvx0fMB3rr1EwYhk4f6Q7U3s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RVRH0VimJs7/1MXvxawGo+y9IhvEoM+qS5f3w2UYr6jA2EQWEfUlRLVo4I0XMfL+x7Cnat9tfet42CM6+wY6JGsgm5xvUX7g9VttXMFsWeI+8UpwqHc8FFdQxpIkFZbD6GQOmjEZrHvzhptPhKjfUwNC2gc0X+dvPa/acowsW9w= 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=4oie5CDw; 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-dc64f63d768so5936112276.2 for ; Sat, 02 Mar 2024 12:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410611; x=1710015411; 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=z4qRVCwUT6U2lE1it/3KAP9Dql1inh3yxdaUzH18pmU=; b=4oie5CDw5PvS9wI9rGwlbAFMuTxzmjU/07cqn4NzhtcqRX53z7HOysQqrtfjHYZ+9F nJOSwlwEVomVrSPHdAZKq3++2ndUon8qHs4xsUYi3a8eoIeBl5lLJXRjYi2I6ogb+8it /7D5QV65bZZ5g4Q3WQdnVusTNFkAihwAk0FsahLkaZdUBlccndbKD+wAaf/1r/zBxrJv NHHd0m8+wSCbJa2HGQ9ZMH4taeBaPtkgwK5Cqth4/bTZJfmkMgSibAbLi7kL9QuDJGf7 591VlceDJ7qGFty2NGy5eyLgiOhUZXs0krldiZoqwuOtNY7EF5jDwFFwYtQLDzk/q/fx BWZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410611; x=1710015411; 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=z4qRVCwUT6U2lE1it/3KAP9Dql1inh3yxdaUzH18pmU=; b=CYBfDJh285GPwqTSJkhxKVvz9e1d+5489Yonosl8LdsE5Fy4fla3+iVACJD4tOEaxg AlItbwXbKlyu1HiRJerYKIipww3JrSgqJ8dAM3gOOMX339o81CyeiMdHwtum1IrZTLuy qkMFyckBR1oKsvTRGsC/mxxYpnz/4YUWee8EUrfBKotz1cTi7VIMD/Pips8vOWzaqZv/ GG5/lXF49DoJk3OycTqrje6bk8OCUoL3Qn7IN+XPfPHIBUIdlow6I0aReo+03YI8qTA9 hnmg97O5lGiKQ7Jrx8tLpz3D6b+zl+A3QGVph/LGpQLcGbAGhlMbQP2GL/z52VGRuhpw nEgQ== X-Forwarded-Encrypted: i=1; AJvYcCVXZFX4BKnzrD25yYAG/QLvcCBHblLOlc83jN6PzuTy7uIXZCqwdT/FopAbcU1ZB8ibCPELuBDwFcEibSNX/wFDCO96JkfLJ5SCFYUc X-Gm-Message-State: AOJu0YyD7w2JpFP7IIToNDdQ/mTS7rz88Y/mNVlOcwvOnA+ElOONrMpf pYme9WpacdVCS8MY5bvoMgsCFlHvNWXa2fUyGxRzKw+/pR0G5WRa6E/HhWRPV8iCWo/MGdaQNFv SouO8b5LNBA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:2492:b0:dcb:b9d7:2760 with SMTP id ds18-20020a056902249200b00dcbb9d72760mr1372955ybb.13.1709410610740; Sat, 02 Mar 2024 12:16:50 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:30 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-2-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792446981489623108 X-GMAIL-MSGID: 1792446981489623108 Export libata NCQ Priority configuration helpers to be reused for libsas managed SATA devices. Signed-off-by: Igor Pylypiv --- drivers/ata/libata-sata.c | 139 +++++++++++++++++++++++++++----------- include/linux/libata.h | 4 ++ 2 files changed, 103 insertions(+), 40 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 0fb1934875f2..a8d5e36d5211 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -848,29 +848,73 @@ 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); + if (!dev) + rc = -ENODEV; + else + rc = !!(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); + int rc; + + rc = ata_ncq_prio_supported(ap, sdev); + if (rc < 0) + return rc; + + return sysfs_emit(buf, "%d\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; - bool ncq_prio_supported; - int rc = 0; + unsigned long flags; + int rc; - 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); - - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_supported); + rc = !!(dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED); + spin_unlock_irqrestore(ap->lock, flags); + return rc; } - -DEVICE_ATTR(ncq_prio_supported, S_IRUGO, ata_ncq_prio_supported_show, NULL); -EXPORT_SYMBOL_GPL(dev_attr_ncq_prio_supported); +EXPORT_SYMBOL_GPL(ata_ncq_prio_enabled); static ssize_t ata_ncq_prio_enable_show(struct device *device, struct device_attribute *attr, @@ -878,50 +922,45 @@ static ssize_t ata_ncq_prio_enable_show(struct device *device, { 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; + int rc; - 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); + rc = ata_ncq_prio_enabled(ap, sdev); + if (rc < 0) + return rc; - return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_enable); + return sysfs_emit(buf, "%d\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 +973,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..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 Sat Mar 2 20:16:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp637980dyc; Sat, 2 Mar 2024 12:17:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU7Mdsdyg9O23hX7iqnwPLL0oa4BaUsFxRqw6B5w6dHcWzu7r/JBjah96KVYYlqxjIuX/Ehlq0Qif25xAaFmxysiuUqrg== X-Google-Smtp-Source: AGHT+IHVjSeUSS2hvqodnOa3lNRgQQvKCYpBqeObHIDGrDObJaIkEUOgGSEf8XaQBt82NiC7lccq X-Received: by 2002:a05:6512:34c8:b0:512:b00f:a55e with SMTP id w8-20020a05651234c800b00512b00fa55emr3451272lfr.13.1709410674323; Sat, 02 Mar 2024 12:17:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410674; cv=pass; d=google.com; s=arc-20160816; b=LMJSV7A/93t4j+ZYTTO6BgDZIqosqIg1bqPqdRgEr0IEbid4q8zerlwoCd3J+q2ZGX u3dHRABmmYvyZlo4uWW5qBq3mVq7OKxl2dsH5SQTo486L8KnvO0W12K6Y9P/+f32ml0A FrHw88QHfCaf2Xrrz2bscO/d1DRGPcADRxpfk2jGDFuVQlyTZny54ezaOAu5ZbVAEDWg +BjRqmLhbNPEiwNFCIobbkHEI+j5Ex+d0Qd36cuiNOyfhL+OkDxoxuyYFKB1lUt3U3Te vYW+XuMHjVvL+Cti7t6eSErROGux2HLJr4vbb2UH+bT2XIngGvZva4hq/oH9QUMcBYk+ eWMQ== 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=SBbBICcO6IvwKDEiRI+I7rx8MULu52MOhujWx/5/qGw=; fh=B6ObIGBR+T+yECCD5g9sz/Z1x/JtvDdMpSlBnLN//oI=; b=mcUnO2OtGf8z5mxMQyXAxRw+LEAcmmM5xnALNSgn4Qci34hBj/wJ4aLpjBSD9M4P6N 2S+27lVmpq5kNrmqZaEcgfy4hi6pTlRJIpbrkNb68jPUCgytjx8jes3por/2HT5fqGFO OK1csC5XNyODxzhH3fx27Tlsl2WPpzpIom6JnOsKRn26QL+jW4sPRmxBnaCG1nBDBkva ZOW9kDUou4Oiino9OPDoQGx+iADBEll045TIPLezdPggxtatGSNUWSUSqWNYn7WkuYng SFdjyyhdoNzFNQObKzvlM7v/J00Kh9f+KLEc9vqd5x51G3JobP4Suw7KRNbX1+7sfuZE O2HA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uYJERZB9; 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-89580-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89580-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 gf11-20020a170906e20b00b00a4300fce0basi2612570ejb.489.2024.03.02.12.17.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:17:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89580-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=uYJERZB9; 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-89580-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89580-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 A2D0B1F21C92 for ; Sat, 2 Mar 2024 20:17:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53B7C44377; Sat, 2 Mar 2024 20:17:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uYJERZB9" 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 C9BB741740 for ; Sat, 2 Mar 2024 20:16:53 +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=1709410616; cv=none; b=iTw9U5gIfGZGMkhu4ppAQ6w+/0mj7dPAxE2/b/nDhW7J7LkLuyhB1EvOOq5N1gf1MWQRosKs32yYCEzDPZAGhQFi0p7bBfzxyImeS6ovunYLeiIowtfL/s27lzJH97KOdONoS0AUa44kTeUFalmbP5AD/q1JJJXvwLda61boHxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410616; c=relaxed/simple; bh=0GrvhQMeDiqnvSKKSLm4FXuympZbNYitH8oNM1c1K2M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Uncqct6as38VlFqiaTmiH5UvV2O63MakYvpjG2qvuzyoYzBanJ1BGdpKCTXKavrg/BGZrHD3SU8RaHfdkmYiTKm/9pIveK2UajEIEvmcgez9e5rxTKBeXYWV9LfWzPYk50dyMk9bWrtTWZZGkjAuqFmlRs7+aXV1Y8lmLWVjY0g= 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=uYJERZB9; 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-dc6ceade361so5527255276.0 for ; Sat, 02 Mar 2024 12:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410613; x=1710015413; 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=SBbBICcO6IvwKDEiRI+I7rx8MULu52MOhujWx/5/qGw=; b=uYJERZB9camoUaUqLYLPLa1tUH/NeYC5rMRbU3nBmmLwk4vnRWCQRaDGxN2SWsD6gB StiXOoqeVr/qZ8pwiQimg5IlJUOKHup0Ug+2fQvQFVLJSCE4DF+98DdYhrDhzLLoCeJ9 aSeM756dtpN3H4arUSLgJvEX+ntorXyCtBwvnu3U26OdtYYmU+Ge1GEWTkuLXgga89Rb aFrnCztjxyUsUrlVKBRBlXKm2bcYIL/6RrotdopSuqjd9EAT/YYHFQ1y6Xa8dFDRG7+D n/9Xj3dHoqkZf5h1Iw7Kuyga3aIz6pJQ/waGUzU376wAn6EYH0k1ya1tkC0Dx3oJFWNE EcRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410613; x=1710015413; 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=SBbBICcO6IvwKDEiRI+I7rx8MULu52MOhujWx/5/qGw=; b=RsFlV1bKQMd4ci7zNXhIOa0YtB4WkktYvdPzgR9FbIJj1cYNMOWzAEJtf0fPO+T620 rWT8NTo+G44Wc65ucyEh8YUZmx+x1STPEsMHgcjzVaHD8uxzpVKvwdB7iUuta7hRbZ7H fDScxw5hIw6qv/8U8HDcK/n9l+Fqhcj4a322pxmhpxqLZFfzx2vo93tDLSLMK1GKoMt6 m5xXxggIwskPkA3x6DMwWAFDn0+vzKclMToHIaSfVIrDXbZVWTaoqof/7oCf6bCz9SvA LuBR00Jryf63A1HRbipFZ/S4wC2dHfMbxvgLiON/01zTrai9y9M8nbsxV4fsDs36j/7g jj9Q== X-Forwarded-Encrypted: i=1; AJvYcCXSOIcKDkDCj0jdjQHOUgo9bt4lEPnsdC70Jg5ii+0YGABDaG+S3qjl1l/923SE8UKOkJt2FpWO5HFISMW4f3neKNLxn5PMKDP6b6t6 X-Gm-Message-State: AOJu0Yy6E8Gt4X3Qukzuew2XS3p6VsbyH/oJJMrdQinUuDjcRzOdfNx5 iIVMyHarCWwawoXezovD2k+XiOLdLjdaqcCDZQJ513AyL0RolGHlMSzjYtFO5mGkjK8fWuPlZYA jExRpIha6/Q== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1744:b0:dcf:6b50:9bd7 with SMTP id bz4-20020a056902174400b00dcf6b509bd7mr1307191ybb.7.1709410613026; Sat, 02 Mar 2024 12:16:53 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:31 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-3-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447007242372953 X-GMAIL-MSGID: 1792447007242372953 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. Signed-off-by: Igor Pylypiv Reviewed-by: John Garry --- drivers/scsi/libsas/sas_ata.c | 92 +++++++++++++++++++++++++++++++++++ include/scsi/sas_ata.h | 6 +++ 2 files changed, 98 insertions(+) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 12e2653846e3..e4d07134a0e4 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -964,3 +964,95 @@ 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 rc; + + /* This attribute shall be visible for SATA devices only */ + if (WARN_ON(!dev_is_sata(ddev))) + return -EINVAL; + + rc = ata_ncq_prio_supported(ddev->sata_dev.ap, sdev); + if (rc < 0) + return rc; + + return sysfs_emit(buf, "%d\n", rc); +} + +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); + int rc; + + /* This attribute shall be visible for SATA devices only */ + if (WARN_ON(!dev_is_sata(ddev))) + return -EINVAL; + + rc = ata_ncq_prio_enabled(ddev->sata_dev.ap, sdev); + if (rc < 0) + return rc; + + return sysfs_emit(buf, "%d\n", rc); +} + +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(!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..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 Sat Mar 2 20:16:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp638056dyc; Sat, 2 Mar 2024 12:18:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXac17Js7YG9zhCMA0Xx9z1Zu2T4bAG0W45koUo8xYf3VW+4RpECpfbAuv2OEqH6BaJSLAZE27zYoWvHmFXOPZx3vp38g== X-Google-Smtp-Source: AGHT+IG1CMYC2UMQLjEKJJnC8LBGuG1J450KzbHhrE2NpRLLl8yJEXC5uepYKMQqsxIVVFs33BxM X-Received: by 2002:a17:906:844:b0:a44:442d:89b3 with SMTP id f4-20020a170906084400b00a44442d89b3mr3385251ejd.48.1709410684907; Sat, 02 Mar 2024 12:18:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410684; cv=pass; d=google.com; s=arc-20160816; b=DPX9OU2qIAE2tHZGmF4rs/BCvqKGmWmjzN/22CG9H2cWh4sHCdi8iWId5cf/BTwI++ ht4cpe3PC3oplHKs/zsRNEYwRGujubc5xRXmzC/41tIYvVj4wKOj5uf5oXpQSAa+n0sR w1l8kwMeF3HsE/Ts3O0N9getjscz9pRM06N1X58SRrUJrtRXipMfD7l9G0d/43WQCrm9 jVRMfWHmQMtBIdC5MhCqT0FB40csw6vQ7v4dAv8eMVCB0xHHhQ+bWLiklLvX3CWslGI4 fx0Q6tsZsJLDfNmt1PfNzZOwGUfDImEwBC7gIdi8Jf57eTCfsgWX34DArRRlVPXvkb5u G2YQ== 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=jZVgry90rEYwnQ29s3Mz+RKBDNtmCmbKQoUc6PEOd2Y=; fh=INjW9hD7zRhR0U/iXTbN1A/27y9JHiHjfQfWzGh+jv4=; b=tI+l/nzDKoGlkf52GBYPEL9G+2066uzoyFC8AVwkKfgjhpCRZGcXeMXKXfwTortwUe ig7Tc8wVf/SZTpBlyez79U9s4SG+ndHZSw+7SJ0zehUJdU4IlxaWDhv/AxpZDND2qN7R PYfVBKmaBvR8J4inuN92z/5yLgEBmbgbx02EvGVsXKaAVnU682oI6DgnNwfR4fYPmGxJ wE3EDOwDVVPjsbYcRsCTaVpMEx9vpKGyuC3XIkBl9FsFn1+slwUXhqGmhke0TsRpMpap UjR11/v+j3Nl7Vd5wubrc0dO8HCfnqwxC/hxmkgMD2na4euDqcR/9qMmneDtvl2d8pzI HdxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BJfL6C0X; 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-89581-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89581-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. [147.75.80.249]) by mx.google.com with ESMTPS id sa9-20020a1709076d0900b00a3fc3580febsi2726524ejc.800.2024.03.02.12.18.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:18:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89581-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BJfL6C0X; 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-89581-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89581-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 85E331F21BDE for ; Sat, 2 Mar 2024 20:18:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D8FC45BE8; Sat, 2 Mar 2024 20:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BJfL6C0X" 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 6BD8A4207B for ; Sat, 2 Mar 2024 20:16:56 +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=1709410618; cv=none; b=WILOAY613JCtR2l8aZSEBnYEU3gVZckEpKOi+MpzxGZ4zjDaCv8/7WgBGo8m95xAip4mnH+zUMUCaVSCM0hnpl1JJy7BrrJr6odSMnLVNr7HswGpuMIOs/Wn+rYIGsMhTQiV0G6E7BmJQKQX+5jDdwrvkxlobiWOqu67Ynd6bts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410618; c=relaxed/simple; bh=KWCF/wRFo5DDf67uvUwFxQaljHz80tfPANfuy0kjn8k=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ljk90qhx2UFvkHoKw5qQ/4IPb+VrDHpCcnyikTR7AoqbzL9HumuRv7tHEkkIinTYDk1TXNVGXDI59ExkpsvXgU0x1pG8sfkLLaXIIPeof/ROLE6jCbkNe2Q2bXn05UDZ/dxLIplA82uzWub3+CXAwxpV4qWasoecbzdO2AzcdM4= 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=BJfL6C0X; 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-dc6b26783b4so4187631276.0 for ; Sat, 02 Mar 2024 12:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410615; x=1710015415; 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=jZVgry90rEYwnQ29s3Mz+RKBDNtmCmbKQoUc6PEOd2Y=; b=BJfL6C0Xzs6wghQ+RU/vyClfzNjlSaa8C3sYe4b8S9XTPS3xcX4+5C3s2QP6bORXzB OwtHDcahIc4br3A1Xa8Au6b/j6Botz/oCAZdhwokbEWqKfdT7xHw0ILeq6GoRdbQHyJE 0DzRqKfWF01P8nq9hwWnC57Kri9fZXLXXo3fSj6WVL972jbAMqvP01eDPSCMXVIWM/ks kSt1rcJYYZFXHwg+5tbLWaEtUJFFTa8pATM/WnRaDkx+l7gGdDVsyKgMOF1s2cYMAWJY wG32XXefyCiEtO7F+TocvT2fQ9KdH3sWrTbT8WlhC0xTiG5Mn9clDAvgzDEOcEh2GjQG j07Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410615; x=1710015415; 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=jZVgry90rEYwnQ29s3Mz+RKBDNtmCmbKQoUc6PEOd2Y=; b=EFmliEScIaRIuqk4zu/8wWpdldgZwdNcXn7L2SoA6wk50XmkjYVvAd82CnMlyB13HB 6PpAh5z6E73UpaZgPFOrk3b89FOt18VAEKRecJldQ6l6F4xa84QgUrOW9jqTwlL2o04u jViHTNYF7Nw1Ttqudud6wVwhwDpNQt3LMSkF7SxpVO7z9svvUq51voEewy+6dh/qNdKK n3ksyD/STqiMe7XsCd4Xm5Kh9Gb54hPokHUs+0s2KeNmZ4ivJOxILYzVI557YqyFT5SM M1rX8aKn8HehzeGfPPExy8jCGCJih91K1M+pTD9p4U6tuueabMhp/DmEuPxs6pz+S6X7 Q50Q== X-Forwarded-Encrypted: i=1; AJvYcCVxScLDs9Odax8lyDFvt2x42n0KuNXmt/bVMIP0jYNn5iMHo0fO1ZSiMucLORzPz2k3gYbBKmN/wjFut65m7d4GfIbqp5HIqQC5co2G X-Gm-Message-State: AOJu0YxEEQbgLAfRHNgCfmvBtXRCmVHM83Mi5AmucvRjdzd5CFGFRKoM 5UOrQ9SDzAUu+Z/7TiMtscKl5Sl1ENucN1bevgrn6DCfKgWyvgT2ky9XrjbiP4kA7rlDRRHl9ad 7BjNdA+NtqA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a25:a009:0:b0:dc6:b982:cfa2 with SMTP id x9-20020a25a009000000b00dc6b982cfa2mr177837ybh.8.1709410615275; Sat, 02 Mar 2024 12:16:55 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:32 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-4-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447018216358677 X-GMAIL-MSGID: 1792447018216358677 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: John Garry Acked-by: Jack Wang --- 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 Sat Mar 2 20:16:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp638140dyc; Sat, 2 Mar 2024 12:18:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUyx4dw67df5g2OD1Ommcv35FmeUytKfNJfo9Dyg/zlLKsWgFtC1apvqXW/c79MFq7s+eA5lIRj3PqaXQQbwh4iQny96Q== X-Google-Smtp-Source: AGHT+IHwmdNk84v46HXnJd+ELBg468+XderrljpazXtAs9LIu2aCgKK/FfaFnakF2SCFjnawVlX7 X-Received: by 2002:a19:e00d:0:b0:512:bdcd:f22b with SMTP id x13-20020a19e00d000000b00512bdcdf22bmr3445337lfg.64.1709410697768; Sat, 02 Mar 2024 12:18:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410697; cv=pass; d=google.com; s=arc-20160816; b=oIrx7vjopKLQRRWetydolzAfKsqP4RWYH2pWTxmJTHgZEQARg3bSM1NvjNJA9kTkEW 0RpxOcwrttfJ9OKiLtXpNHVnCCy6Nw2o3WFXYFwoy3EqRY7UUwDYWxwnDrQYCBTy8Qzj 88Atqc7KpK9f5BBADqgfNYWE6FGpUct9R8azLOG2CNYl2evVxCY4/plzSKbzWY4sDmDX tC4SxCsnThncvK7QUjMU/2ixl8/QgcKyFlT4qCH4PB0TnBApWRyDuZdihkQ5SDr3oTgD MA3Hro22f7amaNHGxsX+hCkBGm884ijO7AypXZW9UZwmH715av7gDf7wg9WYSKxWL5sL XPtQ== 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=63IDjKZgY41/sxscATiWOYuczRuUk4XINSTCQSRn0Gw=; fh=p41+8uMdN9EVxcJvMtSHMGrBKVaN+/Eb29XfgFAMvUs=; b=Kd9Pw7gCHz785xJJLgYgDaM1rSo8loE1bbXGSKqdh0njnZPbwoKDd8eaQNx3WugHBg 7/gdqVy86uD0vCmUu10auKxqXSrIhRAWRObpAMlYCAlmybmLdtxZw+J88FPvP957jFyP 2iQNELfkJSAcBfzQpISXM+YuhAsTQ3ikGdADUkSq2WCuajPbY+51FE148F9X5Aa/vfbG X3JFOouivQGFMz3R6JRM1wjl48JYbL8r6lSdye5uYnA5IvFqXpu2DWknommMOD4hcq+8 VYCzSEfbgBhluaL6XAa1VCqmPerTj+PGhdQ1kpsLW74EL4ZvRTgAlaT3hV0vnswI8OZI cnMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=darQoFh0; 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-89582-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89582-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 y13-20020a50e60d000000b005646c29cabdsi2567275edm.283.2024.03.02.12.18.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:18:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89582-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=darQoFh0; 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-89582-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89582-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 6087C1F21C8C for ; Sat, 2 Mar 2024 20:18:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C07946BA0; Sat, 2 Mar 2024 20:17:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="darQoFh0" 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 B4D1240866 for ; Sat, 2 Mar 2024 20:16:58 +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=1709410620; cv=none; b=T1x8bkBHd+vFbYWlGmv6UCzsaAcfGb5vr62AaK9Se2W/p4KBNv8YKsB+t76FnJ7AtZm6MGTSHeCyG6eCK02Nj6IUIq83kmlxRbEm6iV7duTBHdgcFdUqg21nRBqvbCCJfh0jMCzctnElr2O0LMDLAJHO3G9Oe/udOkYR6POokFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410620; c=relaxed/simple; bh=BVc9AZZs/RVfi8UbrJKJ/9aeH5efGDemJUyaiD8CbnQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lRO+cmgwfT1ZsyKz9hyhS1qTpvi7VhSzUZhophxHMUDSmoH/TxV9gZvPT4wP0syiCpfIZKNj1Wprrz26ZaAhfcQKmDdUc3DUxEwmEa8HuLFep4w0MimE1UJp4pc6hmP0suVuf76CquvZ+PqOWmi6Y4vdP0COkQNUhqTp9u87I/U= 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=darQoFh0; 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-dc64f63d768so5936202276.2 for ; Sat, 02 Mar 2024 12:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410617; x=1710015417; 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=63IDjKZgY41/sxscATiWOYuczRuUk4XINSTCQSRn0Gw=; b=darQoFh0MZx3w51d+OsqEu26I7s5U/qD4kU1pPjsg/iYClzJfpRDrxtDgY6AEoKX3o 2/5kpZ1WLAMQqaXaiPREFLFr67xAtIpjhfeCecAv+FLRUenEasbNfB5qbZAkkHY+UhyQ +KI9tDZ1g6Ir8RdRcyz+EhgLYG4R5Xp+pjJvgq4WohAO28uRpFg+Y7YXmYeYzwHGgkpI /evLyuV9gHVLEhOMS3pzYoEXfCV/DctGkRFkyyy5sZjmymdsviHEhtCFloeWC51xxbpo Zj4r4K+mKPXe7D9WUV8WTpd3uDTE1XFE/z0NBHJd8el4KUkfosnZ9J3zpdzsa0IYFLUH QvZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410617; x=1710015417; 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=63IDjKZgY41/sxscATiWOYuczRuUk4XINSTCQSRn0Gw=; b=rYfkeON38Vnl4uQxtZ+Sm0HbDPQxqKBw5sO+Fs5wHxLu/GT0xPGnvVXsQ0zDPFEq/2 5hq4C1MTUa71+VEpzQgZIIMItjtpZMeBdWEa7NyqfMtA8BEZpe5JfISUsrnRnCJjbaNf 3joeQTG96j9T25FNGhgxjQHdXZngJA1E5KnGKvZx/HhrothxkmWRQe7MzLYDe0Rv2YvT iG1auXstD5nIgItsiPfHwopGvBw5hIlmT00OPYvtq5bwEpA6FdCnFn14GIJQAA6UKSUK HoI1uZL/cBY14PbPxfzHaqy8knMNmHIU4i8x41isMkm87W/Wph0XIptsw4gy5BG8JGxV 4VKg== X-Forwarded-Encrypted: i=1; AJvYcCXTtsW5F+C0p+RyMlLF1rxYmSr2ApyySaa6gEZcF2mYvd1mZ7uj9Z6B1JyBKXr2MXCe86gNRBVqNwlDSKfiBZkVe1TZnDwGNNGHG7pP X-Gm-Message-State: AOJu0YyAoX1vyLv70EJXTgLdJqg2JBmvZIFs2Z8eIzbllzw9YRsTEhNT CCUfiBB2gOxht6PT/+u76GUWPHQ3qp7cmjZJa985bFUcbl1BPr4rYRuoXbuaH4nkkiObYfxPvVB oVm2Y0bEHQQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:210b:b0:dcc:50ca:e153 with SMTP id dk11-20020a056902210b00b00dcc50cae153mr1370635ybb.7.1709410617704; Sat, 02 Mar 2024 12:16:57 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:33 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-5-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447032003796389 X-GMAIL-MSGID: 1792447032003796389 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: John Garry --- 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 Sat Mar 2 20:16:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp638256dyc; Sat, 2 Mar 2024 12:18:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWSX9UZeQsvysvATgFF4cvOkmbIJ6YZz6DclLpf3DXrAZuftOGchNgyi/IIRDhhm00SievoXRmdHxCrIShs++fAbSs/2A== X-Google-Smtp-Source: AGHT+IHmFt9B0srQYrzbetyQ37kwRkFV1qzyU1AtwRhw4oC6edP+nmVFCM4vDa5TQQDNOQ88vdJg X-Received: by 2002:ad4:41cb:0:b0:690:6c7f:8d4d with SMTP id a11-20020ad441cb000000b006906c7f8d4dmr312981qvq.37.1709410721080; Sat, 02 Mar 2024 12:18:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410721; cv=pass; d=google.com; s=arc-20160816; b=Cpa2Goqza1DOzJt1zPpE7nmFTwWOERblqrM665sJd1RSaDnUyki2lii0YLW8I2/wW0 q8SkGy1ohjx7yVHxZHkWOBWSo2ai1JA7GzdZ7NfEFHjOkSSzalmat+7hNI3jVQs9Ptdw FIxr061OQSDucWQ86fJ3X9Hbx1Kb44F31nTzbkOZifED0saQJNjxwV0/xp6PU9vG8jzS yX2Qh8/FMyaMLH9paB/q7tgcxsVDs+ddZQ8W1UlJZDnl9DqLlQ42iQZpw299oMDV+pKy XGjtLm+mtqTmy5w56GBIuaYITSuyZyTh59J5RvjWHqu5VczedvDAOufXWT+tcoKqqPdj 7rjg== 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=aUX3zhIus5O92bJYySj4+GAcqh6w/58AkwOdnSqPEQ8=; fh=Bj2rp8jxZEGBRLOri8IzL5QIItACskGvbZvCL2cqAZA=; b=GBiCfliVUCDyn/sTa+YeUabmLfACGkczOvafBrRluVSq5hai5fURxT1hgZifS4EVU6 hvfhHStqpdUiW7NYemT/xQRAySzD63y9kflK21Vl6juoUXbsk8u8iV8K7hRoAm5hUEal ZfglqUycKvX6WfiIGKBnCox7fVD+A82A4IpPM23fngvELvr2YwIaBUJqv1mvHPDyH/jf WcT2TMZ5HzUvayEw171+wzmLQMzIOyq3KCKyDIEoOoe4FWF8N7uojNzTJqMxjuFPk+q/ DHqLO5BjyqT6voc06lrIIRSk1bN8y9Qsz6eI6njS3QWhQVpYdRksOdVuO5rsNJcfA8EO ghRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0rKlX2OV; 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-89583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89583-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fn14-20020ad45d6e000000b006817d997962si6375971qvb.130.2024.03.02.12.18.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0rKlX2OV; 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-89583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89583-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 CC0551C2097D for ; Sat, 2 Mar 2024 20:18:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA24041206; Sat, 2 Mar 2024 20:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0rKlX2OV" 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 1F7F24597D for ; Sat, 2 Mar 2024 20:17:01 +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=1709410622; cv=none; b=NkQzHqTJlsDnD6xmF/VAUg5cqr3yS5bVK+pBiCOMXOE0wPcJLfz5tlVj+Yh5QupD9ftk4Q6G6bJl898si/0HMeZAwwmOInJh4nv3OfTMefcXkkVu0EBLbId2RG7I1U5/9z07Vp9yIJDv9qMESGZcTLftywEz0o7+nCI/0kGV/iI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410622; c=relaxed/simple; bh=oCEOlszWbRebAJRFgYlHh9o1ZpJRj0ce/17rkZ3A3M8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OjRqaWjwjHY5zWCnraTyK0y1AF8kVHzA07368zHsEwqyqmKHqo3xacRRDbfOZE4fp/1QEh1RAgktowZ/ncR+uXja8QSITrY5Wvog/9WJ6pfntxYBhinDQNmXTrmJ8HQgu2DpvowvkaYm1uH4O3xQCAVfvKZkBBiXnYnq9lCq94I= 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=0rKlX2OV; 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-609a1063919so1537297b3.0 for ; Sat, 02 Mar 2024 12:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410620; x=1710015420; 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=aUX3zhIus5O92bJYySj4+GAcqh6w/58AkwOdnSqPEQ8=; b=0rKlX2OVeDcCZqIEma/ZErmDlV4K9UaJtBQ6QVFl5BpMMamTGG2188njqqx65XsUDp HObo4Q5wUdNhzzCOarMGqduVfrmWhLZu8Sdm2mKppHQiTPdKZT+WLYhQzsa4Wp0ARUbN QN5pMqraZ77vJs0ckpdU5lyhyslk86iiNxXEoapA7HUsDWKX/OT2DcZlP48t2i6Sd11d NN9lDLToUjLaKSQAlyYOvZiQw9qV+EBs4VBYe2RkzIcfgTKFc/F+u46XJzXGXWL90wtt mH4dun9q38W/wiXuunLVNE4dIWhBBCA6KJZnf+7OIbcmH520V1DIZg264hGdUiqWoj+Z ugDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410620; x=1710015420; 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=aUX3zhIus5O92bJYySj4+GAcqh6w/58AkwOdnSqPEQ8=; b=X+3f3yJNqKtdhaXRMlkyp6BB7yKO7yk2pJIF0cf5GhwBW2F9bE5GQ5ldxxjjKjQ0V5 B60KwkDNNcGPLEJTxl+Dsn66GqPtMHO/izy+ZjZ27T1D2ASnpvnHw5s8e+rGVLmDSTiO m5ZHWyJZ3wt4fhXDpDVXTfl85gdmkCIFqhr1v8JA5TUogZnsUhK4ce/PqnhbINyTcyAe AeerweYuBgt1zVCp11mxvJrFtIXkCwksRNjo6tADc6OWIY6sXXWmTQV8iuZiNk0yDXD4 xGsVFC/Ocyuf43+dddOf26odCy/3agq3X3IREGzCfoViT4tpM82hXMTwvReE//APzOT+ +jgw== X-Forwarded-Encrypted: i=1; AJvYcCVWDNZBu3/QdX7s3A8WHCyiwi+PlddWJd/rMqu41vUUnve6SUfBk2DjgozLHRzswa8uOtVrpqMh2UJ+gEfSl7QnmFt6fSSfmEMn1TO/ X-Gm-Message-State: AOJu0Yww3X7oYUQ8eJzF5CtXAzz8MCj+4AkujJvPmPVjjH9Cyzk/2mHC Nu5FFnso3etCTPu6GlDOK79pqqpx57xq8+RPsKkUYrRtr6LO/6al1g90H3xQbIRFBxaVJx5PwaF o07/rs4HBkA== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a05:690c:c86:b0:608:ce23:638c with SMTP id cm6-20020a05690c0c8600b00608ce23638cmr1457644ywb.4.1709410620335; Sat, 02 Mar 2024 12:17:00 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:34 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-6-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447056179626445 X-GMAIL-MSGID: 1792447056179626445 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: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 6 ++++++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 6 ++++++ drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 3c555579f9a1..97864b56a71f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1734,6 +1734,11 @@ static struct attribute *host_v1_hw_attrs[] = { ATTRIBUTE_GROUPS(host_v1_hw); +static const struct attribute_group *sdev_groups_v1_hw[] = { + &sas_ata_sdev_attr_group, + NULL +}; + static const struct scsi_host_template sht_v1_hw = { .name = DRV_NAME, .proc_name = DRV_NAME, @@ -1758,6 +1763,7 @@ static const struct scsi_host_template sht_v1_hw = { .compat_ioctl = sas_ioctl, #endif .shost_groups = host_v1_hw_groups, + .sdev_groups = sdev_groups_v1_hw, .host_reset = hisi_sas_host_reset, }; 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 Sat Mar 2 20:16:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp638358dyc; Sat, 2 Mar 2024 12:18:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQ/8zAWmPxohFOm3nIK5UFHWh2dtSkWx6HLXER2QPjd9ViZhUgkLh7gq7R95L5olW5amw3zZ+yOpMfYAedSQfmweC9XQ== X-Google-Smtp-Source: AGHT+IFqkwTfeXNXT0S+DJyfdFj/Ygos3K/xmFNTOZCdtuI9tapsQZSaWGnXSCx96t3IT+bawMta X-Received: by 2002:a17:906:4148:b0:a44:f89:a04e with SMTP id l8-20020a170906414800b00a440f89a04emr4244056ejk.35.1709410738515; Sat, 02 Mar 2024 12:18:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410738; cv=pass; d=google.com; s=arc-20160816; b=ZHKmVMKixQUBqDiKwyZnKDz76/ObeMFuuWI5SmnL4fpKWpPB50yamEVyeEdzWnA0sq qd/GN4mPeUuO1yiS/xxFh3EEBUiaejOUa2PXNlSPQPxLgD8CQA0PHxcTeDiqX9bgtvjU 0fHmA0C2dRTh/mfFDiE/UkcZnJ0MKdFeQKDsAg9iIGgHwOFAr3oDgx7XvhAJL4t8nAMj b8UQFDxE8akrunoOSiFUriHNntIlSrV/ekhP2mKCEwNGWIVXu7wHB4tpJakDnvCFojZn XK2IyuGhfunCxEk1wR5Pu/VocWviWVcjwHQ13MmrTqXw39N+GP2L+Detb7qaKEBJxcbV IY3A== 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=6eLIO8kHvIyF+nVEO24K/+ffrh7ExfG12XLwVuO+HAI=; fh=w5AAxnLnmBYQnMnAnLzrxm46kOiGsisBku2VQ+LTre4=; b=rIRypINQvCsA5t7hpI7nfTkZ3ytPysGJlazASknwg/6L9NfX5vCXtUXNdxsh+qWTPj GfHBhqNubJlNyjPvSocrbP+JqjyED2omRppciuwQKzQLrszbrXCcczPUjFaaTgmTtCT2 gfnNUL7E4QxYw4Zz4hx0ywxuxpEVEOd/sf8NBE0DluWJZWAJcrQLxotppICxzXhD2Z6N QPflbIJRI9wFRrdR+2YMmc/I5LxV8idXtXFxODAxbCkQtXD9igZB3RW9QAY0Cs67ylgZ ZG39xpfF3HQ3Fv5IYbGiyns8FlACa+7uc1UUvcHBQ7mRmGzUAPXyYseAtKLTqaPSauTv yKsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ku3hPp3S; 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-89584-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89584-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 i19-20020a17090671d300b00a44dc35dee9si664645ejk.988.2024.03.02.12.18.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89584-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=ku3hPp3S; 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-89584-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89584-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 267371F21B5B for ; Sat, 2 Mar 2024 20:18:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B58E84D9FD; Sat, 2 Mar 2024 20:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ku3hPp3S" 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 236A446535 for ; Sat, 2 Mar 2024 20:17:02 +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=1709410625; cv=none; b=Q9ZyD9x4ajCgxQTrc9kGxFZZrzt34iBHik/58iXbFA8gyqLYn4NBrEof5ElhT/EAljbvRXHRnpy1/VcVBLS01doQOal6XHayyKD1/JxPbrGCqKEQC8stO59sbiEYs4XAqGS8/Eq5HxLqEbzVF9iSpLR1Rb3X+6bMM7bdzV9rFc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410625; c=relaxed/simple; bh=NmBOqWZxMsasMb5PgbvxyvjHON2/Pw2TXxQ33JzQhZE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Z8pZP8NIXDQYemHt/ZnFeWEAuxBUY3wu6THWkU2KhBUr09dcnIzGR+hDsnUae3Zoma0tK/w0DEI8aZaUJYgqu4frUgew4nvykezxCY26t9rRlfbzaiwP70ZbI8ieop3lwHTmnq1jsP3/HxgUqK85J1tql9PQkowCK7YjzWiRNls= 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=ku3hPp3S; 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-607e56f7200so30787327b3.2 for ; Sat, 02 Mar 2024 12:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410622; x=1710015422; 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=6eLIO8kHvIyF+nVEO24K/+ffrh7ExfG12XLwVuO+HAI=; b=ku3hPp3Sq6hCgHmpghYtwwY9SLbxMKkDaVnD5/m6bFHMPGCv3kEhjELXhOg6Z6vopB hQfj7P/mye80iGn1PK66WNz3vq0cQ+msBnGEAZX+mDFPCBqqGCyZARKXgPdNvkCAFic+ Fn/Zq6bB/yar9vMn16Uo1BACsD168wmkXQu9gXOhpRX+GQjvk0C2D8pqhF8C1T4AxCPO 2n/4333sL6x6O1FPyDJYfwpdk+a/96h+1Ft7s8JtTUNUJKG73wqzJAJOdhK7RdQu13vi LIdMgPnyxV4aifLm4c3DzE+BgWNec3PUT7vx3ipfWuH5dhP7NaLf+9obVBvwiYWpWd/f lsAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410622; x=1710015422; 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=6eLIO8kHvIyF+nVEO24K/+ffrh7ExfG12XLwVuO+HAI=; b=SATeh5dGWClYVc6Q5EganeGsw4HQ1blnERtWUqZ8jHNaZi0yoUVON6xVwbhGT+DvTU Xv3ya+MUPPSOynqgPV/Mk4ioRqsarjGr3mB9ct4x76GjV3M4ZQCkTCj8aG+78IIurFiv WWJszxX9/gNFjFle3Km+7cDXZJJviQ5ssfb02CLt44XYq8a/bT9MDQEL6N56TKInpIwz AtVJZ3tck9pyPpnMGt+/UxNkX9FgGECQNlW7e1HXVBKaKXheA6o2uCW0P3RU0YuN2buv K3/f0Y9JFejo3g3zJUTpoNnvV12zWO8NKtO7RhXQnusuALqMAeODhu/iC4lH0mctpG5q ltbg== X-Forwarded-Encrypted: i=1; AJvYcCUsQX/T3E+xKxRedL19Il6JJ2o0N6Zgwame/Tp7LGhhtXxu/V0Y0TUfscQGEa7ialaX5U/52PQHSTnYqC6uFSolIQT6gSm7+WRmPe2k X-Gm-Message-State: AOJu0Yx1cBOrAgPWu/WGbdoV1ZsfV++YOM2IpXtfDFb3c9tW979DRi/O RN1dSjBVxc4i/StlNBEKiTm/BiS4+ZLLthCwXz6ndAyH4eadRdEWClPBqQfdDbuiFwLCU/4yHe/ NfAEBkVERmQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a81:9950:0:b0:609:4d6f:7c0b with SMTP id q77-20020a819950000000b006094d6f7c0bmr1094668ywg.4.1709410622201; Sat, 02 Mar 2024 12:17:02 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:35 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-7-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447074444705852 X-GMAIL-MSGID: 1792447074444705852 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: John Garry --- 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 Sat Mar 2 20:16:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 209263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp638406dyc; Sat, 2 Mar 2024 12:19:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUa39H7rq2OGlqScO2RFZDqyOpt4lDF4zRBl4WR1X+8lQ0REPPf85Gy3EWLnzt8awyqBYUqZUaLuMyO3pAaFsuMuWZaIg== X-Google-Smtp-Source: AGHT+IFu7zhkBR7N6h6Uw1MMp+FpmzafYXNQ926+iesSy7/IhU3IAofWkM5fIlmEu27fWsU8EEIm X-Received: by 2002:a17:906:6d06:b0:a3f:86ca:ed2f with SMTP id m6-20020a1709066d0600b00a3f86caed2fmr3829676ejr.49.1709410746594; Sat, 02 Mar 2024 12:19:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709410746; cv=pass; d=google.com; s=arc-20160816; b=uR6X/E5faaK7iDSenkFlGASlXQxsM6QwPhgustC40+w4QDkGx3VTOcXOMzhRiCiB0g fZSCWM14z7BH/wJX/0WBV3sExtKZfU12pZAuunB/t7mY3ApElPucUwo7y/i7EPTAVfXd v0VIksSQ4p70Zg1zftbdT+mUNFgUAIACBSQLXnZF0satl8dy4BrwS/zYQWo91d+fLgmi bNiYtfwD0NnX3ybqyk7wTqXFeH9PSgeax7i40lOguDsuy4BZDN7H9sssCPd97oxyMWOI jwY4ClXH1F5M6Pz9HcQ/HaH/mJkjKGG98DooVWlR6M70tGawLb/O4eiVBg1IH4KwR6dC ba2A== 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=k7XkqJ/HwZdUVuck7Rfqg1Ng2sUDChUOthoiaoWu1uo=; fh=5z/y5oAK2PbEkmVm3eyXdRUBDnP2KsdSr388V7BxQdA=; b=CcriM1xKO5H4pfWXELhSiwIqV2daYBVw5VbfbFJFatv/J9xrpr6ceDSkPuqSyjzsNP lv5esn+seXa2BGwtElahOJIum1rPjaXSZsZrf/pMyIdyqkRamTg8utXT3QVYa2l/x5WI J8yfDc2G7P79nTDeOIgCBPt+fCZfNRQsJQ/oIxNa66NOdsAsKt+M7B4OMuqjr9jxT7nn JeIFxMnYUI+UnVrdiuw8qgKZFCpJbQj/vhl7amdAKyVo3OIQX7M1gwv7dne81kgM7D9k kailY8Je+sGQf1yxJimLrOKqhf1McQulbBAVZorLtrkELVHle8seVctprpwU3dD93bJY wBAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bUgNbILR; 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-89585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89585-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 i19-20020a17090671d300b00a44dc35dee9si664645ejk.988.2024.03.02.12.19.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 12:19:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89585-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=bUgNbILR; 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-89585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89585-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 3A9F91F21C30 for ; Sat, 2 Mar 2024 20:19:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F4544D599; Sat, 2 Mar 2024 20:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bUgNbILR" 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 A780040C0C for ; Sat, 2 Mar 2024 20:17:05 +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=1709410628; cv=none; b=CQ7CUNH2YuuZ2njbf1mUmyPvr79+4vC0G4nOhdSyi7zbZH/yTd3/DL+mlcwX4MtxunFW4/YRFjTXobvPJpzGdVqu7y0S6ogWa56Gklm8HusSuz1aDEZvhoTjQ6G6SvZ2Wv1P12syDh7d1zdZV09bWtH99qJOoF3EmqfxmAtTCBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709410628; c=relaxed/simple; bh=VXEBiw5sEFSk6TqQvuSqUb+O1z3+B7dY5aKYWK0IdpQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aNcSsbltSnZR5JGpba7wUun50mTDrg4OSdAIS755MvAvm1nght0FpSz1nnqia2R15ZcpGbDBTl3w0TOHAQYq93FgHLOHiIXR9BtN79MSxcv9cPchv2hLcdUXfc9XG+rYj6qU0C0uIeQ96E9UDsw9yYkrFMNfmwRCArrjVZPaoLw= 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=bUgNbILR; 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-dcd94cc48a1so5197678276.3 for ; Sat, 02 Mar 2024 12:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709410624; x=1710015424; 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=k7XkqJ/HwZdUVuck7Rfqg1Ng2sUDChUOthoiaoWu1uo=; b=bUgNbILRtQA2lzC7fCLAvsTAkdCPQqxX2v33EtkT6rsLnANLFRqRLFtP6wdQfUMLxh QF+w3SLDTWRf9e3XLv8YXkO2LC9y4hvz8t4gD24nSjPJVfmb0RUfgx2/drB/sv1G8KQO YTifr8d6zF9p1V/JCz9mhkIKT0zv6fUcVJ4RlO1M18hcjkN1NSORm11TjbHiMOw7GBfD yFydrD9mqNZVtdoPF605COEwkCERLtdNahduD7f4e3HJ9jVOpfjNUMPnx3S/cueDnBWd mnAxxfdXt1KfzOefIYGGe2ccRW852KrGpZ0VrVRcJzKEUyEEkGlBrEICO8H6DJsTnWXF 9vPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709410624; x=1710015424; 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=k7XkqJ/HwZdUVuck7Rfqg1Ng2sUDChUOthoiaoWu1uo=; b=MhnKlUFqGMwiC4KZ66jLQZkG/cslrlzx6X6mQ/gJnjPXCX90G2tvGWvSqHYZg2tCfS ugHN3zHX/A1Ut3aGo/5WUhe5EPKuH0UvVMITA4a04i+UxZGlWR8vAT6YMX4egBbkKv0m +aZNxE+P04QaWMxx7oTEgK9P1nBuAfyylspUAbn701liT6S0zSyQae07eMr4whW/auok AYnNy9EVUcUzusNyejRbcYc0HuVON8tmEFEEk4K7N22H0/Dq1E5KdN+Kjy2IKxQbGsQQ G7bIvENe4Y8EnpvXVxCBXudT4OWnuTXaL5z9c/eWTyOH2bVjMat/d8O5P3vHnZY1Wf7m L2Aw== X-Forwarded-Encrypted: i=1; AJvYcCWC3/DMtqLIn33sl9XUpkz4pXBZ07tY+jdv2HKhjZ9U/l56HQiSeYvBXj6esa5QIusCe8EUqSVlig/lVZTkjQPEZWiwmEiB6alWdDr2 X-Gm-Message-State: AOJu0YwuRVA+UmJxid4opDhbR4MvjrBJq66X3ieMgC5FEGPCY2Yro/3F qJVRcoO+mc+mC1M99os05uPzxQziQSmka3a96x1BsMgO7Q327s4H5i9s0KP9FE/LOZP60ipQsGQ 3VMuVAf2Agg== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:13:41a7:9019:9a7:b404]) (user=ipylypiv job=sendgmr) by 2002:a05:6902:1741:b0:dc7:5c0d:f177 with SMTP id bz1-20020a056902174100b00dc75c0df177mr1258736ybb.6.1709410624534; Sat, 02 Mar 2024 12:17:04 -0800 (PST) Date: Sat, 2 Mar 2024 12:16:36 -0800 In-Reply-To: <20240302201636.1228331-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: <20240302201636.1228331-1-ipylypiv@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240302201636.1228331-8-ipylypiv@google.com> Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792447082839650134 X-GMAIL-MSGID: 1792447082839650134 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: John Garry --- 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, };