lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1654770559-101375-10-git-send-email-john.garry@huawei.com>
Date:   Thu, 9 Jun 2022 18:29:10 +0800
From:   John Garry <john.garry@...wei.com>
To:     <axboe@...nel.dk>, <damien.lemoal@...nsource.wdc.com>,
        <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
        <brking@...ibm.com>, <hare@...e.de>, <hch@....de>
CC:     <linux-block@...r.kernel.org>, <linux-ide@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
        <chenxiang66@...ilicon.com>, John Garry <john.garry@...wei.com>
Subject: [PATCH RFC v2 09/18] scsi: ipr: Support reserved commands

Support a single reserved command for ATA internal commands. We also
add SHT reserved_queuecommand callback to support queueing those internal
commands.

Signed-off-by: John Garry <john.garry@...wei.com>
---
 drivers/scsi/ipr.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 256ec6d08c16..4f4cf39cd2bc 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6740,6 +6740,19 @@ static const char *ipr_ioa_info(struct Scsi_Host *host)
 	return buffer;
 }
 
+static int ipr_reserved_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+{
+	struct ata_queued_cmd *qc = (struct ata_queued_cmd *)scmd->host_scribble;
+	struct ata_port *ap = qc->ap;
+	int ret;
+
+	/* We're only going to be seeing ATA internal commands */
+	spin_lock_irq(ap->lock);
+	ret = ata_sas_queuecmd(scmd, ap);
+	spin_unlock_irq(ap->lock);
+	return ret;
+}
+
 static struct scsi_host_template driver_template = {
 	.module = THIS_MODULE,
 	.name = "IPR",
@@ -6749,6 +6762,7 @@ static struct scsi_host_template driver_template = {
 	.compat_ioctl = ipr_ioctl,
 #endif
 	.queuecommand = ipr_queuecommand,
+	.reserved_queuecommand = ipr_reserved_queuecommand,
 	.dma_need_drain = ata_scsi_dma_need_drain,
 	.eh_abort_handler = ipr_eh_abort,
 	.eh_device_reset_handler = ipr_eh_dev_reset,
@@ -9991,7 +10005,8 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
 
 	host->unique_id = host->host_no;
 	host->max_cmd_len = IPR_MAX_CDB_LEN;
-	host->can_queue = ioa_cfg->max_cmds;
+	host->can_queue = ioa_cfg->max_cmds - 1;
+	host->nr_reserved_cmds = 1;
 	pci_set_drvdata(pdev, ioa_cfg);
 
 	for (i = 0; i < ARRAY_SIZE(ioa_cfg->hrrq); i++) {
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