Received: by 10.223.164.202 with SMTP id h10csp1021393wrb; Tue, 7 Nov 2017 20:00:11 -0800 (PST) X-Google-Smtp-Source: ABhQp+SGWdRylLPmb+7tIo0wq/vKBv7Ks7IFLp+Vrn94fJhNUHJlRKE5enbUBiwouqWlsrX8i8sx X-Received: by 10.159.203.133 with SMTP id ay5mr944391plb.12.1510113610743; Tue, 07 Nov 2017 20:00:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510113610; cv=none; d=google.com; s=arc-20160816; b=Sya06MwqHut+whqBjVXIFsK4TuBBBu9EsJdylIVnZaRzKzs9wkVdL7yI/K1MoN7+7n t1OjPq8CvNeCQgLaCFH1aHY+b7UFyvbSj7UIHaPMft0dHjuJyd1L4Q2bjlvh4JvwyZl8 tIwiTUozqtivhF7rQENu1XbHL66xrBzu5GmarNl20zs+KLHg1dMQYDljGmU7LuFv9kAV B8fjx6UjQ1falTKj0KxY1LLCAnfPQd+jbNtoHgyhTJbue07W/DLy38tkrDFO+P/yTkva 0A9LAqo0JTfiekAzkn0+fFCxXj9PX8rMABNEaRU5ZzE4Oi1xKmOo4qn4YHjqA7FpOHC1 CIfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=fII0MeMAKO1aDw20TOpeqviYeFbRRPlWQDXTalY4Mx0=; b=nhBukoOflJrshG1OUOeJs31l5Rl5Os4oLTiIDwAg2RnA2d4q7votb2ROBDc07vZLvc 11SgasKYR1MXziQeZNkUmk+3o5E4C1sHk4Vf3cP9p3Ptuey12cZwHYvwWnGNxgiFp/fk rH0N8z3qEM4LbKvqSco5Vjftxm9CnlXQ+KtxQqZSmF9JMQIhk5V/gk7do8Ye3vNWKng0 scySVeZ/UEFY+6bLAhI8ObvRZGliY5njCDswuRfWI8HcQZs6WQ3y7ZLggSBDg0RuOa6z cSWUtLpTvTbO0SR70QMfLGBxtFwawjoYie+U8g2mk1izY00wy7ppUin+xViqxdNETDUy BIKA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si2667247pga.447.2017.11.07.19.59.58; Tue, 07 Nov 2017 20:00:10 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753035AbdKHCYM (ORCPT + 90 others); Tue, 7 Nov 2017 21:24:12 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44956 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752908AbdKHCYI (ORCPT ); Tue, 7 Nov 2017 21:24:08 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA82NsfF061848 for ; Tue, 7 Nov 2017 21:24:07 -0500 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e3q8evrs6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 21:24:06 -0500 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Nov 2017 19:24:06 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Nov 2017 19:24:03 -0700 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA82O2XK3997984; Tue, 7 Nov 2017 19:24:02 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9D8A6A043; Tue, 7 Nov 2017 19:24:02 -0700 (MST) Received: from suka-w540.usor.ibm.com (unknown [9.70.94.25]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id 47C0B6A03F; Tue, 7 Nov 2017 19:24:02 -0700 (MST) From: Sukadev Bhattiprolu To: Michael Ellerman Cc: Benjamin Herrenschmidt , mikey@neuling.org, hbabu@us.ibm.com, nicholas.piggin@gmail.com, linuxppc-dev@ozlabs.org, Subject: [PATCH v3 02/18] powerpc/vas: Validate window credits Date: Tue, 7 Nov 2017 18:23:42 -0800 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510107838-15181-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1510107838-15181-1-git-send-email-sukadev@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17110802-0020-0000-0000-00000CF6A947 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008029; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00942691; UDB=6.00475552; IPR=6.00722979; BA=6.00005677; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017903; XFM=3.00000015; UTC=2017-11-08 02:24:05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110802-0021-0000-0000-00005ED15307 Message-Id: <1510107838-15181-3-git-send-email-sukadev@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711080027 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NX-842, the only user of VAS, sets the window credits to default values but VAS should check the credits against the possible max values. The VAS_WCREDS_MIN is not needed and can be dropped. Signed-off-by: Sukadev Bhattiprolu --- arch/powerpc/platforms/powernv/vas-window.c | 6 ++++++ arch/powerpc/platforms/powernv/vas.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c index cec7ab7..a2fe120 100644 --- a/arch/powerpc/platforms/powernv/vas-window.c +++ b/arch/powerpc/platforms/powernv/vas-window.c @@ -738,6 +738,9 @@ static bool rx_win_args_valid(enum vas_cop_type cop, if (attr->rx_fifo_size > VAS_RX_FIFO_SIZE_MAX) return false; + if (attr->wcreds_max > VAS_RX_WCREDS_MAX) + return false; + if (attr->nx_win) { /* cannot be fault or user window if it is nx */ if (attr->fault_win || attr->user_win) @@ -927,6 +930,9 @@ static bool tx_win_args_valid(enum vas_cop_type cop, if (cop > VAS_COP_TYPE_MAX) return false; + if (attr->wcreds_max > VAS_TX_WCREDS_MAX) + return false; + if (attr->user_win && (cop != VAS_COP_TYPE_FTW || attr->rsvd_txbuf_count)) return false; diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h index 38dee5d..fea0de4 100644 --- a/arch/powerpc/platforms/powernv/vas.h +++ b/arch/powerpc/platforms/powernv/vas.h @@ -106,8 +106,8 @@ * * TODO: Needs tuning for per-process credits */ -#define VAS_WCREDS_MIN 16 -#define VAS_WCREDS_MAX ((64 << 10) - 1) +#define VAS_RX_WCREDS_MAX ((64 << 10) - 1) +#define VAS_TX_WCREDS_MAX ((4 << 10) - 1) #define VAS_WCREDS_DEFAULT (1 << 10) /* -- 2.7.4 From 1583451611408453762@xxx Tue Nov 07 23:25:33 +0000 2017 X-GM-THRID: 1581787339278420723 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread