Skip to content

PCI: Add for_each_pci_resource and addon_res support

Yinghai Lu linux-acpi linux-pci lkml virtualization 3 versions – Applied

Status from this message: I applied this to my pci/misc branch for v3.10. Nice cleanup, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest29 patches 5 repliesApplied
  2. v327 patches 12 repliesSuperseded
  3. v126 patches 0 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/29PCI: Clean up quirk_io_regiondrivers/pci/quirks.c+47 -851 reply
2/29PCI: Add pci_dev_resource_n()drivers/pci/probe.c include/linux/pci.h+11 -00 replies
3/29PCI: Update pci_resource_start etc to use pci_dev_resource_n()include/linux/pci.h+25 -100 replies
4/29PCI: Add pci_dev_resource_idx() helperdrivers/pci/probe.c include/linux/pci.h+10 -00 replies
5/29PCI: Add is_pci_*_resource_idx() helpersinclude/linux/pci.h+23 -00 replies
6/29PCI: pci resource iteratordrivers/pci/probe.c include/linux/pci.h+72 -00 replies
7/29PCI, x86: Use for_each_pci_resource() with pci_allocate_bridge_resourcesarch/x86/pci/i386.c+1 -20 replies
8/29PCI, x86: Use for_each_pci_resource() with pci_allocate_dev_resourcesarch/x86/pci/i386.c+20 -350 replies
9/29PCI: Use for_each_pci_resource() with IOV releated functionsdrivers/pci/iov.c+15 -160 replies
10/29PCI, acpiphp: Use for_each_pci_resource() helperdrivers/pci/hotplug/acpiphp_glue.c+2 -20 replies
11/29PCI, pciehp: Use for_each_pci_resource() helperdrivers/pci/hotplug/pciehp_hpc.c+3 -20 replies
12/29PCI: Use for_each_pci_resource() in pci_enable_devdrivers/pci/pci.c+8 -70 replies
13/29PCI: Use for_each_pci_resource() in pci_reassigndevdrivers/pci/pci.c+2 -30 replies
14/29PCI: Use for_each_pci_resource() with pci bar reassign funcsdrivers/pci/setup-bus.c+12 -160 replies
15/29PCI: Use for_each_pci_resource() in pci_assign_resourcedrivers/pci/setup-res.c+6 -80 replies
16/29PCI, x86: Use for_each_pci_resource() with noassign_barsarch/x86/pci/common.c+1 -20 replies
17/29PCI: Use for_each_pci_resource() in pci_dev_driver()drivers/pci/pci-driver.c+4 -20 replies
18/29PCI: Use for_each_pci_resource() in pci resource releasedrivers/pci/remove.c+2 -30 replies
19/29PCI: Use for_each_pci_resource() in pci bases readingdrivers/pci/probe.c+4 -20 replies
20/29PCI, x86: Use for_each_pci_resource() with mrstarch/x86/pci/mrst.c+4 -30 replies
21/29PCI, xen: Use for_each_pci_resource() with xen pcidrivers/pci/xen-pcifront.c+1 -30 replies
21/29PCI, xen: Use for_each_pci_resource() with xen pcidrivers/pci/xen-pcifront.c+1 -30 replies
22/29PCI: Add addon_resource support for pci devicesdrivers/pci/probe.c include/linux/pci.h+64 -20 replies
23/29PCI: Treat addon res as std resourcesarch/x86/pci/i386.c drivers/pci/hotplug/acpiphp_glue.c drivers/pci/pci-driver.c +1 more+7 -60 replies
24/29PCI: Add helpers to add addon_resourcedrivers/pci/probe.c include/linux/pci.h+73 -00 replies
25/29PCI: Update pci_resource_bar() to support addon_resourcedrivers/pci/pci.c+7 -00 replies
26/29PCI: Assign/update resource to addon_resdrivers/pci/setup-res.c+18 -60 replies
27/29PCI: Make piix4 quirk to use addon_resdrivers/pci/quirks.c+79 -163 replies
28/29PCI: Make quirk_io_region to use addon_resdrivers/pci/quirks.c+57 -340 replies
29/29PCI: Use addon_fixed_resource with ati fixed resourcedrivers/pci/quirks.c+5 -30 replies

Reviews trailers per patch

2 of 30 patches have a Reviewed-by or Acked-by.

