Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2294746pxj; Sun, 9 May 2021 22:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8jX/uFDImBGhIcN7ntBrhvvQTjt7ys9WEiw5GmBzNvlLO9tJBj0ZVM8sRK7rREvWhiMlH X-Received: by 2002:aa7:cf19:: with SMTP id a25mr27738395edy.231.1620624429252; Sun, 09 May 2021 22:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620624429; cv=none; d=google.com; s=arc-20160816; b=NUR3SlnfDsQUJhd4VsvoMvMrhGWpWY+bKVrqkPePNOLbCbaqxgbPyGuyRq4cSdafui aSONqkAKYB5jX8QIPcogHj0/vSDg7jy2GFwEtxtLzj5okcvcCGsDc6b7Wu2Pr4Txs63x 5PTgayP6fGF1ArrmJ8ZI2bmhRHdk9DhJZpJ+c4erSg2iljWM52Mik4r37vqRe0M03JP6 CgL5/L0g3pm7M30tnBWHb6pCHab663TaymS4jNgc3776MFlOEpzP6sZ8uhjng+2T0OH/ 24V2K9lIURJcA8d4gO32yZbaw/dTkUx/d3wtp6BxEP7oc85TsFYqAuoLmbEcH+lPfzNQ 49Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=eMGxbNhosL7JGExP8RG+UVOK+2Ce5mvNJK+Y3I/Wl8I=; b=LrObUrwxWPbU/aYpZga6AxJSgEj7JVcRFc4UKWfJbm6qCj20W7w9hdpvumW+tmNLFI WcAnC6LAQaue7SjDsSOHz9/L9IVgx73Zbm4+Q42rxRbmROa+x/Ysgkvc32ytiFRxWeYw uURjYOztazusGkbC76rB5Wkhb4Km6qoPmC0kMx1mxfzNAIC/fSKmFY+2Y+YwH+b3ZYtU EyfiMoTta2yhlpsEqvWDbGDpssCPhYtNjvdZOMJELnJYE/F+7RlEGgjOGmw6G6uUU7uI 73rJ8i/fvIg9XYGUlSI/K4gsPbzzWmVynh+wJs15QHkteRW7cZ9lkqmZyWJdaUqSKiI2 ORTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VRuWUElf; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si13124610edb.247.2021.05.09.22.26.35; Sun, 09 May 2021 22:27:09 -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=@gmail.com header.s=20161025 header.b=VRuWUElf; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhEJFUz (ORCPT + 99 others); Mon, 10 May 2021 01:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhEJFUz (ORCPT ); Mon, 10 May 2021 01:20:55 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15ECAC061573 for ; Sun, 9 May 2021 22:19:50 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id i14so12474312pgk.5 for ; Sun, 09 May 2021 22:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=eMGxbNhosL7JGExP8RG+UVOK+2Ce5mvNJK+Y3I/Wl8I=; b=VRuWUElfNVltT+hwkKPCv/1z0ZIZL0oGHvw49vWwWJvFSPDyYi/x2qyiJcYuEc4GXL NWT499/3Ry3PCPO8P93e+zKlaZCSxPEesZl10hEbqjyUz0s+v4hphVleU4/GwjC96AeC k2rTZH5gtTTXB1zA3rD8LuSy+JKryaP+ak/hYgIY22UT1z8m/u2reYF26OKFtpoDkayi sVzzMlOi7zVs/yuFgUigk73GCtBroK8p97P/CsJp/OrXgs2CcgCu7CM1osDSQjnG1bhq ArQQguL4q02plEVTFPsXDxmSWmjdyY1Q1MwqoD2utQDsKE8m2P8vi/O3EzoqI+1u8vKs 41XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=eMGxbNhosL7JGExP8RG+UVOK+2Ce5mvNJK+Y3I/Wl8I=; b=T6ntX213Yeg0Mhc1zixKhS2wz42LOV/uBBSldP6s/dJUkBh1sP+fqUqO/v0agxWlbz +c/e4OApiqQnVlguMvflbwOzZq1jDY8k+wYeLahcpK2dQARX53o4YYk00Gk65VcbJC32 ieBz6O+0Nu6fE6z/mqWQ/ca1PVN+R9UbLXw+jDh63A9FfUA9kVHqT/jdXAEFWB9Miixz b9vRZ0bJfYQwqAYTTPWqRGRztJVQCQh3JIj+GHQz5Pb700AwPHlepUhzds8A0kE+TCXd 0AIyFnibaom8YjwxYIIy4l76BsRNP4Lxuchq1Fojkw5Wn/N8PM+/i8/jUZ9zafNtkwBU r+Rg== X-Gm-Message-State: AOAM530T3V6UgIzhidqvUAMJqW5Lb+WoJpYdH88DoEHTvCFBwGFmtdgU fiVwbioW85aGMcGNFOC4Bo0= X-Received: by 2002:a63:9350:: with SMTP id w16mr23252826pgm.53.1620623988992; Sun, 09 May 2021 22:19:48 -0700 (PDT) Received: from localhost (60-241-47-46.tpgi.com.au. [60.241.47.46]) by smtp.gmail.com with ESMTPSA id u12sm18472978pji.45.2021.05.09.22.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 22:19:48 -0700 (PDT) Date: Mon, 10 May 2021 15:19:42 +1000 From: Nicholas Piggin Subject: Re: [PATCH V3 02/16] powerpc/vas: Move VAS API to common book3s platform To: Haren Myneni , herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: haren@us.ibm.com, hbabu@us.ibm.com References: <163867b893124434dfe3e13c6ba2f081c309e96f.camel@linux.ibm.com> In-Reply-To: <163867b893124434dfe3e13c6ba2f081c309e96f.camel@linux.ibm.com> MIME-Version: 1.0 Message-Id: <1620623481.kmr54zmxzv.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Excerpts from Haren Myneni's message of April 18, 2021 7:02 am: >=20 > Using the same /dev/crypto/nx-gzip interface for both powerNV and > pseries. The pseries NX driver will use the powernv VAS API ? > So this patch creates platforms/book3s/ and moves VAS API > to that directory. The actual functionality is not changed. >=20 > Common interface functions such as open, window open ioctl, mmap > and close are moved to arch/powerpc/platforms/book3s/vas-api.c > Added hooks to call platform specific code, but the underline > powerNV code in these functions is not changed. Even so, could you do one patch that just moves, and another that adds the ops struct? >=20 > Signed-off-by: Haren Myneni > --- > arch/powerpc/include/asm/vas.h | 22 ++++++- > arch/powerpc/platforms/Kconfig | 1 + > arch/powerpc/platforms/Makefile | 1 + > arch/powerpc/platforms/book3s/Kconfig | 15 +++++ > arch/powerpc/platforms/book3s/Makefile | 2 + The usual place for these would be arch/powerpc/sysdev/vas. E.g., see arch/powerpc/sysdev/xive. > .../platforms/{powernv =3D> book3s}/vas-api.c | 64 ++++++++++-------- > arch/powerpc/platforms/powernv/Kconfig | 14 ---- > arch/powerpc/platforms/powernv/Makefile | 2 +- > arch/powerpc/platforms/powernv/vas-window.c | 66 +++++++++++++++++++ > 9 files changed, 143 insertions(+), 44 deletions(-) > create mode 100644 arch/powerpc/platforms/book3s/Kconfig > create mode 100644 arch/powerpc/platforms/book3s/Makefile > rename arch/powerpc/platforms/{powernv =3D> book3s}/vas-api.c (83%) >=20 > diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/va= s.h > index 41f73fae7ab8..6bbade60d8f4 100644 > --- a/arch/powerpc/include/asm/vas.h > +++ b/arch/powerpc/include/asm/vas.h > @@ -5,6 +5,8 @@ > =20 > #ifndef _ASM_POWERPC_VAS_H > #define _ASM_POWERPC_VAS_H > +#include > + > =20 > struct vas_window; > =20 > @@ -48,6 +50,16 @@ enum vas_cop_type { > VAS_COP_TYPE_MAX, > }; > =20 > +/* > + * User space window operations used for powernv and powerVM > + */ > +struct vas_user_win_ops { > + struct vas_window * (*open_win)(struct vas_tx_win_open_attr *, > + enum vas_cop_type); > + u64 (*paste_addr)(void *); > + int (*close_win)(void *); > +}; > + > /* > * Receive window attributes specified by the (in-kernel) owner of windo= w. > */ > @@ -161,6 +173,9 @@ int vas_copy_crb(void *crb, int offset); > * assumed to be true for NX windows. > */ > 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_t= ype, > + const char *name); > +void vas_unregister_api_powernv(void); > =20 > /* > * Register / unregister coprocessor type to VAS API which will be expor= ted > @@ -170,8 +185,9 @@ int vas_paste_crb(struct vas_window *win, int offset,= bool re); > * Only NX GZIP coprocessor type is supported now, but this API can be > * used for others in future. > */ > -int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_t= ype, > - const char *name); > -void vas_unregister_api_powernv(void); > +int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_ty= pe, > + const char *name, > + struct vas_user_win_ops *vops); > +void vas_unregister_coproc_api(void); > =20 > #endif /* __ASM_POWERPC_VAS_H */ > diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kcon= fig > index 7a5e8f4541e3..594544a65b02 100644 > --- a/arch/powerpc/platforms/Kconfig > +++ b/arch/powerpc/platforms/Kconfig > @@ -20,6 +20,7 @@ source "arch/powerpc/platforms/embedded6xx/Kconfig" > source "arch/powerpc/platforms/44x/Kconfig" > source "arch/powerpc/platforms/40x/Kconfig" > source "arch/powerpc/platforms/amigaone/Kconfig" > +source "arch/powerpc/platforms/book3s/Kconfig" > =20 > config KVM_GUEST > bool "KVM Guest support" > diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Mak= efile > index 143d4417f6cc..0e75d7df387b 100644 > --- a/arch/powerpc/platforms/Makefile > +++ b/arch/powerpc/platforms/Makefile > @@ -22,3 +22,4 @@ obj-$(CONFIG_PPC_CELL) +=3D cell/ > obj-$(CONFIG_PPC_PS3) +=3D ps3/ > obj-$(CONFIG_EMBEDDED6xx) +=3D embedded6xx/ > obj-$(CONFIG_AMIGAONE) +=3D amigaone/ > +obj-$(CONFIG_PPC_BOOK3S) +=3D book3s/ > diff --git a/arch/powerpc/platforms/book3s/Kconfig b/arch/powerpc/platfor= ms/book3s/Kconfig > new file mode 100644 > index 000000000000..51e14db83a79 > --- /dev/null > +++ b/arch/powerpc/platforms/book3s/Kconfig > @@ -0,0 +1,15 @@ > +# SPDX-License-Identifier: GPL-2.0 > +config PPC_VAS > + bool "IBM Virtual Accelerator Switchboard (VAS)" > + depends on PPC_POWERNV && PPC_64K_PAGES > + default y > + help > + This enables support for IBM Virtual Accelerator Switchboard (VAS). > + > + VAS allows accelerators in co-processors like NX-GZIP and NX-842 > + to be accessible to kernel subsystems and user processes. > + VAS adapters are found in POWER9 and later based systems. > + The user mode NX-GZIP support is added on P9 for powerNV and on > + P10 for powerVM. > + > + If unsure, say "N". > diff --git a/arch/powerpc/platforms/book3s/Makefile b/arch/powerpc/platfo= rms/book3s/Makefile > new file mode 100644 > index 000000000000..e790f1910f61 > --- /dev/null > +++ b/arch/powerpc/platforms/book3s/Makefile > @@ -0,0 +1,2 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +obj-$(CONFIG_PPC_VAS) +=3D vas-api.o > diff --git a/arch/powerpc/platforms/powernv/vas-api.c b/arch/powerpc/plat= forms/book3s/vas-api.c > similarity index 83% > rename from arch/powerpc/platforms/powernv/vas-api.c > rename to arch/powerpc/platforms/book3s/vas-api.c > index 72d8ce39e56c..05d7b99acf41 100644 > --- a/arch/powerpc/platforms/powernv/vas-api.c > +++ b/arch/powerpc/platforms/book3s/vas-api.c > @@ -4,15 +4,20 @@ > * Copyright (C) 2019 Haren Myneni, IBM Corp > */ > =20 > +#include > #include > #include > #include > #include > #include > #include > +#include > +#include > +#include > +#include > #include > +#include > #include > -#include "vas.h" > =20 > /* > * The driver creates the device node that can be used as follows: > @@ -42,6 +47,7 @@ static struct coproc_dev { > dev_t devt; > struct class *class; > enum vas_cop_type cop_type; > + struct vas_user_win_ops *vops; > } coproc_device; > =20 > struct coproc_instance { > @@ -72,11 +78,10 @@ static int coproc_open(struct inode *inode, struct fi= le *fp) > static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg) > { > void __user *uptr =3D (void __user *)arg; > - struct vas_tx_win_attr txattr =3D {}; > struct vas_tx_win_open_attr uattr; > struct coproc_instance *cp_inst; > struct vas_window *txwin; > - int rc, vasid; > + int rc; > =20 > cp_inst =3D fp->private_data; > =20 > @@ -93,27 +98,20 @@ static int coproc_ioc_tx_win_open(struct file *fp, un= signed long arg) > } > =20 > if (uattr.version !=3D 1) { > - pr_err("Invalid version\n"); > + pr_err("Invalid window open API version\n"); > return -EINVAL; > } > =20 > - vasid =3D uattr.vas_id; > - > - vas_init_tx_win_attr(&txattr, cp_inst->coproc->cop_type); > - > - txattr.lpid =3D mfspr(SPRN_LPID); > - txattr.pidr =3D mfspr(SPRN_PID); > - txattr.user_win =3D true; > - txattr.rsvd_txbuf_count =3D false; > - txattr.pswid =3D false; > - > - pr_devel("Pid %d: Opening txwin, PIDR %ld\n", txattr.pidr, > - mfspr(SPRN_PID)); > + if (!cp_inst->coproc->vops && !cp_inst->coproc->vops->open_win) { > + pr_err("VAS API is not registered\n"); > + return -EACCES; > + } > =20 > - txwin =3D vas_tx_win_open(vasid, cp_inst->coproc->cop_type, &txattr); > + txwin =3D cp_inst->coproc->vops->open_win(&uattr, > + cp_inst->coproc->cop_type); > if (IS_ERR(txwin)) { > - pr_err("%s() vas_tx_win_open() failed, %ld\n", __func__, > - PTR_ERR(txwin)); > + pr_err("%s() VAS window open failed, %ld\n", __func__, > + PTR_ERR(txwin)); > return PTR_ERR(txwin); > } > =20 > @@ -125,9 +123,14 @@ static int coproc_ioc_tx_win_open(struct file *fp, u= nsigned long arg) > static int coproc_release(struct inode *inode, struct file *fp) > { > struct coproc_instance *cp_inst =3D fp->private_data; > + int rc =3D 0; > =20 > if (cp_inst->txwin) { > - vas_win_close(cp_inst->txwin); > + if (cp_inst->coproc->vops && cp_inst->coproc->vops->close_win) { > + rc =3D cp_inst->coproc->vops->close_win(cp_inst->txwin); > + if (rc) > + return rc; > + } > cp_inst->txwin =3D NULL; > } > =20 > @@ -168,7 +171,17 @@ static int coproc_mmap(struct file *fp, struct vm_ar= ea_struct *vma) > return -EINVAL; > } > =20 > - vas_win_paste_addr(txwin, &paste_addr, NULL); > + if (!cp_inst->coproc->vops && !cp_inst->coproc->vops->paste_addr) { > + pr_err("%s(): VAS API is not registered\n", __func__); > + return -EACCES; > + } > + > + paste_addr =3D cp_inst->coproc->vops->paste_addr(txwin); > + if (!paste_addr) { > + pr_err("%s(): Window paste address failed\n", __func__); > + return -EINVAL; > + } > + > pfn =3D paste_addr >> PAGE_SHIFT; > =20 > /* flags, page_prot from cxl_mmap(), except we want cachable */ > @@ -207,8 +220,8 @@ static struct file_operations coproc_fops =3D { > * Supporting only nx-gzip coprocessor type now, but this API code > * extended to other coprocessor types later. > */ > -int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_t= ype, > - const char *name) > +int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_ty= pe, > + const char *name, struct vas_user_win_ops *vops) > { > int rc =3D -EINVAL; > dev_t devno; > @@ -230,6 +243,7 @@ int vas_register_api_powernv(struct module *mod, enum= vas_cop_type cop_type, > } > coproc_device.class->devnode =3D coproc_devnode; > coproc_device.cop_type =3D cop_type; > + coproc_device.vops =3D vops; > =20 > coproc_fops.owner =3D mod; > cdev_init(&coproc_device.cdev, &coproc_fops); > @@ -262,9 +276,8 @@ int vas_register_api_powernv(struct module *mod, enum= vas_cop_type cop_type, > unregister_chrdev_region(coproc_device.devt, 1); > return rc; > } > -EXPORT_SYMBOL_GPL(vas_register_api_powernv); > =20 > -void vas_unregister_api_powernv(void) > +void vas_unregister_coproc_api(void) > { > dev_t devno; > =20 > @@ -275,4 +288,3 @@ void vas_unregister_api_powernv(void) > class_destroy(coproc_device.class); > unregister_chrdev_region(coproc_device.devt, 1); > } > -EXPORT_SYMBOL_GPL(vas_unregister_api_powernv); > diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platfo= rms/powernv/Kconfig > index 619b093a0657..043eefbbdd28 100644 > --- a/arch/powerpc/platforms/powernv/Kconfig > +++ b/arch/powerpc/platforms/powernv/Kconfig > @@ -33,20 +33,6 @@ config PPC_MEMTRACE > Enabling this option allows for runtime allocation of memory (RAM) > for hardware tracing. > =20 > -config PPC_VAS > - bool "IBM Virtual Accelerator Switchboard (VAS)" > - depends on PPC_POWERNV && PPC_64K_PAGES > - default y > - help > - This enables support for IBM Virtual Accelerator Switchboard (VAS). > - > - VAS allows accelerators in co-processors like NX-GZIP and NX-842 > - to be accessible to kernel subsystems and user processes. > - > - VAS adapters are found in POWER9 based systems. > - > - If unsure, say N. > - > config SCOM_DEBUGFS > bool "Expose SCOM controllers via debugfs" > depends on DEBUG_FS > diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platf= orms/powernv/Makefile > index 2eb6ae150d1f..c747a1f1d25b 100644 > --- a/arch/powerpc/platforms/powernv/Makefile > +++ b/arch/powerpc/platforms/powernv/Makefile > @@ -18,7 +18,7 @@ obj-$(CONFIG_MEMORY_FAILURE) +=3D opal-memory-errors.o > obj-$(CONFIG_OPAL_PRD) +=3D opal-prd.o > obj-$(CONFIG_PERF_EVENTS) +=3D opal-imc.o > obj-$(CONFIG_PPC_MEMTRACE) +=3D memtrace.o > -obj-$(CONFIG_PPC_VAS) +=3D vas.o vas-window.o vas-debug.o vas-fault.o va= s-api.o > +obj-$(CONFIG_PPC_VAS) +=3D vas.o vas-window.o vas-debug.o vas-fault.o > obj-$(CONFIG_OCXL_BASE) +=3D ocxl.o > obj-$(CONFIG_SCOM_DEBUGFS) +=3D opal-xscom.o > obj-$(CONFIG_PPC_SECURE_BOOT) +=3D opal-secvar.o > diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/p= latforms/powernv/vas-window.c > index 5f5fe63a3d1c..b973dd574b47 100644 > --- a/arch/powerpc/platforms/powernv/vas-window.c > +++ b/arch/powerpc/platforms/powernv/vas-window.c > @@ -16,6 +16,8 @@ > #include > #include > #include > +#include > +#include > #include "vas.h" > #include "copy-paste.h" > =20 > @@ -1441,3 +1443,67 @@ struct vas_window *vas_pswid_to_window(struct vas_= instance *vinst, > =20 > return window; > } > + > +static struct vas_window *vas_user_win_open(struct vas_tx_win_open_attr = *uattr, > + enum vas_cop_type cop_type) > +{ > + struct vas_tx_win_attr txattr =3D {}; > + > + vas_init_tx_win_attr(&txattr, cop_type); > + > + txattr.lpid =3D mfspr(SPRN_LPID); > + txattr.pidr =3D mfspr(SPRN_PID); > + txattr.user_win =3D true; > + txattr.rsvd_txbuf_count =3D false; > + txattr.pswid =3D false; > + > + pr_devel("Pid %d: Opening txwin, PIDR %ld\n", txattr.pidr, > + mfspr(SPRN_PID)); > + > + return vas_tx_win_open(uattr->vas_id, cop_type, &txattr); > +} > + > +static u64 vas_user_win_paste_addr(void *addr) > +{ > + u64 paste_addr; > + > + vas_win_paste_addr((struct vas_window *)addr, &paste_addr, NULL); > + > + return paste_addr; > +} > + > +static int vas_user_win_close(void *addr) > +{ > + struct vas_window *txwin =3D addr; > + > + vas_win_close(txwin); > + > + return 0; > +} > + > +static struct vas_user_win_ops vops =3D { > + .open_win =3D vas_user_win_open, > + .paste_addr =3D vas_user_win_paste_addr, > + .close_win =3D vas_user_win_close, > +}; > + > +/* > + * Supporting only nx-gzip coprocessor type now, but this API code > + * extended to other coprocessor types later. > + */ > +int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_t= ype, > + const char *name) > +{ > + int rc; > + > + rc =3D vas_register_coproc_api(mod, cop_type, name, &vops); > + > + return rc; > +} > +EXPORT_SYMBOL_GPL(vas_register_api_powernv); > + > +void vas_unregister_api_powernv(void) > +{ > + vas_unregister_coproc_api(); > +} > +EXPORT_SYMBOL_GPL(vas_unregister_api_powernv); > --=20 > 2.18.2 >=20 >=20 >=20