Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751279AbdIMNpR (ORCPT ); Wed, 13 Sep 2017 09:45:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:44292 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750999AbdIMNpQ (ORCPT ); Wed, 13 Sep 2017 09:45:16 -0400 Date: Wed, 13 Sep 2017 15:45:09 +0200 From: Borislav Petkov To: Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Thomas Gleixner , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?B?XCJSYWRpbSBLcsSNbcOhxZlcIg==?= , Tom Lendacky Subject: Re: [RFC Part2 PATCH v3 12/26] KVM: Define SEV key management command id Message-ID: <20170913134509.6xydjlrob4dbcjfr@pd.tnic> References: <20170724200303.12197-1-brijesh.singh@amd.com> <20170724200303.12197-13-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170724200303.12197-13-brijesh.singh@amd.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2051 Lines: 69 On Mon, Jul 24, 2017 at 03:02:49PM -0500, Brijesh Singh wrote: > Define Secure Encrypted Virtualization (SEV) key management command id > and structure. The command definition is available in SEV KM [1] spec > 0.14 and Documentation/virtual/kvm/amd-memory-encryption.txt > > [1] http://support.amd.com/TechDocs/55766_SEV-KM API_Specification.pdf > > Signed-off-by: Brijesh Singh > --- > include/uapi/linux/kvm.h | 148 +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 148 insertions(+) > > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index 6074065..8decc88 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -1367,6 +1367,154 @@ struct kvm_memory_encrypt_ram { > __u64 size; > }; > > +/* Secure Encrypted Virtualization command */ > +enum sev_cmd_id { > + /* Guest initialization commands */ > + KVM_SEV_INIT = 0, > + KVM_SEV_ES_INIT, > + /* Guest launch commands */ > + KVM_SEV_LAUNCH_START, > + KVM_SEV_LAUNCH_UPDATE_DATA, > + KVM_SEV_LAUNCH_UPDATE_VMSA, > + KVM_SEV_LAUNCH_SECRET, > + KVM_SEV_LAUNCH_MEASURE, > + KVM_SEV_LAUNCH_FINISH, > + /* Guest migration commands (outgoing) */ > + KVM_SEV_SEND_START, > + KVM_SEV_SEND_UPDATE_DATA, > + KVM_SEV_SEND_UPDATE_VMSA, > + KVM_SEV_SEND_FINISH, > + /* Guest migration commands (incoming) */ > + KVM_SEV_RECEIVE_START, > + KVM_SEV_RECEIVE_UPDATE_DATA, > + KVM_SEV_RECEIVE_UPDATE_VMSA, > + KVM_SEV_RECEIVE_FINISH, > + /* Guest status and debug commands */ > + KVM_SEV_GUEST_STATUS, > + KVM_SEV_DBG_DECRYPT, > + KVM_SEV_DBG_ENCRYPT, > + /* Guest certificates commands */ > + KVM_SEV_CERT_EXPORT, > + > + KVM_SEV_NR_MAX, > +}; > + > +struct kvm_sev_cmd { > + __u32 id; > + __u64 data; > + __u32 error; > + __u32 sev_fd; > +}; As before, if those structs are read from/written to hardware/firmware, they should be declared __packed so that the compiler doesn't add padding. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --