Received: by 10.223.164.202 with SMTP id h10csp1018647wrb; Tue, 7 Nov 2017 19:56:02 -0800 (PST) X-Google-Smtp-Source: ABhQp+T2M7bE79Nl7vkOy/iVuIY689u7XdBsBP4qm4s6nMJ39ytvDKM9PqVaSR7JMLyQcORYtGiQ X-Received: by 10.101.72.1 with SMTP id h1mr933026pgs.249.1510113362604; Tue, 07 Nov 2017 19:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510113362; cv=none; d=google.com; s=arc-20160816; b=PfLWcQyk4Vf5I1WOSIchEYufQCX7tSGQkGMvnsw2mhGnmvNYi8pnYqqfC60SzfWZmQ tuYT0DcZhIWqh+ecXL553sgwRyN8Wf945iOUA2KQq4lK5x5DUKYxi2fCBkDlOA6XuZ8i GLRoEDP63faIFAq0pBjFFLfSmHVueskT5bPNJXSpcYbzBmjdO+scBcMx/nIc4JB9avGU UvrdLv0bx2PtD6s6L5bNXsiopGnY6MxXZFBLGU6UtYwjGr/K4gMRqzrzEDappVk1GL3s 3nEMh8NP36WlCTUAvQMAFDP4mHIZpURAsHGP4jwpXBknS3D5dJcF9JULTJcaxdX1HZqk IO0w== 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=pVZZfkHHray0qNDNpCLlUawbn4C2TxHbI26nVYMnTzQ=; b=h5xAEOolRBy7E9qK9bQu7TjKznr1fF7XX6bvoFWhOkTB4/iqX5aMrc0Ur060Pj0f/s AmOUxyUIqRpYTcaBS6epxKpksR3hp393APcOhdb9HUcbPewxPsmXQKoXSBDYC6BKVWFa FVsybWjThfP193Z6fN2CLDDouMgMtF7K6uRoAbJab15KEYRJhrLiDF4IbKa3hQsp0V2J HDe6HUFYfK0yrqCcEMc+3VMfD4WBHoOUsC6ZYKpWTIQuFKuSQDE+qm+3bnR2ef5NFNau 5peiXHbL4im0DNROr/JzyqFHz/iwHBQ61yNvU13OUZTlpOBdUbPSj7EBcY62MT04pYqz fgkA== 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 v5si2893434pfl.215.2017.11.07.19.55.50; Tue, 07 Nov 2017 19:56:02 -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 S1753247AbdKHCYY (ORCPT + 90 others); Tue, 7 Nov 2017 21:24:24 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49382 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752908AbdKHCYU (ORCPT ); Tue, 7 Nov 2017 21:24:20 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA82O66r194118 for ; Tue, 7 Nov 2017 21:24:19 -0500 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2e3m26n09v-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 21:24:19 -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:18 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) 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:15 -0700 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA82OFCC60948732; Tue, 7 Nov 2017 19:24:15 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2EF76A03C; Tue, 7 Nov 2017 19:24:14 -0700 (MST) Received: from suka-w540.usor.ibm.com (unknown [9.70.94.25]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id 7ADBB6A043; Tue, 7 Nov 2017 19:24:14 -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 10/18] powerpc/vas, nx-842: Define and use chip_to_vas_id() Date: Tue, 7 Nov 2017 18:23:50 -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-00000CF6A958 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:17 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110802-0021-0000-0000-00005ED15325 Message-Id: <1510107838-15181-11-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 Define a helper, chip_to_vas_id() to map a given chip id to corresponding vas id. Normally, callers of vas_rx_win_open() and vas_tx_win_open() want the VAS window to be on the same chip where the calling thread is executing. These callers can pass in -1 for the VAS id. This interface will be useful if a thread running on one chip wants to open a window on another chip (like the NX-842 driver does during start up). Signed-off-by: Sukadev Bhattiprolu --- arch/powerpc/include/asm/vas.h | 9 +++++++++ arch/powerpc/platforms/powernv/vas.c | 11 +++++++++++ drivers/crypto/nx/nx-842-powernv.c | 18 +++--------------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index fd5963a..044748f 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -104,6 +104,15 @@ struct vas_tx_win_attr { }; /* + * Helper to map a chip id to VAS id. + * For POWER9, this is a 1:1 mapping. In the future this maybe a 1:N + * mapping in which case, we will need to update this helper. + * + * Return the VAS id or -1 if no matching vasid is found. + */ +int chip_to_vas_id(int chipid); + +/* * Helper to initialize receive window attributes to defaults for an * NX window. */ diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c index abb7090..cd9a733 100644 --- a/arch/powerpc/platforms/powernv/vas.c +++ b/arch/powerpc/platforms/powernv/vas.c @@ -123,6 +123,17 @@ struct vas_instance *find_vas_instance(int vasid) return NULL; } +int chip_to_vas_id(int chipid) +{ + int cpu; + + for_each_possible_cpu(cpu) { + if (cpu_to_chip_id(cpu) == chipid) + return per_cpu(cpu_vas_id, cpu); + } + return -1; +} + static int vas_probe(struct platform_device *pdev) { return init_vas_instance(pdev); diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c index 874ddf5..eb221ed 100644 --- a/drivers/crypto/nx/nx-842-powernv.c +++ b/drivers/crypto/nx/nx-842-powernv.c @@ -847,24 +847,12 @@ static int __init nx842_powernv_probe_vas(struct device_node *pn) return -EINVAL; } - for_each_compatible_node(dn, NULL, "ibm,power9-vas-x") { - if (of_get_ibm_chip_id(dn) == chip_id) - break; - } - - if (!dn) { - pr_err("Missing VAS device node\n"); + vasid = chip_to_vas_id(chip_id); + if (vasid < 0) { + pr_err("Unable to map chip_id %d to vasid\n", chip_id); return -EINVAL; } - if (of_property_read_u32(dn, "ibm,vas-id", &vasid)) { - pr_err("Missing ibm,vas-id device property\n"); - of_node_put(dn); - return -EINVAL; - } - - of_node_put(dn); - for_each_child_of_node(pn, dn) { if (of_device_is_compatible(dn, "ibm,p9-nx-842")) { ret = vas_cfg_coproc_info(dn, chip_id, vasid); -- 2.7.4 From 1584815445731966691@xxx Thu Nov 23 00:43:06 +0000 2017 X-GM-THRID: 1584815445731966691 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread