Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1327324pxb; Sat, 17 Apr 2021 14:06:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNu9NtjnYGQoYDs6G//WveHHuhrnGSc/bycZLFcr3sNoPMp7XGrGtRyUZ/LYM8dlx6Jktc X-Received: by 2002:a17:906:b191:: with SMTP id w17mr14637068ejy.200.1618693608410; Sat, 17 Apr 2021 14:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618693608; cv=none; d=google.com; s=arc-20160816; b=N+Rw0IyXybdfmKQONMtNNRValrOWoIgPzHAStO51abK1aHwik16FnL8VmAbd0YyEV6 /xrWcy8UvcZKr9GTViGW2nK2vvbVzRfaQaFTUprUmeV6RhgwBkiNeXbEuMD2SiWxhSwY hqt3kZSaNaSrhjiIcVo+bdLEL3NI0VgBD+MH7gRqZEbTkRU8j0Vjig+3+PXZgpgfacak hq890V+o8zZT9DwNB1Vndk6WlB0Hf4bgH/xWLaMC/fzBJ5W0AGb7YNviyK7nEt2sttDl 3Qr4Th6mCAbXbcmtBGC7ueRI1raldmXX5hRq0l4o5R9y9FP86bGm4u9ABTGAjjlirm1k qUuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=olc+eomlGw3902fdR0WGyXodUkT7w/7aW0MiC+MUNFk=; b=d/dyb67MT/S3wOLuZSEPYQHS+OUixJ4KaAjnAemlcg9I8xHoNEXLjQkGn70Q2JsLHY aWDJldvZlkoMJmasOw11qsH+b4CY+twYcW7XO/cA5ZCO/1wQ3pxddY2jvFeBWHRX6qeE MTLYmyhDYsCzWgw0P9uYvZjOUm4aLNplkF3AvOxeDLB54xNyQWVsDEWNjY8rCcNmLkjJ V+jLgwp5DNgrTYoTOMQo6mGt3UYPBUEEmhvLdmN44ah11h1TlyIvIcFtZjMxSuiLlSKV G8TQVh8pxi/lPjSin/IX/bSnS102h5eItiZcKdk7RMWwkrdOJkDNHDnNMfM6F4waA8hE qU3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ScqKpq7U; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si7718518ejq.335.2021.04.17.14.06.25; Sat, 17 Apr 2021 14:06:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ScqKpq7U; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237083AbhDQVGQ (ORCPT + 99 others); Sat, 17 Apr 2021 17:06:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:6570 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237014AbhDQVGP (ORCPT ); Sat, 17 Apr 2021 17:06:15 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13HL3XqS039509; Sat, 17 Apr 2021 17:05:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=olc+eomlGw3902fdR0WGyXodUkT7w/7aW0MiC+MUNFk=; b=ScqKpq7U8tTB8WlNIFPOt+rzagWWtijwX7uenhJtqSzUiQIA+RRAN2nYyZJvVTBsTV6s 1lXFlpiMutulicagUWnImByp3tJA89PjBS9Kez+yBEhbLRZfb3GdYVId/2jTXv/VN1/0 QOYQt0wp82z3oEyPNSUQw3CmKGmEqqhHgGuwwVDunf1TdMXiyiycPwuy34DlaUaCnErG sgkQBSoxY3wZy+ezV2VFcUi9Ro7bImtYdehgJyZTtF2kHYefEG4TXSLyIWXB8l6G7893 xbcm0Es+c1vy0rn8AJfVxwbHed1J6EZIIa++IZiPLXNKO4O2v5dUHMoWZWuBSa4XsgGj Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37yrjmx85x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Apr 2021 17:05:43 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 13HL3lbS039770; Sat, 17 Apr 2021 17:05:43 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 37yrjmx85n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Apr 2021 17:05:42 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13HL2DvC004261; Sat, 17 Apr 2021 21:05:41 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma03wdc.us.ibm.com with ESMTP id 37yqa8dgwy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Apr 2021 21:05:41 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13HL5fIa8651304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 17 Apr 2021 21:05:41 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C04628058; Sat, 17 Apr 2021 21:05:41 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4323728059; Sat, 17 Apr 2021 21:05:40 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.232.48]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Sat, 17 Apr 2021 21:05:40 +0000 (GMT) Message-ID: <286ae5f4fdc4fd5620470cb0bf452e827e1f3864.camel@linux.ibm.com> Subject: [V3 PATCH 06/16] powerpc/pseries/vas: Define VAS/NXGZIP HCALLs and structs From: Haren Myneni To: linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org, mpe@ellerman.id.au, herbert@gondor.apana.org.au, npiggin@gmail.com Cc: hbabu@us.ibm.com, haren@us.ibm.com Date: Sat, 17 Apr 2021 14:05:38 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8z3_NzrbRT5UxeyNBzx3cTRUUqusxGm- X-Proofpoint-ORIG-GUID: Szl-Xz0iOIicmKM4YiAXuvFOtfCyThqV X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-17_15:2021-04-16,2021-04-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104170152 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch adds HCALLs and other definitions. Also define structs that are used in VAS implementation on powerVM. Signed-off-by: Haren Myneni --- arch/powerpc/include/asm/hvcall.h | 7 ++ arch/powerpc/include/asm/vas.h | 28 ++++++++ arch/powerpc/platforms/pseries/vas.h | 96 ++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 arch/powerpc/platforms/pseries/vas.h diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index ed6086d57b22..accbb7f6f272 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -294,6 +294,13 @@ #define H_RESIZE_HPT_COMMIT 0x370 #define H_REGISTER_PROC_TBL 0x37C #define H_SIGNAL_SYS_RESET 0x380 +#define H_ALLOCATE_VAS_WINDOW 0x388 +#define H_MODIFY_VAS_WINDOW 0x38C +#define H_DEALLOCATE_VAS_WINDOW 0x390 +#define H_QUERY_VAS_WINDOW 0x394 +#define H_QUERY_VAS_CAPABILITIES 0x398 +#define H_QUERY_NX_CAPABILITIES 0x39C +#define H_GET_NX_FAULT 0x3A0 #define H_INT_GET_SOURCE_INFO 0x3A8 #define H_INT_SET_SOURCE_CONFIG 0x3AC #define H_INT_GET_SOURCE_CONFIG 0x3B0 diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index f928bf4c7e98..d15784506a54 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -179,6 +179,7 @@ struct vas_tx_win_attr { bool rx_win_ord_mode; }; +#ifdef CONFIG_PPC_POWERNV /* * 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 @@ -243,6 +244,33 @@ int vas_paste_crb(struct vas_window *win, int offset, bool re); int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_type, const char *name); void vas_unregister_api_powernv(void); +#endif + +#ifdef CONFIG_PPC_PSERIES + +/* VAS Capabilities */ +#define VAS_GZIP_QOS_FEAT 0x1 +#define VAS_GZIP_DEF_FEAT 0x2 +#define VAS_GZIP_QOS_FEAT_BIT (1UL << (63 - VAS_GZIP_QOS_FEAT)) /* Bit 1 */ +#define VAS_GZIP_DEF_FEAT_BIT (1UL << (63 - VAS_GZIP_DEF_FEAT)) /* Bit 2 */ + +/* NX Capabilities */ +#define VAS_NX_GZIP_FEAT 0x1 +#define VAS_NX_GZIP_FEAT_BIT (1UL << (63 - VAS_NX_GZIP_FEAT)) /* Bit 1 */ +#define VAS_DESCR_LEN 8 + +struct vas_all_capabs_be { + __be64 descriptor; + __be64 feat_type; +} __packed __aligned(0x1000); + +struct vas_all_capabs { + char name[VAS_DESCR_LEN + 1]; + u64 descriptor; + u64 feat_type; +}; + +#endif /* * Register / unregister coprocessor type to VAS API which will be exported diff --git a/arch/powerpc/platforms/pseries/vas.h b/arch/powerpc/platforms/pseries/vas.h new file mode 100644 index 000000000000..208682fffa57 --- /dev/null +++ b/arch/powerpc/platforms/pseries/vas.h @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright 2020-21 IBM Corp. + */ + +#ifndef _VAS_H +#define _VAS_H +#include +#include +#include + +/* + * VAS window modify flags + */ +#define VAS_MOD_WIN_CLOSE (1UL << 63) +#define VAS_MOD_WIN_JOBS_KILL (1UL << (63 - 1)) +#define VAS_MOD_WIN_DR (1UL << (63 - 3)) +#define VAS_MOD_WIN_PR (1UL << (63 - 4)) +#define VAS_MOD_WIN_SF (1UL << (63 - 5)) +#define VAS_MOD_WIN_TA (1UL << (63 - 6)) +#define VAS_MOD_WIN_FLAGS (VAS_MOD_WIN_JOBS_KILL | VAS_MOD_WIN_DR | \ + VAS_MOD_WIN_PR | VAS_MOD_WIN_SF) + +#define VAS_WIN_ACTIVE 0x0 +#define VAS_WIN_CLOSED 0x1 +#define VAS_WIN_INACTIVE 0x2 /* Inactive due to HW failure */ +/* Process of being modified, deallocated, or quiesced */ +#define VAS_WIN_MOD_IN_PROCESS 0x3 + +#define VAS_COPY_PASTE_USER_MODE 0x00000001 +#define VAS_COP_OP_USER_MODE 0x00000010 + +/* + * Co-processor feature - GZIP QoS windows or GZIP default windows + */ +enum vas_cop_feat_type { + VAS_GZIP_QOS_FEAT_TYPE, + VAS_GZIP_DEF_FEAT_TYPE, + VAS_MAX_FEAT_TYPE, +}; + +struct vas_ct_capabs_be { + __be64 descriptor; + u8 win_type; /* Default or QoS type */ + u8 user_mode; + __be16 max_lpar_creds; + __be16 max_win_creds; + union { + __be16 reserved; + __be16 def_lpar_creds; /* Used for default capabilities */ + }; + __be16 target_lpar_creds; +} __packed __aligned(0x1000); + +struct vas_ct_capabs { + char name[VAS_DESCR_LEN + 1]; + u64 descriptor; + u8 win_type; /* Default or QoS type */ + u8 user_mode; /* User mode copy/paste or COP HCALL */ + u16 max_lpar_creds; /* Max credits available in LPAR */ + /* Max credits can be assigned per window */ + u16 max_win_creds; + union { + u16 reserved; /* Used for QoS credit type */ + u16 def_lpar_creds; /* Used for default credit type */ + }; + /* Total LPAR available credits. Can be different from max LPAR */ + /* credits due to DLPAR operation */ + atomic_t target_lpar_creds; + atomic_t used_lpar_creds; /* Used credits so far */ + u16 avail_lpar_creds; /* Remaining available credits */ +}; + +struct vas_capabs { + struct vas_ct_capabs capab; + struct list_head list; +}; + +struct vas_win_lpar_be { + __be16 version; + u8 win_type; + u8 status; + __be16 credits; /* No of credits assigned to this window */ + __be16 reserved; + __be32 pid; /* LPAR Process ID */ + __be32 tid; /* LPAR Thread ID */ + __be64 win_addr; + __be32 interrupt; /* Interrupt when NX request completes */ + __be32 fault; /* Interrupt when NX sees fault */ + /* Associativity Domain Identifiers as returned in */ + /* H_HOME_NODE_ASSOCIATIVITY */ + __be64 domain[6]; + __be64 win_util; /* Number of bytes processed */ +} __packed __aligned(0x1000); + +#endif /* _VAS_H */ -- 2.18.2