Am Wed, 2 Aug 2017 10:56:55 -0700
schrieb Gustavo Lima Chaves <[email protected]>:

> * Henning Schild <[email protected]> [2017-08-02 10:34:27
> +0200]:
> 
> > Looks good, tested with python2 and 3 on one machine where the
> > change would not be needed. pep8 also looks good.  
> 
> Thanks. Now jumping in with a different question on the config-gen
> infra, why to we have
> 
> """
> # kernel does not have memmap region, pick one
> if ourmem is None:
>     ourmem = alloc_mem(regions, total)
> """
> 
> there? Wouldn't it be better off to fail if we're under a non-memory
> reserved boot? Does this scenario try to get free RAM on the go? Does
> it scale among different boots and RAM usage? We might be better
> requiring the memory reservation more explicitly also because the
> ending root cell mem maps will change between boots with and without
> the memmap option. Please correct me if I'm wrong.

That is in there for the bootstrap where people generate their first
config. The config will contain a comment telling you how to configure
memmap and in recent jailhouse versions the driver will refuse to start
jailhouse if there is no reservation.

So you:
- generate the config
- configure bootloader
- reboot
- run jailhouse

If you miss the second step or get it wrong, you should see an error
message.
So jailhouse will fail but the generator will assist.

Henning

> > 
> > Henning
> > 
> > Am Tue, 1 Aug 2017 17:29:13 -0700
> > schrieb Gustavo Lima Chaves <[email protected]>:
> >   
> > > We were sticking to hardcoded 256 entries there. We now scale
> > > better for systems with more PCI device entries.
> > > 
> > > Signed-off-by: Gustavo Lima Chaves <[email protected]>
> > > ---
> > >  tools/jailhouse-config-create | 14 ++++++++++++--
> > >  tools/root-cell-config.c.tmpl |  2 +-
> > >  2 files changed, 13 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/tools/jailhouse-config-create
> > > b/tools/jailhouse-config-create index b0b9557..ce2affc 100755
> > > --- a/tools/jailhouse-config-create
> > > +++ b/tools/jailhouse-config-create
> > > @@ -21,6 +21,7 @@
> > >  from __future__ import print_function
> > >  import sys
> > >  import os
> > > +import math
> > >  import re
> > >  import argparse
> > >  import struct
> > > @@ -639,6 +640,7 @@ def parse_iomem(pcidevices):
> > >  
> > >  
> > >  def parse_pcidevices():
> > > +    int_src_cnt = 0
> > >      devices = []
> > >      caps = []
> > >      basedir = '/sys/bus/pci/devices'
> > > @@ -660,8 +662,9 @@ def parse_pcidevices():
> > >                      d.caps[0].comments.append(str(d))
> > >                      d.caps_start = len(caps)
> > >                      caps.extend(d.caps)
> > > +            int_src_cnt += max(d.num_msi_vectors,
> > > d.num_msix_vectors) devices.append(d)
> > > -    return (devices, caps)
> > > +    return (devices, caps, int_src_cnt)
> > >  
> > >  
> > >  def parse_kernel_cmdline():
> > > @@ -1146,7 +1149,13 @@ if jh_enabled == '1':
> > >            file=sys.stderr)
> > >      sys.exit(1)
> > >  
> > > -(pcidevices, pcicaps) = parse_pcidevices()
> > > +IOAPIC_MAX_PINS = 120
> > > +int_src_count = IOAPIC_MAX_PINS
> > > +
> > > +(pcidevices, pcicaps, cnt) = parse_pcidevices()
> > > +
> > > +int_src_count += cnt
> > > +vtd_interrupt_limit = 2**math.ceil(math.log(int_src_count, 2))
> > >  
> > >  product = [input_readline('/sys/class/dmi/id/sys_vendor',
> > >                            True).rstrip(),
> > > @@ -1209,6 +1218,7 @@ kwargs = {
> > >      'cpucount': cpucount,
> > >      'irqchips': ioapics,
> > >      'pm_timer_base': pm_timer_base,
> > > +    'vtd_interrupt_limit': vtd_interrupt_limit,
> > >      'mmconfig': mmconfig,
> > >      'iommu_units': iommu_units,
> > >      'debug_console': debug_console,
> > > diff --git a/tools/root-cell-config.c.tmpl
> > > b/tools/root-cell-config.c.tmpl index 0d2ea29..100429f 100644
> > > --- a/tools/root-cell-config.c.tmpl
> > > +++ b/tools/root-cell-config.c.tmpl
> > > @@ -87,7 +87,7 @@ struct {
> > >                   .pci_mmconfig_end_bus =
> > > ${hex(mmconfig.end_bus)}, .x86 = {
> > >                           .pm_timer_address =
> > > ${hex(pm_timer_base)},
> > > -                         .vtd_interrupt_limit = 256,
> > > +                         .vtd_interrupt_limit =
> > > ${int(vtd_interrupt_limit)}, % if iommu_units:
> > >                           .iommu_units = {
> > >                                   % for unit in
> > > iommu_units:  
> > 
> > -- 
> > 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]. For more options, visit
> > https://groups.google.com/d/optout.  
> 

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to