Received: by 10.223.176.46 with SMTP id f43csp4055846wra; Tue, 23 Jan 2018 03:36:25 -0800 (PST) X-Google-Smtp-Source: AH8x227INU/RQrkDi+tWxjUEBqzWkDAViKUouSejFgb85chMp7/ZbKMgNoqZiTPNeLfSA/NI2jC8 X-Received: by 10.98.71.197 with SMTP id p66mr10260680pfi.3.1516707385141; Tue, 23 Jan 2018 03:36:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516707385; cv=none; d=google.com; s=arc-20160816; b=sH0nK0his7MqzOXuUc98xkmJ1MBa8TR13SviMINfraMvMdsDERujTw3fs0mUvo3MFv JFZbtn4kTNRHKa3trup2KzybmV9DphuDptb7ze6jmLggmRLcXqkcSE5NsQkt7WhUdYah XbexOXm+bynbIGCst90ylTbxh++wAWS5aDm13TyAo0UCfTvqUEzH+HUrZ8GJBXOeBCwH SBLD7RYnoYnji94i54C2jBSQwa+e3x0ZpItfmO/QaqEMB5WF4yQO0x35PevRXJqRkxqc IFZBDYFzBmjNlsFsUoa3Ti85o1DeK3TDgKC8cuopudvsM5xX0bWhAeULuHkpnug2khYs Uapg== 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=VfLSKa+xLsVJa2BgrF41YN67X3ajcI6QgeJI9nkKdqk=; b=PFo6sexjR1tWg5EnxMwTpo4DHYOkUF1K0Pckn4kYuxq/qT+vylrKLmoyHbb54xZpQP H5S3WmpWXn84QPHq6DSv/8nl9qsAplG7onFf8RZEYKZVzOVkaY6XdaeZNQbKF+YGP5Ml f4JrHvXy0j6oIHpjXbDAe6gtoyxG1njB5970l2GaNk/lJux1EdtnILIOougC3nPCVvEg 03+bwfP6aLNjRi1NZDqw903zHqz/cM4JOIyWHlOunrhWYymElTs9YL3QqXzZWpCyfR2g cuhW2cSzb1+wJqgkhY3oAZ6eRwCkBhB7O8n6phBA1Ecfpj5RkwSlaBOqmXB3gD9hYXot 5LIg== 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 a9si14945016pgn.474.2018.01.23.03.36.10; Tue, 23 Jan 2018 03:36:25 -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 S1751530AbeAWLcB (ORCPT + 99 others); Tue, 23 Jan 2018 06:32:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56942 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751359AbeAWLb6 (ORCPT ); Tue, 23 Jan 2018 06:31:58 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0NBTcC9132045 for ; Tue, 23 Jan 2018 06:31:57 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fnyy8sv3s-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 23 Jan 2018 06:31:57 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 23 Jan 2018 11:31:55 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 23 Jan 2018 11:31:53 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0NBVqEr45547562; Tue, 23 Jan 2018 11:31:52 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD05EA4051; Tue, 23 Jan 2018 11:25:32 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9565AA404D; Tue, 23 Jan 2018 11:25:32 +0000 (GMT) Received: from borneo.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.34]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 23 Jan 2018 11:25:32 +0000 (GMT) From: Frederic Barrat To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, gregkh@linuxfoundation.org, mpe@ellerman.id.au, andrew.donnellan@au1.ibm.com, alastair@au1.ibm.com Subject: [PATCH v2 03/13] powerpc/powernv: Add opal calls for opencapi Date: Tue, 23 Jan 2018 12:31:38 +0100 X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180123113148.6024-1-fbarrat@linux.vnet.ibm.com> References: <20180123113148.6024-1-fbarrat@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18012311-0040-0000-0000-00000427E033 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18012311-0041-0000-0000-000020CB6196 Message-Id: <20180123113148.6024-4-fbarrat@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-23_03:,, 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-1709140000 definitions=main-1801230158 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add opal calls to interact with the NPU: OPAL_NPU_SPA_SETUP: set the Shared Process Area (SPA) The SPA is a table containing one entry (Process Element) per memory context which can be accessed by the opencapi device. OPAL_NPU_SPA_CLEAR_CACHE: clear the context cache The NPU keeps a cache of recently accessed memory contexts. When a Process Element is removed from the SPA, the cache for the link must be cleared. OPAL_NPU_TL_SET: configure the Transaction Layer The Transaction Layer specification defines several templates for messages to be exchanged on the link. During link setup, the host and device must negotiate what templates are supported on both sides and at what rates those messages can be sent. Signed-off-by: Frederic Barrat Acked-by: Andrew Donnellan --- arch/powerpc/include/asm/opal-api.h | 5 ++++- arch/powerpc/include/asm/opal.h | 6 ++++++ arch/powerpc/platforms/powernv/opal-wrappers.S | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 233c7504b1f2..24c73f5575ee 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -201,7 +201,10 @@ #define OPAL_SET_POWER_SHIFT_RATIO 155 #define OPAL_SENSOR_GROUP_CLEAR 156 #define OPAL_PCI_SET_P2P 157 -#define OPAL_LAST 157 +#define OPAL_NPU_SPA_SETUP 159 +#define OPAL_NPU_SPA_CLEAR_CACHE 160 +#define OPAL_NPU_TL_SET 161 +#define OPAL_LAST 161 /* Device tree flags */ diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 0c545f7fc77b..12e70fb58700 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -34,6 +34,12 @@ int64_t opal_npu_init_context(uint64_t phb_id, int pasid, uint64_t msr, uint64_t bdf); int64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid, uint64_t lpcr); +int64_t opal_npu_spa_setup(uint64_t phb_id, uint32_t bdfn, + uint64_t addr, uint64_t PE_mask); +int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn, + uint64_t PE_handle); +int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap, + uint64_t rate_phys, uint32_t size); int64_t opal_console_write(int64_t term_number, __be64 *length, const uint8_t *buffer); int64_t opal_console_read(int64_t term_number, __be64 *length, diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index 6f4b00a2ac46..1b2936ba6040 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S @@ -320,3 +320,6 @@ OPAL_CALL(opal_set_powercap, OPAL_SET_POWERCAP); OPAL_CALL(opal_get_power_shift_ratio, OPAL_GET_POWER_SHIFT_RATIO); OPAL_CALL(opal_set_power_shift_ratio, OPAL_SET_POWER_SHIFT_RATIO); OPAL_CALL(opal_sensor_group_clear, OPAL_SENSOR_GROUP_CLEAR); +OPAL_CALL(opal_npu_spa_setup, OPAL_NPU_SPA_SETUP); +OPAL_CALL(opal_npu_spa_clear_cache, OPAL_NPU_SPA_CLEAR_CACHE); +OPAL_CALL(opal_npu_tl_set, OPAL_NPU_TL_SET); -- 2.14.1