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

Re: [XEN][PATCH 2/7] xen/domctl: introduce XEN_DOMCTL_CDF_is_32bits


  • To: Julien Grall <julien@xxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Thu, 31 Jul 2025 22:49:49 +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=E+BXB9JHtS3exQvWJhL4OM5/vBuEunZW7VhovC5VFu8=; b=lU5kgAbX98ZBwQrf/2lSOgWuHpEnI0sr9EdaXJOcSkJP+xUQZDNecqs/GU1kL4EMPb1yHP04WBzDwOxpkQHgMUmZQpa3XcCk8t9MuEsoxuAZ4UX/BghsQxYHAU7MBlI1zGvujNN2OGFzjSAqwEN2AKSnODHu+TBESfgGxm2TwjJRKbdWt9Lbzeb49UzIYotHQucFIlrH2zvDeKVgcgLSE3w5V8Loo7HqTNvK/8hp8RG7/zYtvaaVDfLkKcqI3MUXHskVDWP3eunEHx3bFbIKvQ6EVrhbPMySUVMS5eHNUEaVKWsRbbbjPzb9L4cRo6rMZDbBdN5tLtq9QDZwRtTWmw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ivT/R/ySzG0cegYgFf07emTDWaxi+mJVKMqkkkxmBwdPDhSpcW/359VfTEni3oS25glSyI7MiKez/WYdDY6aRDA1Lt0UaY3s7OFIreU3Grc+gASIuR6pCJfvTL3zcNcwIdjJER2X3ox6Nln8pBopcLYLx+7LW5UUL0+KwFAYU9iXWzRYkAI1QZr89AaBCFzmshBdPuJFdMuu6PNzc+ZDO++aP8VSNwYXd+DK7Z2z/yjRh2Q0Lipq7mEyhhAUsWCbCCgXj3LwVJ0XkQSgr+bXj8SBfQdDZDArBrIAWyHRe2ATsdtGT4lr8VM/pewwyWMCK3wnf7SFl26PSzF/7KXvPA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 31 Jul 2025 19:50:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 31.07.25 18:19, Julien Grall wrote:
Hi Teddy,

On 31/07/2025 15:02, Teddy Astie wrote:
Hello,

Le 31/07/2025 à 11:44, Grygorii Strashko a écrit :
Hence, this patch introduces extra "XEN_DOMCTL_CDF_is_32bits" flag which is
intended to be used by 64bit Arches for proper configuration of domain type
when domain is created.

Now it adds initial support for this flag for Arm64 arch only. The default
Arm64 domain type is changed to 64bit:
- the Arm Xen boot code is handling this case properly already;
- for toolstack case the XEN_DOMCTL_set_address_size hypercall handling
updated to forcibly configure domain type regardless of current domain type
configuration. Hence toolstack configures vcpus and memory after
configuring domain type it allows to start with domain default AArch64 type
and then switch to requested domain type and ensures all required domain
settings applied.

For Arm32 this flag is ignored.

Note. For Arm64, Once toolstack is updated to probe guest binary before
creating domain the XEN_DOMCTL_set_address_size will become obsolete.

[1] https://lists.xen.org/archives/html/xen-devel/2025-07/msg01647.html
[2] https://lists.xen.org/archives/html/xen-devel/2025-07/msg01648.html

Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---

I would prefer it be better presented as a platform-specific enum.
Something like

```
enum xen_arch_subarch {

We need to be cautious when using enum in the public interface because, if I am 
not mistaken, the size of the enum if not stable.

    XEN_ARM_SUBARCH_NATIVE = 0,

"native" is a bit ambiguous when a platform is able to support 32-bit and 
64-bit. Does this refer to the bitness of the hypervisor (EL2)? Firmware (EL3)?

That said, I am not entirely sure I see the value of native because EL1 (the 
kernel exception level) has to be known at boot. So it is better to explicitly 
mention whether the kernel is 32-bit or 64-bit.

    XEN_ARM_SUBARCH_ARMV7 = 1,

This name would not be correct. You can have a 32-bit Armv8 guest. A better 
name is SUBARCH_AARCH32.

    XEN_ARM_SUBARCH_AARCH64 = 2,

I've been thinking how about using ELF "e_machine" to identify guest?

It defines all arch ids already (no need to invent anything custom),
plus supports EM_NONE which can be treated as default value or indicate that
guest type is not set - arch specific handling.


config/domain structs:
   uint16_t e_machine;

Arch code can define and check number of supported ids, for example:
 arm: EM_NONE, EM_ARM (32bit), EM_AARCH64 (64bit)
 x86: EM_NONE [, EM_386 (32bit), EM_X86_64 (64bit) ]



--
Best regards,
-grygorii



 


Rackspace

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