xen/evtchn: Pass max_evtchn_port into evtchn_init()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Mar 2018 18:27:24 +0000 (18:27 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 15 Aug 2018 18:40:28 +0000 (19:40 +0100)
... rather than setting it up once domain_create() has completed.  This
involves constructing a default value for dom0.

No practical change in functionality.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/setup.c
xen/arch/x86/setup.c
xen/common/domain.c
xen/common/domctl.c
xen/common/event_channel.c
xen/include/xen/sched.h

index 7d40a8466b5e1b8b91eb323e312e01dc01dd731f..45f3841105ea98552ceb519ba9a14ec92bf26423 100644 (file)
@@ -691,7 +691,9 @@ void __init start_xen(unsigned long boot_phys_offset,
     const char *cmdline;
     struct bootmodule *xen_bootmodule;
     struct domain *dom0;
-    struct xen_domctl_createdomain dom0_cfg = {};
+    struct xen_domctl_createdomain dom0_cfg = {
+        .max_evtchn_port = -1,
+    };
 
     dcache_line_bytes = read_dcache_line_bytes();
 
index 7c86b9a3e137894a0e4f33014a54d84e05ad3a18..727dad4dc3613c3c50587790a4eaad29db81b483 100644 (file)
@@ -681,6 +681,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     };
     struct xen_domctl_createdomain dom0_cfg = {
         .flags = XEN_DOMCTL_CDF_s3_integrity,
+        .max_evtchn_port = -1,
     };
 
     /* Critical region without IDT or TSS.  Any fault is deadly! */
index 749722bcb2030f25f5e64dab89e386c7886cb441..171d25ed4b0a68e587f7d8ade9b8e1e0a96c433e 100644 (file)
@@ -362,7 +362,7 @@ struct domain *domain_create(domid_t domid,
 
         radix_tree_init(&d->pirq_tree);
 
-        if ( (err = evtchn_init(d)) != 0 )
+        if ( (err = evtchn_init(d, config->max_evtchn_port)) != 0 )
             goto fail;
         init_status |= INIT_evtchn;
 
index 3a68fc91cfde5735afe5d0b413f79a510b457fe7..0ef554acd6478185daf4c0a3df31281c25483634 100644 (file)
@@ -540,9 +540,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             break;
         }
 
-        d->max_evtchn_port = min_t(unsigned int,
-                                   op->u.createdomain.max_evtchn_port, INT_MAX);
-
         ret = 0;
         op->domain = d->domain_id;
         copyback = 1;
index c62046590be584de3747b45cfedcf1110f6e13a0..41cbbae1abdd2d00dbe8273b8625dfe131d405af 100644 (file)
@@ -1284,10 +1284,10 @@ void evtchn_check_pollers(struct domain *d, unsigned int port)
     }
 }
 
-int evtchn_init(struct domain *d)
+int evtchn_init(struct domain *d, unsigned int max_port)
 {
     evtchn_2l_init(d);
-    d->max_evtchn_port = INT_MAX;
+    d->max_evtchn_port = min_t(unsigned int, max_port, INT_MAX);
 
     d->evtchn = alloc_evtchn_bucket(d, 0);
     if ( !d->evtchn )
index 3c35473742974fe49cacb995ee60c852968d3670..51ceebe6ccccff8eeba5ccdbbe28b25eceb3b1b0 100644 (file)
@@ -134,7 +134,7 @@ struct evtchn
 #endif
 } __attribute__((aligned(64)));
 
-int  evtchn_init(struct domain *d); /* from domain_create */
+int  evtchn_init(struct domain *d, unsigned int max_port);
 void evtchn_destroy(struct domain *d); /* from domain_kill */
 void evtchn_destroy_final(struct domain *d); /* from complete_domain_destroy */