|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] domain: adjust soft-reset arch dependency
commit dedbb0e212f068bf7bb1f19e50e1cf105aa18828
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Nov 19 10:14:13 2025 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Nov 19 10:14:13 2025 +0100
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@xxxxxxxx>
Reviewed-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
Acked-by: Julien GralL <jgrall@xxxxxxxxxx>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
xen/arch/arm/domain.c | 5 -----
xen/arch/ppc/stubs.c | 5 -----
xen/arch/riscv/stubs.c | 5 -----
xen/arch/x86/Kconfig | 1 +
xen/arch/x86/domain.c | 2 ++
xen/common/Kconfig | 3 +++
xen/common/argo.c | 2 ++
xen/common/domain.c | 2 ++
xen/common/domctl.c | 6 ++++++
xen/common/grant_table.c | 2 ++
10 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index e36719bce4..ab78444335 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -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);
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index bdaf474c5c..75ebcae5e2 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -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");
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 1a8c86cd8d..340ed3cd6c 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -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");
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 3f0f3a0f3a..c808c989fc 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -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
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 19fd86ce88..66b7412b87 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -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)
{
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 53f681bbb2..401d5046f6 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -155,6 +155,9 @@ config HAS_PMAP
config HAS_SCHED_GRANULARITY
bool
+config HAS_SOFT_RESET
+ bool
+
config HAS_STACK_PROTECTOR
bool
diff --git a/xen/common/argo.c b/xen/common/argo.c
index cbe8911a43..029a82825b 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -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 */
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 775c339285..3b6e9471c4 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -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)
{
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 954d790226..29a7726d32 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -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;
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index cf131c43a1..592384514b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -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(
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |