[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN][PATCH 3/8] xen/arm: move vcpu_switch_to_aarch64_mode() in arm64


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Wed, 23 Jul 2025 07:58:38 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nFDTHmETQ5fRxFAxpX2NNcZUKxnF62Jp5vQIcFCpppM=; b=W7B8Y6n4YivbwCNVtvTVzHSzJtBw0lmRtR4TZrae9P0pfT0pRygZ7mIS9LZFsXAjbbsJHtR4+hn3r8pFMkAV3vs70RLPsyqu2KsrftQq7qkjJSbxojZeMbHXBmWQVUQwmSYODtpqJMNDBMUBtEemtmOgelouvYXaheHNitQ1PXafUqLN95vEyCAK6KcWlbHSMMDzHSEzmKy6kdARUU0fedQ9cvLKMoxBYY5QR64OxqaxJy9NmntkYREKzHRmGX92R438B8VRjSdaXMDuIhdqeRBIo2hjTn5Y4bdCsz9DoXKw2txjhLvTSl5M1zXUjLW2UnkOWpwGJOaVIWt8QktJKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JwyVJguC8Ab4aA+yOQUdsblHpqazYZvyVmM4LK31pEer0QLwsAsykP0Sk8bfc68rqMEfZe0Kb7yjcRQPQzKwXtlVhDiMiLvBMGXqtpioue0Bm0JHs8f/ZebjVrVGZXGRVsOji3pU0dR50D0gYzxgkTSzrvFZXHoRTAD6sH1uUxYyAkbEWEAsxsEsl/2Wy4tqeJR5OgPkYAD0JTG0EiccnRmLyDDzl09O9aDV0tmbwztkZDildTlV2irW/V0HqmZeNagSgqrpqlvGC1FyQRwf2ZHadr01KOfVgwRsqBhQEAis262YVhDDCeEE0/ABsKDkLa2VrX12Yj7DcIlZqOLv5w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Delivery-date: Wed, 23 Jul 2025 07:58:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb+6eZp6GoTWRoEk2X7VZ+pq7wbg==
  • Thread-topic: [XEN][PATCH 3/8] xen/arm: move vcpu_switch_to_aarch64_mode() in arm64

From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>

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_strashko@xxxxxxxx>
---
 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;
+}
+
 /*
  * 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)
+
+#endif /* ARM_ARM32_DOMAIN_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/arm64/domain.h 
b/xen/arch/arm/include/asm/arm64/domain.h
new file mode 100644
index 000000000000..b5f1177d2508
--- /dev/null
+++ b/xen/arch/arm/include/asm/arm64/domain.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ARM_ARM64_DOMAIN_H
+#define ARM_ARM64_DOMAIN_H
+
+/*
+ * Set guest execution state to AArch64 (EL1) for selected vcpu
+ *
+ * @vcpu: pointer to the vcpu structure
+ */
+void vcpu_switch_to_aarch64_mode(struct vcpu *v);
+
+#endif /* ARM_ARM64_DOMAIN_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/domain.h 
b/xen/arch/arm/include/asm/domain.h
index a3487ca71303..fa258eb8d359 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -24,9 +24,11 @@ enum domain_type {
 };
 #define is_32bit_domain(d) ((d)->arch.type == DOMAIN_32BIT)
 #define is_64bit_domain(d) ((d)->arch.type == DOMAIN_64BIT)
+#include <asm/arm64/domain.h>
 #else
 #define is_32bit_domain(d) (1)
 #define is_64bit_domain(d) (0)
+#include <asm/arm64/domain.h>
 #endif
 
 /*
@@ -246,7 +248,6 @@ struct arch_vcpu
 }  __cacheline_aligned;
 
 void vcpu_show_registers(struct vcpu *v);
-void vcpu_switch_to_aarch64_mode(struct vcpu *v);
 
 /*
  * Due to the restriction of GICv3, the number of vCPUs in AFF0 is
-- 
2.34.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.