On 23.11.20 21:46, Andrea Bastoni wrote:
> Add generic architecture API layer needed to implement coloring:
>
> arch_color_map_memory_region() // cell_create
> arch_color_unmap_memory_region() // cell_destroy
> arch_color_remap_to_root() // cell_load
> arch_color_unmap_from_root() // cell_start
>
> Currently only arm64 will implement the API. arm32 could be also a
> possible target for coloring. x86 already features CAT support.
>
> ARM architectures also implement:
>
> arm_color_dcache_flush_memory_region() // range flushing
> arm_color_init() // hook for the initialization of
> coloring
>
> The architecture operations implement functionalities that consider the
> color assigned to a memory region when performing the VA <-> PA
> translation.
>
> This patch uses a reserved memory region as mapping-scratchpad to
> perform coloring during the load operations. The mapping is removed
> during the start operation. A later patch makes the start of the memory
> region configurable.
>
> Refer to the Documentation/cache-coloring.md for an introduction of the
> coloring isolation software techniques.
>
> Signed-off-by: Andrea Bastoni <[email protected]>
> ---
> driver/cell.c | 10 +++-
> .../arch/arm-common/include/asm/dcaches.h | 8 +++
> hypervisor/arch/arm-common/mmu_cell.c | 52 ++++++++++------
> hypervisor/arch/arm/include/asm/coloring.h | 59 +++++++++++++++++++
> hypervisor/arch/arm64/include/asm/coloring.h | 59 +++++++++++++++++++
> hypervisor/arch/arm64/setup.c | 3 +
> hypervisor/arch/x86/include/asm/coloring.h | 45 ++++++++++++++
> hypervisor/control.c | 56 ++++++++++++------
> hypervisor/include/jailhouse/control.h | 7 +++
> include/jailhouse/cell-config.h | 6 ++
> 10 files changed, 267 insertions(+), 38 deletions(-)
> create mode 100644 hypervisor/arch/arm/include/asm/coloring.h
> create mode 100644 hypervisor/arch/arm64/include/asm/coloring.h
> create mode 100644 hypervisor/arch/x86/include/asm/coloring.h
>
...
> diff --git a/include/jailhouse/cell-config.h b/include/jailhouse/cell-config.h
> index 472cb4bb..e62e692b 100644
> --- a/include/jailhouse/cell-config.h
> +++ b/include/jailhouse/cell-config.h
> @@ -115,6 +115,7 @@ struct jailhouse_cell_desc {
> #define JAILHOUSE_MEM_LOADABLE 0x0040
> #define JAILHOUSE_MEM_ROOTSHARED 0x0080
> #define JAILHOUSE_MEM_NO_HUGEPAGES 0x0100
> +#define JAILHOUSE_MEM_COLORED 0x0200
> #define JAILHOUSE_MEM_IO_UNALIGNED 0x8000
> #define JAILHOUSE_MEM_IO_WIDTH_SHIFT 16 /* uses bits 16..19 */
> #define JAILHOUSE_MEM_IO_8 (1 << JAILHOUSE_MEM_IO_WIDTH_SHIFT)
> @@ -127,8 +128,13 @@ struct jailhouse_memory {
> __u64 virt_start;
> __u64 size;
> __u64 flags;
> + /* only meaningful with JAILHOUSE_MEM_COLORED */
> + size_t colors;
Wrong type. Needs to be one that specifies the width in bits.
This needs to be bitmask, one bit per possibly color, right? Do we need
64, or even 128? Or would 32 suffice in practice? In the latter case, we
could consider shrinking flags to 32 bits.
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/8eb7c1ca-ae63-3c38-baeb-ea121dc12251%40siemens.com.