]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
configs/tools: Exclude MSI-X table from memory regions
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 16 Aug 2014 07:00:18 +0000 (09:00 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Tue, 26 Aug 2014 17:56:49 +0000 (19:56 +0200)
We need to virtualize the access to the MSI-X table, thus we have to
prevent that the cells access them directly. As the table may be
embedded into a larger BAR, specifically followed by the PBA, split up
the BAR region as required.

Update the QEMU config accordingly - currently the only config with
MSI-X devices.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs/qemu-vm.c
tools/jailhouse-config-create
tools/root-cell-config.c.tmpl

index 7fe3d4b7ea4f1c52ce43510cea4ac284549ab3b8..286760e7d0e1cf79a116eb5d2a46f972a72de011 100644 (file)
@@ -25,7 +25,7 @@
 struct {
        struct jailhouse_system header;
        __u64 cpus[1];
-       struct jailhouse_memory mem_regions[5];
+       struct jailhouse_memory mem_regions[9];
        struct jailhouse_irqchip irqchips[1];
        __u8 pio_bitmap[0x2000];
        struct jailhouse_pci_device pci_devices[6];
@@ -75,14 +75,50 @@ struct {
                        .size = 0x30000,
                        .flags = JAILHOUSE_MEM_READ,
                },
-               /* PCI */ {
-                       .phys_start = 0xc0000000,
-                       .virt_start = 0xc0000000,
-                       .size = 0x3ec00000,
+               /* MemRegion: fc000000-fc3fffff : vesafb */
+               {
+                       .phys_start = 0xfc000000,
+                       .virt_start = 0xfc000000,
+                       .size = 0x400000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               /* MemRegion: feb80000-febbffff : 0000:00:02.0 */
+               {
+                       .phys_start = 0xfeb80000,
+                       .virt_start = 0xfeb80000,
+                       .size = 0x40000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               /* MemRegion: febc0000-febdffff : e1000 */
+               {
+                       .phys_start = 0xfebc0000,
+                       .virt_start = 0xfebc0000,
+                       .size = 0x20000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               /* MemRegion: febe0000-febeffff : 0000:00:01.0 */
+               {
+                       .phys_start = 0xfebe0000,
+                       .virt_start = 0xfebe0000,
+                       .size = 0x10000,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
                },
-               /* not safe until we catch MSIs via interrupt remapping */
-               /* HPET */ {
+               /* MemRegion: febf0000-febf0fff : 0000:00:01.0 */
+               {
+                       .phys_start = 0xfebf0000,
+                       .virt_start = 0xfebf0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               /* MemRegion: febf2000-febf2fff : ahci */
+               {
+                       .phys_start = 0xfebf2000,
+                       .virt_start = 0xfebf2000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+               },
+               /* MemRegion: fed00000-fed003ff : PNP0103:00 */
+               {
                        .phys_start = 0xfed00000,
                        .virt_start = 0xfed00000,
                        .size = 0x1000,
index e6cbe0fb6725e852e23fc33af006b3c9ecc80a1c..6474534823774bd413ebaa1525630da402ae8909 100755 (executable)
@@ -366,7 +366,7 @@ class IOMemRegionTree:
         return linenumbers, regions
 
 
-def parse_iomem():
+def parse_iomem(pcidevices):
     (maxsz, tree) = IOMemRegionTree.parse_iomem_file()
 
     # create a spare array so we can easiely keep the order from the file
@@ -378,11 +378,25 @@ def parse_iomem():
         regions[l] = regs[i]
         i += 1
 
-    # now prepare a non-sparse array for a return value
+    # now prepare a non-sparse array for a return value,
+    # also filtering out MSI-X pages
     ret = []
     for r in regions:
         if r:
-            ret.append(r)
+            for d in pcidevices:
+                if d.msix_address >= r.start and d.msix_address <= r.stop:
+                    if d.msix_address > r.start:
+                        head_r = MemRegion(r.start, d.msix_address - 1,
+                                           r.typestr, r.comments)
+                        ret.append(head_r)
+                    if d.msix_address + d.msix_region_size < r.stop:
+                        tail_r = MemRegion(d.msix_address + d.msix_region_size,
+                                           r.stop, r.typestr, r.comments)
+                        ret.append(tail_r)
+                    r = None
+                    break
+            if r:
+                ret.append(r)
 
     # newer Linux kernels will report the first page as reserved
     # it is needed for CPU init so include it anyways
@@ -593,7 +607,7 @@ product = [input_readline('/sys/class/dmi/id/sys_vendor',
 inmatemem = kmg_multiply_str(options.mem_inmates)
 hvmem = [0, kmg_multiply_str(options.mem_hv)]
 
-regions = parse_iomem()
+regions = parse_iomem(pcidevices)
 ourmem = parse_cmdline()
 total = hvmem[1] + inmatemem
 
index c0a09ec46f6301e16e1fdff38f0e75644f9f9342..fb34462f11dffa26fcce3a33839fc3d4cefc776a 100644 (file)
@@ -73,9 +73,9 @@ struct {
                /* ${c} */
                % endfor
                {
-                       .phys_start = ${hex(r.start)},
-                       .virt_start = ${hex(r.start)},
-                       .size = ${hex(r.size())},
+                       .phys_start = ${hex(r.start).strip('L')},
+                       .virt_start = ${hex(r.start).strip('L')},
+                       .size = ${hex(r.size()).strip('L')},
                        .flags = ${r.flagstr('\t\t')},
                },
                % endfor