@@ -116,6 +116,49 @@ LLC way size (as previously discussed) and Dom0 colors can be set using the
appropriate command line parameters. See the relevant documentation
in "docs/misc/xen-command-line.pandoc".
+DomUs colors can be set either in the xl configuration file (relative
+documentation at "docs/man/xl.cfg.pod.5.in") or via Device Tree, also for
+Dom0less configurations (relative documentation in
+"docs/misc/arm/device-tree/booting.txt"), as in the following example:
+
+.. raw:: html
+
+ <pre>
+ xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 sched=null llc-coloring=on llc-way-size=64K xen-llc-colors=0-1 dom0-llc-colors=2-6";
+ xen,dom0-bootargs "console=hvc0 earlycon=xen earlyprintk=xen root=/dev/ram0"
+
+ dom0 {
+ compatible = "xen,linux-zimage" "xen,multiboot-module";
+ reg = <0x0 0x1000000 0x0 15858176>;
+ };
+
+ dom0-ramdisk {
+ compatible = "xen,linux-initrd" "xen,multiboot-module";
+ reg = <0x0 0x2000000 0x0 20638062>;
+ };
+
+ domU0 {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+ compatible = "xen,domain";
+ memory = <0x0 0x40000>;
+ llc-colors = "4-8,10,11,12";
+ cpus = <0x1>;
+ vpl011 = <0x1>;
+
+ module@2000000 {
+ compatible = "multiboot,kernel", "multiboot,module";
+ reg = <0x2000000 0xffffff>;
+ bootargs = "console=ttyAMA0";
+ };
+
+ module@30000000 {
+ compatible = "multiboot,ramdisk", "multiboot,module";
+ reg = <0x3000000 0xffffff>;
+ };
+ };
+ </pre>
+
**Note:** If no color configuration is provided for a domain, the default one,
which corresponds to all available colors, is used instead.
@@ -162,6 +162,10 @@ with the following properties:
An integer specifying the number of vcpus to allocate to the guest.
+- llc-colors
+ A string specifying the LLC color configuration for the guest.
+ Refer to "docs/misc/arm/cache_coloring.rst" for syntax.
+
- vpl011
An empty property to enable/disable a virtual pl011 for the guest to
@@ -3854,6 +3854,8 @@ void __init create_domUs(void)
struct dt_device_node *node;
const struct dt_device_node *cpupool_node,
*chosen = dt_find_node_by_path("/chosen");
+ const char *llc_colors_str;
+ unsigned int *llc_colors = NULL, num_llc_colors = 0;
BUG_ON(chosen == NULL);
dt_for_each_child_node(chosen, node)
@@ -3960,12 +3962,26 @@ void __init create_domUs(void)
d_cfg.max_maptrack_frames = val;
}
+ if ( !dt_property_read_string(node, "llc-colors", &llc_colors_str) )
+ {
+ if ( !llc_coloring_enabled )
+ printk(XENLOG_WARNING
+ "'llc-colors' found, but LLC coloring is disabled\n");
+ else if ( dt_find_property(node, "xen,static-mem", NULL) )
+ panic("static-mem and LLC coloring are incompatible\n");
+ else
+ llc_colors = llc_colors_from_str(llc_colors_str,
+ &num_llc_colors);
+ }
+
/*
* The variable max_init_domid is initialized with zero, so here it's
* very important to use the pre-increment operator to call
* domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
*/
- d = domain_create(++max_init_domid, &d_cfg, flags);
+ d = domain_create_llc_colored(++max_init_domid, &d_cfg, flags,
+ llc_colors, num_llc_colors);
+
if ( IS_ERR(d) )
panic("Error creating domain %s\n", dt_node_name(node));
@@ -18,12 +18,15 @@
bool __init llc_coloring_init(void);
unsigned int *dom0_llc_colors(unsigned int *num_colors);
+unsigned int *llc_colors_from_str(const char *str, unsigned int *num_colors);
#else /* !CONFIG_LLC_COLORING */
static inline bool __init llc_coloring_init(void) { return true; }
static inline unsigned int *dom0_llc_colors(
unsigned int *num_colors) { return NULL; }
+static inline unsigned int *llc_colors_from_str(
+ const char *str, unsigned int *num_colors) { return NULL; }
#endif /* CONFIG_LLC_COLORING */
@@ -289,6 +289,16 @@ unsigned int *llc_colors_from_guest(struct xen_domctl_createdomain *config)
return colors;
}
+unsigned int *llc_colors_from_str(const char *str, unsigned int *num_colors)
+{
+ unsigned int *colors = alloc_colors(nr_colors);
+
+ if ( parse_color_config(str, colors, num_colors) )
+ panic("Error parsing LLC color configuration\n");
+
+ return colors;
+}
+
/*
* Local variables:
* mode: C