]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
tools: config-create: Initial support for non-Intel boards
authorValentine Sinitsyn <valentine.sinitsyn@gmail.com>
Tue, 19 Aug 2014 19:20:02 +0000 (01:20 +0600)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 22 Aug 2014 12:19:45 +0000 (14:19 +0200)
DMAR is Intel-specific. For AMD, we need to parse IVRS table, but
this code is currently missing since there is no IOMMU support in
AMD-V port.

Initially, we just make DMAR optional and ignore possible errors
on AMD (Intel will still fail at signature check stage if DMAR is
missing, however the error message will be somewhat misleading).
The template was also modified so missing bits of information are
not included (and IOAPIC ID is set to zero).

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools/jailhouse-config-create
tools/root-cell-config.c.tmpl

index 8991441f360f43350cd9df4bc62608c66edc78c6..67e3b32c9fb6e0cc87f8303fe9ab033ea0880a78 100755 (executable)
@@ -435,7 +435,10 @@ def parse_dmar_devscope(f):
 # parsing of DMAR ACPI Table
 # see Intel VT-d Spec chapter 8
 def parse_dmar():
-    f = input_open('/sys/firmware/acpi/tables/DMAR', 'rb')
+    f = input_open('/sys/firmware/acpi/tables/DMAR', 'rb', True)
+    if get_cpu_vendor() == 'AuthenticAMD':
+        print('WARNING: AMD IOMMU support is not implemented yet')
+        return [], 0, []
     signature = f.read(4)
     if signature != b'DMAR':
         if options.generate_collector:
@@ -543,6 +546,16 @@ if (
     print('ERROR: You have to be root to work on "/"!', file=sys.stderr)
     sys.exit(1)
 
+def get_cpu_vendor():
+    with input_open('/proc/cpuinfo', 'r') as f:
+        for line in f:
+            if not line.strip():
+                continue
+            key, value = line.split(':')
+            if key.strip() == 'vendor_id':
+                return value.strip()
+
+
 (pcidevices, pcicaps) = parse_pcidevices()
 
 product = [input_readline('/sys/class/dmi/id/sys_vendor',
index c626d1aec1ea70f3a04e93ce489b9f6743e7f6d8..962f7957caa13fa811c55d6a560ffcab1a68457d 100644 (file)
@@ -36,11 +36,13 @@ struct {
                        .mmconfig_base = ${hex(mmconfig.base)},
                        .mmconfig_end_bus = ${hex(mmconfig.end_bus)},
                        .pm_timer_address = ${hex(pm_timer_base)},
+                       % if dmar_units:
                        .dmar_unit_base = {
                                % for d in dmar_units:
                                ${hex(d)},
                                % endfor
                        },
+                       % endif
                },
                .root_cell = {
                        .name = "RootCell",