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

[PATCH 01/23] xen: introduce hardware domain create flag


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 6 Mar 2025 17:03:21 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=C3v6UlYBcmi3ov7lYi2wo5cPY1aCBB8qLirYSeYSjb0=; b=msQC1FXgdPvjqSPW9oK2LjGhHGJN9cc+XY0Km1BGrKbDQob23pmOD83IxaiRfWND07M/+BU9w8i6IzhkmOPUlYCzXgdHLwz8XowRy/J4fLXV4kKmD4qM0vIrfkv9WizW8dR7Hmi03Wz7YGUZe/AedQqexjYvxlXv/nqu+ku+QMeGQSmoXcgIQg01R27E/NCadFRWjrymdhLcNKxBVfpPWEFY6qhQUSd4PZNoWGp5V7e/mUPsPDucbTvnwg5w32iofMR5EqDc3r8anmOxjBv4hF0dgWu5PrPcnU7Y75x/RY+2Imnwxogi9JY8gaHfo0HHVihgktBuKT8H0K/04Zzkhw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A2gsierDPhEKm1IQG1yL6KmjONIvqIfpbQQJL6hdPE0RoPmFU5FxEoDGoPsEjq9MDnHVwbNWlgQBuwQQANyWsubRJkXO2uc0i4hXVDVob4xMktVvijIb+i0GhdtmaM0ExNjBRkPa7Zv9hyjOCte5lVAf1gvHDX48FWxsdq9jU12f17NcIjzg04zkqbNaHPgIYlrWFFylb0uQkrwvNxwLKoGXFlhFvunRhHuw4QHr3USG/cdhl/+0HjzDxDA7ECdnY+8uA/7/lH7/U5S2cqYAu3PRvyxqmwOHW0Dy1hB7MKXyHiveme5qHEy0Lt2ZVnsdxwpq4sJcpMroYZdGK8s65Q==
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, 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 Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Thu, 06 Mar 2025 22:04:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>

Add and use a new internal create domain flag to specify the hardware
domain.  This removes the hardcoding of domid 0 as the hardware domain.

This allows more flexibility with domain creation.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 xen/arch/arm/domain_build.c | 2 +-
 xen/arch/x86/setup.c        | 3 ++-
 xen/common/domain.c         | 2 +-
 xen/include/xen/domain.h    | 2 ++
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index d4570bc0b4..6784ee6f6d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2358,7 +2358,7 @@ void __init create_dom0(void)
         .max_maptrack_frames = -1,
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
-    unsigned int flags = CDF_privileged;
+    unsigned int flags = CDF_privileged | CDF_hardware;
     int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 143749e5da..fa18b9caf2 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1017,7 +1017,8 @@ static struct domain *__init create_dom0(struct boot_info 
*bi)
 
     /* Create initial domain.  Not d0 for pvshim. */
     domid = get_initial_domain_id();
-    d = domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged);
+    d = domain_create(domid, &dom0_cfg,
+                      pv_shim ? 0 : CDF_privileged | CDF_hardware);
     if ( IS_ERR(d) )
         panic("Error creating d%u: %ld\n", domid, PTR_ERR(d));
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0c4cc77111..c170597410 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -699,7 +699,7 @@ struct domain *domain_create(domid_t domid,
     d->is_privileged = flags & CDF_privileged;
 
     /* Sort out our idea of is_hardware_domain(). */
-    if ( domid == 0 || domid == hardware_domid )
+    if ( flags & CDF_hardware || domid == hardware_domid )
     {
         if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
             panic("The value of hardware_dom must be a valid domain ID\n");
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 3de5635291..b5e82578c3 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -50,6 +50,8 @@ void arch_get_domain_info(const struct domain *d,
 #else
 #define CDF_staticmem            0
 #endif
+/* Is this the hardware? */
+#define CDF_hardware             (1U << 3)
 
 #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap)
 #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem)
-- 
2.48.1




 


Rackspace

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