@@ -113,6 +113,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
+----------------------+-------------------------------+
| ``buddy-alloc-size`` | Buddy allocator reserved size |
+----------------------+-------------------------------+
+| ``xen-llc-colors`` | Xen color configuration |
++----------------------+-------------------------------+
Colors selection format
***********************
@@ -2923,6 +2923,16 @@ mode.
**WARNING: `x2apic_phys` is deprecated and superseded by `x2apic-mode`.
The latter takes precedence if both are set.**
+### xen-llc-colors (arm64)
+> `= List of [ <integer> | <integer>-<integer> ]`
+
+> Default: `0: the lowermost color`
+
+Specify Xen LLC color configuration. This options is available only when
+`CONFIG_LLC_COLORING` is enabled.
+Two colors are most likely needed on platforms where private caches are
+physically indexed, e.g. the L1 instruction cache of the Arm Cortex-A57.
+
### xenheap_megabytes (arm32)
> `= <size>`
@@ -12,6 +12,7 @@
#include <xen/param.h>
#define NR_LLC_COLORS (1U << CONFIG_LLC_COLORS_ORDER)
+#define XEN_DEFAULT_NUM_COLORS 1
bool __ro_after_init llc_coloring_enabled;
boolean_param("llc-coloring", llc_coloring_enabled);
@@ -28,6 +29,9 @@ static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
static unsigned int __initdata dom0_num_colors;
+static unsigned int __ro_after_init xen_colors[NR_LLC_COLORS];
+static unsigned int __ro_after_init xen_num_colors;
+
#define mfn_color_mask (max_nr_colors - 1)
#define mfn_to_color(mfn) (mfn_x(mfn) & mfn_color_mask)
@@ -86,7 +90,14 @@ static int __init parse_dom0_colors(const char *s)
}
custom_param("dom0-llc-colors", parse_dom0_colors);
-static void print_colors(const unsigned int colors[], unsigned int num_colors)
+static int __init parse_xen_colors(const char *s)
+{
+ return parse_color_config(s, xen_colors, ARRAY_SIZE(xen_colors),
+ &xen_num_colors);
+}
+custom_param("xen-llc-colors", parse_xen_colors);
+
+static void print_colors(const unsigned int *colors, unsigned int num_colors)
{
unsigned int i;
@@ -167,6 +178,22 @@ void __init llc_coloring_init(void)
for ( i = 0; i < max_nr_colors; i++ )
default_colors[i] = i;
+ if ( !xen_num_colors )
+ {
+ unsigned int i;
+
+ xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
+
+ printk(XENLOG_WARNING
+ "Xen LLC color config not found. Using first %u colors\n",
+ xen_num_colors);
+ for ( i = 0; i < xen_num_colors; i++ )
+ xen_colors[i] = i;
+ }
+ else if ( xen_num_colors > max_nr_colors ||
+ !check_colors(xen_colors, xen_num_colors) )
+ panic("Bad LLC color config for Xen\n");
+
arch_llc_coloring_init();
}
@@ -177,6 +204,8 @@ void dump_llc_coloring_info(void)
printk("LLC coloring info:\n");
printk(" Number of LLC colors supported: %u\n", max_nr_colors);
+ printk(" Xen LLC colors (%u): ", xen_num_colors);
+ print_colors(xen_colors, xen_num_colors);
}
void domain_dump_llc_colors(const struct domain *d)