From: Haren Myneni <haren@linux.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: mikey@neuling.org, npiggin@gmail.com, hch@infradead.org,
linux-crypto@vger.kernel.org, sukadev@linux.vnet.ibm.com,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 08/10] crypto/NX: Add NX GZIP user space API
Date: Thu, 19 Dec 2019 00:49:44 -0800 [thread overview]
Message-ID: <1576745384.12797.37.camel@hbabu-laptop> (raw)
In-Reply-To: <20191217093334.ihvz3fzzfgjwse32@gondor.apana.org.au>
On Tue, 2019-12-17 at 17:33 +0800, Herbert Xu wrote:
> On Sun, Dec 15, 2019 at 05:05:19AM -0800, Haren Myneni wrote:
> >
> > On power9, userspace can send GZIP compression requests directly to NX
> > once kernel establishes NX channel / window. This patch provides GZIP
> > engine access to user space via /dev/crypto/nx-gzip device node with
> > open, VAS_TX_WIN_OPEN ioctl, mmap and close operations.
> >
> > Each window corresponds to file descriptor and application can open
> > multiple windows. After the window is opened, mmap() system call to map
> > the hardware address of engine's request queue into the application's
> > virtual address space.
> >
> > Then the application can then submit one or more requests to the the
> > engine by using the copy/paste instructions and pasting the CRBs to
> > the virtual address (aka paste_address) returned by mmap().
> >
> > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> > Signed-off-by: Haren Myneni <haren@us.ibm.com>
> > ---
> > drivers/crypto/nx/Makefile | 2 +-
> > drivers/crypto/nx/nx-842-powernv.h | 2 +
> > drivers/crypto/nx/nx-commom-powernv.c | 21 ++-
> > drivers/crypto/nx/nx-gzip-powernv.c | 282 ++++++++++++++++++++++++++++++++++
> > 4 files changed, 304 insertions(+), 3 deletions(-)
> > create mode 100644 drivers/crypto/nx/nx-gzip-powernv.c
>
> We already have a kernel compress API which could be exposed
> to user-space through af_alg. If every driver created their
> own user-space API it would be unmanageable.
Thanks.
Virtual Accelerator Switchboard (VAS) can provide support different
accelerators, Right now only NX is used, but possible to extend to
others in future. Or different functionalities such as fast thread
wakeup (VAS feature) with VAS windows.
So looking common VAS API for any its accelerators. Need open a window /
channel - open() and ioctl()) calls, and setup the communications with
mapping address to NX (mmap()) and close the window. Then user space
communicates to accelerator directly without kernel involvement.
Specific drivers should set window attributes such as how many requests
can be send at same time and etc. All other interfaces should be same
for any accelerator.
Also, since user space sends requests directly, should restrict
malicious users to prevent overload NX (security issue). Allowing
sysadmin to restrict /dev/crypto/nx-gzip usage.
As you suggested, SW crypto API (af_alg) can be used just for NX
compression like using API based on the accelerator functionalities. It
is socket based API with AF_ALG socket family. But is there a way for
sysadmin to restrict usage from user space? Need just few functions in
struct proto.
static struct proto_ops {
.family = PF_ALG,
.ioctl = nxgzip_ioctl,
.mmap = nxgzip_mmap,
.release = nxgzip_release,
};
Thanks
Haren
>
> Cheers,
next prev parent reply other threads:[~2019-12-19 8:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-15 12:50 [PATCH 00/10] crypto/nx: Enable GZIP engine and provide userpace API Haren Myneni
2019-12-15 12:59 ` [PATCH 01/10] powerpc/vas: Define vas_win_paste_addr() Haren Myneni
2019-12-15 13:00 ` [PATCH 02/10] powerpc/vas: Initialize window attributes for GZIP compression Haren Myneni
2019-12-15 13:01 ` [PATCH 03/10] powerpc/vas: Define VAS_TX_WIN_OPEN ioctl API Haren Myneni
2019-12-15 13:02 ` [PATCH 04/10] crypto/nx: Initialize coproc entry with kzalloc Haren Myneni
2019-12-15 13:02 ` [PATCH 05/10] crypto/nx: Organize powernv 842 code to add new GZIP compression type Haren Myneni
2019-12-15 13:03 ` [PATCH 06/10] crypto/NX: Make code generic to add new GZIP compression Haren Myneni
2019-12-15 13:03 ` [PATCH 07/10] crypto/nx: Enable and setup GZIP compresstion type Haren Myneni
2019-12-15 13:05 ` [PATCH 08/10] crypto/NX: Add NX GZIP user space API Haren Myneni
2019-12-17 9:33 ` Herbert Xu
2019-12-19 8:49 ` Haren Myneni [this message]
2019-12-20 7:41 ` Herbert Xu
2019-12-15 13:05 ` [PATCH 09/10] powerpc/vas: Remove 'pid' in vas_tx_win_attr struct Haren Myneni
2019-12-15 13:06 ` [PATCH 10/10] Documentation/powerpc: VAS API Haren Myneni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1576745384.12797.37.camel@hbabu-laptop \
--to=haren@linux.ibm.com \
--cc=hch@infradead.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=npiggin@gmail.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox