From 8776ddaa4755cca37155a08aaf07032b62e664d7 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 30 Jul 2014 16:11:30 +0200 Subject: [PATCH] configs/tools: Describe MMCONFIG region in config files This prepares to switch from ACPI parsing to config file based MMCONFIG discovery. Update the qemu-vm and h87i configs accordingly. Signed-off-by: Jan Kiszka --- configs/h87i.c | 2 ++ configs/qemu-vm.c | 2 ++ hypervisor/include/jailhouse/cell-config.h | 3 +++ tools/jailhouse-config-create | 30 +++++++++++++++++++++- tools/root-cell-config.c.tmpl | 2 ++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/configs/h87i.c b/configs/h87i.c index 2972b29..73dae62 100644 --- a/configs/h87i.c +++ b/configs/h87i.c @@ -36,6 +36,8 @@ struct { .size = 0x15000, }, .platform_info.x86 = { + .mmconfig_base = 0xf8000000, + .mmconfig_end_bus = 0x3f, .pm_timer_address = 0x1808, }, .root_cell = { diff --git a/configs/qemu-vm.c b/configs/qemu-vm.c index 55d9cb3..6ce9b58 100644 --- a/configs/qemu-vm.c +++ b/configs/qemu-vm.c @@ -41,6 +41,8 @@ struct { .size = 0x30000, }, .platform_info.x86 = { + .mmconfig_base = 0xb0000000, + .mmconfig_end_bus = 0xff, .pm_timer_address = 0x608, }, .root_cell = { diff --git a/hypervisor/include/jailhouse/cell-config.h b/hypervisor/include/jailhouse/cell-config.h index 2ba5b62..b477b34 100644 --- a/hypervisor/include/jailhouse/cell-config.h +++ b/hypervisor/include/jailhouse/cell-config.h @@ -81,6 +81,9 @@ struct jailhouse_system { struct jailhouse_memory config_memory; union { struct { + __u64 mmconfig_base; + __u8 mmconfig_end_bus; + __u8 padding[5]; __u16 pm_timer_address; } x86; } platform_info; diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create index db55c91..8a83975 100755 --- a/tools/jailhouse-config-create +++ b/tools/jailhouse-config-create @@ -410,6 +410,31 @@ def parse_ioports(): return pm_timer_base +class MMConfig: + def __init__(self, base, end_bus): + self.base = base + self.end_bus = end_bus + + @staticmethod + def parse(): + f = input_open('/sys/firmware/acpi/tables/MCFG', 'rb') + signature = f.read(4) + if signature != b'MCFG': + if options.generate_collector: + return MMConfig(0, 0) + raise RuntimeError('incorrect input file format %s' % signature) + (length,) = struct.unpack(' 60: + raise RuntimeError('Multiple MMCONFIG regions found! ' + 'This is not supported') + f.seek(44) + (base, segment, start_bus, end_bus) = \ + struct.unpack('