Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp756522pxb; Thu, 9 Sep 2021 11:13:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBag5tun8GBnK7InAjJzR4RhudK4qt3FtUupJfGnW2Y0PjhfaF93o7DHw5TW3jbvQob0Fs X-Received: by 2002:a17:906:260b:: with SMTP id h11mr4821316ejc.215.1631211225333; Thu, 09 Sep 2021 11:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631211225; cv=none; d=google.com; s=arc-20160816; b=VomDp4voYWKjiUXJMekuaj8TlhVG/BrqO3wNLNDMQ1V148Fv0sL395sG0Zyj6LX5Oj nuRbLpLMMhisrYnfw4DzggrdchNl4rb6nNKkT7IvF7Mtl6TDHrJw+LwjyFCOwQfi0pV6 IyIER2qTWla26MrAPcIcIvK3XY4m5RgdueOvwakgHWkz2igqof+TjCNl8WeSZl+hUNg3 G0Vdwm0tugfY2K5EcdXmEbqSyQ1Hf3TPlIt8fJSiQ3nVxdDcXV3DU+wiA4AlFIzZINCf h3BNaVdT261s2w+NTVu+1uGtfpgZRBwoy+2gp2KEqzmpd/VUq9fBZaxr4bIaJbH3chFs mw4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oYzdplyM18KY0Rs8AvP7jRRMtS3fev77XkdskNX9cmc=; b=OEInND5dcrnm+Z0CURZFjChxSUEafBqx3x3pxu3Zvpks+MY/fAmBQYs6WQoe7zkxdN eU7RPai52R72RN2g9/4gQKHdVJjKBDKtkYeRi5/DwIlO5T+48LiAsqTvY2/8pwuzk0WY vxFL1Kw3JFujZ+QPlMbKbnKP2ocjqe1PidpVulPhL/42FMqLfXz/2aUuqEmhm0xT7kqA gyDrllU7JOp5Ai4Ox5VXR9dSrnNrTfKGfRrLSzxucK/cJ+zbZ6zF+gABS3j29LAuc6j5 MCOYArfNZ1X5Rp0sVwOfGebvH1deAmv66aKj1gON8K0YVrTAPloVsG9r/S9EhEh8C6Lw FbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZR+lGDI9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si2716283ejx.491.2021.09.09.11.13.20; Thu, 09 Sep 2021 11:13:45 -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=@google.com header.s=20210112 header.b=ZR+lGDI9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243824AbhIISOW (ORCPT + 99 others); Thu, 9 Sep 2021 14:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244722AbhIISOT (ORCPT ); Thu, 9 Sep 2021 14:14:19 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED97AC061575 for ; Thu, 9 Sep 2021 11:13:09 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so2128790pjc.3 for ; Thu, 09 Sep 2021 11:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oYzdplyM18KY0Rs8AvP7jRRMtS3fev77XkdskNX9cmc=; b=ZR+lGDI9LQg3dBtisyxTNm+HrbpIznzitrU0/yGTRHNMwChDKiR/owHUXKZTFgn/DW lDK+N+zsp3x/AcjIhqSh64wZcb/Fg4Um1uwRLHAf5ISFDW2KRa9ttt8Z1Rn4hqT9YX5c 6J6gFEa93O2XZ3gmgfvfHywZwVUHzwRmdCdHW2malFgfBuBU3FAhksfJZESzKGjpX11g pJmYmOetRt5HuKgC+7I49jLfrUHg5jhqnRw0kiCmjldscemLhWTopFYo1Lbb3M9L7UUC zwa+C/MspbQlDyNCK78koAsA4WHdGMom9cWg+O0zfZKB6oiwtXKK8rSJ/b73ojpVzwah oTvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oYzdplyM18KY0Rs8AvP7jRRMtS3fev77XkdskNX9cmc=; b=3s/5amcyKT+XB9628rMwtsjU3sM6pbvqQ7v0rbW07/jFYi5ntBAowtswbrO0629Scc zC/m3RFtfQiJfrsWTic9znFc0cGg2uPlYpSo5YpEC05LBukgD69W823v2Vw80pwCfvm6 EPqVeEx+SiAgtQQzalbG0bwdMqh9WC4gEorCZ+k0f5447gVt3qfsb45sn+N6oLEUxDvb ZtShn0rRD37GGYzim1Uz1p88DeWSFOfkE7mdRlkLakJ6ihLWXzjZKz394fiAcbX+Avop M9fLBKzsBbf5Q19k4O+B18bvpV2GuhcD14Q2ksUcwHYS8AM6AjmphsoDZhdwoQILMwL5 VKQA== X-Gm-Message-State: AOAM5305IsX346FhlSY0TfUEzllr4O7Wm8ZQ/y3C86+4+RGINlKmh1i+ 01O0rS7pAiomKryTTKUpYG+Z0A== X-Received: by 2002:a17:902:7c93:b0:13a:a1e:dd2d with SMTP id y19-20020a1709027c9300b0013a0a1edd2dmr3821810pll.12.1631211189217; Thu, 09 Sep 2021 11:13:09 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id h20sm2876865pfn.173.2021.09.09.11.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 11:13:08 -0700 (PDT) Date: Thu, 9 Sep 2021 18:13:05 +0000 From: Sean Christopherson To: Brijesh Singh Cc: Mingwei Zhang , Paolo Bonzini , Tom Lendacky , John Allen , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Alper Gun , Borislav Petkov , David Rienjes , Marc Orr , Peter Gonda , Vipin Sharma Subject: Re: [PATCH v2 3/4] KVM: SVM: move sev_bind_asid to psp Message-ID: References: <20210818053908.1907051-1-mizhang@google.com> <20210818053908.1907051-4-mizhang@google.com> <8421f104-34e8-cc68-1066-be95254af625@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8421f104-34e8-cc68-1066-be95254af625@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Sep 09, 2021, Brijesh Singh wrote: > > On 9/7/21 6:37 PM, Sean Christopherson wrote: > > On Tue, Sep 07, 2021, Brijesh Singh wrote: > > > I have no strong preference for either of the abstraction approaches. The > > > sheer number of argument can also make some folks wonder whether such > > > abstraction makes it easy to read. e.g send-start may need up to 11. > > > > Yeah, that's brutal, but IMO having a few ugly functions is an acceptable cost if > > it means the rest of the API is cleaner. E.g. KVM is not the right place to > > implement sev_deactivate_lock, as any coincident DEACTIVATE will be problematic. > > The current code "works" because KVM is the only in-tree user, but even that's a > > bit of a grey area because sev_guest_deactivate() is exported. > > > > If large param lists are problematic, one idea would be to reuse the sev_data_* > > structs for the API. I still don't like the idea of exposing those structs > > outside of the PSP driver, and the potential user vs. kernel pointer confusion > > is more than a bit ugly. On the other hand it's not exactly secret info, > > e.g. KVM's UAPI structs are already excrutiatingly close to sev_data_* structs. > > > > For future ioctls(), KVM could even define UAPI structs that are bit-for-bit > > compatible with the hardware structs. That would allow KVM to copy userspace's > > data directly into a "struct sev_data_*" and simply require the handle and any > > other KVM-defined params to be zero. KVM could then hand the whole struct over > > to the PSP driver for processing. > > Most of the address field in the "struct sev_data_*" are physical > addressess. The userspace will not be able to populate those fields. Yeah, that's my biggest hesitation to using struct sev_data_* in the API, it's both confusing and gross. But it's also why I think these helpers belong in the PSP driver, KVM should not need to know the "on-the-wire" format for communicating with the PSP. > PSP or KVM may still need to assist filling the final hardware structure. > Some of fields in hardware structure must be zero, so we need to add checks > for it. > I can try posting RFC post SNP series and we can see how it all looks. I'm a bit torn. I completely understand the desire to get SNP support merged, but at the same time KVM has accrued a fair bit of technical debt for SEV and SEV-ES, and the lack of tests is also a concern. I don't exactly love the idea of kicking those cans further down the road. Paolo, any thoughts?