xen/gnttab: Export opt_max_{grant,maptrack}_frames
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Mar 2018 15:33:32 +0000 (15:33 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 23 Jul 2018 10:11:02 +0000 (11:11 +0100)
This is to facilitate the values being passed in via domain_create(), at which
point the dom0 construction code needs to know them.

While cleaning up, drop the DEFAULT_* defines, which are only used immediately
adjacent in a context which makes it obvious that they are the defaults, and
drop the (unused) logic to allow a per-arch override of
DEFAULT_MAX_NR_GRANT_FRAMES.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/common/grant_table.c
xen/include/xen/grant_table.h

index 51a4a7d20e4f23cbeb5ab07ce120c04f7e16b4e5..d9ec711c7345d8d84fd2fb3bb11e4aa7482e4eb5 100644 (file)
@@ -82,20 +82,11 @@ struct grant_table {
     struct grant_table_arch arch;
 };
 
-#ifndef DEFAULT_MAX_NR_GRANT_FRAMES /* to allow arch to override */
-/* Default maximum size of a grant table. [POLICY] */
-#define DEFAULT_MAX_NR_GRANT_FRAMES   64
-#endif
-
-static unsigned int __read_mostly max_grant_frames =
-                                               DEFAULT_MAX_NR_GRANT_FRAMES;
-integer_runtime_param("gnttab_max_frames", max_grant_frames);
-
-#define DEFAULT_MAX_MAPTRACK_FRAMES 1024
+unsigned int __read_mostly opt_max_grant_frames = 64;
+integer_runtime_param("gnttab_max_frames", opt_max_grant_frames);
 
-static unsigned int __read_mostly max_maptrack_frames =
-                                               DEFAULT_MAX_MAPTRACK_FRAMES;
-integer_runtime_param("gnttab_max_maptrack_frames", max_maptrack_frames);
+unsigned int __read_mostly opt_max_maptrack_frames = 1024;
+integer_runtime_param("gnttab_max_maptrack_frames", opt_max_maptrack_frames);
 
 static unsigned int __read_mostly opt_gnttab_max_version = 2;
 static bool __read_mostly opt_transitive_grants = true;
@@ -3609,7 +3600,8 @@ grant_table_create(
 
     if ( d->domain_id == 0 )
     {
-        ret = grant_table_init(d, t, gnttab_dom0_frames(), max_maptrack_frames);
+        ret = grant_table_init(d, t, gnttab_dom0_frames(),
+                               opt_max_maptrack_frames);
     }
 
     return ret;
@@ -3811,8 +3803,8 @@ int grant_table_set_limits(struct domain *d, unsigned int grant_frames,
     struct grant_table *gt = d->grant_table;
 
     if ( grant_frames < INITIAL_NR_GRANT_FRAMES ||
-         grant_frames > max_grant_frames ||
-         maptrack_frames > max_maptrack_frames )
+         grant_frames > opt_max_grant_frames ||
+         maptrack_frames > opt_max_maptrack_frames )
         return -EINVAL;
     if ( !gt )
         return -ENOENT;
@@ -3992,7 +3984,7 @@ __initcall(gnttab_usage_init);
 
 unsigned int __init gnttab_dom0_frames(void)
 {
-    return min(max_grant_frames, gnttab_dom0_max());
+    return min(opt_max_grant_frames, gnttab_dom0_max());
 }
 
 /*
index b3a95fda5860a5171da3723b1f2bc7a191f3d218..0286ba33ddd0f15e9d6560164d1fe0ebe9becf4a 100644 (file)
@@ -31,6 +31,9 @@
 
 struct grant_table;
 
+extern unsigned int opt_max_grant_frames;
+extern unsigned int opt_max_maptrack_frames;
+
 /* Create/destroy per-domain grant table context. */
 int grant_table_create(
     struct domain *d);