Looks good, tested with python2 and 3 on one machine where the change
would not be needed. pep8 also looks good.

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.

Reply via email to