Helper domctl_lock_{acquire,release} is domctl_lock, which HVM_PARAM_IDENT_PT
uses to ensure synchronization and hence being a toolstack-only operation.
So we shall make HVM_PARAM_IDENT_PT conditional upon CONFIG_MGMT_HYPERCALLS,
returning -EOPNOTSUPP when MGMT_HYPERCALLS=n.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v2 -> v3:
- new commit
---
xen/arch/x86/hvm/hvm.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e77b0c03ed..e7d630af95 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4281,7 +4281,6 @@ static int hvm_allow_set_param(struct domain *d,
static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
{
struct domain *curr_d = current->domain;
- struct vcpu *v;
int rc;
rc = hvm_allow_set_param(d, index, value);
@@ -4307,6 +4306,10 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
rc = -EINVAL;
break;
case HVM_PARAM_IDENT_PT:
+ {
+#ifdef CONFIG_MGMT_HYPERCALLS
+ struct vcpu *v;
+
/*
* Only actually required for VT-x lacking unrestricted_guest
* capabilities. Short circuit the pause if possible.
@@ -4334,7 +4337,11 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
domain_unpause(d);
domctl_lock_release();
+#else
+ rc = -EOPNOTSUPP;
+#endif /* CONFIG_MGMT_HYPERCALLS */
break;
+ }
case HVM_PARAM_DM_DOMAIN:
/* The only value this should ever be set to is DOMID_SELF */
if ( value != DOMID_SELF )
--
2.34.1