Signed-off-by: Tyler Fanelli <tfanelli(a)redhat.com>
---
src/remote/remote_daemon_dispatch.c | 44 +++++++++++++++++++++++
src/remote/remote_driver.c | 55 +++++++++++++++++++++++++++++
src/remote/remote_protocol.x | 21 ++++++++++-
src/remote_protocol-structs | 12 +++++++
4 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 2463386e39..dcb734ab09 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -5305,6 +5305,50 @@ remoteDispatchNodeGetSevInfo(virNetServer *server G_GNUC_UNUSED,
return rv;
}
+static int
+remoteDispatchDomainGetSevAttestationReport(virNetServer *server G_GNUC_UNUSED,
+ virNetServerClient *client,
+ virNetMessage *msg G_GNUC_UNUSED,
+ struct virNetMessageError *rerr,
+ remote_domain_get_sev_attestation_report_args
*args,
+ remote_domain_get_sev_attestation_report_ret
*ret)
+{
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ int rv = -1;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
+ virDomainPtr dom = NULL;
+
+ if (!conn)
+ goto cleanup;
+
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
+ goto cleanup;
+
+ if (virTypedParamsDeserialize((struct _virTypedParameterRemote *)
args->params.params_val,
+ args->params.params_len,
+ 0, ¶ms, &nparams) < 0)
+ goto cleanup;
+
+ if (virDomainGetSevAttestationReport(dom, ¶ms, &nparams, args->flags)
< 0)
+ goto cleanup;
+
+ if (virTypedParamsSerialize(params, nparams,
+ REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX,
+ (struct _virTypedParameterRemote **)
&ret->params.params_val,
+ &ret->params.params_len,
+ args->flags) < 0)
+ goto cleanup;
+
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ virTypedParamsFree(params, nparams);
+
+ return rv;
+}
static int
remoteDispatchNodeGetMemoryParameters(virNetServer *server G_GNUC_UNUSED,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 7e7a21fcab..bfc5d6c874 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6775,6 +6775,60 @@ remoteNodeGetSEVInfo(virConnectPtr conn,
return rv;
}
+static int
+remoteDomainGetSevAttestationReport(virDomainPtr dom,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags)
+{
+ int rv = -1;
+ remote_domain_get_sev_attestation_report_args args;
+ remote_domain_get_sev_attestation_report_ret ret;
+ struct private_data *priv = dom->conn->privateData;
+ virTypedParameterPtr ret_params = NULL;
+ int ret_nparams = 0;
+
+ remoteDriverLock(priv);
+
+
+ make_nonnull_domain(&args.dom, dom);
+ args.flags = flags;
+
+ if (virTypedParamsSerialize(*params, *nparams,
+ REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX,
+ (struct _virTypedParameterRemote **)
&args.params.params_val,
+ &args.params.params_len,
+ VIR_TYPED_PARAM_STRING_OKAY) < 0) {
+ goto cleanup;
+ }
+
+ memset(&ret, 0, sizeof(ret));
+ if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SEV_ATTESTATION_REPORT,
+ (xdrproc_t) xdr_remote_domain_get_sev_attestation_report_args, (char *)
&args,
+ (xdrproc_t) xdr_remote_domain_get_sev_attestation_report_ret, (char *)
&ret) == -1) {
+ goto done;
+ }
+
+ if (virTypedParamsDeserialize((struct _virTypedParameterRemote *)
ret.params.params_val,
+ ret.params.params_len,
+ REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX,
+ &ret_params,
+ &ret_nparams) < 0)
+ goto cleanup;
+
+ virTypedParamsFree(*params, *nparams);
+ *params = g_steal_pointer(&ret_params);
+ *nparams = ret_nparams;
+
+ rv = 0;
+
+cleanup:
+ virTypedParamsFree(ret_params, ret_nparams);
+ xdr_free((xdrproc_t) xdr_remote_domain_get_sev_attestation_report_ret, (char *)
&ret);
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
static int
remoteNodeGetCPUMap(virConnectPtr conn,
@@ -8651,6 +8705,7 @@ static virHypervisorDriver hypervisor_driver = {
.domainGetMessages = remoteDomainGetMessages, /* 7.1.0 */
.domainStartDirtyRateCalc = remoteDomainStartDirtyRateCalc, /* 7.2.0 */
.domainSetLaunchSecurityState = remoteDomainSetLaunchSecurityState, /* 8.0.0 */
+ .domainGetSevAttestationReport = remoteDomainGetSevAttestationReport, /* 8.1.0 */
};
static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 4f13cef662..4e5ce42bd5 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -275,6 +275,9 @@ const REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX = 64;
/* Upper limit on number of launch security state entries */
const REMOTE_DOMAIN_LAUNCH_SECURITY_STATE_PARAMS_MAX = 64;
+/* Upper limit on number of SEV attestation report entries */
+const REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX = 64;
+
/* Upper limit on number of parameters describing a guest */
const REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX = 2048;
@@ -3651,6 +3654,16 @@ struct remote_domain_set_launch_security_state_args {
unsigned int flags;
};
+struct remote_domain_get_sev_attestation_report_args {
+ remote_nonnull_domain dom;
+ remote_typed_param
params<REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX>;
+ unsigned int flags;
+};
+
+struct remote_domain_get_sev_attestation_report_ret {
+ remote_typed_param
params<REMOTE_DOMAIN_GET_SEV_ATTESTATION_REPORT_PARAMS_MAX>;
+};
+
/* nwfilter binding */
struct remote_nwfilter_binding_lookup_by_port_dev_args {
@@ -6920,5 +6933,11 @@ enum remote_procedure {
* @generate: both
* @acl: domain:write
*/
- REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE = 439
+ REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE = 439,
+
+ /**
+ * @generate: none
+ * @acl: domain:read
+ */
+ REMOTE_PROC_DOMAIN_GET_SEV_ATTESTATION_REPORT = 440
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index d88176781d..67333284cd 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -3013,6 +3013,17 @@ struct remote_domain_set_launch_security_state_args {
} params;
u_int flags;
};
+struct remote_domain_get_sev_attestation_report_args {
+ remote_nonnull_domain dom;
+ u_int flags;
+};
+struct remote_domain_get_sev_attestation_report_ret {
+ struct {
+ u_int params_len;
+ remote_typed_param * params_val;
+ } params;
+ int nparams;
+};
struct remote_nwfilter_binding_lookup_by_port_dev_args {
remote_nonnull_string name;
};
@@ -3689,4 +3700,5 @@ enum remote_procedure {
REMOTE_PROC_NETWORK_CREATE_XML_FLAGS = 437,
REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE = 438,
REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE = 439,
+ REMOTE_PROC_DOMAIN_GET_SEV_ATTESTATION_REPORT = 440,
};
--
2.34.1