domain: adjust soft-reset arch dependency

Arm's arch_domain_soft_reset() returning -ENOSYS is quite unhelpful: This
way a domain will be crashed if a tool stack mistakenly invokes
XEN_DOMCTL_soft_reset on it. Instead the tool stack should be told of its
mistake.

Introduce HAS_SOFT_RESET, implied only by x86. "imply" rather than
"select" such that HAS_SOFT_RESET can later gain a dependency on
MGMT_HYPERCALLS. That way HAS_SOFT_RESET will go off when
MGMT_HYPERCALLS is off.

Check the new setting early in domctl handling, and compile out the thus
dead (when HAS_SOFT_RESET=n) domain_soft_reset() as well as its dedicated
helpers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
Acked-by: Julien GralL <jgrall@amazon.com>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
Jan Beulich committed 2025-11-19 10:14:13 +01:00
1 parent dc6f5458e9
commit dedbb0e212
10 files changed
+18 -15

No files matched your search

-5
View File
@@ -875,11 +875,6 @@ void arch_domain_unpause(struct domain *d)
{
}
int arch_domain_soft_reset(struct domain *d)
{
return -ENOSYS;
}
void arch_domain_creation_finished(struct domain *d)
{
p2m_domain_creation_finished(d);
-5
View File
@@ -214,11 +214,6 @@ void arch_domain_unpause(struct domain *d)
BUG_ON("unimplemented");
}
int arch_domain_soft_reset(struct domain *d)
{
BUG_ON("unimplemented");
}
void arch_domain_creation_finished(struct domain *d)
{
BUG_ON("unimplemented");
-5
View File
@@ -188,11 +188,6 @@ void arch_domain_unpause(struct domain *d)
BUG_ON("unimplemented");
}
int arch_domain_soft_reset(struct domain *d)
{
BUG_ON("unimplemented");
}
void arch_domain_creation_finished(struct domain *d)
{
BUG_ON("unimplemented");
+1
View File
@@ -29,6 +29,7 @@ config X86
select HAS_PCI_MSI
select HAS_PIRQ
select HAS_SCHED_GRANULARITY
imply HAS_SOFT_RESET
select HAS_UBSAN
select HAS_VMAP
select HAS_VPCI if HVM
+2
View File
@@ -1030,6 +1030,7 @@ void arch_domain_unpause(struct domain *d)
viridian_time_domain_thaw(d);
}
#ifdef CONFIG_HAS_SOFT_RESET
int arch_domain_soft_reset(struct domain *d)
{
struct page_info *page = virt_to_page(d->shared_info), *new_page;
@@ -1131,6 +1132,7 @@ int arch_domain_soft_reset(struct domain *d)
return ret;
}
#endif /* CONFIG_HAS_SOFT_RESET */
void arch_domain_creation_finished(struct domain *d)
{
+3
View File
@@ -155,6 +155,9 @@ config HAS_PMAP
config HAS_SCHED_GRANULARITY
bool
config HAS_SOFT_RESET
bool
config HAS_STACK_PROTECTOR
bool
+2
View File
@@ -2351,6 +2351,7 @@ argo_destroy(struct domain *d)
write_unlock(&L1_global_argo_rwlock);
}
#ifdef CONFIG_HAS_SOFT_RESET
void
argo_soft_reset(struct domain *d)
{
@@ -2374,3 +2375,4 @@ argo_soft_reset(struct domain *d)
write_unlock(&L1_global_argo_rwlock);
}
#endif /* CONFIG_HAS_SOFT_RESET */
+2
View File
@@ -1687,6 +1687,7 @@ void domain_unpause_except_self(struct domain *d)
domain_unpause(d);
}
#ifdef CONFIG_HAS_SOFT_RESET
int domain_soft_reset(struct domain *d, bool resuming)
{
struct vcpu *v;
@@ -1724,6 +1725,7 @@ int domain_soft_reset(struct domain *d, bool resuming)
return rc;
}
#endif /* CONFIG_HAS_SOFT_RESET */
int vcpu_reset(struct vcpu *v)
{
+6
View File
@@ -466,6 +466,12 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
case XEN_DOMCTL_soft_reset:
case XEN_DOMCTL_soft_reset_cont:
if ( !IS_ENABLED(CONFIG_HAS_SOFT_RESET) )
{
ret = -EOPNOTSUPP;
break;
}
if ( d == current->domain ) /* no domain_pause() */
{
ret = -EINVAL;
+2
View File
@@ -3962,6 +3962,7 @@ int gnttab_release_mappings(struct domain *d)
return 0;
}
#ifdef CONFIG_HAS_SOFT_RESET
void grant_table_warn_active_grants(struct domain *d)
{
struct grant_table *gt = d->grant_table;
@@ -4006,6 +4007,7 @@ void grant_table_warn_active_grants(struct domain *d)
#undef WARN_GRANT_MAX
}
#endif /* CONFIG_HAS_SOFT_RESET */
void
grant_table_destroy(
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.