On 06/06/2018 03:45 AM, Erik Skultety wrote:
On Tue, Jun 05, 2018 at 12:59:25PM -0500, Brijesh Singh wrote:
> The API can be used by application to query the SEV capability.
>
> Signed-off-by: Brijesh Singh <<brijesh.singh(a)amd.com>>
> ---
> include/libvirt/libvirt-host.h | 42 +++++++++++++++++
> src/driver-hypervisor.h | 6 +++
> src/libvirt-host.c | 48 +++++++++++++++++++
> src/libvirt_public.syms | 5 ++
> src/qemu/qemu_capabilities.c | 7 +++
> src/qemu/qemu_capabilities.h | 4 ++
> src/qemu/qemu_driver.c | 93 +++++++++++++++++++++++++++++++++++++
> src/remote/remote_daemon_dispatch.c | 44 ++++++++++++++++++
> src/remote/remote_driver.c | 41 ++++++++++++++++
> src/remote/remote_protocol.x | 22 ++++++++-
> src/remote_protocol-structs | 13 ++++++
> 11 files changed, 324 insertions(+), 1 deletion(-)
please split this patch into multiple patches introducing per-driver change,
just like you're doing it for the GetLaunchSecurityInfo.
OK, noted.
>
> diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h
> index 84f4858..d020597 100644
> --- a/include/libvirt/libvirt-host.h
> +++ b/include/libvirt/libvirt-host.h
> @@ -432,6 +432,48 @@ typedef virNodeCPUStats *virNodeCPUStatsPtr;
>
> typedef virNodeMemoryStats *virNodeMemoryStatsPtr;
>
> +
> +/**
> + *
> + * SEV Parameters
> + */
> +
> +/**
> + * VIR_NODE_SEV_PDH:
> + *
> + * Marco represents the Platform Diffie-Hellman key, as VIR_TYPED_PARAMS_STRING.
> + */
> +# define VIR_NODE_SEV_PDH "pdh"
> +
> +/**
> + * VIR_NODE_SEV_CERT_CHAIN:
> + *
> + * Marco represents the Platform certificate chain that includes the
> + * endorsement key (PEK), owner certificate authority (OCD) and chip
> + * endorsement key (CEK), as VIR_TYPED_PARAMS_STRING.
> + */
> +# define VIR_NODE_SEV_CERT_CHAIN "cert-chain"
> +
> +/**
> + * VIR_NODE_SEV_CBITPOS:
> + *
> + * Marco represents the CBit Position used by hypervisor when SEV is enabled.
> + */
> +# define VIR_NODE_SEV_CBITPOS "cbitpos"
> +
> +/**
> + * VIR_NODE_SEV_REDUCED_PHYS_BITS:
> + *
> + * Marco represents the number of bits we lose in physical address space
> + * when SEV is enabled in the guest.
> + */
> +# define VIR_NODE_SEV_REDUCED_PHYS_BITS "reduced-phys-bits"
> +
> +int virNodeGetSEVCapability (virConnectPtr conn,
> + virTypedParameterPtr *params,
> + int *nparams,
> + unsigned int flags);
I'm not very convinced by having "Capability" in the name, PDH and
cert-chain
represent information about the system, pretty much something dmi-decode would
report, let's use virNodeGetSEVInfo as I suggested in v6.
I will rename to virNodeGetSEVInfo(..)
...
> #endif /* __QEMU_CAPABILITIES_H__*/
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c200c5a..7c619dd 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -137,6 +137,8 @@ VIR_LOG_INIT("qemu.qemu_driver");
>
> #define QEMU_NB_BANDWIDTH_PARAM 7
>
> +#define QEMU_SEV_PARAMS 4
The difference between this patch and the next one is basically ^this bit which
I don't even see being used, so I assume the next patch in the series is the
one to be applied.
Ah this macro is not used, I will fix in v8.