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

[xen staging] x86/domain: Implement arch_init_idle_domain()



commit fdb4d76ff3c44752d067fe598c0c021389030c63
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jul 18 21:12:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jul 31 11:14:50 2024 +0100

    x86/domain: Implement arch_init_idle_domain()
    
    The idle domain needs d->arch.ctxt_switch initialised on x86.  Implement the
    new arch_init_idle_domain() in order to do this.
    
    Intentionally remove cpu_policy's initialisation to ZERO_BLOCK_PTR.  It has
    never tripped since it's introduction, and is weird to have in isolation
    without a similar approach on other pointers.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/domain.c             | 21 +++++++++++----------
 xen/arch/x86/include/asm/domain.h |  3 +++
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ccadfe0c9e..a6cb7a98ed 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -768,6 +768,17 @@ static bool emulation_flags_ok(const struct domain *d, 
uint32_t emflags)
     return true;
 }
 
+void __init arch_init_idle_domain(struct domain *d)
+{
+    static const struct arch_csw idle_csw = {
+        .from = paravirt_ctxt_switch_from,
+        .to   = paravirt_ctxt_switch_to,
+        .tail = idle_loop,
+    };
+
+    d->arch.ctxt_switch = &idle_csw;
+}
+
 int arch_domain_create(struct domain *d,
                        struct xen_domctl_createdomain *config,
                        unsigned int flags)
@@ -783,16 +794,6 @@ int arch_domain_create(struct domain *d,
     /* Minimal initialisation for the idle domain. */
     if ( unlikely(is_idle_domain(d)) )
     {
-        static const struct arch_csw idle_csw = {
-            .from = paravirt_ctxt_switch_from,
-            .to   = paravirt_ctxt_switch_to,
-            .tail = idle_loop,
-        };
-
-        d->arch.ctxt_switch = &idle_csw;
-
-        d->arch.cpu_policy = ZERO_BLOCK_PTR; /* Catch stray misuses. */
-
         return 0;
     }
 
diff --git a/xen/arch/x86/include/asm/domain.h 
b/xen/arch/x86/include/asm/domain.h
index f5daeb182b..bca3258d69 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -779,6 +779,9 @@ struct arch_vcpu_io {
 /* Maxphysaddr supportable by the paging infrastructure. */
 unsigned int domain_max_paddr_bits(const struct domain *d);
 
+#define arch_init_idle_domain arch_init_idle_domain
+void arch_init_idle_domain(struct domain *d);
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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