From: Jan Kiszka <[email protected]> Switch from a bitmap-based way to an array of structures for describing cell CPUs. This has the advantage that we can decouple Jailhouse from CPU enumeration of Linux and pass the physical CPUs to the hypervisor. Furthermore, the structure can be extended later on to associate configuration information such as cache partitions with a specific CPU. To avoid breaking the config parser more than needed, 8 bytes are already reserved in the new structure.
Note that this commit breaks the build in order to break-up the upcoming changes into smaller logical pieces. Signed-off-by: Jan Kiszka <[email protected]> --- include/jailhouse/cell-config.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/include/jailhouse/cell-config.h b/include/jailhouse/cell-config.h index 6b54e34b..124373d5 100644 --- a/include/jailhouse/cell-config.h +++ b/include/jailhouse/cell-config.h @@ -1,7 +1,7 @@ /* * Jailhouse, a Linux-based partitioning hypervisor * - * Copyright (c) Siemens AG, 2014-2016 + * Copyright (c) Siemens AG, 2014-2022 * * Authors: * Jan Kiszka <[email protected]> @@ -50,7 +50,7 @@ * Incremented on any layout or semantic change of system or cell config. * Also update formats and HEADER_REVISION in pyjailhouse/config_parser.py. */ -#define JAILHOUSE_CONFIG_REVISION 13 +#define JAILHOUSE_CONFIG_REVISION 14 #define JAILHOUSE_CELL_NAME_MAXLEN 31 @@ -89,7 +89,7 @@ struct jailhouse_cell_desc { __u32 id; /* set by the driver */ __u32 flags; - __u32 cpu_set_size; + __u32 num_cpus; __u32 num_memory_regions; __u32 num_cache_regions; __u32 num_irqchips; @@ -106,6 +106,11 @@ struct jailhouse_cell_desc { struct jailhouse_console console; } __attribute__((packed)); +struct jailhouse_cpu { + __u64 phys_id; + __u8 padding[8]; +} __attribute__((packed)); + #define JAILHOUSE_MEM_READ 0x0001 #define JAILHOUSE_MEM_WRITE 0x0002 #define JAILHOUSE_MEM_EXECUTE 0x0004 @@ -361,7 +366,7 @@ static inline __u32 jailhouse_cell_config_size(struct jailhouse_cell_desc *cell) { return sizeof(struct jailhouse_cell_desc) + - cell->cpu_set_size + + cell->num_cpus * sizeof(struct jailhouse_cpu) + cell->num_memory_regions * sizeof(struct jailhouse_memory) + cell->num_cache_regions * sizeof(struct jailhouse_cache) + cell->num_irqchips * sizeof(struct jailhouse_irqchip) + @@ -378,10 +383,10 @@ jailhouse_system_config_size(struct jailhouse_system *system) jailhouse_cell_config_size(&system->root_cell); } -static inline const unsigned long * -jailhouse_cell_cpu_set(const struct jailhouse_cell_desc *cell) +static inline const struct jailhouse_cpu * +jailhouse_cell_cpus(const struct jailhouse_cell_desc *cell) { - return (const unsigned long *)((const void *)cell + + return (const struct jailhouse_cpu *)((const void *)cell + sizeof(struct jailhouse_cell_desc)); } @@ -389,7 +394,8 @@ static inline const struct jailhouse_memory * jailhouse_cell_mem_regions(const struct jailhouse_cell_desc *cell) { return (const struct jailhouse_memory *) - ((void *)jailhouse_cell_cpu_set(cell) + cell->cpu_set_size); + ((void *)jailhouse_cell_cpus(cell) + + cell->num_cpus * sizeof(struct jailhouse_cpu)); } static inline const struct jailhouse_cache * -- 2.36.1 -- 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/20220627131329.3659-13-ralf.ramsauer%40oth-regensburg.de.
