]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core/configs: Clean up config structure alignment/packing
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 5 Jun 2014 16:25:39 +0000 (18:25 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Sat, 14 Jun 2014 17:09:29 +0000 (19:09 +0200)
Instead of spreading aligned(1), we rather need to pack all config
structures and also the containers we define in the config files
themselves. Clean this up, also dropping the now unneeded padding from
jailhouse_cell_desc.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs/apic-demo.c
configs/celsius-w420.c
configs/chromebook.c
configs/h700-8G.c
configs/h87i.c
configs/qemu-vm.c
configs/tiny-demo.c
hypervisor/include/jailhouse/cell-config.h

index 9e3a6a181062dcd18213a4f347ad61a5cd23531e..479aca2791ef25238aa2b565977b79bab3ba785d 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_cell_desc ALIGN cell;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[2];
-       __u8 ALIGN pio_bitmap[0x2000];
-} ALIGN config = {
+       struct jailhouse_cell_desc cell;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[2];
+       __u8 pio_bitmap[0x2000];
+} __attribute__((packed)) config = {
        .cell = {
                .name = "apic-demo",
 
index 32becba01e85dea31e6acd17c5832d603ccacf75..707168386c2263fd1597960cb16afa7b82dca6b3 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_system ALIGN header;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[13];
-       __u8 ALIGN pio_bitmap[0x2000];
+       struct jailhouse_system header;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[13];
+       __u8 pio_bitmap[0x2000];
        struct jailhouse_pci_device pci_devices[13];
-} ALIGN config = {
+} __attribute__((packed)) config = {
        .header = {
                .hypervisor_memory = {
                        .phys_start = 0x1c000000,
index c264b300ad0780cccc0e459f6ef221a366854890..55d6e8ce1487b2e40b59105ae97843982bc1660b 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_system ALIGN header;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[1];
-} ALIGN config = {
+       struct jailhouse_system header;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[1];
+} __attribute__((packed)) config = {
        .header = {
                .hypervisor_memory = {
                        .phys_start = 0xbc000000,
index 38fa6e9180878ffadf9c9ce1c822d86ce7eb958b..63b23cd53f0412f07c7589999afb0a58b76d7ca4 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_system ALIGN header;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[9];
-       __u8 ALIGN pio_bitmap[0x2000];
+       struct jailhouse_system header;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[9];
+       __u8 pio_bitmap[0x2000];
        struct jailhouse_pci_device pci_devices[25];
-} ALIGN config = {
+} __attribute__((packed)) config = {
        .header = {
                .hypervisor_memory = {
                        .phys_start = 0x3c000000,
index 8d9bd92279a8c7dad368038bed5b46b89ef20978..4ceeeb17fa6abadce05945951eeebf9dd27d7ba3 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_system ALIGN header;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[9];
-       __u8 ALIGN pio_bitmap[0x2000];
+       struct jailhouse_system header;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[9];
+       __u8 pio_bitmap[0x2000];
        struct jailhouse_pci_device pci_devices[13];
-} ALIGN config = {
+} __attribute__((packed)) config = {
        .header = {
                .hypervisor_memory = {
                        .phys_start = 0x3c000000,
index d1cf57e0e5369a8731bfe9eae4086f9ea8458591..493db001d5bf42bdae1d3c0499f20b0c05d5041a 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_system ALIGN header;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[5];
-       __u8 ALIGN pio_bitmap[0x2000];
+       struct jailhouse_system header;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[5];
+       __u8 pio_bitmap[0x2000];
        struct jailhouse_pci_device pci_devices[7];
-} ALIGN config = {
+} __attribute__((packed)) config = {
        .header = {
                .hypervisor_memory = {
                        .phys_start = 0x3c000000,
index fb486a0194079650fd6ba73186f62180a6fec4b2..6c09a2bea2c8f7199e796273e9a1f9f7f2e5f98a 100644 (file)
 #include <linux/types.h>
 #include <jailhouse/cell-config.h>
 
-#define ALIGN __attribute__((aligned(1)))
 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
 
 struct {
-       struct jailhouse_cell_desc ALIGN cell;
-       __u64 ALIGN cpus[1];
-       struct jailhouse_memory ALIGN mem_regions[1];
-       __u8 ALIGN pio_bitmap[0x2000];
-} ALIGN config = {
+       struct jailhouse_cell_desc cell;
+       __u64 cpus[1];
+       struct jailhouse_memory mem_regions[1];
+       __u8 pio_bitmap[0x2000];
+} __attribute__((packed)) config = {
        .cell = {
                .name = "tiny-demo",
                .flags = JAILHOUSE_CELL_PASSIVE_COMMREG,
index b18237d8f910a37a3bbb2874b79ae9c65de9c8de..ebc27e5407b5613aeed81f7330a3217159405548 100644 (file)
@@ -26,9 +26,7 @@ struct jailhouse_cell_desc {
        __u32 num_irq_lines;
        __u32 pio_bitmap_size;
        __u32 num_pci_devices;
-
-       __u32 padding[2];
-};
+} __attribute__((packed));
 
 #define JAILHOUSE_MEM_READ             0x0001
 #define JAILHOUSE_MEM_WRITE            0x0002
@@ -49,12 +47,12 @@ struct jailhouse_memory {
        __u64 virt_start;
        __u64 size;
        __u64 flags;
-};
+} __attribute__((packed));
 
 struct jailhouse_irq_line {
        __u32 num;
        __u32 irqchip;
-};
+} __attribute__((packed));
 
 #define JAILHOUSE_PCI_TYPE_DEVICE      0x01
 #define JAILHOUSE_PCI_TYPE_BRIDGE      0x02
@@ -70,7 +68,7 @@ struct jailhouse_system {
        struct jailhouse_memory hypervisor_memory;
        struct jailhouse_memory config_memory;
        struct jailhouse_cell_desc system;
-};
+} __attribute__((packed));
 
 static inline __u32
 jailhouse_cell_config_size(struct jailhouse_cell_desc *cell)