[RFC FYI] tools: config create: add -U, --no-iommu option

16 views
Skip to first unread message

hw.cl...@gmail.com

unread,
Mar 19, 2015, 10:58:48 AM3/19/15
to Jan Kiszka, Claudio Fontana, jailho...@googlegroups.com
From: Claudio Fontana <claudio...@huawei.com>

this works around the lack of VT-d or ACPI DMAR table on intel.
For debugging and early enablement of guests, it might be
useful to ignore lack of iommu.

Signed-off-by: Claudio Fontana <claudio...@huawei.com>
---
tools/jailhouse-config-collect.tmpl | 4 +++-
tools/jailhouse-config-create | 14 +++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)

This is a modified version of the previous RFC,
I do not exclude the PCI devices description, I just put "0"
in the .iommu just as for AMD. Therefore I changed the option
to --no-iommu.

With this patch, plus a replacement of the intel iommu functions
with amd's empty skeletons I can enable jailhouse and also
start some simple demo cells :-)

I understand however that the direction is to require iommu,
so I will have to find some suitable hardware to work on..

Thanks,

Claudio

diff --git a/tools/jailhouse-config-collect.tmpl b/tools/jailhouse-config-collect.tmpl
index d155b18..3790d5f 100644
--- a/tools/jailhouse-config-collect.tmpl
+++ b/tools/jailhouse-config-collect.tmpl
@@ -58,7 +58,9 @@ for f in $filelist; do
done
grep GenuineIntel /proc/cpuinfo > /dev/null &&
for f in $filelist_intel; do
- copy_file $f
+ if [ -f $f ]; then
+ copy_file $f
+ fi
done
for f in $filelist_opt; do
if [ -f $f ]; then
diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create
index c3eebbe..7d4d65b 100755
--- a/tools/jailhouse-config-create
+++ b/tools/jailhouse-config-create
@@ -50,6 +50,9 @@ parser.add_argument('-t', '--template-dir',
default=template_default_dir,
action='store',
type=str)
+parser.add_argument('-U', '--no-iommu',
+ help="skip checks for iommu",
+ action="store_true")

memargs = [['--mem-inmates', '2M', 'inmate'],
['--mem-hv', '64M', 'hypervisor']]
@@ -613,6 +616,8 @@ def parse_dmar_devscope(f):
# parsing of DMAR ACPI Table
# see Intel VT-d Spec chapter 8
def parse_dmar(pcidevices, ioapics):
+ if not os.path.exists("/sys/firmware/acpi/tables/DMAR"):
+ raise RuntimeError('DMAR: no DMAR table found in sysfs. Try --no-iommu ?')
f = input_open('/sys/firmware/acpi/tables/DMAR', 'rb')
signature = f.read(4)
if signature != b'DMAR':
@@ -797,7 +802,7 @@ mmconfig = MMConfig.parse()

ioapics = parse_madt()

-if get_cpu_vendor() == 'GenuineIntel':
+if get_cpu_vendor() == 'GenuineIntel' and not options.no_iommu:
(dmar_units, rmrr_regs) = parse_dmar(pcidevices, ioapics)
else:
(dmar_units, rmrr_regs) = [], []
@@ -807,8 +812,11 @@ for d in pcidevices:
if get_cpu_vendor() == 'AuthenticAMD':
d.iommu = 0 # temporary workaround
if d.iommu is None:
- raise RuntimeError('PCI device %02x:%02x.%x outside the scope of an '
- 'IOMMU' % (d.bus, d.dev, d.fn))
+ if options.no_iommu:
+ d.iommu = 0
+ else:
+ raise RuntimeError('PCI device %02x:%02x.%x outside the scope of an '
+ 'IOMMU' % (d.bus, d.dev, d.fn))

# kernel does not have memmap region, pick one
if ourmem is None:
--
1.8.5.3

Henning Schild

unread,
Mar 19, 2015, 11:46:35 AM3/19/15
to hw.cl...@gmail.com, Jan Kiszka, Claudio Fontana, jailho...@googlegroups.com
On Thu, 19 Mar 2015 16:00:55 +0100
<hw.cl...@gmail.com> wrote:

> I understand however that the direction is to require iommu,
> so I will have to find some suitable hardware to work on..

Jan already said that having no iommu is just a temporal hack.
Valentine is currently looking into IOMMU support for AMD, and the
only reason the Intel path still works without an iommu is because we
like to use qemu for debugging.
I am afraid this patch will not be accepted, but good to have it on the
list. If anyone else runs into the same problems, they might find it
useful.

Henning
Reply all
Reply to author
Forward
0 new messages