Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Brijesh Singh <brijesh.singh@amd.com>
Cc: x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Gary Hook" <gary.hook@amd.com>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	linux-crypto@vger.kernel.org
Subject: Re: [Part2 PATCH v5 11/31] crypto: ccp: Define SEV key management command id
Date: Thu, 5 Oct 2017 22:56:58 +0200	[thread overview]
Message-ID: <20171005205658.77onrn2mr2mrxafs@pd.tnic> (raw)
In-Reply-To: <20171004131412.13038-12-brijesh.singh@amd.com>

On Wed, Oct 04, 2017 at 08:13:52AM -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.
> 
> [1] http://support.amd.com/TechDocs/55766_SEV-KM API_Specification.pdf
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Gary Hook <gary.hook@amd.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: linux-crypto@vger.kernel.org
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  include/linux/psp-sev.h | 515 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 515 insertions(+)
>  create mode 100644 include/linux/psp-sev.h

Some fixes ontop below.

With that:

Reviewed-by: Borislav Petkov <bp@suse.de>

---
diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h
index f01d0e3b09b8..496375d7f6a9 100644
--- a/include/linux/psp-sev.h
+++ b/include/linux/psp-sev.h
@@ -122,12 +122,12 @@ enum psp_ret_code {
  * @tmr_address: system physical address used for SEV-ES
  * @tmr_len: len of tmr_address
  */
-struct __attribute__((__packed__)) sev_data_init {
+struct sev_data_init {
 	u32 flags;			/* In */
 	u32 reserved;			/* In */
 	u64 tmr_address;		/* In */
 	u32 tmr_len;			/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_status - PLATFORM_STATUS command parameters
@@ -140,7 +140,7 @@ struct __attribute__((__packed__)) sev_data_init {
  * @build: firmware build id for API version
  * @guest_count: number of active guests
  */
-struct __attribute__((__packed__)) sev_data_status {
+struct sev_data_status {
 	u8 api_major;				/* Out */
 	u8 api_minor;				/* Out */
 	u8 state;				/* Out */
@@ -150,7 +150,7 @@ struct __attribute__((__packed__)) sev_data_status {
 	u32 reserved2 : 23;
 	u32 build : 8;				/* Out */
 	u32 guest_count;			/* Out */
-};
+} __packed;
 
 /**
  * struct sev_data_pek_csr - PEK_CSR command parameters
@@ -158,10 +158,10 @@ struct __attribute__((__packed__)) sev_data_status {
  * @address: PEK certificate chain
  * @len: len of certificate
  */
-struct __attribute__((__packed__)) sev_data_pek_csr {
+struct sev_data_pek_csr {
 	u64 address;				/* In */
 	u32 len;				/* In/Out */
-};
+} __packed;
 
 /**
  * struct sev_data_cert_import - PEK_CERT_IMPORT command parameters
@@ -171,13 +171,13 @@ struct __attribute__((__packed__)) sev_data_pek_csr {
  * @oca_address: OCA certificate chain
  * @oca_len: len of OCA certificate
  */
-struct __attribute__((__packed__)) sev_data_pek_cert_import {
+struct sev_data_pek_cert_import {
 	u64 pek_cert_address;			/* In */
 	u32 pek_cert_len;			/* In */
 	u32 reserved;				/* In */
 	u64 oca_cert_address;			/* In */
 	u32 oca_cert_len;			/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_pdh_cert_export - PDH_CERT_EXPORT command parameters
@@ -187,22 +187,22 @@ struct __attribute__((__packed__)) sev_data_pek_cert_import {
  * @cert_chain_address: PDH certificate chain
  * @cert_chain_len: len of PDH certificate chain
  */
-struct __attribute__((__packed__)) sev_data_pdh_cert_export {
+struct sev_data_pdh_cert_export {
 	u64 pdh_cert_address;			/* In */
 	u32 pdh_cert_len;			/* In/Out */
 	u32 reserved;				/* In */
 	u64 cert_chain_address;			/* In */
 	u32 cert_chain_len;			/* In/Out */
-};
+} __packed;
 
 /**
  * struct sev_data_decommission - DECOMMISSION command parameters
  *
  * @handle: handle of the VM to decommission
  */
-struct __attribute__((__packed__)) sev_data_decommission {
+struct sev_data_decommission {
 	u32 handle;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_activate - ACTIVATE command parameters
@@ -210,19 +210,19 @@ struct __attribute__((__packed__)) sev_data_decommission {
  * @handle: handle of the VM to activate
  * @asid: asid assigned to the VM
  */
-struct __attribute__((__packed__)) sev_data_activate {
+struct sev_data_activate {
 	u32 handle;				/* In */
 	u32 asid;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_deactivate - DEACTIVATE command parameters
  *
  * @handle: handle of the VM to deactivate
  */
-struct __attribute__((__packed__)) sev_data_deactivate {
+struct sev_data_deactivate {
 	u32 handle;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_guest_status - SEV GUEST_STATUS command parameters
@@ -232,12 +232,12 @@ struct __attribute__((__packed__)) sev_data_deactivate {
  * @asid: current ASID of the VM
  * @state: current state of the VM
  */
-struct __attribute__((__packed__)) sev_data_guest_status {
+struct sev_data_guest_status {
 	u32 handle;				/* In */
 	u32 policy;				/* Out */
 	u32 asid;				/* Out */
 	u8 state;				/* Out */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_start - LAUNCH_START command parameters
@@ -249,7 +249,7 @@ struct __attribute__((__packed__)) sev_data_guest_status {
  * @session_address: physical address of session parameters
  * @session_len: len of session parameters
  */
-struct __attribute__((__packed__)) sev_data_launch_start {
+struct sev_data_launch_start {
 	u32 handle;				/* In/Out */
 	u32 policy;				/* In */
 	u64 dh_cert_address;			/* In */
@@ -257,7 +257,7 @@ struct __attribute__((__packed__)) sev_data_launch_start {
 	u32 reserved;				/* In */
 	u64 session_address;			/* In */
 	u32 session_len;			/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_update_data - LAUNCH_UPDATE_DATA command parameter
@@ -266,12 +266,12 @@ struct __attribute__((__packed__)) sev_data_launch_start {
  * @len: len of memory to be encrypted
  * @address: physical address of memory region to encrypt
  */
-struct __attribute__((__packed__)) sev_data_launch_update_data {
+struct sev_data_launch_update_data {
 	u32 handle;				/* In */
 	u32 reserved;
 	u64 address;				/* In */
 	u32 len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_update_vmsa - LAUNCH_UPDATE_VMSA command
@@ -280,12 +280,12 @@ struct __attribute__((__packed__)) sev_data_launch_update_data {
  * @address: physical address of memory region to encrypt
  * @len: len of memory region to encrypt
  */
-struct __attribute__((__packed__)) sev_data_launch_update_vmsa {
+struct sev_data_launch_update_vmsa {
 	u32 handle;				/* In */
 	u32 reserved;
 	u64 address;				/* In */
 	u32 len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_measure - LAUNCH_MEASURE command parameters
@@ -294,12 +294,12 @@ struct __attribute__((__packed__)) sev_data_launch_update_vmsa {
  * @address: physical address containing the measurement blob
  * @len: len of measurement blob
  */
-struct __attribute__((__packed__)) sev_data_launch_measure {
+struct sev_data_launch_measure {
 	u32 handle;				/* In */
 	u32 reserved;
 	u64 address;				/* In */
 	u32 len;				/* In/Out */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_secret - LAUNCH_SECRET command parameters
@@ -312,7 +312,7 @@ struct __attribute__((__packed__)) sev_data_launch_measure {
  * @trans_address: physical address of transport memory buffer
  * @trans_len: len of transport memory buffer
  */
-struct __attribute__((__packed__)) sev_data_launch_secret {
+struct sev_data_launch_secret {
 	u32 handle;				/* In */
 	u32 reserved1;
 	u64 hdr_address;			/* In */
@@ -323,16 +323,16 @@ struct __attribute__((__packed__)) sev_data_launch_secret {
 	u32 reserved3;
 	u64 trans_address;			/* In */
 	u32 trans_len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_launch_finish - LAUNCH_FINISH command parameters
  *
  * @handle: handle of the VM to process
  */
-struct __attribute__((__packed__)) sev_data_launch_finish {
+struct sev_data_launch_finish {
 	u32 handle;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_send_start - SEND_START command parameters
@@ -348,7 +348,7 @@ struct __attribute__((__packed__)) sev_data_launch_finish {
  * @session_address: physical address containing Session data
  * @session_len: len of session data
  */
-struct __attribute__((__packed__)) sev_data_send_start {
+struct sev_data_send_start {
 	u32 handle;				/* In */
 	u32 policy;				/* Out */
 	u64 pdh_cert_address;			/* In */
@@ -362,7 +362,7 @@ struct __attribute__((__packed__)) sev_data_send_start {
 	u32 reserved3;
 	u64 session_address;			/* In */
 	u32 session_len;			/* In/Out */
-};
+} __packed;
 
 /**
  * struct sev_data_send_update - SEND_UPDATE_DATA command
@@ -375,7 +375,7 @@ struct __attribute__((__packed__)) sev_data_send_start {
  * @trans_address: physical address of host memory region
  * @trans_len: len of host memory region
  */
-struct __attribute__((__packed__)) sev_data_send_update_data {
+struct sev_data_send_update_data {
 	u32 handle;				/* In */
 	u32 reserved1;
 	u64 hdr_address;			/* In */
@@ -386,7 +386,7 @@ struct __attribute__((__packed__)) sev_data_send_update_data {
 	u32 reserved3;
 	u64 trans_address;			/* In */
 	u32 trans_len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_send_update - SEND_UPDATE_VMSA command
@@ -399,7 +399,7 @@ struct __attribute__((__packed__)) sev_data_send_update_data {
  * @trans_address: physical address of host memory region
  * @trans_len: len of host memory region
  */
-struct __attribute__((__packed__)) sev_data_send_update_vmsa {
+struct sev_data_send_update_vmsa {
 	u32 handle;				/* In */
 	u64 hdr_address;			/* In */
 	u32 hdr_len;				/* In/Out */
@@ -409,16 +409,16 @@ struct __attribute__((__packed__)) sev_data_send_update_vmsa {
 	u32 reserved3;
 	u64 trans_address;			/* In */
 	u32 trans_len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_send_finish - SEND_FINISH command parameters
  *
  * @handle: handle of the VM to process
  */
-struct __attribute__((__packed__)) sev_data_send_finish {
+struct sev_data_send_finish {
 	u32 handle;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_receive_start - RECEIVE_START command parameters
@@ -429,7 +429,7 @@ struct __attribute__((__packed__)) sev_data_send_finish {
  * @session_address: system physical address containing session blob
  * @session_len: len of session blob
  */
-struct __attribute__((__packed__)) sev_data_receive_start {
+struct sev_data_receive_start {
 	u32 handle;				/* In/Out */
 	u32 policy;				/* In */
 	u64 pdh_cert_address;			/* In */
@@ -437,7 +437,7 @@ struct __attribute__((__packed__)) sev_data_receive_start {
 	u32 reserved1;
 	u64 session_address;			/* In */
 	u32 session_len;			/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_receive_update_data - RECEIVE_UPDATE_DATA command parameters
@@ -450,7 +450,7 @@ struct __attribute__((__packed__)) sev_data_receive_start {
  * @trans_address: system physical address of transport buffer
  * @trans_len: len of transport buffer
  */
-struct __attribute__((__packed__)) sev_data_receive_update_data {
+struct sev_data_receive_update_data {
 	u32 handle;				/* In */
 	u32 reserved1;
 	u64 hdr_address;			/* In */
@@ -461,7 +461,7 @@ struct __attribute__((__packed__)) sev_data_receive_update_data {
 	u32 reserved3;
 	u64 trans_address;			/* In */
 	u32 trans_len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_receive_update_vmsa - RECEIVE_UPDATE_VMSA command parameters
@@ -474,7 +474,7 @@ struct __attribute__((__packed__)) sev_data_receive_update_data {
  * @trans_address: system physical address of transport buffer
  * @trans_len: len of transport buffer
  */
-struct __attribute__((__packed__)) sev_data_receive_update_vmsa {
+struct sev_data_receive_update_vmsa {
 	u32 handle;				/* In */
 	u32 reserved1;
 	u64 hdr_address;			/* In */
@@ -485,16 +485,16 @@ struct __attribute__((__packed__)) sev_data_receive_update_vmsa {
 	u32 reserved3;
 	u64 trans_address;			/* In */
 	u32 trans_len;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_receive_finish - RECEIVE_FINISH command parameters
  *
  * @handle: handle of the VM to finish
  */
-struct __attribute__((__packed__)) sev_data_receive_finish {
+struct sev_data_receive_finish {
 	u32 handle;				/* In */
-};
+} __packed;
 
 /**
  * struct sev_data_dbg - DBG_ENCRYPT/DBG_DECRYPT command parameters
@@ -504,12 +504,12 @@ struct __attribute__((__packed__)) sev_data_receive_finish {
  * @dst_addr: destination address of data to operate on
  * @len: len of data to operate on
  */
-struct __attribute__((__packed__)) sev_data_dbg {
+struct sev_data_dbg {
 	u32 handle;				/* In */
 	u32 reserved;
 	u64 src_addr;				/* In */
 	u64 dst_addr;				/* In */
 	u32 len;				/* In */
-};
+} __packed;
 
 #endif	/* __PSP_SEV_H__ */

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

  reply	other threads:[~2017-10-05 20:56 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 13:13 [Part2 PATCH v5 00/31] x86: Secure Encrypted Virtualization (AMD) Brijesh Singh
2017-10-04 13:13 ` [Part2 PATCH v5 09/31] crypto: ccp: Build the AMD secure processor driver only with AMD CPU support Brijesh Singh
2017-10-04 21:47   ` Borislav Petkov
2017-10-04 23:06     ` Brijesh Singh
2017-10-04 13:13 ` [Part2 PATCH v5 10/31] crypto: ccp: Add Platform Security Processor (PSP) device support Brijesh Singh
2017-10-05  9:56   ` Borislav Petkov
2017-10-06 23:09   ` [Part2 PATCH v5.1 " Brijesh Singh
2017-10-04 13:13 ` [Part2 PATCH v5 11/31] crypto: ccp: Define SEV key management command id Brijesh Singh
2017-10-05 20:56   ` Borislav Petkov [this message]
2017-10-08 21:14     ` Brijesh Singh
2017-10-04 13:13 ` [Part2 PATCH v5 12/31] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support Brijesh Singh
2017-10-06 18:49   ` Borislav Petkov
2017-10-06 19:48     ` Brijesh Singh
2017-10-07 18:13     ` Brijesh Singh
2017-10-07  1:05   ` [Part2 PATCH v5.1 12.1/31] " Brijesh Singh
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.2/31] crypto: ccp: Define SEV userspace ioctl and command id Brijesh Singh
2017-10-07 14:20       ` Borislav Petkov
2017-10-08 21:18         ` Brijesh Singh
2017-10-11 16:46       ` [Part2 PATCH v5.2 12.1/31] " Brijesh Singh
2017-10-12 13:27         ` Borislav Petkov
2017-10-12 14:18           ` Brijesh Singh
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.3/31] crypto: ccp: Implement SEV_FACTORY_RESET ioctl command Brijesh Singh
2017-10-11 14:32       ` Borislav Petkov
2017-10-11 16:55       ` [Part2 PATCH v5.2 " Brijesh Singh
2017-10-12 14:13         ` Borislav Petkov
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.4/31] crypto: ccp: Implement SEV_PLATFORM_STATUS " Brijesh Singh
2017-10-11 17:01       ` [Part2 PATCH v5.2 " Brijesh Singh
2017-10-11 17:02       ` [Part2 PATCH v5.1 " Borislav Petkov
2017-10-11 19:49         ` Brijesh Singh
2017-10-11 20:04           ` Borislav Petkov
2017-10-11 20:10             ` Borislav Petkov
2017-10-11 20:10             ` Brijesh Singh
2017-10-11 20:28               ` Borislav Petkov
2017-10-11 20:45                 ` Brijesh Singh
2017-10-11 20:53                   ` Brijesh Singh
2017-10-11 20:54                   ` Borislav Petkov
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.5/31] crypto: ccp: Implement SEV_PEK_GEN " Brijesh Singh
2017-10-12 18:28       ` Borislav Petkov
2017-10-12 20:11         ` Brijesh Singh
2017-10-12 20:21           ` Borislav Petkov
2017-10-12 20:34             ` Brijesh Singh
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.6/31] crypto: ccp: Implement SEV_PDH_GEN " Brijesh Singh
2017-10-12 18:48       ` Borislav Petkov
2017-10-12 20:21         ` Brijesh Singh
2017-10-12 20:23           ` Borislav Petkov
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.7/31] crypto: ccp: Implement SEV_PEK_CSR " Brijesh Singh
2017-10-12 19:53       ` Borislav Petkov
2017-10-13  2:24         ` Brijesh Singh
2017-10-13  4:13           ` Brijesh Singh
2017-10-13 10:20             ` Borislav Petkov
2017-10-13  9:14           ` Borislav Petkov
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.8/31] crypto: ccp: Implement SEV_PEK_CERT_IMPORT " Brijesh Singh
2017-10-13 14:53       ` Borislav Petkov
2017-10-13 16:09         ` Brijesh Singh
2017-10-07  1:06     ` [Part2 PATCH v5.1 12.9/31] crypto: ccp: Implement SEV_PDH_CERT_EXPORT " Brijesh Singh
2017-10-13 15:01       ` Borislav Petkov
2017-10-07 18:40     ` [Part2 PATCH v5.1 12.1/31] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support Borislav Petkov
2017-10-08 13:30       ` Brijesh Singh
2017-10-08 14:00         ` Borislav Petkov
2017-10-09  0:11           ` Brijesh Singh
2017-10-09 15:21             ` Borislav Petkov
2017-10-10 15:00               ` Brijesh Singh
2017-10-10 18:43                 ` Tom Lendacky
2017-10-10 20:04                   ` Borislav Petkov
2017-10-11 14:19         ` Borislav Petkov
2017-10-11 14:23           ` Brijesh Singh
2017-10-11 16:50     ` [Part2 PATCH v5.2 12.2/31] " Brijesh Singh
2017-10-12 14:08       ` Borislav Petkov
2017-10-12 21:11         ` Brijesh Singh
2017-10-12 21:41           ` Borislav Petkov
2017-10-12 21:52             ` Brijesh Singh
2017-10-12 22:22               ` Borislav Petkov
2017-10-12 18:21       ` Borislav Petkov
2017-10-12 20:05         ` Brijesh Singh

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=20171005205658.77onrn2mr2mrxafs@pd.tnic \
    --to=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=gary.hook@amd.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kvm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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