From patchwork Wed Jul 26 05:36:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9864221 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 AFA2A6038F for ; Wed, 26 Jul 2017 05:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5A2B28720 for ; Wed, 26 Jul 2017 05:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E1C28725; Wed, 26 Jul 2017 05:52:56 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59C9328720 for ; Wed, 26 Jul 2017 05:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Y86nYxTFhKEvRqP1o2whMvMLR0wp8b6tgjQkzuR99AE=; b=Z1U3FmMZYmkR5xEBAXEmribpvk pykVBWZmdoRX1VPu5G16eM3GlNhq5PNzJgQJEfJsVjaOLCa2KFk4QpCQV7LIY0i7UlfZimUV/+lu1 Zg9UkAZ2vSSeOgEUlI+O1pffnCsX9WC55sNmrEnhYDxNu3IxCuHgwppX8e+3FeOiUzjHwcGHXdC+O QtxKFUXL3P3CzJT22iFtlJKcfJpZmmaVFecPstB/BaYlvUStzQedU26SaUPnWuApAUOsQR2QywIIT b0tW+SnCa2jC+K1vB7VxLK2W9mcI8gtscJHS8fTc9+olXbsR499ahNq/BP/OnWdqhZ+eaSIJLoidt kSyaDDRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1daFFg-0003A6-2a; Wed, 26 Jul 2017 05:52:56 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1daF1E-0003wu-OW for linux-arm-kernel@lists.infradead.org; Wed, 26 Jul 2017 05:38:08 +0000 Received: by mail-wm0-x229.google.com with SMTP id m85so57818571wma.1 for ; Tue, 25 Jul 2017 22:37:42 -0700 (PDT) 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=vjLNb62Cnh9eJR3eBWcXJTxcKGR6Qg7IuUA1XOL0ySA=; b=RAPBAYWpXWlciR0qR31OXP3QnDbxQ0iqL1LDJutqZFdGQQ6E1rVf4Q4+f5vdouib0A GLzZT/4ZwoGC8JJ6+VQ3tlu37n2HT2L8ocltDPYFWeXvNZV2PR+hmQRm5FkYdqcXrUox kGcHJvF7zMUJ/2wt2S7AGaBEmO+ViOkEsARRs= 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=vjLNb62Cnh9eJR3eBWcXJTxcKGR6Qg7IuUA1XOL0ySA=; b=m7cjPBbQj2lzk6/CNZiIC16Ewtwpr2rsf1r/F9TjFfXWfdKpHtSW+1Y5xBQo9IpDmG PkVVh+AXN7R/Mjxx9dZX7ZEVmXV+VGyBoCaKyEC3Rkr4vHrcSq5dnGpErxX+QLobVraq TCyZ/TBFOsf7hIfon9BgzXVRSbMnZGynVQhH1LGPGcMP0OX/Hu2qFB63rBRIKgp68ROd 9g5bg7WcEYl/+oVPwcQW76aCBenhJ84SE1X6YDtDdutpcvnyAcGG8yg1lz3Y/g7YuBck UbZ4+PZHEMzVhFa9QOfoK8wg5LKH1iqrUghQtaSss982kuIxHnVxSS++C6iac0nqGUTq 9DrA== X-Gm-Message-State: AIVw111EolNgPJEYh4oQszq8l+gyN1x/otfwo1pJeinZYAoPkbEmtcNC Lt1UpKsfJe/mDgR4 X-Received: by 10.28.140.67 with SMTP id o64mr10085482wmd.68.1501047461663; Tue, 25 Jul 2017 22:37:41 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id 34sm17417595wrt.36.2017.07.25.22.37.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 22:37:41 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Vinod Koul , Dan Williams Subject: [PATCH 2/6] dma: bcm-sba-raid: Peek mbox when we are left with no free requests Date: Wed, 26 Jul 2017 11:06:40 +0530 Message-Id: <1501047404-14456-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501047404-14456-1-git-send-email-anup.patel@broadcom.com> References: <1501047404-14456-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170725_223802_673873_A6E188E2 X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We should peek mbox channels when we are left with no free sba_requests in sba_alloc_request() Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden --- drivers/dma/bcm-sba-raid.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 6d15fed..321420b 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -199,6 +199,14 @@ static inline u32 __pure sba_cmd_pq_c_mdata(u32 d, u32 b1, u32 b0) /* ====== General helper routines ===== */ +static void sba_peek_mchans(struct sba_device *sba) +{ + int mchan_idx; + + for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++) + mbox_client_peek_data(sba->mchans[mchan_idx]); +} + static struct sba_request *sba_alloc_request(struct sba_device *sba) { unsigned long flags; @@ -210,8 +218,17 @@ static struct sba_request *sba_alloc_request(struct sba_device *sba) if (req) list_move_tail(&req->node, &sba->reqs_alloc_list); spin_unlock_irqrestore(&sba->reqs_lock, flags); - if (!req) + + if (!req) { + /* + * We have no more free requests so, we peek + * mailbox channels hoping few active requests + * would have completed which will create more + * room for new requests. + */ + sba_peek_mchans(sba); return NULL; + } req->flags = SBA_REQUEST_STATE_ALLOCED; req->first = req; @@ -558,17 +575,15 @@ static enum dma_status sba_tx_status(struct dma_chan *dchan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - int mchan_idx; enum dma_status ret; struct sba_device *sba = to_sba_device(dchan); - for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++) - mbox_client_peek_data(sba->mchans[mchan_idx]); - ret = dma_cookie_status(dchan, cookie, txstate); if (ret == DMA_COMPLETE) return ret; + sba_peek_mchans(sba); + return dma_cookie_status(dchan, cookie, txstate); }