Le jeudi 9 mai 2019 09:52:51 UTC+2, [email protected] a écrit :
> Le mardi 7 mai 2019 23:14:41 UTC+2, Hakkı Kurumahmut a écrit :
> > Hi Jan, Jeanne
> > 
> > @Jeanne
> > 
> > I prepared a solution about the problem. Please apply two patch for 
> > jailhouse/next branch. Or download attached file sysfs_parser.py.
> > 
> > I also sent sysconfig.c for your platform. When you use the new script, you 
> > will produce a similar file.
> > 
> > Please test it.
> > 
> > Could you send us below command outputs?
> > 
> > sudo lspci -D
> > sudo lspci -Dtvvv
> > sudo lspci -Dkvvvnnxxx
> > 
> > 
> > @Jan
> > 
> > I have a question about the patch. assign_iommu_info and 
> > append_comment_info methods is running for PCI-PCI bridge primary and 
> > secondary bus,dev,fn. 
> > 
> > I'm not sure it should work for the primary bus,dev,fn.
> > 
> > Example Device Scope:
> > 
> > 01 0A 00 00 00 00 1C 07 00 00 
> > 01 0A 00 00 00 00 1C 07 00 02 
> > 01 0A 00 00 00 00 1C 07 00 04
> > 
> > It is running order
> > 
> > 1.) 00:1C.07
> > 2.) sec-bus:00.00
> > 3.) 00:1C.07
> > 4.) sec-bus:00.02 
> > 5.) 00:1C.07
> > 6.) sec-bus:00.04 
> > 
> > May be it is run for only secondary buses.
> > 
> > 1.) sec-bus:00.00
> > 2.) sec-bus:00.02 
> > 3.) sec-bus:00.04 
> > 
> > 
> > ---------------------------------------------------------------------------
> > [PATCH 1/2]
> > 
> > From aa9e7f0e25317d2f516da68b4163f9f08fc6c76d Mon Sep 17 00:00:00 2001
> > From: HAKKI KURUMAHMUT <[email protected]>
> > Date: Tue, 7 May 2019 19:37:59 +0300
> > Subject: [PATCH 1/2] Scripts: Fix for Parsing DMAR Region under Reserved
> >  Section
> > 
> >  While kernel command parameters are intel_iommu=on  intremap=on at
> >  some machines, cat /proc/iomem shows DMAR region under reserved section.
> >  This patch must be done for config creation to complete because of
> >  generating DMAR region not found error although it exist. If this patch is
> >  not apply, an error is throw by "config create" command whether
> >  intel_iommu On or Off because "reserved" regions are currently excluded 
> > from
> >  the generated config although DMAR region exists. Thus, DMAR under reserved
> >  section must be parsed by parser.
> > 
> > Signed-off-by: HAKKI KURUMAHMUT <[email protected]>
> > ---
> >  pyjailhouse/sysfs_parser.py | 23 +++++++++++++----------
> >  1 file changed, 13 insertions(+), 10 deletions(-)
> > 
> > diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py
> > index 46c95fc2..4f5da12e 100644
> > --- a/pyjailhouse/sysfs_parser.py
> > +++ b/pyjailhouse/sysfs_parser.py
> > @@ -94,14 +94,13 @@ def input_listdir(dir, wildcards):
> >  
> >  
> >  def parse_iomem(pcidevices):
> > -    regions = IOMemRegionTree.parse_iomem_tree(
> > +    (regions, dmar_regions) = IOMemRegionTree.parse_iomem_tree(
> >          IOMemRegionTree.parse_iomem_file())
> >  
> >      rom_region = MemRegion(0xc0000, 0xdffff, 'ROMs')
> >      add_rom_region = False
> >  
> >      ret = []
> > -    dmar_regions = []
> >      for r in regions:
> >          append_r = True
> >          # filter the list for MSI-X pages
> > @@ -860,21 +859,21 @@ class IOMemRegionTree:
> >  
> >          return root
> >  
> > -    # find HPET regions in tree
> > +    # find specific regions in tree
> >      @staticmethod
> > -    def find_hpet_regions(tree):
> > +    def find_regions_by_name(tree, string):
> >          regions = []
> >  
> >          for tree in tree.children:
> >              r = tree.region
> >              s = r.typestr
> >  
> > -            if (s.find('HPET') >= 0):
> > +            if (s.find(string) >= 0):
> >                  regions.append(r)
> >  
> >              # if the tree continues recurse further down ...
> >              if (len(tree.children) > 0):
> > -                regions.extend(IOMemRegionTree.find_hpet_regions(tree))
> > +                regions.extend(IOMemRegionTree.find_regions_by_name(tree, 
> > string))
> >  
> >          return regions
> >  
> > @@ -882,6 +881,7 @@ class IOMemRegionTree:
> >      @staticmethod
> >      def parse_iomem_tree(tree):
> >          regions = []
> > +        dmar_regions = []
> >  
> >          for tree in tree.children:
> >              r = tree.region
> > @@ -901,20 +901,23 @@ class IOMemRegionTree:
> >              ):
> >                  continue
> >  
> > -            # generally blacklisted, unless we find an HPET behind it
> > +            # generally blacklisted, with a few exceptions
> >              if (s.lower() == 'reserved'):
> > -                regions.extend(IOMemRegionTree.find_hpet_regions(tree))
> > +                regions.extend(IOMemRegionTree.find_regions_by_name(tree, 
> > 'HPET'))
> > +                
> > dmar_regions.extend(IOMemRegionTree.find_regions_by_name(tree, 'dmar'))
> >                  continue
> >  
> >              # if the tree continues recurse further down ...
> >              if (len(tree.children) > 0):
> > -                regions.extend(IOMemRegionTree.parse_iomem_tree(tree))
> > +                (temp_regions, temp_dmar_regions) = 
> > IOMemRegionTree.parse_iomem_tree(tree)
> > +                regions.extend(temp_regions)
> > +                dmar_regions.extend(temp_dmar_regions)
> >                  continue
> >  
> >              # add all remaining leaves
> >              regions.append(r)
> >  
> > -        return regions
> > +        return regions, dmar_regions
> >  
> >  
> >  class IOMMUConfig:
> > -- 
> > 2.17.1
> > 
> > 
> > ---------------------------------------------------------------------------
> > [PATCH 2/2]
> > 
> > From d7f925b10f32a37b4595255afe8690abf50a4a3d Mon Sep 17 00:00:00 2001
> > From: HAKKI KURUMAHMUT <[email protected]>
> > Date: Tue, 7 May 2019 23:25:14 +0300
> > Subject: [PATCH 2/2] Scrits: Fix for Unsupported DMAR Device Scope Structure
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> >  Currently DMAR parser does not support parsing secondary path info for 
> > PCI-PCI bridge that is "PCI Endpoint Device" type.
> >  For example: 8086:1d1e Patsburg PCI Express Root Port 8
> > 
> >  If the ‘Path’ field length is more than 2 bytes (N > 1), the Device Scope
> >  Entry identifies a device behind one or more system software visible PCI-
> >  PCI bridges. Bus rebalancing actions by system software modifying bus
> >  assignments of the device’s parent bridge impacts the bus number portion
> >  of device’s requester-id.
> > 
> >  Please read VT-d Specification Chapter 8.3.1
> > 
> > Signed-off-by: HAKKI KURUMAHMUT <[email protected]>
> > ---
> >  pyjailhouse/sysfs_parser.py | 113 ++++++++++++++++++++++--------------
> >  1 file changed, 70 insertions(+), 43 deletions(-)
> > 
> > diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py
> > index 4f5da12e..9e5c08d1 100644
> > --- a/pyjailhouse/sysfs_parser.py
> > +++ b/pyjailhouse/sysfs_parser.py
> > @@ -194,12 +194,45 @@ def parse_madt():
> >      return ioapics
> >  
> >  
> > -def parse_dmar_devscope(f):
> > -    (scope_type, scope_len, id, bus, dev, fn) = \
> > -        struct.unpack('<BBxxBBBB', f.read(8))
> > -    if scope_len != 8:
> > -        raise RuntimeError('Unsupported DMAR Device Scope Structure')
> > -    return (scope_type, scope_len, id, bus, dev, fn)
> > +def assign_iommu_info(flags, pcidevices, units, ioapics, scope_type, id, 
> > bus, dev, fn):
> > +    # PCI Endpoint Device
> > +    if scope_type == 1:
> > +        assert not (flags & 1)
> > +        for d in pcidevices:
> > +            if d.bus == bus and d.dev == dev and d.fn == fn:
> > +                d.iommu = len(units) - 1
> > +                break
> > +    # PCI Sub-hierarchy
> > +    elif scope_type == 2:
> > +        assert not (flags & 1)
> > +        for d in pcidevices:
> > +            if d.bus == bus and d.dev == dev and d.fn == fn:
> > +                (secondbus, subordinate) = \
> > +                    PCIPCIBridge.get_2nd_busses(d)
> > +                for d2 in pcidevices:
> > +                    if (
> > +                        d2.bus >= secondbus and
> > +                        d2.bus <= subordinate
> > +                    ):
> > +                        d2.iommu = len(units) - 1
> > +                break
> > +    # IOAPIC
> > +    elif scope_type == 3:
> > +        ioapic = next(chip for chip in ioapics if chip.id == id)
> > +        bdf = (bus << 8) | (dev << 3) | fn
> > +        for chip in ioapics:
> > +            if chip.bdf == bdf:
> > +                raise RuntimeError('IOAPICs with identical BDF')
> > +        ioapic.bdf = bdf
> > +        ioapic.iommu = len(units) - 1
> > +
> > +
> > +def append_comment_info(comments, scope_type, bus, dev, fn):
> > +    if scope_type == 1:
> > +        comments.append('PCI device: %02x:%02x.%x' %
> > +                        (bus, dev, fn))
> > +    else:
> > +        comments.append('DMAR parser could not decode device path')
> >  
> >  
> >  # parsing of DMAR ACPI Table
> > @@ -249,38 +282,22 @@ def parse_dmar(pcidevices, ioapics, dmar_regions):
> >                          d.iommu = len(units) - 1
> >              offset += 16 - offset
> >              while offset < struct_len:
> > -                (scope_type, scope_len, id, bus, dev, fn) =\
> > -                    parse_dmar_devscope(f)
> > -                # PCI Endpoint Device
> > -                if scope_type == 1:
> > -                    assert not (flags & 1)
> > -                    for d in pcidevices:
> > -                        if d.bus == bus and d.dev == dev and d.fn == fn:
> > -                            d.iommu = len(units) - 1
> > -                            break
> > -                # PCI Sub-hierarchy
> > -                elif scope_type == 2:
> > -                    assert not (flags & 1)
> > +                (scope_type, scope_len) = struct.unpack('<BB', f.read(2))
> > +
> > +                N = (int)((scope_len - 6) / 2) - 1
> > +
> > +                (id, starting_bus, starting_dev, starting_fn) = 
> > struct.unpack('<xxBBBB', f.read(6))
> > +
> > +                assign_iommu_info(flags, pcidevices, units, ioapics, 
> > scope_type, id, starting_bus, starting_dev, starting_fn)
> > +
> > +                while N != 0:
> > +                    N-=1
> > +                    (secondary_dev, secondary_fn) = struct.unpack('<BB', 
> > f.read(2))
> >                      for d in pcidevices:
> > -                        if d.bus == bus and d.dev == dev and d.fn == fn:
> > -                            (secondbus, subordinate) = \
> > -                                PCIPCIBridge.get_2nd_busses(d)
> > -                            for d2 in pcidevices:
> > -                                if (
> > -                                    d2.bus >= secondbus and
> > -                                    d2.bus <= subordinate
> > -                                ):
> > -                                    d2.iommu = len(units) - 1
> > +                        if d.bus == starting_bus and d.dev == starting_dev 
> > and d.fn == starting_fn:
> > +                            (secondbus, subordinate) = 
> > PCIPCIBridge.get_2nd_busses(d)
> >                              break
> > -                # IOAPIC
> > -                elif scope_type == 3:
> > -                    ioapic = next(chip for chip in ioapics if chip.id == 
> > id)
> > -                    bdf = (bus << 8) | (dev << 3) | fn
> > -                    for chip in ioapics:
> > -                        if chip.bdf == bdf:
> > -                            raise RuntimeError('IOAPICs with identical 
> > BDF')
> > -                    ioapic.bdf = bdf
> > -                    ioapic.iommu = len(units) - 1
> > +                    assign_iommu_info(flags, pcidevices, units, ioapics, 
> > scope_type, id, secondbus, secondary_dev, secondary_fn)
> >                  offset += scope_len
> >  
> >          # Reserved Memory Region Reporting Structure
> > @@ -292,13 +309,23 @@ def parse_dmar(pcidevices, ioapics, dmar_regions):
> >  
> >              comments = []
> >              while offset < struct_len:
> > -                (scope_type, scope_len, id, bus, dev, fn) =\
> > -                    parse_dmar_devscope(f)
> > -                if scope_type == 1:
> > -                    comments.append('PCI device: %02x:%02x.%x' %
> > -                                    (bus, dev, fn))
> > -                else:
> > -                    comments.append('DMAR parser could not decode device 
> > path')
> > +                (scope_type, scope_len) = struct.unpack('<BB', f.read(2))
> > +
> > +                N = (int)((scope_len - 6) / 2) - 1
> > +
> > +                (id, starting_bus, starting_dev, starting_fn) = 
> > struct.unpack('<xxBBBB', f.read(6))
> > +
> > +                append_comment_info(comments, scope_type, starting_bus, 
> > starting_dev, starting_fn)
> > +
> > +                while N != 0:
> > +                    N-=1
> > +                    (secondary_dev, secondary_fn) = struct.unpack('<BB', 
> > f.read(2))
> > +                    for d in pcidevices:
> > +                        if d.bus == starting_bus and d.dev == starting_dev 
> > and d.fn == starting_fn:
> > +                            (secondbus, subordinate) = 
> > PCIPCIBridge.get_2nd_busses(d)
> > +                            break
> > +
> > +                    append_comment_info(comments, scope_type, secondbus, 
> > secondary_dev, secondary_fn)
> >                  offset += scope_len
> >  
> >              reg = MemRegion(base, limit, 'ACPI DMAR RMRR', comments)
> > -- 
> > 2.17.1
> > 
> > ---------------------------------------------------------------------------
> > 
> > 
> > Thanks.
> > 
> > HAKKI
> 
> Hello everyone, 
> 
> Thanks for the help now I pass the hradware check ! Unfortunately the 
> enabling of the rootCell is not working yet. With Halli's configuration 
> everything is juste freezing without giving any error. When I use my 
> generated file (that is similar to Hakki's one) I got this error :
> 
> 
> [] Irq 16 : nobody cared (try booting with the "irqpoll" option) 
> [] Handlers :
> [] [<ffffffff81622fa0>] usb_hcd_irq
> [] [<ffffffffc025c360>] ilo_isr [hpilo]
> [] Disabling IRQ # 16
> [] NMI watchdog: BUG: soft lockup - CPU#7 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#6 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#8 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#9 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#11 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#12 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#13 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#14 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#15 stuck for 22s! [kworkers/...]
> [] NMI watchdog: BUG: soft lockup - CPU#17 stuck for 22s! [kworkers/...]
> 
> etc...
> 
> I don't know why there is this error. Do you have an idea ? 
> 
> 
> 
> @Hakki you can find in attachment the lspci command lines you requested
> 
> again : thanks for your help

Hello again, 

Actually my error is a kernel panic that is shutting down all the CPUs with NMI

best regards,

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/02568569-7d1b-4bb5-8a1e-a5cbee5a77ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to