From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tJNWq1ZthzDvdj for ; Wed, 16 Nov 2016 10:14:47 +1100 (AEDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAFNEF1v115499 for ; Tue, 15 Nov 2016 18:14:44 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 26ray81r61-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 15 Nov 2016 18:14:44 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Nov 2016 16:14:43 -0700 From: Uma Krishnan To: linux-scsi@vger.kernel.org, James Bottomley , "Martin K. Petersen" , "Matthew R. Ochs" , "Manoj N. Kumar" Cc: Brian King , linuxppc-dev@lists.ozlabs.org, Ian Munsie , Andrew Donnellan , Frederic Barrat , Christophe Lombard , Uma Krishnan Subject: [PATCH 05/14] cxlflash: Remove unused buffer from AFU command Date: Tue, 15 Nov 2016 17:14:34 -0600 In-Reply-To: <1479251530-22573-1-git-send-email-ukrishn@linux.vnet.ibm.com> References: <1479251530-22573-1-git-send-email-ukrishn@linux.vnet.ibm.com> Message-Id: <1479251674-22856-1-git-send-email-ukrishn@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew R. Ochs" The cxlflash driver originally required a per-command 4K buffer that hosted data passed to the AFU. When the routines that initiate AFU and internal SCSI commands were refactored to use scsi_execute(), the need for this buffer became obsolete. As it is no longer necessary, the buffer is removed. Signed-off-by: Matthew R. Ochs --- drivers/scsi/cxlflash/common.h | 1 - drivers/scsi/cxlflash/main.c | 28 ++-------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/cxlflash/common.h b/drivers/scsi/cxlflash/common.h index 6e68155..0744546 100644 --- a/drivers/scsi/cxlflash/common.h +++ b/drivers/scsi/cxlflash/common.h @@ -134,7 +134,6 @@ struct afu_cmd { struct sisl_ioasa sa; /* IOASA must follow IOARCB */ spinlock_t slock; struct completion cevent; - char *buf; /* per command buffer */ struct afu *parent; int slot; atomic_t free; diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 1a32e8b..51ee9ef 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -41,8 +41,7 @@ MODULE_LICENSE("GPL"); * Commands are checked out in a round-robin fashion. Note that since * the command pool is larger than the hardware queue, the majority of * times we will only loop once or twice before getting a command. The - * buffer and CDB within the command are initialized (zeroed) prior to - * returning. + * CDB within the command is initialized (zeroed) prior to returning. * * Return: The checked out command or NULL when command pool is empty. */ @@ -59,7 +58,6 @@ static struct afu_cmd *cmd_checkout(struct afu *afu) if (!atomic_dec_if_positive(&cmd->free)) { pr_devel("%s: returning found index=%d cmd=%p\n", __func__, cmd->slot, cmd); - memset(cmd->buf, 0, CMD_BUFSIZE); memset(cmd->rcb.cdb, 0, sizeof(cmd->rcb.cdb)); return cmd; } @@ -615,17 +613,9 @@ static void cxlflash_wait_for_pci_err_recovery(struct cxlflash_cfg *cfg) */ static void free_mem(struct cxlflash_cfg *cfg) { - int i; - char *buf = NULL; struct afu *afu = cfg->afu; if (cfg->afu) { - for (i = 0; i < CXLFLASH_NUM_CMDS; i++) { - buf = afu->cmd[i].buf; - if (!((u64)buf & (PAGE_SIZE - 1))) - free_page((ulong)buf); - } - free_pages((ulong)afu, get_order(sizeof(struct afu))); cfg->afu = NULL; } @@ -874,7 +864,6 @@ static int alloc_mem(struct cxlflash_cfg *cfg) { int rc = 0; int i; - char *buf = NULL; struct device *dev = &cfg->dev->dev; /* AFU is ~12k, i.e. only one 64k page or up to four 4k pages */ @@ -889,20 +878,7 @@ static int alloc_mem(struct cxlflash_cfg *cfg) cfg->afu->parent = cfg; cfg->afu->afu_map = NULL; - for (i = 0; i < CXLFLASH_NUM_CMDS; buf += CMD_BUFSIZE, i++) { - if (!((u64)buf & (PAGE_SIZE - 1))) { - buf = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); - if (unlikely(!buf)) { - dev_err(dev, - "%s: Allocate command buffers fail!\n", - __func__); - rc = -ENOMEM; - free_mem(cfg); - goto out; - } - } - - cfg->afu->cmd[i].buf = buf; + for (i = 0; i < CXLFLASH_NUM_CMDS; i++) { atomic_set(&cfg->afu->cmd[i].free, 1); cfg->afu->cmd[i].slot = i; } -- 2.1.0