* [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-11 23:55 ` Singh, Brijesh
0 siblings, 0 replies; 14+ messages in thread
From: Singh, Brijesh @ 2019-04-11 23:55 UTC (permalink / raw)
To: qemu-devel@nongnu.org
Cc: Singh, Brijesh, Paolo Bonzini, Markus Armbruster, Eric Blake,
Daniel P . Berrangé, Laszlo Ersek, Erik Skultety,
Lendacky, Thomas
There are limited numbers of the SEV guests that can be run concurrently.
A management applications may need to know this limit so that it can place
SEV VMs on hosts which have suitable resources available.
Currently, this limit is not exposed to the application. Add a new
'sev-max-guest' field in the query-sev-capabilities to provide this
information.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Erik Skultety <eskultet@redhat.com>
Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
changes since v1:
- document the new field and add (since 4.1) annotation.
qapi/target.json | 9 +++++++--
target/i386/sev.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/qapi/target.json b/qapi/target.json
index 1d4d54b600..8cd4fc7919 100644
--- a/qapi/target.json
+++ b/qapi/target.json
@@ -177,13 +177,17 @@
# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
# enabled
#
+# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
+# (since 4.1)
+#
# Since: 2.12
##
{ 'struct': 'SevCapability',
'data': { 'pdh': 'str',
'cert-chain': 'str',
'cbitpos': 'int',
- 'reduced-phys-bits': 'int'},
+ 'reduced-phys-bits': 'int',
+ 'sev-max-guests': 'int'},
'if': 'defined(TARGET_I386)' }
##
@@ -200,7 +204,8 @@
#
# -> { "execute": "query-sev-capabilities" }
# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
-# "cbitpos": 47, "reduced-phys-bits": 5}}
+# "cbitpos": 47, "reduced-phys-bits": 5,
+# "sev-max-guests" : 15}}
#
##
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
diff --git a/target/i386/sev.c b/target/i386/sev.c
index cd77f6b5d4..6829586fbe 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -488,7 +488,7 @@ sev_get_capabilities(void)
guchar *pdh_data = NULL;
guchar *cert_chain_data = NULL;
size_t pdh_len = 0, cert_chain_len = 0;
- uint32_t ebx;
+ uint32_t ebx, ecx, edx;
int fd;
fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
@@ -507,7 +507,7 @@ sev_get_capabilities(void)
cap->pdh = g_base64_encode(pdh_data, pdh_len);
cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
- host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
+ host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
cap->cbitpos = ebx & 0x3f;
/*
@@ -516,6 +516,11 @@ sev_get_capabilities(void)
*/
cap->reduced_phys_bits = 1;
+ /*
+ * The maximum number of SEV guests with SEV-ES disabled that can run
+ * simultaneously.
+ */
+ cap->sev_max_guests = ecx - edx + 1;
out:
g_free(pdh_data);
g_free(cert_chain_data);
--
2.17.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-11 23:55 ` Singh, Brijesh
0 siblings, 0 replies; 14+ messages in thread
From: Singh, Brijesh @ 2019-04-11 23:55 UTC (permalink / raw)
To: qemu-devel@nongnu.org
Cc: Lendacky, Thomas, Erik Skultety, Laszlo Ersek, Markus Armbruster,
Singh, Brijesh, Paolo Bonzini
There are limited numbers of the SEV guests that can be run concurrently.
A management applications may need to know this limit so that it can place
SEV VMs on hosts which have suitable resources available.
Currently, this limit is not exposed to the application. Add a new
'sev-max-guest' field in the query-sev-capabilities to provide this
information.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Erik Skultety <eskultet@redhat.com>
Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
changes since v1:
- document the new field and add (since 4.1) annotation.
qapi/target.json | 9 +++++++--
target/i386/sev.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/qapi/target.json b/qapi/target.json
index 1d4d54b600..8cd4fc7919 100644
--- a/qapi/target.json
+++ b/qapi/target.json
@@ -177,13 +177,17 @@
# @reduced-phys-bits: Number of physical Address bit reduction when SEV is
# enabled
#
+# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
+# (since 4.1)
+#
# Since: 2.12
##
{ 'struct': 'SevCapability',
'data': { 'pdh': 'str',
'cert-chain': 'str',
'cbitpos': 'int',
- 'reduced-phys-bits': 'int'},
+ 'reduced-phys-bits': 'int',
+ 'sev-max-guests': 'int'},
'if': 'defined(TARGET_I386)' }
##
@@ -200,7 +204,8 @@
#
# -> { "execute": "query-sev-capabilities" }
# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
-# "cbitpos": 47, "reduced-phys-bits": 5}}
+# "cbitpos": 47, "reduced-phys-bits": 5,
+# "sev-max-guests" : 15}}
#
##
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
diff --git a/target/i386/sev.c b/target/i386/sev.c
index cd77f6b5d4..6829586fbe 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -488,7 +488,7 @@ sev_get_capabilities(void)
guchar *pdh_data = NULL;
guchar *cert_chain_data = NULL;
size_t pdh_len = 0, cert_chain_len = 0;
- uint32_t ebx;
+ uint32_t ebx, ecx, edx;
int fd;
fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
@@ -507,7 +507,7 @@ sev_get_capabilities(void)
cap->pdh = g_base64_encode(pdh_data, pdh_len);
cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
- host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
+ host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
cap->cbitpos = ebx & 0x3f;
/*
@@ -516,6 +516,11 @@ sev_get_capabilities(void)
*/
cap->reduced_phys_bits = 1;
+ /*
+ * The maximum number of SEV guests with SEV-ES disabled that can run
+ * simultaneously.
+ */
+ cap->sev_max_guests = ecx - edx + 1;
out:
g_free(pdh_data);
g_free(cert_chain_data);
--
2.17.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 7:58 ` Laszlo Ersek
0 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-04-12 7:58 UTC (permalink / raw)
To: Singh, Brijesh, qemu-devel@nongnu.org
Cc: Paolo Bonzini, Markus Armbruster, Eric Blake,
Daniel P . Berrangé, Erik Skultety, Lendacky, Thomas
On 04/12/19 01:55, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>
> changes since v1:
> - document the new field and add (since 4.1) annotation.
>
> qapi/target.json | 9 +++++++--
> target/i386/sev.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/qapi/target.json b/qapi/target.json
> index 1d4d54b600..8cd4fc7919 100644
> --- a/qapi/target.json
> +++ b/qapi/target.json
> @@ -177,13 +177,17 @@
> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> # enabled
> #
> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> +# (since 4.1)
> +#
> # Since: 2.12
> ##
> { 'struct': 'SevCapability',
> 'data': { 'pdh': 'str',
> 'cert-chain': 'str',
> 'cbitpos': 'int',
> - 'reduced-phys-bits': 'int'},
> + 'reduced-phys-bits': 'int',
> + 'sev-max-guests': 'int'},
> 'if': 'defined(TARGET_I386)' }
>
> ##
> @@ -200,7 +204,8 @@
> #
> # -> { "execute": "query-sev-capabilities" }
> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> +# "cbitpos": 47, "reduced-phys-bits": 5,
> +# "sev-max-guests" : 15}}
There seems to be a superfluous space character before the colon, but I
don't think it matters much.
> #
> ##
> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index cd77f6b5d4..6829586fbe 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> guchar *pdh_data = NULL;
> guchar *cert_chain_data = NULL;
> size_t pdh_len = 0, cert_chain_len = 0;
> - uint32_t ebx;
> + uint32_t ebx, ecx, edx;
> int fd;
>
> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>
> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> cap->cbitpos = ebx & 0x3f;
>
> /*
> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> */
> cap->reduced_phys_bits = 1;
>
> + /*
> + * The maximum number of SEV guests with SEV-ES disabled that can run
> + * simultaneously.
> + */
> + cap->sev_max_guests = ecx - edx + 1;
> out:
> g_free(pdh_data);
> g_free(cert_chain_data);
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 7:58 ` Laszlo Ersek
0 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-04-12 7:58 UTC (permalink / raw)
To: Singh, Brijesh, qemu-devel@nongnu.org
Cc: Lendacky, Thomas, Erik Skultety, Markus Armbruster, Paolo Bonzini
On 04/12/19 01:55, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>
> changes since v1:
> - document the new field and add (since 4.1) annotation.
>
> qapi/target.json | 9 +++++++--
> target/i386/sev.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/qapi/target.json b/qapi/target.json
> index 1d4d54b600..8cd4fc7919 100644
> --- a/qapi/target.json
> +++ b/qapi/target.json
> @@ -177,13 +177,17 @@
> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> # enabled
> #
> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> +# (since 4.1)
> +#
> # Since: 2.12
> ##
> { 'struct': 'SevCapability',
> 'data': { 'pdh': 'str',
> 'cert-chain': 'str',
> 'cbitpos': 'int',
> - 'reduced-phys-bits': 'int'},
> + 'reduced-phys-bits': 'int',
> + 'sev-max-guests': 'int'},
> 'if': 'defined(TARGET_I386)' }
>
> ##
> @@ -200,7 +204,8 @@
> #
> # -> { "execute": "query-sev-capabilities" }
> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> +# "cbitpos": 47, "reduced-phys-bits": 5,
> +# "sev-max-guests" : 15}}
There seems to be a superfluous space character before the colon, but I
don't think it matters much.
> #
> ##
> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index cd77f6b5d4..6829586fbe 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> guchar *pdh_data = NULL;
> guchar *cert_chain_data = NULL;
> size_t pdh_len = 0, cert_chain_len = 0;
> - uint32_t ebx;
> + uint32_t ebx, ecx, edx;
> int fd;
>
> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>
> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> cap->cbitpos = ebx & 0x3f;
>
> /*
> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> */
> cap->reduced_phys_bits = 1;
>
> + /*
> + * The maximum number of SEV guests with SEV-ES disabled that can run
> + * simultaneously.
> + */
> + cap->sev_max_guests = ecx - edx + 1;
> out:
> g_free(pdh_data);
> g_free(cert_chain_data);
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:05 ` Paolo Bonzini
0 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2019-04-12 8:05 UTC (permalink / raw)
To: Laszlo Ersek, Singh, Brijesh, qemu-devel@nongnu.org
Cc: Markus Armbruster, Eric Blake, Daniel P . Berrangé,
Erik Skultety, Lendacky, Thomas
On 12/04/19 09:58, Laszlo Ersek wrote:
> On 04/12/19 01:55, Singh, Brijesh wrote:
>> There are limited numbers of the SEV guests that can be run concurrently.
>> A management applications may need to know this limit so that it can place
>> SEV VMs on hosts which have suitable resources available.
>>
>> Currently, this limit is not exposed to the application. Add a new
>> 'sev-max-guest' field in the query-sev-capabilities to provide this
>> information.
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Markus Armbruster <armbru@redhat.com>
>> Cc: Eric Blake <eblake@redhat.com>
>> Cc: Daniel P. Berrangé <berrange@redhat.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Erik Skultety <eskultet@redhat.com>
>> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>> ---
>>
>> changes since v1:
>> - document the new field and add (since 4.1) annotation.
>>
>> qapi/target.json | 9 +++++++--
>> target/i386/sev.c | 9 +++++++--
>> 2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/qapi/target.json b/qapi/target.json
>> index 1d4d54b600..8cd4fc7919 100644
>> --- a/qapi/target.json
>> +++ b/qapi/target.json
>> @@ -177,13 +177,17 @@
>> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
>> # enabled
>> #
>> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
>> +# (since 4.1)
>> +#
>> # Since: 2.12
>> ##
>> { 'struct': 'SevCapability',
>> 'data': { 'pdh': 'str',
>> 'cert-chain': 'str',
>> 'cbitpos': 'int',
>> - 'reduced-phys-bits': 'int'},
>> + 'reduced-phys-bits': 'int',
>> + 'sev-max-guests': 'int'},
>> 'if': 'defined(TARGET_I386)' }
>>
>> ##
>> @@ -200,7 +204,8 @@
>> #
>> # -> { "execute": "query-sev-capabilities" }
>> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
>> -# "cbitpos": 47, "reduced-phys-bits": 5}}
>> +# "cbitpos": 47, "reduced-phys-bits": 5,
>> +# "sev-max-guests" : 15}}
>
> There seems to be a superfluous space character before the colon, but I
> don't think it matters much.
>
>> #
>> ##
>> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>> index cd77f6b5d4..6829586fbe 100644
>> --- a/target/i386/sev.c
>> +++ b/target/i386/sev.c
>> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
>> guchar *pdh_data = NULL;
>> guchar *cert_chain_data = NULL;
>> size_t pdh_len = 0, cert_chain_len = 0;
>> - uint32_t ebx;
>> + uint32_t ebx, ecx, edx;
>> int fd;
>>
>> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
>> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
>> cap->pdh = g_base64_encode(pdh_data, pdh_len);
>> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>>
>> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
>> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
>> cap->cbitpos = ebx & 0x3f;
>>
>> /*
>> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
>> */
>> cap->reduced_phys_bits = 1;
>>
>> + /*
>> + * The maximum number of SEV guests with SEV-ES disabled that can run
>> + * simultaneously.
>> + */
>> + cap->sev_max_guests = ecx - edx + 1;
>> out:
>> g_free(pdh_data);
>> g_free(cert_chain_data);
>>
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
As mentioned in v1, I don't think a management application should need
to run QEMU in order to figure this out.
Paolo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:05 ` Paolo Bonzini
0 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2019-04-12 8:05 UTC (permalink / raw)
To: Laszlo Ersek, Singh, Brijesh, qemu-devel@nongnu.org
Cc: Lendacky, Thomas, Markus Armbruster, Erik Skultety
On 12/04/19 09:58, Laszlo Ersek wrote:
> On 04/12/19 01:55, Singh, Brijesh wrote:
>> There are limited numbers of the SEV guests that can be run concurrently.
>> A management applications may need to know this limit so that it can place
>> SEV VMs on hosts which have suitable resources available.
>>
>> Currently, this limit is not exposed to the application. Add a new
>> 'sev-max-guest' field in the query-sev-capabilities to provide this
>> information.
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Markus Armbruster <armbru@redhat.com>
>> Cc: Eric Blake <eblake@redhat.com>
>> Cc: Daniel P. Berrangé <berrange@redhat.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Erik Skultety <eskultet@redhat.com>
>> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>> ---
>>
>> changes since v1:
>> - document the new field and add (since 4.1) annotation.
>>
>> qapi/target.json | 9 +++++++--
>> target/i386/sev.c | 9 +++++++--
>> 2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/qapi/target.json b/qapi/target.json
>> index 1d4d54b600..8cd4fc7919 100644
>> --- a/qapi/target.json
>> +++ b/qapi/target.json
>> @@ -177,13 +177,17 @@
>> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
>> # enabled
>> #
>> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
>> +# (since 4.1)
>> +#
>> # Since: 2.12
>> ##
>> { 'struct': 'SevCapability',
>> 'data': { 'pdh': 'str',
>> 'cert-chain': 'str',
>> 'cbitpos': 'int',
>> - 'reduced-phys-bits': 'int'},
>> + 'reduced-phys-bits': 'int',
>> + 'sev-max-guests': 'int'},
>> 'if': 'defined(TARGET_I386)' }
>>
>> ##
>> @@ -200,7 +204,8 @@
>> #
>> # -> { "execute": "query-sev-capabilities" }
>> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
>> -# "cbitpos": 47, "reduced-phys-bits": 5}}
>> +# "cbitpos": 47, "reduced-phys-bits": 5,
>> +# "sev-max-guests" : 15}}
>
> There seems to be a superfluous space character before the colon, but I
> don't think it matters much.
>
>> #
>> ##
>> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>> index cd77f6b5d4..6829586fbe 100644
>> --- a/target/i386/sev.c
>> +++ b/target/i386/sev.c
>> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
>> guchar *pdh_data = NULL;
>> guchar *cert_chain_data = NULL;
>> size_t pdh_len = 0, cert_chain_len = 0;
>> - uint32_t ebx;
>> + uint32_t ebx, ecx, edx;
>> int fd;
>>
>> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
>> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
>> cap->pdh = g_base64_encode(pdh_data, pdh_len);
>> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>>
>> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
>> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
>> cap->cbitpos = ebx & 0x3f;
>>
>> /*
>> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
>> */
>> cap->reduced_phys_bits = 1;
>>
>> + /*
>> + * The maximum number of SEV guests with SEV-ES disabled that can run
>> + * simultaneously.
>> + */
>> + cap->sev_max_guests = ecx - edx + 1;
>> out:
>> g_free(pdh_data);
>> g_free(cert_chain_data);
>>
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
As mentioned in v1, I don't think a management application should need
to run QEMU in order to figure this out.
Paolo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:20 ` Daniel P. Berrangé
0 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2019-04-12 8:20 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Laszlo Ersek, Singh, Brijesh, qemu-devel@nongnu.org,
Markus Armbruster, Eric Blake, Erik Skultety, Lendacky, Thomas
On Fri, Apr 12, 2019 at 10:05:23AM +0200, Paolo Bonzini wrote:
> On 12/04/19 09:58, Laszlo Ersek wrote:
> > On 04/12/19 01:55, Singh, Brijesh wrote:
> >> There are limited numbers of the SEV guests that can be run concurrently.
> >> A management applications may need to know this limit so that it can place
> >> SEV VMs on hosts which have suitable resources available.
> >>
> >> Currently, this limit is not exposed to the application. Add a new
> >> 'sev-max-guest' field in the query-sev-capabilities to provide this
> >> information.
> >>
> >> Cc: Paolo Bonzini <pbonzini@redhat.com>
> >> Cc: Markus Armbruster <armbru@redhat.com>
> >> Cc: Eric Blake <eblake@redhat.com>
> >> Cc: Daniel P. Berrangé <berrange@redhat.com>
> >> Cc: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Erik Skultety <eskultet@redhat.com>
> >> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> >> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> >> ---
> >>
> >> changes since v1:
> >> - document the new field and add (since 4.1) annotation.
> >>
> >> qapi/target.json | 9 +++++++--
> >> target/i386/sev.c | 9 +++++++--
> >> 2 files changed, 14 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/qapi/target.json b/qapi/target.json
> >> index 1d4d54b600..8cd4fc7919 100644
> >> --- a/qapi/target.json
> >> +++ b/qapi/target.json
> >> @@ -177,13 +177,17 @@
> >> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> >> # enabled
> >> #
> >> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> >> +# (since 4.1)
> >> +#
> >> # Since: 2.12
> >> ##
> >> { 'struct': 'SevCapability',
> >> 'data': { 'pdh': 'str',
> >> 'cert-chain': 'str',
> >> 'cbitpos': 'int',
> >> - 'reduced-phys-bits': 'int'},
> >> + 'reduced-phys-bits': 'int',
> >> + 'sev-max-guests': 'int'},
> >> 'if': 'defined(TARGET_I386)' }
> >>
> >> ##
> >> @@ -200,7 +204,8 @@
> >> #
> >> # -> { "execute": "query-sev-capabilities" }
> >> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> >> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> >> +# "cbitpos": 47, "reduced-phys-bits": 5,
> >> +# "sev-max-guests" : 15}}
> >
> > There seems to be a superfluous space character before the colon, but I
> > don't think it matters much.
> >
> >> #
> >> ##
> >> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> >> diff --git a/target/i386/sev.c b/target/i386/sev.c
> >> index cd77f6b5d4..6829586fbe 100644
> >> --- a/target/i386/sev.c
> >> +++ b/target/i386/sev.c
> >> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> >> guchar *pdh_data = NULL;
> >> guchar *cert_chain_data = NULL;
> >> size_t pdh_len = 0, cert_chain_len = 0;
> >> - uint32_t ebx;
> >> + uint32_t ebx, ecx, edx;
> >> int fd;
> >>
> >> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> >> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> >> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> >> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
> >>
> >> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> >> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> >> cap->cbitpos = ebx & 0x3f;
> >>
> >> /*
> >> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> >> */
> >> cap->reduced_phys_bits = 1;
> >>
> >> + /*
> >> + * The maximum number of SEV guests with SEV-ES disabled that can run
> >> + * simultaneously.
> >> + */
> >> + cap->sev_max_guests = ecx - edx + 1;
> >> out:
> >> g_free(pdh_data);
> >> g_free(cert_chain_data);
> >>
> >
> > Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> As mentioned in v1, I don't think a management application should need
> to run QEMU in order to figure this out.
Libvirt is already running this query-sev-capabilities command to find
out information about SEV support, so from our POV this is the natural
place to report the max limits.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:20 ` Daniel P. Berrangé
0 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2019-04-12 8:20 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Lendacky, Thomas, Singh, Brijesh, Erik Skultety,
qemu-devel@nongnu.org, Markus Armbruster, Laszlo Ersek
On Fri, Apr 12, 2019 at 10:05:23AM +0200, Paolo Bonzini wrote:
> On 12/04/19 09:58, Laszlo Ersek wrote:
> > On 04/12/19 01:55, Singh, Brijesh wrote:
> >> There are limited numbers of the SEV guests that can be run concurrently.
> >> A management applications may need to know this limit so that it can place
> >> SEV VMs on hosts which have suitable resources available.
> >>
> >> Currently, this limit is not exposed to the application. Add a new
> >> 'sev-max-guest' field in the query-sev-capabilities to provide this
> >> information.
> >>
> >> Cc: Paolo Bonzini <pbonzini@redhat.com>
> >> Cc: Markus Armbruster <armbru@redhat.com>
> >> Cc: Eric Blake <eblake@redhat.com>
> >> Cc: Daniel P. Berrangé <berrange@redhat.com>
> >> Cc: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Erik Skultety <eskultet@redhat.com>
> >> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> >> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> >> ---
> >>
> >> changes since v1:
> >> - document the new field and add (since 4.1) annotation.
> >>
> >> qapi/target.json | 9 +++++++--
> >> target/i386/sev.c | 9 +++++++--
> >> 2 files changed, 14 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/qapi/target.json b/qapi/target.json
> >> index 1d4d54b600..8cd4fc7919 100644
> >> --- a/qapi/target.json
> >> +++ b/qapi/target.json
> >> @@ -177,13 +177,17 @@
> >> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> >> # enabled
> >> #
> >> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> >> +# (since 4.1)
> >> +#
> >> # Since: 2.12
> >> ##
> >> { 'struct': 'SevCapability',
> >> 'data': { 'pdh': 'str',
> >> 'cert-chain': 'str',
> >> 'cbitpos': 'int',
> >> - 'reduced-phys-bits': 'int'},
> >> + 'reduced-phys-bits': 'int',
> >> + 'sev-max-guests': 'int'},
> >> 'if': 'defined(TARGET_I386)' }
> >>
> >> ##
> >> @@ -200,7 +204,8 @@
> >> #
> >> # -> { "execute": "query-sev-capabilities" }
> >> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> >> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> >> +# "cbitpos": 47, "reduced-phys-bits": 5,
> >> +# "sev-max-guests" : 15}}
> >
> > There seems to be a superfluous space character before the colon, but I
> > don't think it matters much.
> >
> >> #
> >> ##
> >> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> >> diff --git a/target/i386/sev.c b/target/i386/sev.c
> >> index cd77f6b5d4..6829586fbe 100644
> >> --- a/target/i386/sev.c
> >> +++ b/target/i386/sev.c
> >> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> >> guchar *pdh_data = NULL;
> >> guchar *cert_chain_data = NULL;
> >> size_t pdh_len = 0, cert_chain_len = 0;
> >> - uint32_t ebx;
> >> + uint32_t ebx, ecx, edx;
> >> int fd;
> >>
> >> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> >> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> >> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> >> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
> >>
> >> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> >> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> >> cap->cbitpos = ebx & 0x3f;
> >>
> >> /*
> >> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> >> */
> >> cap->reduced_phys_bits = 1;
> >>
> >> + /*
> >> + * The maximum number of SEV guests with SEV-ES disabled that can run
> >> + * simultaneously.
> >> + */
> >> + cap->sev_max_guests = ecx - edx + 1;
> >> out:
> >> g_free(pdh_data);
> >> g_free(cert_chain_data);
> >>
> >
> > Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> As mentioned in v1, I don't think a management application should need
> to run QEMU in order to figure this out.
Libvirt is already running this query-sev-capabilities command to find
out information about SEV support, so from our POV this is the natural
place to report the max limits.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:21 ` Daniel P. Berrangé
0 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2019-04-12 8:21 UTC (permalink / raw)
To: Singh, Brijesh
Cc: qemu-devel@nongnu.org, Paolo Bonzini, Markus Armbruster,
Eric Blake, Laszlo Ersek, Erik Skultety, Lendacky, Thomas
On Thu, Apr 11, 2019 at 11:55:15PM +0000, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:21 ` Daniel P. Berrangé
0 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2019-04-12 8:21 UTC (permalink / raw)
To: Singh, Brijesh
Cc: Lendacky, Thomas, Erik Skultety, Laszlo Ersek,
qemu-devel@nongnu.org, Markus Armbruster, Paolo Bonzini
On Thu, Apr 11, 2019 at 11:55:15PM +0000, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:26 ` Erik Skultety
0 siblings, 0 replies; 14+ messages in thread
From: Erik Skultety @ 2019-04-12 8:26 UTC (permalink / raw)
To: Singh, Brijesh
Cc: qemu-devel@nongnu.org, Paolo Bonzini, Markus Armbruster,
Eric Blake, Daniel P . Berrangé, Laszlo Ersek,
Lendacky, Thomas
On Thu, Apr 11, 2019 at 11:55:15PM +0000, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>
> changes since v1:
> - document the new field and add (since 4.1) annotation.
>
> qapi/target.json | 9 +++++++--
> target/i386/sev.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/qapi/target.json b/qapi/target.json
> index 1d4d54b600..8cd4fc7919 100644
> --- a/qapi/target.json
> +++ b/qapi/target.json
> @@ -177,13 +177,17 @@
> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> # enabled
> #
> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> +# (since 4.1)
> +#
> # Since: 2.12
> ##
> { 'struct': 'SevCapability',
> 'data': { 'pdh': 'str',
> 'cert-chain': 'str',
> 'cbitpos': 'int',
> - 'reduced-phys-bits': 'int'},
> + 'reduced-phys-bits': 'int',
> + 'sev-max-guests': 'int'},
> 'if': 'defined(TARGET_I386)' }
>
> ##
> @@ -200,7 +204,8 @@
> #
> # -> { "execute": "query-sev-capabilities" }
> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> +# "cbitpos": 47, "reduced-phys-bits": 5,
> +# "sev-max-guests" : 15}}
> #
> ##
> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index cd77f6b5d4..6829586fbe 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> guchar *pdh_data = NULL;
> guchar *cert_chain_data = NULL;
> size_t pdh_len = 0, cert_chain_len = 0;
> - uint32_t ebx;
> + uint32_t ebx, ecx, edx;
> int fd;
>
> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>
> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> cap->cbitpos = ebx & 0x3f;
>
> /*
> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> */
> cap->reduced_phys_bits = 1;
>
> + /*
> + * The maximum number of SEV guests with SEV-ES disabled that can run
> + * simultaneously.
> + */
> + cap->sev_max_guests = ecx - edx + 1;
I'm not that familiar with QEMU code, so I guess ^this works as intended, but
to the idea (and per my comment in v1):
Reviewed-by: Erik Skultety <eskultet@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 8:26 ` Erik Skultety
0 siblings, 0 replies; 14+ messages in thread
From: Erik Skultety @ 2019-04-12 8:26 UTC (permalink / raw)
To: Singh, Brijesh
Cc: Lendacky, Thomas, Laszlo Ersek, qemu-devel@nongnu.org,
Markus Armbruster, Paolo Bonzini
On Thu, Apr 11, 2019 at 11:55:15PM +0000, Singh, Brijesh wrote:
> There are limited numbers of the SEV guests that can be run concurrently.
> A management applications may need to know this limit so that it can place
> SEV VMs on hosts which have suitable resources available.
>
> Currently, this limit is not exposed to the application. Add a new
> 'sev-max-guest' field in the query-sev-capabilities to provide this
> information.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Erik Skultety <eskultet@redhat.com>
> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>
> changes since v1:
> - document the new field and add (since 4.1) annotation.
>
> qapi/target.json | 9 +++++++--
> target/i386/sev.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/qapi/target.json b/qapi/target.json
> index 1d4d54b600..8cd4fc7919 100644
> --- a/qapi/target.json
> +++ b/qapi/target.json
> @@ -177,13 +177,17 @@
> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
> # enabled
> #
> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
> +# (since 4.1)
> +#
> # Since: 2.12
> ##
> { 'struct': 'SevCapability',
> 'data': { 'pdh': 'str',
> 'cert-chain': 'str',
> 'cbitpos': 'int',
> - 'reduced-phys-bits': 'int'},
> + 'reduced-phys-bits': 'int',
> + 'sev-max-guests': 'int'},
> 'if': 'defined(TARGET_I386)' }
>
> ##
> @@ -200,7 +204,8 @@
> #
> # -> { "execute": "query-sev-capabilities" }
> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
> -# "cbitpos": 47, "reduced-phys-bits": 5}}
> +# "cbitpos": 47, "reduced-phys-bits": 5,
> +# "sev-max-guests" : 15}}
> #
> ##
> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index cd77f6b5d4..6829586fbe 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
> guchar *pdh_data = NULL;
> guchar *cert_chain_data = NULL;
> size_t pdh_len = 0, cert_chain_len = 0;
> - uint32_t ebx;
> + uint32_t ebx, ecx, edx;
> int fd;
>
> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
> cap->pdh = g_base64_encode(pdh_data, pdh_len);
> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>
> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
> cap->cbitpos = ebx & 0x3f;
>
> /*
> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
> */
> cap->reduced_phys_bits = 1;
>
> + /*
> + * The maximum number of SEV guests with SEV-ES disabled that can run
> + * simultaneously.
> + */
> + cap->sev_max_guests = ecx - edx + 1;
I'm not that familiar with QEMU code, so I guess ^this works as intended, but
to the idea (and per my comment in v1):
Reviewed-by: Erik Skultety <eskultet@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 12:17 ` Laszlo Ersek
0 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-04-12 12:17 UTC (permalink / raw)
To: Paolo Bonzini, Singh, Brijesh, qemu-devel@nongnu.org
Cc: Markus Armbruster, Eric Blake, Daniel P . Berrangé,
Erik Skultety, Lendacky, Thomas
On 04/12/19 10:05, Paolo Bonzini wrote:
> On 12/04/19 09:58, Laszlo Ersek wrote:
>> On 04/12/19 01:55, Singh, Brijesh wrote:
>>> There are limited numbers of the SEV guests that can be run concurrently.
>>> A management applications may need to know this limit so that it can place
>>> SEV VMs on hosts which have suitable resources available.
>>>
>>> Currently, this limit is not exposed to the application. Add a new
>>> 'sev-max-guest' field in the query-sev-capabilities to provide this
>>> information.
>>>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Markus Armbruster <armbru@redhat.com>
>>> Cc: Eric Blake <eblake@redhat.com>
>>> Cc: Daniel P. Berrangé <berrange@redhat.com>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Erik Skultety <eskultet@redhat.com>
>>> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
>>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>>> ---
>>>
>>> changes since v1:
>>> - document the new field and add (since 4.1) annotation.
>>>
>>> qapi/target.json | 9 +++++++--
>>> target/i386/sev.c | 9 +++++++--
>>> 2 files changed, 14 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/qapi/target.json b/qapi/target.json
>>> index 1d4d54b600..8cd4fc7919 100644
>>> --- a/qapi/target.json
>>> +++ b/qapi/target.json
>>> @@ -177,13 +177,17 @@
>>> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
>>> # enabled
>>> #
>>> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
>>> +# (since 4.1)
>>> +#
>>> # Since: 2.12
>>> ##
>>> { 'struct': 'SevCapability',
>>> 'data': { 'pdh': 'str',
>>> 'cert-chain': 'str',
>>> 'cbitpos': 'int',
>>> - 'reduced-phys-bits': 'int'},
>>> + 'reduced-phys-bits': 'int',
>>> + 'sev-max-guests': 'int'},
>>> 'if': 'defined(TARGET_I386)' }
>>>
>>> ##
>>> @@ -200,7 +204,8 @@
>>> #
>>> # -> { "execute": "query-sev-capabilities" }
>>> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
>>> -# "cbitpos": 47, "reduced-phys-bits": 5}}
>>> +# "cbitpos": 47, "reduced-phys-bits": 5,
>>> +# "sev-max-guests" : 15}}
>>
>> There seems to be a superfluous space character before the colon, but I
>> don't think it matters much.
>>
>>> #
>>> ##
>>> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
>>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>>> index cd77f6b5d4..6829586fbe 100644
>>> --- a/target/i386/sev.c
>>> +++ b/target/i386/sev.c
>>> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
>>> guchar *pdh_data = NULL;
>>> guchar *cert_chain_data = NULL;
>>> size_t pdh_len = 0, cert_chain_len = 0;
>>> - uint32_t ebx;
>>> + uint32_t ebx, ecx, edx;
>>> int fd;
>>>
>>> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
>>> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
>>> cap->pdh = g_base64_encode(pdh_data, pdh_len);
>>> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>>>
>>> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
>>> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
>>> cap->cbitpos = ebx & 0x3f;
>>>
>>> /*
>>> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
>>> */
>>> cap->reduced_phys_bits = 1;
>>>
>>> + /*
>>> + * The maximum number of SEV guests with SEV-ES disabled that can run
>>> + * simultaneously.
>>> + */
>>> + cap->sev_max_guests = ecx - edx + 1;
>>> out:
>>> g_free(pdh_data);
>>> g_free(cert_chain_data);
>>>
>>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> As mentioned in v1, I don't think a management application should need
> to run QEMU in order to figure this out.
Sorry, I didn't mean to ignore your feedback; I hadn't seen it.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'
@ 2019-04-12 12:17 ` Laszlo Ersek
0 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-04-12 12:17 UTC (permalink / raw)
To: Paolo Bonzini, Singh, Brijesh, qemu-devel@nongnu.org
Cc: Lendacky, Thomas, Markus Armbruster, Erik Skultety
On 04/12/19 10:05, Paolo Bonzini wrote:
> On 12/04/19 09:58, Laszlo Ersek wrote:
>> On 04/12/19 01:55, Singh, Brijesh wrote:
>>> There are limited numbers of the SEV guests that can be run concurrently.
>>> A management applications may need to know this limit so that it can place
>>> SEV VMs on hosts which have suitable resources available.
>>>
>>> Currently, this limit is not exposed to the application. Add a new
>>> 'sev-max-guest' field in the query-sev-capabilities to provide this
>>> information.
>>>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Markus Armbruster <armbru@redhat.com>
>>> Cc: Eric Blake <eblake@redhat.com>
>>> Cc: Daniel P. Berrangé <berrange@redhat.com>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Erik Skultety <eskultet@redhat.com>
>>> Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
>>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>>> ---
>>>
>>> changes since v1:
>>> - document the new field and add (since 4.1) annotation.
>>>
>>> qapi/target.json | 9 +++++++--
>>> target/i386/sev.c | 9 +++++++--
>>> 2 files changed, 14 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/qapi/target.json b/qapi/target.json
>>> index 1d4d54b600..8cd4fc7919 100644
>>> --- a/qapi/target.json
>>> +++ b/qapi/target.json
>>> @@ -177,13 +177,17 @@
>>> # @reduced-phys-bits: Number of physical Address bit reduction when SEV is
>>> # enabled
>>> #
>>> +# @sev-max-guests: maximum number of concurrent SEV guest with SEV-ES disabled
>>> +# (since 4.1)
>>> +#
>>> # Since: 2.12
>>> ##
>>> { 'struct': 'SevCapability',
>>> 'data': { 'pdh': 'str',
>>> 'cert-chain': 'str',
>>> 'cbitpos': 'int',
>>> - 'reduced-phys-bits': 'int'},
>>> + 'reduced-phys-bits': 'int',
>>> + 'sev-max-guests': 'int'},
>>> 'if': 'defined(TARGET_I386)' }
>>>
>>> ##
>>> @@ -200,7 +204,8 @@
>>> #
>>> # -> { "execute": "query-sev-capabilities" }
>>> # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
>>> -# "cbitpos": 47, "reduced-phys-bits": 5}}
>>> +# "cbitpos": 47, "reduced-phys-bits": 5,
>>> +# "sev-max-guests" : 15}}
>>
>> There seems to be a superfluous space character before the colon, but I
>> don't think it matters much.
>>
>>> #
>>> ##
>>> { 'command': 'query-sev-capabilities', 'returns': 'SevCapability',
>>> diff --git a/target/i386/sev.c b/target/i386/sev.c
>>> index cd77f6b5d4..6829586fbe 100644
>>> --- a/target/i386/sev.c
>>> +++ b/target/i386/sev.c
>>> @@ -488,7 +488,7 @@ sev_get_capabilities(void)
>>> guchar *pdh_data = NULL;
>>> guchar *cert_chain_data = NULL;
>>> size_t pdh_len = 0, cert_chain_len = 0;
>>> - uint32_t ebx;
>>> + uint32_t ebx, ecx, edx;
>>> int fd;
>>>
>>> fd = open(DEFAULT_SEV_DEVICE, O_RDWR);
>>> @@ -507,7 +507,7 @@ sev_get_capabilities(void)
>>> cap->pdh = g_base64_encode(pdh_data, pdh_len);
>>> cap->cert_chain = g_base64_encode(cert_chain_data, cert_chain_len);
>>>
>>> - host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
>>> + host_cpuid(0x8000001F, 0, NULL, &ebx, &ecx, &edx);
>>> cap->cbitpos = ebx & 0x3f;
>>>
>>> /*
>>> @@ -516,6 +516,11 @@ sev_get_capabilities(void)
>>> */
>>> cap->reduced_phys_bits = 1;
>>>
>>> + /*
>>> + * The maximum number of SEV guests with SEV-ES disabled that can run
>>> + * simultaneously.
>>> + */
>>> + cap->sev_max_guests = ecx - edx + 1;
>>> out:
>>> g_free(pdh_data);
>>> g_free(cert_chain_data);
>>>
>>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
> As mentioned in v1, I don't think a management application should need
> to run QEMU in order to figure this out.
Sorry, I didn't mean to ignore your feedback; I hadn't seen it.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-04-12 12:20 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11 23:55 [Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities' Singh, Brijesh
2019-04-11 23:55 ` Singh, Brijesh
2019-04-12 7:58 ` Laszlo Ersek
2019-04-12 7:58 ` Laszlo Ersek
2019-04-12 8:05 ` Paolo Bonzini
2019-04-12 8:05 ` Paolo Bonzini
2019-04-12 8:20 ` Daniel P. Berrangé
2019-04-12 8:20 ` Daniel P. Berrangé
2019-04-12 12:17 ` Laszlo Ersek
2019-04-12 12:17 ` Laszlo Ersek
2019-04-12 8:21 ` Daniel P. Berrangé
2019-04-12 8:21 ` Daniel P. Berrangé
2019-04-12 8:26 ` Erik Skultety
2019-04-12 8:26 ` Erik Skultety
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.