From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C865C4167B for ; Wed, 6 Dec 2023 20:22:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 512F36B0082; Wed, 6 Dec 2023 15:22:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 49B5A6B0083; Wed, 6 Dec 2023 15:22:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33C066B0085; Wed, 6 Dec 2023 15:22:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 214896B0082 for ; Wed, 6 Dec 2023 15:22:25 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D143680295 for ; Wed, 6 Dec 2023 20:22:24 +0000 (UTC) X-FDA: 81537515808.01.48FE57E Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by imf11.hostedemail.com (Postfix) with ESMTP id D8E6A40004 for ; Wed, 6 Dec 2023 20:22:20 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=alien8.de header.s=alien8 header.b=UbDOGqzh; dmarc=pass (policy=none) header.from=alien8.de; spf=pass (imf11.hostedemail.com: domain of bp@alien8.de designates 65.109.113.108 as permitted sender) smtp.mailfrom=bp@alien8.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701894141; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ryopeQNWNsQaqPkdyPy2Qh1IoKrpD4SJ99n33evI0kE=; b=o/hzzZ0k+NDhyvHMRq47Napzq8sOf2eEyyXop2FbzAcRl0U6hxtnzr82UTcGVfzuVUA46e tNhDBEsQ3KQQalHy9j2y+Vx3e84hp5573FHrvJCulI7T2s3pXVdvMxsiFhCO6tkHSJfmcH ClSH4DHrslqHmWISMBu5yvJbEAc0LQ0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=alien8.de header.s=alien8 header.b=UbDOGqzh; dmarc=pass (policy=none) header.from=alien8.de; spf=pass (imf11.hostedemail.com: domain of bp@alien8.de designates 65.109.113.108 as permitted sender) smtp.mailfrom=bp@alien8.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701894141; a=rsa-sha256; cv=none; b=v9HtnJshr517PYpSx4v1T3wmca+M1rLaBja6vIQdCzphb1PHJ98idZy4ZgRBlTw2p5ts+3 gVxCNCHh3knyLHT4a/U1hLD2h58677AE7a0YhEJu6pbi5i7esBd9tvZq4AQk6PPw6IKmhL HnBNxURVj+U1EtkRvXfrxz7TpevoEQs= Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 105A740E00C9; Wed, 6 Dec 2023 20:22:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vf3DdiCh_Bav; Wed, 6 Dec 2023 20:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1701894135; bh=ryopeQNWNsQaqPkdyPy2Qh1IoKrpD4SJ99n33evI0kE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UbDOGqzhT8SuBANzPSeO7uZMrzZFS6G5Yh2HNhk2HegKohiJfxIDQN77Ma2zi4cUh FkIKDvOSSC3jQ0U/kVDh16WgxcjVd+GDAWbR7aLgoJJxK/lIb23uuOsk0/urT1veO6 aPwUE1J/6EHR72e15S9tRf+2oD47a3Sycw2f/+pKXLky53sRg01SW6BQgfdY5JCw6d CTyfmKlwGZR8+hba3NmOfB6QRBYWt4wjmKrIcMU+rQuY5aMzaYQ/qH3WR00MBpHEmF HhZQ4ZrSrz29MDvd5tRfM51JL5c6GmGYC2kWd4yKRqaidORAJPlC11sPNMWJ7n7N4A cMT2XvefsFMF296xYANuCsgQ1luRRjgyRMfijw3Crvwa9GT7q2ffOUoRLv18sS0MTH exmaXvh9oKovzvQrlLRmaXsqLecG5b1YIhJhs3eZy+RPkV3FvGKT4RUIW3HnRD5Ir4 o8N/9LRffc/q2IKWxEKyQG6h0tEtX8BRohVbxCVamkUl+gWbtHjK7w7hcdp/hMEfsP U9bjUsjj0Oy//hj4Yn2veXG5QPHc+s7bJN6BWrXiPK+zqfGdEttztXevAmSiEYuf0S PynQAgjQmGgPj099UA8jHKCDQ+SgO5bzwGgRzv4K2PZeMRyGxsSwEfMNsf00kmBhbf CEERiDwlaIi1VkTFDTYrwphs= Received: from zn.tnic (pd95304da.dip0.t-ipconnect.de [217.83.4.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BAD8640E00C6; Wed, 6 Dec 2023 20:21:34 +0000 (UTC) Date: Wed, 6 Dec 2023 21:21:28 +0100 From: Borislav Petkov To: Michael Roth Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, jarkko@kernel.org, ashish.kalra@amd.com, nikunj.dadhania@amd.com, pankaj.gupta@amd.com, liam.merwick@oracle.com, zhi.a.wang@intel.com, Brijesh Singh Subject: Re: [PATCH v10 15/50] crypto: ccp: Provide API to issue SEV and SNP commands Message-ID: <20231206202128.GDZXDXyIjW4eKEFyvB@fat_crate.local> References: <20231016132819.1002933-1-michael.roth@amd.com> <20231016132819.1002933-16-michael.roth@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231016132819.1002933-16-michael.roth@amd.com> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D8E6A40004 X-Stat-Signature: i8cqotp7auid938tfk441pu33ogrze73 X-HE-Tag: 1701894140-748471 X-HE-Meta: U2FsdGVkX18iRmxk3B5WG5jU1jvxbej1CBB+QtXRJQDnnN7rC7dpK3i+l9whlpd6EkpzyxnOAg9Ju2E6v9CKGynQbFWKllkQfj1WQPPJQ4DQDFV/XJMVopT8SrOCNvzomZYhESF3t5IU1izgLJpQXu7XuFyOzLZkaNLi2Ymp9nqAzpBamQjWnXtl1oiZYcIYegTdlOGs5lkNLMU9UhYD64odEB+luwNoXuTs2LKgsZ0+JpnaFZnhzGRwdTkSVpm417QOp5ZxFdwB/6YO1+xkVfARxJwX4R7waWJgcBwGbG593zyr7cw7DnGYx+3qvIzA0mgFmaeaAn3Yiby9LkxuXvi+c7aOlp3mHmTg+6JN9UJJJV2cDGAOlwrsX/R3IrnBL8nPTPDsLZdvFV4DKDpbtHM0dSx/5B1CQkaeAzhJxpFT8OjVHqcIUU+/qIt0TVBTSUChXgzhr5QjVNKSngvvZSUg3IxPEwX0nAHawQMQGiO1+TS3Ejyi3mOUO2GKOln8KO7f236S7HLYnvoYCeCP3d0aB/pmr/+A71Ol8NTcAXJ203ZejiDaRsV20Zb5NNrvvw7/drRGpiYus2W0yKqGdzfINEVz/mPCwp1gHedZ1lKsuReKRo4FSHVCBJ3pgKBTrcOJk35FRkgDO6RxyIeQgrTpDqB6XjAa61OIhEv756PuOqle9pdPwCb2q+c+wsnTmuy41gWsUnHqLIxXSE51DL9JwN48fXZRLZUsMKLQwU5gf4Pc8EIT14KU/K/d7VG2yAFoH1r0xR70sOXIUssJbqErM7u8nejwckgoG78u1lwubhmSXnrGzuHkV7S98FjwM3GTo20bhCd1iPGZZzsYUOBptEI+OXxxPN7zcT9gHnbPdRBYO74gRa2l4kXW9YPAbqH6Wmq3k9lMHpEnGD3cjuPmk0w8IOWxW7sWx3F6XALhGZiRNoICD6jGRt3Lo4nP4s9ghH5pt+C26BHQYfn adRdA+zD nbb3YGmf/MJLCY/CFU1hJBPjBy/ubPmVhv4q/ZLZaH3l7IzO9vZ8A18bqArsEfcZFCboK43ZMeyU/955MEXDZBqLc2ofmA+RXd5npbkXJWnnUFvswtvM+Pca5xie9wMWSinS64ewdr/JqjwmCHglO8sktGyhJznodL/aMPn7OOkEiIV3lJaLaz8p7LSehs97BhusMvTyWCfMPVNiQ06LevgLFVDpbH0IvhKxm X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Oct 16, 2023 at 08:27:44AM -0500, Michael Roth wrote: > Subject: Re: [PATCH v10 15/50] crypto: ccp: Provide API to issue SEV and SNP commands "...: Export sev_do_cmd() as a generic API..." > From: Brijesh Singh > > Make sev_do_cmd() a generic API interface for the hypervisor > to issue commands to manage an SEV and SNP guest. The commands > for SEV and SNP are defined in the SEV and SEV-SNP firmware > specifications. > > Signed-off-by: Brijesh Singh > Signed-off-by: Ashish Kalra > --- ... > diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h > index a7f92e74564d..61bb5849ebf2 100644 > --- a/include/linux/psp-sev.h > +++ b/include/linux/psp-sev.h > @@ -883,6 +883,20 @@ int sev_guest_df_flush(int *error); > */ > int sev_guest_decommission(struct sev_data_decommission *data, int *error); > > +/** See below for the output of ./scripts/kernel-doc -none include/linux/psp-sev.h I understand that you want to kernel-doc stuff but you should do it right. > + * sev_do_cmd - perform SEV command "Issue an SEV or an SEV-SNP command" > + * > + * @error: SEV command return code That must be @psp_ret. And to quote the abovementioned script: include/linux/psp-sev.h:898: warning: Function parameter or member 'cmd' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Function parameter or member 'data' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Function parameter or member 'psp_ret' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Excess function parameter 'error' description in 'sev_do_cmd' > + * > + * Returns: > + * 0 if the SEV successfully processed the command "the SEV"? You mean the "SEV device"? > + * -%ENODEV if the SEV device is not available > + * -%ENOTSUPP if the SEV does not support SEV > + * -%ETIMEDOUT if the SEV command timed out > + * -%EIO if the SEV returned a non-zero return code > + */ > +int sev_do_cmd(int cmd, void *data, int *psp_ret); > + > void *psp_copy_user_blob(u64 uaddr, u32 len); > > #else /* !CONFIG_CRYPTO_DEV_SP_PSP */ > @@ -898,6 +912,9 @@ sev_guest_deactivate(struct sev_data_deactivate *data, int *error) { return -ENO > static inline int > sev_guest_decommission(struct sev_data_decommission *data, int *error) { return -ENODEV; } > > +static inline int > +sev_do_cmd(int cmd, void *data, int *psp_ret) { return -ENODEV; } > + > static inline int > sev_guest_activate(struct sev_data_activate *data, int *error) { return -ENODEV; } > include/linux/psp-sev.h:20: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * SEV platform state include/linux/psp-sev.h:31: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * SEV platform and guest management commands include/linux/psp-sev.h:126: warning: Function parameter or member 'reserved' not described in 'sev_data_init' include/linux/psp-sev.h:146: warning: Function parameter or member 'reserved' not described in 'sev_data_init_ex' include/linux/psp-sev.h:175: warning: expecting prototype for struct sev_data_cert_import. Prototype was for struct sev_data_pek_cert_import instead include/linux/psp-sev.h:212: warning: Function parameter or member 'pdh_cert_address' not described in 'sev_data_pdh_cert_export' include/linux/psp-sev.h:212: warning: Function parameter or member 'pdh_cert_len' not described in 'sev_data_pdh_cert_export' include/linux/psp-sev.h:212: warning: Function parameter or member 'reserved' not described in 'sev_data_pdh_cert_export' include/linux/psp-sev.h:276: warning: Function parameter or member 'reserved' not described in 'sev_data_launch_start' include/linux/psp-sev.h:290: warning: Function parameter or member 'reserved' not described in 'sev_data_launch_update_data' include/linux/psp-sev.h:304: warning: Function parameter or member 'reserved' not described in 'sev_data_launch_update_vmsa' include/linux/psp-sev.h:318: warning: Function parameter or member 'reserved' not described in 'sev_data_launch_measure' include/linux/psp-sev.h:342: warning: Function parameter or member 'reserved1' not described in 'sev_data_launch_secret' include/linux/psp-sev.h:342: warning: Function parameter or member 'reserved2' not described in 'sev_data_launch_secret' include/linux/psp-sev.h:342: warning: Function parameter or member 'reserved3' not described in 'sev_data_launch_secret' include/linux/psp-sev.h:381: warning: Function parameter or member 'reserved1' not described in 'sev_data_send_start' include/linux/psp-sev.h:381: warning: Function parameter or member 'reserved2' not described in 'sev_data_send_start' include/linux/psp-sev.h:381: warning: Function parameter or member 'reserved3' not described in 'sev_data_send_start' include/linux/psp-sev.h:405: warning: expecting prototype for struct sev_data_send_update. Prototype was for struct sev_data_send_update_data instead include/linux/psp-sev.h:428: warning: expecting prototype for struct sev_data_send_update. Prototype was for struct sev_data_send_update_vmsa instead include/linux/psp-sev.h:465: warning: Function parameter or member 'policy' not described in 'sev_data_receive_start' include/linux/psp-sev.h:465: warning: Function parameter or member 'reserved1' not described in 'sev_data_receive_start' include/linux/psp-sev.h:489: warning: Function parameter or member 'reserved1' not described in 'sev_data_receive_update_data' include/linux/psp-sev.h:489: warning: Function parameter or member 'reserved2' not described in 'sev_data_receive_update_data' include/linux/psp-sev.h:489: warning: Function parameter or member 'reserved3' not described in 'sev_data_receive_update_data' include/linux/psp-sev.h:513: warning: Function parameter or member 'reserved1' not described in 'sev_data_receive_update_vmsa' include/linux/psp-sev.h:513: warning: Function parameter or member 'reserved2' not described in 'sev_data_receive_update_vmsa' include/linux/psp-sev.h:513: warning: Function parameter or member 'reserved3' not described in 'sev_data_receive_update_vmsa' include/linux/psp-sev.h:538: warning: Function parameter or member 'reserved' not described in 'sev_data_dbg' include/linux/psp-sev.h:554: warning: Function parameter or member 'reserved' not described in 'sev_data_attestation_report' include/linux/psp-sev.h:585: warning: Function parameter or member 'gctx_paddr' not described in 'sev_data_snp_addr' include/linux/psp-sev.h:605: warning: Function parameter or member 'gctx_paddr' not described in 'sev_data_snp_launch_start' include/linux/psp-sev.h:605: warning: Function parameter or member 'ma_gctx_paddr' not described in 'sev_data_snp_launch_start' include/linux/psp-sev.h:605: warning: Function parameter or member 'rsvd' not described in 'sev_data_snp_launch_start' include/linux/psp-sev.h:605: warning: Function parameter or member 'gosvw' not described in 'sev_data_snp_launch_start' include/linux/psp-sev.h:644: warning: Function parameter or member 'gctx_paddr' not described in 'sev_data_snp_launch_update' include/linux/psp-sev.h:644: warning: Function parameter or member 'rsvd' not described in 'sev_data_snp_launch_update' include/linux/psp-sev.h:644: warning: Function parameter or member 'rsvd2' not described in 'sev_data_snp_launch_update' include/linux/psp-sev.h:644: warning: Function parameter or member 'rsvd3' not described in 'sev_data_snp_launch_update' include/linux/psp-sev.h:644: warning: Function parameter or member 'rsvd4' not described in 'sev_data_snp_launch_update' include/linux/psp-sev.h:659: warning: Function parameter or member 'gctx_paddr' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'id_block_paddr' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'id_auth_paddr' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'id_block_en' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'auth_key_en' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'rsvd' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:659: warning: Function parameter or member 'host_data' not described in 'sev_data_snp_launch_finish' include/linux/psp-sev.h:705: warning: expecting prototype for struct sev_data_dbg. Prototype was for struct sev_data_snp_dbg instead include/linux/psp-sev.h:718: warning: expecting prototype for struct sev_snp_guest_request. Prototype was for struct sev_data_snp_guest_request instead include/linux/psp-sev.h:734: warning: expecting prototype for struct sev_data_snp_init. Prototype was for struct sev_data_snp_init_ex instead include/linux/psp-sev.h:746: warning: Function parameter or member 'rsvd' not described in 'sev_data_range' include/linux/psp-sev.h:758: warning: Function parameter or member 'rsvd' not described in 'sev_data_range_list' include/linux/psp-sev.h:770: warning: Function parameter or member 'rsvd1' not described in 'sev_data_snp_shutdown_ex' include/linux/psp-sev.h:825: warning: Function parameter or member 'filep' not described in 'sev_issue_cmd_external_user' include/linux/psp-sev.h:825: warning: Function parameter or member 'id' not described in 'sev_issue_cmd_external_user' include/linux/psp-sev.h:825: warning: Function parameter or member 'data' not described in 'sev_issue_cmd_external_user' include/linux/psp-sev.h:840: warning: Function parameter or member 'data' not described in 'sev_guest_deactivate' include/linux/psp-sev.h:840: warning: Function parameter or member 'error' not described in 'sev_guest_deactivate' include/linux/psp-sev.h:840: warning: Excess function parameter 'deactivate' description in 'sev_guest_deactivate' include/linux/psp-sev.h:840: warning: Excess function parameter 'sev_ret' description in 'sev_guest_deactivate' include/linux/psp-sev.h:855: warning: Function parameter or member 'data' not described in 'sev_guest_activate' include/linux/psp-sev.h:855: warning: Function parameter or member 'error' not described in 'sev_guest_activate' include/linux/psp-sev.h:855: warning: Excess function parameter 'activate' description in 'sev_guest_activate' include/linux/psp-sev.h:855: warning: Excess function parameter 'sev_ret' description in 'sev_guest_activate' include/linux/psp-sev.h:869: warning: Function parameter or member 'error' not described in 'sev_guest_df_flush' include/linux/psp-sev.h:869: warning: Excess function parameter 'sev_ret' description in 'sev_guest_df_flush' include/linux/psp-sev.h:884: warning: Function parameter or member 'data' not described in 'sev_guest_decommission' include/linux/psp-sev.h:884: warning: Function parameter or member 'error' not described in 'sev_guest_decommission' include/linux/psp-sev.h:884: warning: Excess function parameter 'decommission' description in 'sev_guest_decommission' include/linux/psp-sev.h:884: warning: Excess function parameter 'sev_ret' description in 'sev_guest_decommission' include/linux/psp-sev.h:898: warning: Function parameter or member 'cmd' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Function parameter or member 'data' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Function parameter or member 'psp_ret' not described in 'sev_do_cmd' include/linux/psp-sev.h:898: warning: Excess function parameter 'error' description in 'sev_do_cmd' -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette