@@ -2796,6 +2796,16 @@ In the case that x2apic is in use, this option switches between physical and
clustered mode. The default, given no hint from the **FADT**, is cluster
mode.
+### 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>`
@@ -19,6 +19,10 @@
#include <asm/processor.h>
#include <asm/sysregs.h>
+/* By default Xen uses the lowest color */
+#define XEN_DEFAULT_COLOR 0
+#define XEN_DEFAULT_NUM_COLORS 1
+
bool llc_coloring_enabled;
boolean_param("llc-coloring", llc_coloring_enabled);
@@ -33,6 +37,9 @@ static paddr_t __ro_after_init addr_col_mask;
static unsigned int __ro_after_init dom0_colors[CONFIG_NR_LLC_COLORS];
static unsigned int __ro_after_init dom0_num_colors;
+static unsigned int __ro_after_init xen_colors[CONFIG_NR_LLC_COLORS];
+static unsigned int __ro_after_init xen_num_colors;
+
#define addr_to_color(addr) (((addr) & addr_col_mask) >> PAGE_SHIFT)
/*
@@ -83,6 +90,12 @@ static int parse_color_config(const char *buf, unsigned int *colors,
return *s ? -EINVAL : 0;
}
+static int __init parse_xen_colors(const char *s)
+{
+ return parse_color_config(s, xen_colors, &xen_num_colors);
+}
+custom_param("xen-llc-colors", parse_xen_colors);
+
static int __init parse_dom0_colors(const char *s)
{
return parse_color_config(s, dom0_colors, &dom0_num_colors);
@@ -166,6 +179,8 @@ static void dump_coloring_info(unsigned char key)
printk("LLC way size: %u KiB\n", llc_way_size >> 10);
printk("Number of LLC colors supported: %u\n", nr_colors);
printk("Address to LLC color mask: 0x%lx\n", addr_col_mask);
+ printk("Xen LLC colors: ");
+ print_colors(xen_colors, xen_num_colors);
}
bool __init llc_coloring_init(void)
@@ -202,6 +217,21 @@ bool __init llc_coloring_init(void)
addr_col_mask = (nr_colors - 1) << PAGE_SHIFT;
+ if ( !xen_num_colors )
+ {
+ printk(XENLOG_WARNING
+ "Xen LLC color config not found. Using default color: %u\n",
+ XEN_DEFAULT_COLOR);
+ xen_colors[0] = XEN_DEFAULT_COLOR;
+ xen_num_colors = XEN_DEFAULT_NUM_COLORS;
+ }
+
+ if ( !check_colors(xen_colors, xen_num_colors) )
+ {
+ printk(XENLOG_ERR "Bad LLC color config for Xen\n");
+ return false;
+ }
+
register_keyhandler('K', dump_coloring_info, "dump LLC coloring info", 1);
return true;