]> rtime.felk.cvut.cz Git - jailhouse.git/blobdiff - hypervisor/include/jailhouse/cell-config.h
Merge remote-tracking branch 'kiszka/master'
[jailhouse.git] / hypervisor / include / jailhouse / cell-config.h
index ef9de707af05e8f1f852c24548b3d06b6380f1c1..8e8495dc2a4669541788b3fb49553d4ae4e48891 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Jailhouse, a Linux-based partitioning hypervisor
  *
- * Copyright (c) Siemens AG, 2014, 2015
+ * Copyright (c) Siemens AG, 2014-2016
  *
  * Authors:
  *  Jan Kiszka <jan.kiszka@siemens.com>
@@ -52,6 +52,7 @@ struct jailhouse_cell_desc {
 
        __u32 cpu_set_size;
        __u32 num_memory_regions;
+       __u32 num_cache_regions;
        __u32 num_irqchips;
        __u32 pio_bitmap_size;
        __u32 num_pci_devices;
@@ -66,15 +67,12 @@ struct jailhouse_cell_desc {
 #define JAILHOUSE_MEM_COMM_REGION      0x0020
 #define JAILHOUSE_MEM_LOADABLE         0x0040
 #define JAILHOUSE_MEM_ROOTSHARED       0x0080
-
-#define JAILHOUSE_MEM_VALID_FLAGS      (JAILHOUSE_MEM_READ | \
-                                        JAILHOUSE_MEM_WRITE | \
-                                        JAILHOUSE_MEM_EXECUTE | \
-                                        JAILHOUSE_MEM_DMA | \
-                                        JAILHOUSE_MEM_IO | \
-                                        JAILHOUSE_MEM_COMM_REGION | \
-                                        JAILHOUSE_MEM_LOADABLE | \
-                                        JAILHOUSE_MEM_ROOTSHARED)
+#define JAILHOUSE_MEM_IO_UNALIGNED     0x0100
+#define JAILHOUSE_MEM_IO_WIDTH_SHIFT   16 /* uses bits 8..11 */
+#define JAILHOUSE_MEM_IO_8             (1 << JAILHOUSE_MEM_IO_WIDTH_SHIFT)
+#define JAILHOUSE_MEM_IO_16            (2 << JAILHOUSE_MEM_IO_WIDTH_SHIFT)
+#define JAILHOUSE_MEM_IO_32            (4 << JAILHOUSE_MEM_IO_WIDTH_SHIFT)
+#define JAILHOUSE_MEM_IO_64            (8 << JAILHOUSE_MEM_IO_WIDTH_SHIFT)
 
 struct jailhouse_memory {
        __u64 phys_start;
@@ -83,10 +81,29 @@ struct jailhouse_memory {
        __u64 flags;
 } __attribute__((packed));
 
+#define JAILHOUSE_MEMORY_IS_SUBPAGE(mem)       \
+       ((mem)->virt_start & ~PAGE_MASK || (mem)->size & ~PAGE_MASK)
+
+#define JAILHOUSE_CACHE_L3_CODE                0x01
+#define JAILHOUSE_CACHE_L3_DATA                0x02
+#define JAILHOUSE_CACHE_L3             (JAILHOUSE_CACHE_L3_CODE | \
+                                        JAILHOUSE_CACHE_L3_DATA)
+
+#define JAILHOUSE_CACHE_ROOTSHARED     0x0001
+
+struct jailhouse_cache {
+       __u32 start;
+       __u32 size;
+       __u8 type;
+       __u8 padding;
+       __u16 flags;
+} __attribute__((packed));
+
 struct jailhouse_irqchip {
        __u64 address;
-       __u64 id;
-       __u64 pin_bitmap;
+       __u32 id;
+       __u32 pin_base;
+       __u32 pin_bitmap[4];
 } __attribute__((packed));
 
 #define JAILHOUSE_PCI_TYPE_DEVICE      0x01
@@ -110,6 +127,8 @@ struct jailhouse_pci_device {
        __u32 shmem_region;
 } __attribute__((packed));
 
+#define JAILHOUSE_PCI_EXT_CAP          0x8000
+
 #define JAILHOUSE_PCICAPS_WRITE                0x0001
 
 struct jailhouse_pci_capability {
@@ -121,22 +140,31 @@ struct jailhouse_pci_capability {
 
 #define JAILHOUSE_MAX_IOMMU_UNITS      8
 
+struct jailhouse_iommu {
+       __u64 base;
+       __u32 size;
+       __u16 amd_bdf;
+       __u8 amd_base_cap;
+       __u8 amd_msi_cap;
+       __u32 amd_features;
+} __attribute__((packed));
+
 #define JAILHOUSE_SYSTEM_SIGNATURE     "JAILSYST"
 
 struct jailhouse_system {
        char signature[8];
        struct jailhouse_memory hypervisor_memory;
-       struct jailhouse_memory debug_uart;
+       struct jailhouse_memory debug_console;
        union {
                struct {
                        __u64 mmconfig_base;
                        __u8 mmconfig_end_bus;
                        __u8 padding[5];
                        __u16 pm_timer_address;
-                       __u64 iommu_base[JAILHOUSE_MAX_IOMMU_UNITS];
+                       struct jailhouse_iommu
+                               iommu_units[JAILHOUSE_MAX_IOMMU_UNITS];
                } __attribute__((packed)) x86;
        } __attribute__((packed)) platform_info;
-       __u32 device_limit;
        __u32 interrupt_limit;
        struct jailhouse_cell_desc root_cell;
 } __attribute__((packed));
@@ -147,6 +175,7 @@ jailhouse_cell_config_size(struct jailhouse_cell_desc *cell)
        return sizeof(struct jailhouse_cell_desc) +
                cell->cpu_set_size +
                cell->num_memory_regions * sizeof(struct jailhouse_memory) +
+               cell->num_cache_regions * sizeof(struct jailhouse_cache) +
                cell->num_irqchips * sizeof(struct jailhouse_irqchip) +
                cell->pio_bitmap_size +
                cell->num_pci_devices * sizeof(struct jailhouse_pci_device) +
@@ -174,12 +203,20 @@ jailhouse_cell_mem_regions(const struct jailhouse_cell_desc *cell)
                ((void *)jailhouse_cell_cpu_set(cell) + cell->cpu_set_size);
 }
 
+static inline const struct jailhouse_cache *
+jailhouse_cell_cache_regions(const struct jailhouse_cell_desc *cell)
+{
+       return (const struct jailhouse_cache *)
+               ((void *)jailhouse_cell_mem_regions(cell) +
+                cell->num_memory_regions * sizeof(struct jailhouse_memory));
+}
+
 static inline const struct jailhouse_irqchip *
 jailhouse_cell_irqchips(const struct jailhouse_cell_desc *cell)
 {
        return (const struct jailhouse_irqchip *)
-               ((void *)jailhouse_cell_mem_regions(cell) +
-                cell->num_memory_regions * sizeof(struct jailhouse_memory));
+               ((void *)jailhouse_cell_cache_regions(cell) +
+                cell->num_cache_regions * sizeof(struct jailhouse_cache));
 }
 
 static inline const __u8 *