Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp283598pxj; Wed, 16 Jun 2021 02:13:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO57R+bE7yn/On9OHXxkg0l17WGn1eiGOMyxjao9jH6AfsChiPgL9hjLelsTOYIkpp1NCl X-Received: by 2002:aa7:c38f:: with SMTP id k15mr2672563edq.156.1623834787039; Wed, 16 Jun 2021 02:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623834787; cv=none; d=google.com; s=arc-20160816; b=T2cQXp0w2KM2VYWF6ph6q8au0SSoXuKObKCcYUDRljcEu4YbGQ6Wplu8roYlQd6Zqw QvAoyz+dzmJzNhIAQuLYS0x8gJWbsaF4xXJUis9p8tMES59f5uIKYn0PoyYgQaL2LQV7 TnM7eenMzWcD7a0Y1n5uTAqc2Y2BbaRd8idk5p2/BFQ043YhOYnhR03WJ8qcrzkjczGW eFLGJvVL56dfxjFRp4UahDD6Qdk1IxBMHGvDc+y1DQ144jFsnehzQmFHqWeNN7EgSCHV U+n9NZ7Qb08jQX+o1VJeHzk7p3YsY8V6b5RCvfHer6VAZGNAR8VD7MsCwxo8FIz+hn74 Nq6Q== 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=KtVdMb/6axa2rNnzxWBctbX/60Uc/ENo0T3/IaoLfho=; b=c6HT+vcMAI2f4tzO7OyqvCOOVeVyVT/f1u1RL1kLlqZPRT5IoBip0HZJR2wTO3m8ok HdycUiYw1bKK6/MJAEe+paC4+GnuGkBBhuQ4uxQBuJqHCRo4B4sBFW4SNhUbZoPQ+RmZ nFxlB0vrKIiwFwxIvz3wR4cOQwSbls3k1XtPzVSJWm2pynxJC/EcmcXcT7mBZNmQCaFD god4iFsUUcL5mY8hU3jV4nqXCojFZV/Qr5FOHwMZdpuzxZKDqBntgzmfpUtKQQgOYHG8 YOsv/0/xsreokiAX2RupwgFCft4fHRDe2aUe78q0V7bMTDqAWCBQjcnhhxyWxVf29JPb bGag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qcvIkQTt; 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 w15si1747216edj.25.2021.06.16.02.12.10; Wed, 16 Jun 2021 02:13:07 -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=qcvIkQTt; 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 S232217AbhFPJN4 (ORCPT + 99 others); Wed, 16 Jun 2021 05:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232108AbhFPJNz (ORCPT ); Wed, 16 Jun 2021 05:13:55 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22FFCC061574 for ; Wed, 16 Jun 2021 02:11:49 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id q15so1425927pgg.12 for ; Wed, 16 Jun 2021 02:11:49 -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=KtVdMb/6axa2rNnzxWBctbX/60Uc/ENo0T3/IaoLfho=; b=qcvIkQTtpPF0I+gN5iCvyP9ggl5XqSW4PJpsnIoGvVVckTmWiP5TV2ZMxiHaYXEX22 UPbNzqeQ8J1M5ziNfdgDaxzmWJok/77O5B+CxV7rrkmd6YaWPQndrt1stBXAwytgPrHB 4FWZYhZdYcoevju4mz/SKTFMGWcVuBvVFL/DCmGn0w0R7sOLtRttU4TPISiHduDUCKaB mbIwv+Y4DGyVx6ZZmiRvKCo1R5ELUk/MaOeqSg5c6FWffnYjM2sd7uqJQmHo9lGgX/ug oK0Czx1HPTR5BVGzl5c1VT0/f982B/zR+PfkeX5jrpSiCz4Pd4ZbxPi3hcO4pwSlmng6 DeNw== 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=KtVdMb/6axa2rNnzxWBctbX/60Uc/ENo0T3/IaoLfho=; b=jLyHUcP08gj3cqk8YF2bmJ/SG9TTfUSS7RD97PrY4T/k9xsBgw5bVtrchVmTukJ90f dqPvtBzXZ5rh/QaDaj759zLSV3zVwuLZpe9QOReAfGB7FA2M1m9yZVDWfrjS13+6qFpv FmcgPqVK+0DhsqgMp7hJXJKdnQPmF+qpcDV46M6MR/GXf+fmmuIFydxMStmwnQcSVc1r M6eluWXRjgzkIK9JyhpJXNnUtwUjTosNPR9WJuvIHESztAfgzReYZbBV6A64q7+NFjhL BtF0M3fpUehOPvCmT5BThcl5od0bKknefUIphiduXUDamhrgiR89mJJduQyJFLhMOg4n +yCA== X-Gm-Message-State: AOAM533IsZoF5L2r4zBAKKefbpbjyHKtG++bFdYhiEiE5CzijC472mxl cgnHJycEPeIEDWAdc1SWvI8= X-Received: by 2002:a63:6982:: with SMTP id e124mr3900515pgc.439.1623834708645; Wed, 16 Jun 2021 02:11:48 -0700 (PDT) Received: from localhost (60-242-147-73.tpgi.com.au. [60.242.147.73]) by smtp.gmail.com with ESMTPSA id d12sm1576296pfo.113.2021.06.16.02.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 02:11:48 -0700 (PDT) Date: Wed, 16 Jun 2021 19:11:42 +1000 From: Nicholas Piggin Subject: Re: [PATCH v5 04/17] powerpc/vas: Add platform specific user window operations 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: <1623636838.8tsdy9nisc.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1623834468.xkn6to1dom.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 June 15, 2021 4:37 pm: > On Mon, 2021-06-14 at 12:24 +1000, Nicholas Piggin wrote: >> Excerpts from Haren Myneni's message of June 13, 2021 8:57 pm: >> > PowerNV uses registers to open/close VAS windows, and getting the >> > paste address. Whereas the hypervisor calls are used on PowerVM. >> >=20 >> > This patch adds the platform specific user space window operations >> > and register with the common VAS user space interface. >> >=20 >> > Signed-off-by: Haren Myneni >> > --- >> > arch/powerpc/include/asm/vas.h | 14 +++++- >> > arch/powerpc/platforms/book3s/vas-api.c | 53 +++++++++++++-- >> > ------ >> > arch/powerpc/platforms/powernv/vas-window.c | 45 ++++++++++++++++- >> > 3 files changed, 89 insertions(+), 23 deletions(-) >> >=20 >> > diff --git a/arch/powerpc/include/asm/vas.h >> > b/arch/powerpc/include/asm/vas.h >> > index bab7891d43f5..85318d7446c7 100644 >> > --- a/arch/powerpc/include/asm/vas.h >> > +++ b/arch/powerpc/include/asm/vas.h >> > @@ -5,6 +5,7 @@ >> > =20 >> > #ifndef _ASM_POWERPC_VAS_H >> > #define _ASM_POWERPC_VAS_H >> > +#include >> > =20 >> > struct vas_window; >> > =20 >> > @@ -48,6 +49,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)(struct vas_window *); >> > + int (*close_win)(struct vas_window *); >> > +}; >>=20 >> This looks better, but rather than pull in uapi and the user API=20 >> structure here, could you just pass in vas_id and flags after the >> common=20 >> code does the user copy and verifies the version and other details? >>=20 >> I think it's generally good practice to limit the data that the usre >> can influence as much as possible. Sorry for not picking up on that >> earlier. >=20 > The user space pass vas_tx_win_open_attr struct - use only vas_id and > flags right now but it can be extended in future with reserve elements. > So passing the same struct to platform specific API. >=20 > do you prefer "struct vas_window * (*open_win)(vas_id, flags, cop)" and > extend later when more elments are used? Yes I think so. The reason being so you don't sending data under the control of user very far into the kernel. Better safe than sorry. Thanks, Nick