Commit 1ca98fa652bb5dc3c8793335db9ccc5d0f2e1f65

Authored by Bjorn Helgaas
Committed by Jesse Barnes
1 parent df17e62e5b

x86/PCI: MMCONFIG: fix region end calculation

The end of an MMCONFIG region depends on the ending bus number, not on the
number of buses the region covers.  We previously computed the wrong ending
address whenever the starting bus number was non-zero, e.g.,:

  MMCONFIG for [bus 00-1f] at [mem 0xe0000000-0xe1ffffff] (base 0xe0000000)
  MMCONFIG for [bus 20-3f] at [mem 0xe2000000-0xe1ffffff] (base 0xe0000000)

The correct regions are:

  MMCONFIG for [bus 00-1f] at [mem 0xe0000000-0xe1ffffff] (base 0xe0000000)
  MMCONFIG for [bus 20-3f] at [mem 0xe2000000-0xe3ffffff] (base 0xe0000000)

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff

arch/x86/pci/mmconfig-shared.c
... ... @@ -65,7 +65,6 @@
65 65 int end, u64 addr)
66 66 {
67 67 struct pci_mmcfg_region *new;
68   - int num_buses;
69 68 struct resource *res;
70 69  
71 70 if (addr == 0)
72 71  
... ... @@ -82,10 +81,9 @@
82 81  
83 82 list_add_sorted(new);
84 83  
85   - num_buses = end - start + 1;
86 84 res = &new->res;
87 85 res->start = addr + PCI_MMCFG_BUS_OFFSET(start);
88   - res->end = addr + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
  86 + res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1;
89 87 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
90 88 snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN,
91 89 "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end);