Received: by 10.223.164.202 with SMTP id h10csp1019255wrb; Tue, 7 Nov 2017 19:57:00 -0800 (PST) X-Google-Smtp-Source: ABhQp+QjfUzopjWz/ZZrnexs5cT93cNk8fCYAATopm646o2MQvr9JlgzRZJIP75Tue+Vj+Td8vLe X-Received: by 10.99.146.76 with SMTP id s12mr970827pgn.354.1510113420097; Tue, 07 Nov 2017 19:57:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510113420; cv=none; d=google.com; s=arc-20160816; b=kDrgVz7E6bkuCesXWV7oZbSzXfbQDjkLzwH5RkoOax8DCTVUyepYMU5sB6FAMgDtcm uatsB2wTDpOk3GChGEf3BoKEFUSpCfKvX5O/xTwf/IsGPC6T9tl4Btv+OXxqoqSCh7bB 5T/8zj2NSL9qrM7be9q6Mgx9jPx1Ymr6H+k6Bf+O1RjXMozf2rpzip2WSXH7UAXavVA8 1AeWoaD94XiEfCG419VffkvjR1dLK9medZqGWg7WuR/JD2GCpvb2JOpHG1Gy+Z5xvRkS YYA0lCQ7KQbS97DEu+YMuOBmHU1iLkziZr4GPkwZsgcXt5DhsVxfqTC0Bv0SGE+3x1O1 qOgA== 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=+oxgWFUfg+RMiGrjlsxuMzz/d1GxQrVO2g+rVbSTD3Y=; b=o+T7wfMS/Kx5uKNVqvmoJmc9+hcOA9+G39Rb4QtqZh8CJ1TcABsG1cXxkB8mb5RvMt AoD4HiG8ocJwzFDCXwxT21lyipVcN6qGk26mgG3H5OVYJdpN0YAbCFCIsfTfADEiRjJz djWp9gmNPbzMPbmIxsWElp1Eo8DwkCumXVMQ9N49H0hRUSW6Ya6/yvN+vw92qPEUqfH1 Ypi6TseB0T4jlsDFNkODBl3Q5GoRkW4E3vvZcNu31h2F/cnSPSQCNT/N+eT7OCpWHT6K Rh7rvgOaDPePH2yXQ+exVSQq9jibLErJ6+crAqzweFJ11FLc365FgjfMP/QXW73DAQja aFrA== 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 m16si2743536plk.258.2017.11.07.19.56.47; Tue, 07 Nov 2017 19:57:00 -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 S1753211AbdKHCYW (ORCPT + 90 others); Tue, 7 Nov 2017 21:24:22 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52544 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753156AbdKHCYT (ORCPT ); Tue, 7 Nov 2017 21:24:19 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA82Nvo2067307 for ; Tue, 7 Nov 2017 21:24:18 -0500 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e3j9323h4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 21:24:18 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Nov 2017 19:24:17 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Nov 2017 19:24:13 -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 vA82ODsK6291896; Tue, 7 Nov 2017 19:24:13 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63E946A041; Tue, 7 Nov 2017 19:24:13 -0700 (MST) Received: from suka-w540.usor.ibm.com (unknown [9.70.94.25]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id EFDC06A03B; Tue, 7 Nov 2017 19:24:12 -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 09/18] powerpc/vas: Create cpu to vas id mapping Date: Tue, 7 Nov 2017 18:23:49 -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-0016-0000-0000-000007C5B185 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.00475553; 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:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110802-0017-0000-0000-00003C2A38DC Message-Id: <1510107838-15181-10-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 Create a cpu to vasid mapping so callers can specify -1 instead of trying to find a VAS id. Changelog[v2] [Michael Ellerman] Use per-cpu variables to simplify code. Signed-off-by: Sukadev Bhattiprolu --- arch/powerpc/platforms/powernv/vas.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c index 565a487..abb7090 100644 --- a/arch/powerpc/platforms/powernv/vas.c +++ b/arch/powerpc/platforms/powernv/vas.c @@ -18,15 +18,18 @@ #include #include #include +#include #include "vas.h" static DEFINE_MUTEX(vas_mutex); static LIST_HEAD(vas_instances); +static DEFINE_PER_CPU(int, cpu_vas_id); + static int init_vas_instance(struct platform_device *pdev) { - int rc, vasid; + int rc, cpu, vasid; struct resource *res; struct vas_instance *vinst; struct device_node *dn = pdev->dev.of_node; @@ -74,6 +77,11 @@ static int init_vas_instance(struct platform_device *pdev) "paste_win_id_shift 0x%llx\n", pdev->name, vasid, vinst->paste_base_addr, vinst->paste_win_id_shift); + for_each_possible_cpu(cpu) { + if (cpu_to_chip_id(cpu) == of_get_ibm_chip_id(dn)) + per_cpu(cpu_vas_id, cpu) = vasid; + } + mutex_lock(&vas_mutex); list_add(&vinst->node, &vas_instances); mutex_unlock(&vas_mutex); @@ -98,6 +106,10 @@ struct vas_instance *find_vas_instance(int vasid) struct vas_instance *vinst; mutex_lock(&vas_mutex); + + if (vasid == -1) + vasid = per_cpu(cpu_vas_id, smp_processor_id()); + list_for_each(ent, &vas_instances) { vinst = list_entry(ent, struct vas_instance, node); if (vinst->vas_id == vasid) { -- 2.7.4 From 1583483323539638345@xxx Wed Nov 08 07:49:36 +0000 2017 X-GM-THRID: 1583403757964943611 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread