File 377e6d4b-amd-sev-apis.patch of Package perl-Sys-Virt
commit 377e6d4b72bdb21709ca8fb889062b53734d87eb
Author: Daniel P. Berrangé <berrange@redhat.com>
Date: Wed Jun 27 13:04:29 2018 +0100
Add APIs and constants for AMD SEV
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Index: Sys-Virt-4.0.0/Changes
===================================================================
--- Sys-Virt-4.0.0.orig/Changes
+++ Sys-Virt-4.0.0/Changes
@@ -6,6 +6,7 @@ Revision history for perl module Sys::Vi
- Fix rd_req / wr_req hash keys for block stats
- Fix misc spelling mistakes
- Fix docs for storage pool destroy/undefine
+ - Add new constants and APIs for AMD SEV
3.9.1 2017-12-05
Index: Sys-Virt-4.0.0/lib/Sys/Virt.pm
===================================================================
--- Sys-Virt-4.0.0.orig/lib/Sys/Virt.pm
+++ Sys-Virt-4.0.0/lib/Sys/Virt.pm
@@ -1461,6 +1461,32 @@ of the MEMORY PARAMETERS constants. The
parameter is currently unused, and defaults to 0 if omitted.
+=item $info = $conn->get_node_sev_info($flags=0)
+
+Get the AMD SEV information for the host. C<$flags> is
+currently unused and defaults to 0 if omitted. The returned
+hash contains the following keys:
+
+=over 4
+
+=item Sys::Virt::SEV_CBITPOS
+
+The CBit position
+
+=item Sys::Virt::SEV_CERT_CHAIN
+
+The certificate chain
+
+=item Sys::Virt::SEV_PDH
+
+Platform diffie-hellman key
+
+=item Sys::Virt::SEV_REDUCED_PHYS_BITS
+
+The number of physical address bits used by SEV
+
+=back
+
=item $conn->node_suspend_for_duration($target, $duration, $flags=0)
Suspend the the host, using mode C<$target> which is one of the NODE
Index: Sys-Virt-4.0.0/lib/Sys/Virt/Domain.pm
===================================================================
--- Sys-Virt-4.0.0.orig/lib/Sys/Virt/Domain.pm
+++ Sys-Virt-4.0.0/lib/Sys/Virt/Domain.pm
@@ -2020,6 +2020,20 @@ at the moment when the threshold was rea
Changes the actions of lifecycle events for domain represented as
<on_$type>$action</on_$type> in the domain XML.
+=item $info = $dom->get_launch_security_info($flags=0)
+
+Get information about the domaim launch security policy. C<$flags>
+is currently unused and defaults to zero. The returned hash may
+contain the following keys
+
+=over 4
+
+=item Sys::Virt::Domain::LAUNCH_SECURITY_SEV_MEASUREMENT
+
+The AMD SEV launch measurement
+
+=back
+
=back
=head1 CONSTANTS
Index: Sys-Virt-4.0.0/Virt.xs
===================================================================
--- Sys-Virt-4.0.0.orig/Virt.xs
+++ Sys-Virt-4.0.0/Virt.xs
@@ -2398,6 +2398,23 @@ get_node_security_model(con)
OUTPUT:
RETVAL
+HV *
+get_node_sev_info(conn, flags=0)
+ virConnectPtr conn;
+ unsigned int flags;
+ PREINIT:
+ virTypedParameterPtr params;
+ int nparams;
+ CODE:
+ if (virNodeGetSEVInfo(conn, ¶ms, &nparams, flags) < 0) {
+ _croak_error();
+ }
+
+ RETVAL = vir_typed_param_to_hv(params, nparams);
+ free(params);
+ OUTPUT:
+ RETVAL
+
void
get_node_cpu_map(con, flags=0)
virConnectPtr con;
@@ -4864,6 +4881,23 @@ set_perf_events(dom, newparams, flags=0)
Safefree(params);
+HV *
+get_launch_security_info(dom, flags=0)
+ virDomainPtr dom;
+ unsigned int flags;
+ PREINIT:
+ virTypedParameterPtr params;
+ int nparams;
+ CODE:
+ if (virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, flags) < 0) {
+ _croak_error();
+ }
+ RETVAL = vir_typed_param_to_hv(params, nparams);
+ free(params);
+ OUTPUT:
+ RETVAL
+
+
unsigned long
get_max_memory(dom)
virDomainPtr dom;
@@ -8393,6 +8427,12 @@ BOOT:
REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_ADD, NODE_ALLOC_PAGES_ADD);
REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_SET, NODE_ALLOC_PAGES_SET);
+
+ REGISTER_CONSTANT_STR(VIR_NODE_SEV_CBITPOS, SEV_CBITPOS);
+ REGISTER_CONSTANT_STR(VIR_NODE_SEV_CERT_CHAIN, SEV_CERT_CHAIN);
+ REGISTER_CONSTANT_STR(VIR_NODE_SEV_PDH, SEV_PDH);
+ REGISTER_CONSTANT_STR(VIR_NODE_SEV_REDUCED_PHYS_BITS, SEV_REDUCED_PHYS_BITS);
+
stash = gv_stashpv( "Sys::Virt::Event", TRUE );
REGISTER_CONSTANT(VIR_EVENT_HANDLE_READABLE, HANDLE_READABLE);
@@ -9116,6 +9156,9 @@ BOOT:
REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY, LIFECYCLE_ACTION_COREDUMP_DESTROY);
REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART, LIFECYCLE_ACTION_COREDUMP_RESTART);
+
+ REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT, LAUNCH_SECURITY_SEV_MEASUREMENT);
+
stash = gv_stashpv( "Sys::Virt::DomainSnapshot", TRUE );
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, DELETE_CHILDREN);
REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, DELETE_METADATA_ONLY);