|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 16/36] xen/color alloc: implement color_from_page for ARM64
From: Luca Miccio <lucmiccio@xxxxxxxxx>
The colored allocator should not make any assumptions on how a color is
defined, since the definition may change depending on the architecture.
Use a generic function "color_from_page" that returns the color id based
on the page address.
Add a definition for ARMv8 architectures.
Signed-off-by: Luca Miccio <lucmiccio@xxxxxxxxx>
Signed-off-by: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>
---
xen/arch/arm/coloring.c | 13 +++++++++++++
xen/arch/arm/include/asm/coloring.h | 7 +++++++
2 files changed, 20 insertions(+)
diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c
index 8061c3824f..4748d717d6 100644
--- a/xen/arch/arm/coloring.c
+++ b/xen/arch/arm/coloring.c
@@ -196,6 +196,19 @@ bool check_domain_colors(struct domain *d)
return !ret;
}
+/*
+ * Compute color id from the page @param pg.
+ * Page size determines the lowest available bit, while add_col_mask is used to
+ * select the rest.
+ *
+ * @param pg Page address
+ * @return unsigned long Color id
+ */
+unsigned long color_from_page(struct page_info *pg)
+{
+ return ((addr_col_mask & page_to_maddr(pg)) >> PAGE_SHIFT);
+}
+
bool __init coloring_init(void)
{
int i;
diff --git a/xen/arch/arm/include/asm/coloring.h
b/xen/arch/arm/include/asm/coloring.h
index 8609e17e80..318e2a4521 100644
--- a/xen/arch/arm/include/asm/coloring.h
+++ b/xen/arch/arm/include/asm/coloring.h
@@ -42,6 +42,13 @@ bool check_domain_colors(struct domain *d);
uint32_t *setup_default_colors(uint32_t *col_num);
void coloring_dump_info(struct domain *d);
+
+/*
+ * Compute the color of the given page address.
+ * This function should change depending on the cache architecture
+ * specifications.
+ */
+unsigned long color_from_page(struct page_info *pg);
#else /* !CONFIG_COLORING */
static inline bool __init coloring_init(void)
{
--
2.30.2
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |