Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1685058ybi; Wed, 17 Jul 2019 20:06:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoMNKvuq+9K7aG1F8IB/wA6nqi2daSYQ4/vHwf4xHPBAKepb+yc9RQiiSE71lKB3Be6mdE X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr47065437pju.81.1563419173796; Wed, 17 Jul 2019 20:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563419173; cv=none; d=google.com; s=arc-20160816; b=dm6cAxr8X0vCGplQUDH9589jgI5PU0Byf2vCNNFpcqpWH8WJR/bzEqGtF0Tg3xOrrh E6Ld4QLeczjl3QWBJW6vOPbYjXeGi5UgumDyxPoKObxq8J8Knbxqnu5W4vL8pgcyLR7a zoBLt5lBHuPGDzvxXTslaRsDxkugPylPmmksRA7d7L5Nnf5pxAubhqvp3IG9BHIXzZi0 uZY7KBc60uy1n87c7oTAfLV3MpzieEV7Z90zjNAAmmq/nNyqNYOXTP2OYQGYDvrneAGa xAtkUg6sof0HyxTM/bgurRLGhRCWkvSkrH+HsZz85riCfILyRuDPB19JArctwF2fV54s 9cuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ae2n9eZo/LGD6s7X2Y0Y3C8Drdrvy/vkaRFiuyf7aj4=; b=SOMr0GQmqyy2fwa4O6pjBBdzRqxOl/oMHYx/V6DhiBAz1Tc07+FnsYVT/DjfWED34i ZgsSC5ZN6ScoMdFAdntK8/heqkFD/+nR2RxOKn2nyp2agWqL/eIAgt6FXxu9/5dRqH1V xcrZIIjip4ZHXTgvM9xQGhesFlPwUpuSdy85obP+rE/7+fhyDG9QVQ7cKiQWCVloT3gb ZDrzuL9/MNZ5EEtIfDT4yTo3avmfafG513EkwEgLJBQBZooZHFZuuETKcSfoMa4nSfvF PtqiYat8kGXOqU7E7kBVQUOF8CESfJstHUy+ETGicUkQGi6zkTGhxbu+P0pJ0gEtbFY0 ZoDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wjoqn8ex; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si635752pgm.406.2019.07.17.20.05.57; Wed, 17 Jul 2019 20:06:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wjoqn8ex; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389490AbfGRDDs (ORCPT + 99 others); Wed, 17 Jul 2019 23:03:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:34488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389458AbfGRDDo (ORCPT ); Wed, 17 Jul 2019 23:03:44 -0400 Received: from localhost (115.42.148.210.bf.2iij.net [210.148.42.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E5AF2173B; Thu, 18 Jul 2019 03:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563419023; bh=BJ9zIYxkn1CTCL32DcCF3xpYoTTLYqY6mHsnGFoEtVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjoqn8exHHgjFnc/OolCDwysEuAe9Q8P1SZVwc97I2Cg170GNKHpyYZ2COWBH7ghe SR0+RLk6iOK+rNGX+rMMrLmR2Z846zh8mfgPAkki0/kevxyYrUctDOq/iG0+NIbXdB cKSPFm7+0ml2kjlW4eyaVD2gHZL+L1pxWryXKY1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haren Myneni , Herbert Xu Subject: [PATCH 5.2 20/21] crypto/NX: Set receive window credits to max number of CRBs in RxFIFO Date: Thu, 18 Jul 2019 12:01:38 +0900 Message-Id: <20190718030035.970872560@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718030030.456918453@linuxfoundation.org> References: <20190718030030.456918453@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haren Myneni commit e52d484d9869eb291140545746ccbe5ffc7c9306 upstream. System gets checkstop if RxFIFO overruns with more requests than the maximum possible number of CRBs in FIFO at the same time. The max number of requests per window is controlled by window credits. So find max CRBs from FIFO size and set it to receive window credits. Fixes: b0d6c9bab5e4 ("crypto/nx: Add P9 NX support for 842 compression engine") CC: stable@vger.kernel.org # v4.14+ Signed-off-by:Haren Myneni Signed-off-by: Greg Kroah-Hartman Signed-off-by: Herbert Xu --- drivers/crypto/nx/nx-842-powernv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/crypto/nx/nx-842-powernv.c +++ b/drivers/crypto/nx/nx-842-powernv.c @@ -27,8 +27,6 @@ MODULE_ALIAS_CRYPTO("842-nx"); #define WORKMEM_ALIGN (CRB_ALIGN) #define CSB_WAIT_MAX (5000) /* ms */ #define VAS_RETRIES (10) -/* # of requests allowed per RxFIFO at a time. 0 for unlimited */ -#define MAX_CREDITS_PER_RXFIFO (1024) struct nx842_workmem { /* Below fields must be properly aligned */ @@ -812,7 +810,11 @@ static int __init vas_cfg_coproc_info(st rxattr.lnotify_lpid = lpid; rxattr.lnotify_pid = pid; rxattr.lnotify_tid = tid; - rxattr.wcreds_max = MAX_CREDITS_PER_RXFIFO; + /* + * Maximum RX window credits can not be more than #CRBs in + * RxFIFO. Otherwise, can get checkstop if RxFIFO overruns. + */ + rxattr.wcreds_max = fifo_size / CRB_SIZE; /* * Open a VAS receice window which is used to configure RxFIFO