)]}'
{
  "commit": "93d2175d3d31f11ba04fcfa0e9a496a1b4bc8b34",
  "tree": "3bb4635b432268db72967b237d6b3f33d427ef9f",
  "parents": [
    "df8d06ade6eed9077f658ac8696fc1cb5c081220"
  ],
  "author": {
    "name": "Yinghai Lu",
    "email": "yinghai@kernel.org",
    "time": "Fri May 13 18:06:17 2011 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Mon May 16 18:33:35 2011 -0700"
  },
  "message": "PCI: Clear bridge resource flags if requested size is 0\n\nDuring pci remove/rescan testing found:\n\n  pci 0000:c0:03.0: PCI bridge to [bus c4-c9]\n  pci 0000:c0:03.0:   bridge window [io  0x1000-0x0fff]\n  pci 0000:c0:03.0:   bridge window [mem 0xf0000000-0xf00fffff]\n  pci 0000:c0:03.0:   bridge window [mem 0xfc180000000-0xfc197ffffff 64bit pref]\n  pci 0000:c0:03.0: device not available (can\u0027t reserve [io  0x1000-0x0fff])\n  pci 0000:c0:03.0: Error enabling bridge (-22), continuing\n  pci 0000:c0:03.0: enabling bus mastering\n  pci 0000:c0:03.0: setting latency timer to 64\n  pcieport 0000:c0:03.0: device not available (can\u0027t reserve [io  0x1000-0x0fff])\n  pcieport: probe of 0000:c0:03.0 failed with error -22\n\nThis bug was caused by commit c8adf9a3e873 (\"PCI: pre-allocate\nadditional resources to devices only after successful allocation of\nessential resources.\")\n\nAfter that commit, pci_hotplug_io_size is changed to additional_io_size\nfrom minium size.  So it will not go through resource_size(res) !\u003d 0\npath, and will not be reset.\n\nThe root cause is: pci_bridge_check_ranges will set RESOURCE_IO flag for\npci bridge, and later if children do not need IO resource.  those bridge\nresources will not need to be allocated.  but flags is still there.\nthat will confuse the the pci_enable_bridges later.\n\nrelated code:\n\n   static void assign_requested_resources_sorted(struct resource_list *head,\n                                    struct resource_list_x *fail_head)\n   {\n           struct resource *res;\n           struct resource_list *list;\n           int idx;\n\n           for (list \u003d head-\u003enext; list; list \u003d list-\u003enext) {\n                   res \u003d list-\u003eres;\n                   idx \u003d res - \u0026list-\u003edev-\u003eresource[0];\n                   if (resource_size(res) \u0026\u0026 pci_assign_resource(list-\u003edev, idx)) {\n   ...\n                           reset_resource(res);\n                   }\n           }\n   }\n\nAt last, We have to clear the flags in pbus_size_mem/io when requested\nsize \u003d\u003d 0 and !add_head.  becasue this case it will not go through\nadjust_resources_sorted().\n\nJust make size1 \u003d size0 when !add_head. it will make flags get cleared.\n\nAt the same time when requested size \u003d\u003d 0, add_size !\u003d 0, will still\nhave in head and add_list.  because we do not clear the flags for it.\n\nAfter this, we will get right result:\n\n  pci 0000:c0:03.0: PCI bridge to [bus c4-c9]\n  pci 0000:c0:03.0:   bridge window [io  disabled]\n  pci 0000:c0:03.0:   bridge window [mem 0xf0000000-0xf00fffff]\n  pci 0000:c0:03.0:   bridge window [mem 0xfc180000000-0xfc197ffffff 64bit pref]\n  pci 0000:c0:03.0: enabling bus mastering\n  pci 0000:c0:03.0: setting latency timer to 64\n  pcieport 0000:c0:03.0: setting latency timer to 64\n  pcieport 0000:c0:03.0: irq 160 for MSI/MSI-X\n  pcieport 0000:c0:03.0: Signaling PME through PCIe PME interrupt\n  pci 0000:c4:00.0: Signaling PME through PCIe PME interrupt\n  pcie_pme 0000:c0:03.0:pcie01: service driver pcie_pme loaded\n  aer 0000:c0:03.0:pcie02: service driver aer loaded\n  pciehp 0000:c0:03.0:pcie04: Hotplug Controller:\n\nv3: more simple fix. also fix one typo in pbus_size_mem\n\nSigned-off-by: Yinghai Lu \u003cyinghai@kernel.org\u003e\nReviewed-by: Ram Pai \u003clinuxram@us.ibm.com\u003e\nCc: Jesse Barnes \u003cjbarnes@virtuousgeek.org\u003e\nCc: Bjorn Helgaas \u003cbhelgaas@google.com\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ebf51ad1b71478f08532edcdda8b3acf9d711bb7",
      "old_mode": 33188,
      "old_path": "drivers/pci/setup-bus.c",
      "new_id": "a806cb321d2e25c2f896cda9aa4c329eb38a3051",
      "new_mode": 33188,
      "new_path": "drivers/pci/setup-bus.c"
    }
  ]
}
