From patchwork Fri Jan 19 12:37:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suganath Prabu S X-Patchwork-Id: 10175187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 118BB60386 for ; Fri, 19 Jan 2018 12:38:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 030DD28607 for ; Fri, 19 Jan 2018 12:38:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC1CC2868D; Fri, 19 Jan 2018 12:38:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E87D28607 for ; Fri, 19 Jan 2018 12:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755398AbeASMiS (ORCPT ); Fri, 19 Jan 2018 07:38:18 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34055 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755197AbeASMiR (ORCPT ); Fri, 19 Jan 2018 07:38:17 -0500 Received: by mail-qt0-f196.google.com with SMTP id 33so3416241qtv.1 for ; Fri, 19 Jan 2018 04:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pDSWkUX6IDBhIGMaoGRmmMHcDBo6ukdCoNsdMTqECm0=; b=Dm72D1R8fBu1nCQAsYwq1Ho03PIlSDOUGxFvVXS+Y4AXFJxSUQeV9aqX/muvj9S122 MWOvXpMCrVwYqnm4n644hFb+QZ/FOKlBGsR/ZQ0KIgDRsGiSX/imCI6ebHJYFAyVZFBc IPk9BCmwkGnDjFScWW5FE6lp42e/120TSqqfI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pDSWkUX6IDBhIGMaoGRmmMHcDBo6ukdCoNsdMTqECm0=; b=r/mlU35ve//F0C3IebE0qREp62VoWd4b7huKO9B0MhXm7YWgpzqcXQFdyG0TilJuHz A9vOCDgXV02Z6jzvExPflf1lssETwuQFSFOZ3l1hvTHXxg+nmXdPv+zWjaLemjlVgj3W a7PjK3Ec+N41GqIf8Rw6zS6aOSoHdPeT6e/9sJadHPQcPbfkcBpR3q/sWkAcWAuoPuDb VqF4IqYTdqzcE2KIe9GarXrTwSCcHOA6DMadK0U3yTCo1h3a7sY36wBvgPfGEKNN7Zgn q5nuvZ/qdoLR5Wr3qVUr2Mxn4BKcYqfhXwd9NnWM+4QEsB4aZaO5WWe3Z+Z6qeuO2x5g 33QQ== X-Gm-Message-State: AKwxytd+C3PeA1fhY+8aZSBH0rc4qCOtNUp7w2cH+NrfCbK3STJs36+2 urehmP7PFTffhGxLhbyldn18Yclj X-Google-Smtp-Source: ACJfBostwNjX1GB/OBWtoy9KCSxwbg8WVfCIQc4EsJGo2DJ2R2m/JZYBK33pSJFC6t5SrwZ7kqgmlg== X-Received: by 10.200.52.155 with SMTP id w27mr35734877qtb.244.1516365496441; Fri, 19 Jan 2018 04:38:16 -0800 (PST) Received: from dhcp-135-24-192-103.dhcp.broadcom.net ([192.19.239.250]) by smtp.googlemail.com with ESMTPSA id p40sm6327885qtp.25.2018.01.19.04.38.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 04:38:16 -0800 (PST) From: Suganath Prabu S To: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, chaitra.basappa@broadcom.com, Suganath Prabu S Subject: [PATCH 6/6] mpt3sas: Introduce function to clone mpi reply. Date: Fri, 19 Jan 2018 04:37:42 -0800 Message-Id: <1516365462-14708-7-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1516365462-14708-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1516365462-14708-1-git-send-email-suganath-prabu.subramani@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the posted request has an error of any type, the IOC writes a Reply message into a host-based system reply message frame. This functions clone it in the BAR0 mapped region. Signed-off-by: Suganath Prabu S --- drivers/scsi/mpt3sas/mpt3sas_base.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 0248058..fa13916 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -126,6 +126,32 @@ module_param_call(mpt3sas_fwfault_debug, _scsih_set_fwfault_debug, param_get_int, &mpt3sas_fwfault_debug, 0644); /** + * _base_clone_reply_to_sys_mem - copies reply to reply free iomem + * in BAR0 space. + * + * @ioc: per adapter object + * @reply: reply message frame(lower 32bit addr) + * @index: System request message index. + * + * @Returns - Nothing + */ +static void +_base_clone_reply_to_sys_mem(struct MPT3SAS_ADAPTER *ioc, U32 reply, + u32 index) +{ + /* + * 256 is offset within sys register. + * 256 offset MPI frame starts. Max MPI frame supported is 32. + * 32 * 128 = 4K. From here, Clone of reply free for mcpu starts + */ + u16 cmd_credit = ioc->facts.RequestCredit + 1; + void *reply_free_iomem = (void *)ioc->chip + MPI_FRAME_START_OFFSET + + (cmd_credit * ioc->request_sz) + (index * sizeof(u32)); + + writel(cpu_to_le32(reply), reply_free_iomem); +} + +/** * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames * to system/BAR0 region. * @@ -1396,6 +1422,9 @@ _base_interrupt(int irq, void *bus_id) 0 : ioc->reply_free_host_index + 1; ioc->reply_free[ioc->reply_free_host_index] = cpu_to_le32(reply); + if (ioc->is_mcpu_endpoint) + _base_clone_reply_to_sys_mem(ioc, reply, + ioc->reply_free_host_index); writel(ioc->reply_free_host_index, &ioc->chip->ReplyFreeHostIndex); } @@ -6244,8 +6273,11 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) /* initialize Reply Free Queue */ for (i = 0, reply_address = (u32)ioc->reply_dma ; i < ioc->reply_free_queue_depth ; i++, reply_address += - ioc->reply_sz) + ioc->reply_sz) { ioc->reply_free[i] = cpu_to_le32(reply_address); + if (ioc->is_mcpu_endpoint) + _base_clone_reply_to_sys_mem(ioc, reply_address, i); + } /* initialize reply queues */ if (ioc->is_driver_loading)