PatchKonrad Rzeszutek Wilk
1/29
2/29
3/29
4/29
5/29
6/29
7/29
8/29
9/29
10/29
11/29
12/29
13/29
14/29
15/29
16/29
17/29
18/29
19/29
20/29
21/29R-b R-b
21/29R-b R-b
22/29
23/29
24/29
25/29
26/29
27/29
28/29
29/29

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/29] PCI: Add for_each_pci_resource and addon_res support

First part is for_each_pci_resource support:
Now pci device resource iteration is done via "for (i=0...)" open code. That make code hard to read esp when only bridge or sriov resources are involved.

We want to replace those open code with for_each_pci_resource() to make the code more readable.
Also will add addon_resource handling, and need to make addon resource to be treated as normal PCI resources during iteration, add for_each_pci_resource will make that support transition more simple.

To make for_each_pci_resource more efficient. We will use preset bitmap of different type for searching next idx.

Second part is addon_res support:
Now there is some non normal pci resources other than standard,rom, sriov, bridges.
Some could be same as standard reg, but using different position. Some could have own way to read/write to them.
Kernel are using different way to hack those resources like abusing pci bridge resource spot on non bridge pci device.

Add addon_resources list in pci_dev for those non-standard resources. With this patch, will treat addon-resource like standard resources with special ops.

At last replace some quirk_io with addon_res.

could get from
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-for-each-res-addon

-v4: split one patch out, and remove PCI_NO_....

Notes: We still need to keep _idx as we use it all the time, and drivers still use them to get resource.

Thanks

Yinghai Lu

Ram Pai (1):
PCI: pci resource iterator

Yinghai Lu (28):
PCI: Clean up quirk_io_region
PCI: Add pci_dev_resource_n()
PCI: Update pci_resource_start etc to use pci_dev_resource_n()
PCI: Add pci_dev_resource_idx() helper
PCI: Add is_pci_*_resource_idx() helpers
PCI, x86: Use for_each_pci_resource() with
pci_allocate_bridge_resources
PCI, x86: Use for_each_pci_resource() with pci_allocate_dev_resources
PCI: Use for_each_pci_resource() with IOV releated functions PCI, acpiphp: Use for_each_pci_resource() helper
PCI, pciehp: Use for_each_pci_resource() helper
PCI: Use for_each_pci_resource() in pci_enable_dev
PCI: Use for_each_pci_resource() in pci_reassigndev
PCI: Use for_each_pci_resource() with pci bar reassign funcs
PCI: Use for_each_pci_resource() in pci_assign_resource PCI, x86: Use for_each_pci_resource() with noassign_bars
PCI: Use for_each_pci_resource() in pci_dev_driver()
PCI: Use for_each_pci_resource() in pci resource release
PCI: Use for_each_pci_resource() in pci bases reading
PCI, x86: Use for_each_pci_resource() with mrst
PCI, xen: Use for_each_pci_resource() with xen pci
PCI: Add addon_resource support for pci devices
PCI: Treat addon res as std resources
PCI: Add helpers to add addon_resource
PCI: Update pci_resource_bar() to support addon_resource
PCI: Assign/update resource to addon_res
PCI: Make piix4 quirk to use addon_res
PCI: Make quirk_io_region to use addon_res
PCI: Use addon_fixed_resource with ati fixed resource

 arch/x86/pci/common.c              |   3 +-
 arch/x86/pci/i386.c                |  58 +++------
 arch/x86/pci/mrst.c                |   7 +-
 drivers/pci/hotplug/acpiphp_glue.c |   4 +-
 drivers/pci/hotplug/pciehp_hpc.c   |   5 +-
 drivers/pci/iov.c                  |  31 +++--
 drivers/pci/pci-driver.c           |   7 +-
 drivers/pci/pci.c                  |  27 ++--
 drivers/pci/probe.c                | 176 ++++++++++++++++++++++++-
 drivers/pci/quirks.c               | 258 ++++++++++++++++++++++---------------
 drivers/pci/remove.c               |   5 +-
 drivers/pci/setup-bus.c            |  28 ++--
 drivers/pci/setup-res.c            |  38 ++++--
 drivers/pci/xen-pcifront.c         |   4 +-
 include/linux/pci.h                | 116 +++++++++++++++--
 15 files changed, 541 insertions(+), 226 deletions(-)
Signature · 1 line
1.8.1.4