Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1703669ybi; Wed, 17 Jul 2019 20:26:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjbqJ4hYXQuT9Xu6Bs41iDCVHMUfUU0nT4uofksCex6aA+otl5yVobredCM2v9RSds5azK X-Received: by 2002:a17:902:ba96:: with SMTP id k22mr48572372pls.44.1563420368045; Wed, 17 Jul 2019 20:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563420368; cv=none; d=google.com; s=arc-20160816; b=gArYZJSC0u8CpIxSEX/RhBWpZrVMT6YNu9xroLRjK62K1Y50bYghcVLlqNZ7F0q92X aQXhk3J/WJ/zI9RSfwQJnqB1+LP+9VYjJZvQqlBMahWR4BUqrHTWBq16Sw5mACxz+ZU5 hk0kIcry9JKRLsoNsN7tFfNA+ibTNOTEI8dWopCdPigTSubCoZ2DdVMODlXGH3JnpqDT TZMSlUE3HWKzfL4fsZ/lAalMZJRlxrI6uyworp2Ntlo3/VTX8bX747qAAPStyDW+eXCv T8cjsPFa23mNqmIkPHHkmMfyMmgaNm6Uk7+0DOBJQMBq2OnHd77YeYY0U34ks735Uo93 NAeQ== 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=zDJYnc0wvyfpLKL0W+HtPDmmIgBWVgp3EfjlCx3S3dk=; b=0Lo6R14QZDaQiD/SZLsuSiKKzfbdqJ8XKSt+bMgc1hcBqak2zMwG5xZyg6nbis52C5 /VgHUwgtlbswa1zA0cVGzP6xjMFNACTOiH0/MVP+adDSKzUDxSMb8iQIgHzUOfB0Dbta KFn2HZ1JfgundiAiLoj3+1ndjgq74fMuY7bqiTETm2QkcvPdeaZHRPhMvEjATc7VWKpy +FoapT8+ukp68sYFzJ3huIcpkb39oboH5XZ6aOo3JCwjPcUIf5+n7EPCmrpSXuH9zuRu +s3Iccz/LCTAe80SQWS9ZgWtYA6oVZt12nPjmr28D3pHQ19XAhIRBB6hPEPIpx6U2xQB wz5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dUyH5L/K"; 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 i68si105733plb.13.2019.07.17.20.25.51; Wed, 17 Jul 2019 20:26:08 -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="dUyH5L/K"; 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 S2391050AbfGRDXg (ORCPT + 99 others); Wed, 17 Jul 2019 23:23:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:39796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390574AbfGRDIA (ORCPT ); Wed, 17 Jul 2019 23:08:00 -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 D63C72173B; Thu, 18 Jul 2019 03:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563419279; bh=p7qARXKPniQ4Gp1UilfQNwHUhNLhD7ZHzbN/ZdiWL40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUyH5L/K6hgDi5fEs1k1+7HYwbr/yTnccLyHsqy1cjH/fY+Xr2s4BdYo8fncUhtA4 8ni7I80X62MtWub5mO99PLNp/1wjisNhmjIbhi0jQu0TfYdGr1B5gPp0qjIkX5PZ87 hRts4jzo60VMosB7rBS6WqCHkSqN2Li2uEzVFE10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haren Myneni , Herbert Xu Subject: [PATCH 4.19 42/47] crypto/NX: Set receive window credits to max number of CRBs in RxFIFO Date: Thu, 18 Jul 2019 12:01:56 +0900 Message-Id: <20190718030052.300915199@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190718030045.780672747@linuxfoundation.org> References: <20190718030045.780672747@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 @@ -36,8 +36,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 */ @@ -821,7 +819,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