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

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


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Wed, 23 Jul 2025 13:45:17 +0300
  • 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=h+7VgzAtPOvtIFHv9OmnjG5IBZFUidZmHs2DAkFzkyU=; b=H5YAB58Y3eucPU1msT7fZaFrYNN3MIDM0YXP+Elt1AUkhdGK3Xl/DHDyJ23RvOrDkjJSMAPv+Dzua0A4ccMLApCiu6lSmc8CLJfa3ral7InpQPR/morMhwJEdgv3Mk445Bh6tK7LjrPhpTjyNGs4Mbd02waN9VVsjkSBjhSQ1Jt+PADrkXi7vWL6BQtkPqoyLD9FBNmh6kGynbe2WugYXX8VWPykVhil2VDORjvP4FPqCtAVDPXqVW8wkGXPdJ4Zv24OR0QyhAeIt9Ku347q/eWhHHS8n6BxOfT8x6/xIvpiFcPChswxY40Yxq33j0gg1lmHoR/A7VPpiYhv6SBjQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UUuDCE4Nt5DcE9xEUbgqU7jdL6Hqbq5HN+yBNtlE0zoaHTLpKpH+W3+wtAQ2cSJ3oIX0S/2ZmrMHAPMDdqPd7G3AVVFc69PrQU2y2VlUkk/3ou+ySJDRHif1tUKjwjfIqLNbkIoX1CAK5TgQoEPPmrvGwefZj2s5zVsIRdMP+91cGltuKH/tspf/tNZoQXoZFK6Ihl2cd89RDwkW3w5dzLcmS6EqxbjzcocwRHOkLPhKf2u0MifZ7dmET4b7B5hlUcHAbWSbHPHvsBjgIXxYLngEMlrClPxY5G5f1W9Ehs7BnI6O8ModMAl95tKdDAUJcKg+V69esYBaTSJGdgl2zQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, 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>
  • Delivery-date: Wed, 23 Jul 2025 10:45:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 23.07.25 12:22, Julien Grall wrote:
Hi,

On 23/07/2025 08:58, Grygorii Strashko wrote:
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;
+}

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



 


Rackspace

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