From patchwork Wed Feb 7 10:51:50 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: 10204977 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 D299060247 for ; Wed, 7 Feb 2018 10:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B394827F8E for ; Wed, 7 Feb 2018 10:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8A0328608; Wed, 7 Feb 2018 10:52:30 +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 4972E283F9 for ; Wed, 7 Feb 2018 10:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614AbeBGKw2 (ORCPT ); Wed, 7 Feb 2018 05:52:28 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:43212 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753840AbeBGKw0 (ORCPT ); Wed, 7 Feb 2018 05:52:26 -0500 Received: by mail-qk0-f193.google.com with SMTP id y204so481387qkb.10 for ; Wed, 07 Feb 2018 02:52:26 -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=/M7U8//iRAYz1aMaqKkcYlKpx6jxbtm02uW5e3cLOI8=; b=g53EHUwDmPBN0J66MwJ5+TjTR5gTYIO5YXueZdhBLe1OIz8dMk1zr6DiuNStUff5F4 4Y0RFzlA7cFXLwl+1HH8OzGtujwiak9Rfkhb9b6r/Cupspw7crRVw1YQSTzTvA8em1DS GPZpBY6n+9LWcRRNhrrbNaMCoXNLY5JwyDWe4= 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=/M7U8//iRAYz1aMaqKkcYlKpx6jxbtm02uW5e3cLOI8=; b=XCfbnKFh+A9JWAoIUJ7MeaI6LG+oZOL9U7mojpSAvJbI+NwXxjEt6RtQOqE0FbABDu IpCsamyFso42m2fCG61hNIz0QtNIOSLyW/ryKzae8AY4QXt2BS+T/+2O4RaiJywcUQ19 XE5Wuu7PvPeJDg7DZAbSJZ2G8ww2zbdLGsb8Rh5XYf+O/g53OC0Fxxi5uFhkWZ/Uhg0n SGh7igRr4YOvwgn/3xAtMTJHM8HoZCH2wdRaM2UiV6ybOADX7M0kSnauhNEKO+j/qnXN saxbDQZVOp9eKcSUPOCAZgfkz/z8EOMiuMOmVsriM9kO+8CWzJlF8vys75F+c8Aqjfnp xTtw== X-Gm-Message-State: APf1xPABWRcNUL31MAKce/C2O7vfSQzdAeJevJ3s871Wn0Vg9Nt+lw2o ETOl3IoPj5wtVuy+T2Bz1SnzhKoe X-Google-Smtp-Source: AH8x2249VeTIlUYaCkNReCPRp5Zcq5eJWJwTRRkrNkAjCP+yIQkymkQ+W+CfciJu0ga21cOnUHTFUw== X-Received: by 10.55.183.70 with SMTP id h67mr8044936qkf.331.1518000745715; Wed, 07 Feb 2018 02:52:25 -0800 (PST) Received: from dhcp-135-24-192-103.dhcp.broadcom.net ([192.19.252.250]) by smtp.googlemail.com with ESMTPSA id a63sm834005qkj.70.2018.02.07.02.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Feb 2018 02:52:25 -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: [V1 6/6] mpt3sas: Introduce function to clone mpi reply. Date: Wed, 7 Feb 2018 02:51:50 -0800 Message-Id: <1518000710-17256-7-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1518000710-17256-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1518000710-17256-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 | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 52effd1..1c29286 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -126,6 +126,33 @@ 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 __iomem *reply_free_iomem = (void __iomem *)ioc->chip + + MPI_FRAME_START_OFFSET + + (cmd_credit * ioc->request_sz) + (index * sizeof(u32)); + + writel(reply, reply_free_iomem); +} + +/** * _base_clone_mpi_to_sys_mem - Writes/copies MPI frames * to system/BAR0 region. * @@ -1400,6 +1427,10 @@ _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, + cpu_to_le32(reply), + ioc->reply_free_host_index); writel(ioc->reply_free_host_index, &ioc->chip->ReplyFreeHostIndex); } @@ -6242,8 +6273,12 @@ _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, + (__le32)reply_address, i); + } /* initialize reply queues */ if (ioc->is_driver_loading)