Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934976AbdLSAre (ORCPT ); Mon, 18 Dec 2017 19:47:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44922 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933765AbdLSAra (ORCPT ); Mon, 18 Dec 2017 19:47:30 -0500 Subject: Re: [PATCH 03/13] powerpc/powernv: Add opal calls for opencapi To: Frederic Barrat , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, alastair@au1.ibm.com, arnd@arndb.de References: From: Andrew Donnellan Date: Tue, 19 Dec 2017 11:47:21 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17121900-0020-0000-0000-000003E14DBE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121900-0021-0000-0000-000042726006 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-18_17:,, 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-1712190006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3652 Lines: 84 On 19/12/17 02:21, Frederic Barrat wrote: > 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 Corresponding skiboot patch: https://patchwork.ozlabs.org/patch/849830/ 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); The function prototype on the skiboot side has slightly different parameter names: long capabilities, uint32_t rate_sz. > 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); > -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnellan@au1.ibm.com IBM Australia Limited