On 23.07.25 12:22, Julien Grall wrote:
Hi,
On 23/07/2025 08:58, Grygorii Strashko wrote:
From: Grygorii Strashko <grygorii_stras...@epam.com>
The vcpu_switch_to_aarch64_mode() is Arm64 specific, so move it in Arm64.
As part of this change:
- introduce arm32/arm64 domain.h headers and include them in asm/domain.h
basing on CONFIG_ARM_xx;
- declare vcpu_switch_to_aarch64_mode() for arm64;
- add vcpu_switch_to_aarch64_mode() as empty macro for arm32.
Signed-off-by: Grygorii Strashko <grygorii_stras...@epam.com>
---
xen/arch/arm/arm64/domain.c | 5 +++++
xen/arch/arm/domain.c | 5 -----
xen/arch/arm/include/asm/arm32/domain.h | 17 +++++++++++++++++
xen/arch/arm/include/asm/arm64/domain.h | 22 ++++++++++++++++++++++
xen/arch/arm/include/asm/domain.h | 3 ++-
5 files changed, 46 insertions(+), 6 deletions(-)
create mode 100644 xen/arch/arm/include/asm/arm32/domain.h
create mode 100644 xen/arch/arm/include/asm/arm64/domain.h
diff --git a/xen/arch/arm/arm64/domain.c b/xen/arch/arm/arm64/domain.c
index dd1909892995..1e78986b5a7b 100644
--- a/xen/arch/arm/arm64/domain.c
+++ b/xen/arch/arm/arm64/domain.c
@@ -55,6 +55,11 @@ void vcpu_regs_user_to_hyp(struct vcpu *vcpu,
#undef C
}
+void vcpu_switch_to_aarch64_mode(struct vcpu *v)
+{
+ v->arch.hcr_el2 |= HCR_RW;
+}
Strictly speaking arm/domain.c is GPLv2-or-later. But arm64/domain.c doesn't
have a license.
So it would default to GPLv2-only. There have been argument in the past on
whether we would
re-license code from GPLv2-or-later to GPLv2-only. But this was never
concluded. So I am not entirely sure what to do with this change...
Bertrand, Michal, Stefano?
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index bbd4a764c696..e785278cdbd7 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -605,11 +605,6 @@ void arch_vcpu_destroy(struct vcpu *v)
free_xenheap_pages(v->arch.stack, STACK_ORDER);
}
-void vcpu_switch_to_aarch64_mode(struct vcpu *v)
-{
- v->arch.hcr_el2 |= HCR_RW;
-}
-
int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
{
unsigned int max_vcpus;
diff --git a/xen/arch/arm/include/asm/arm32/domain.h
b/xen/arch/arm/include/asm/arm32/domain.h
new file mode 100644
index 000000000000..4d1251e9c128
--- /dev/null
+++ b/xen/arch/arm/include/asm/arm32/domain.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ARM_ARM32_DOMAIN_H
+#define ARM_ARM32_DOMAIN_H
+
+#define vcpu_switch_to_aarch64_mode(v)
I think you want to "consume" v. IOW (void)(v). That said, we tend to prefer
using a static inline whenever it is possible. Have you tried it?
will do static inline.
Thank you.
--
Best regards,
-grygorii