diff mbox series

[13/36] xen/arm: A domain is not direct mapped when coloring is enabled

Message ID 20220304174701.1453977-14-marco.solieri@minervasys.tech (mailing list archive)
State New, archived
Headers show
Series Arm cache coloring | expand

Commit Message

Marco Solieri March 4, 2022, 5:46 p.m. UTC
From: Luca Miccio <lucmiccio@gmail.com>

Based on the intrinsic nature of cache coloring, it is trivial to state
that each domain that is colored is also not direct mapped.
Set the directmap variable to false when coloring is enabled.

Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
---
 xen/arch/arm/domain.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Julien Grall March 9, 2022, 8:34 p.m. UTC | #1
Hi,

On 04/03/2022 17:46, Marco Solieri wrote:
> From: Luca Miccio <lucmiccio@gmail.com>
> 
> Based on the intrinsic nature of cache coloring, it is trivial to state
> that each domain that is colored is also not direct mapped.
> Set the directmap variable to false when coloring is enabled.

This is basically fixing a bug that was introduced in the previous 
patch. Please fold it.

> 
> Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
> Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
> ---
>   xen/arch/arm/domain.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 33471b3c58..80a6f39464 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -785,6 +785,8 @@ int arch_domain_create(struct domain *d,
>   
>       d->max_colors = 0;
>   #ifdef CONFIG_COLORING
> +    d->arch.directmap = false;

We should avoid silently overwriting what the user requested. Instead, 
we should add a check in arch_sanitise_domain_config() to forbid case 
where CDF_directmap is set *and* the number of colors is > 0.

> +
>       /* Setup domain colors */
>       if ( !config->arch.colors.max_colors )
>       {

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 33471b3c58..80a6f39464 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -785,6 +785,8 @@  int arch_domain_create(struct domain *d,
 
     d->max_colors = 0;
 #ifdef CONFIG_COLORING
+    d->arch.directmap = false;
+
     /* Setup domain colors */
     if ( !config->arch.colors.max_colors )
     {