Skip to content

PCI: Re-factor PCI's 'latency timer' setup

Myron Stowe linux-pci lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest16 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16PCI: add declaration for pcibios_set_master() to pci coreinclude/linux/pci.h+2 -02 replies
2/16PCI: ARM: convert pcibios_set_master() to a non-inlined functionarch/arm/common/it8152.c arch/arm/include/asm/pci.h arch/arm/kernel/bios32.c+10 -120 replies
3/16PCI: IA64: convert pcibios_set_master() to a non-inlined functionarch/ia64/include/asm/pci.h arch/ia64/pci/pci.c+5 -60 replies
4/16PCI: MicroBlaze: convert pcibios_set_master() to a non-inlined functionarch/microblaze/include/asm/pci.h arch/microblaze/pci/pci-common.c+5 -50 replies
5/16PCI: PowerPC: convert pcibios_set_master() to a non-inlined functionarch/powerpc/include/asm/pci.h arch/powerpc/kernel/pci-common.c+5 -50 replies
6/16PCI: SPARC: convert pcibios_set_master() to a non-inlined functionarch/sparc/include/asm/pci_32.h arch/sparc/include/asm/pci_64.h arch/sparc/kernel/pci.c+5 -100 replies
7/16PCI: TILE: convert pcibios_set_master() to a non-inlined functionarch/tile/include/asm/pci.h arch/tile/kernel/pci.c+5 -71 reply
8/16PCI: UniCore: convert pcibios_set_master() to a non-inlined functionarch/unicore32/include/asm/pci.h arch/unicore32/kernel/pci.c+5 -50 replies
9/16PCI: Xtensa: convert pcibios_set_master() to a non-inlined functionarch/xtensa/include/asm/pci.h arch/xtensa/kernel/pci.c+5 -50 replies
10/16PCI: Pull PCI 'latency timer' setup up into the corearch/blackfin/include/asm/pci.h arch/frv/mb93090-mb00/pci-frv.c arch/frv/mb93090-mb00/pci-frv.h +9 more+32 -450 replies
11/16PCI: frv: use generic pcibios_set_master()arch/frv/mb93090-mb00/pci-frv.c+0 -140 replies
12/16PCI: MIPS: use generic pcibios_set_master()arch/mips/pci/pci.c+0 -150 replies
13/16PCI: mn10300: use generic pcibios_set_master()arch/mn10300/unit-asb2305/pci-asb2305.c+0 -160 replies
14/16PCI: sh: use generic pcibios_set_master()arch/sh/drivers/pci/pci.c+0 -150 replies
15/16PCI: x86: use generic pcibios_set_master()arch/x86/pci/i386.c+0 -140 replies
16/16PCI: latency timer doesn't apply to PCIedrivers/pci/pci.c+4 -00 replies

Reviews trailers per patch

1 of 16 patches has a Reviewed-by or Acked-by.

PatchChris Metcalf
1/16
2/16
3/16
4/16
5/16
6/16
7/16A-b
8/16
9/16
10/16
11/16
12/16
13/16
14/16
15/16
16/16

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

Read the v1 thread

Cover letter [PATCH -v2 00/16] PCI: Re-factor PCI's 'latency timer' setup

The 'latency timer' of PCI devices, both Type 0 and Type 1, is setup in architecture-specific code [see: pcibios_set_master()]. There are two approaches being taken by all the architectures - check if the 'latency timer' is currently set between 16 and 255 and if not bring it within bounds, or, do nothing (and then there is the gratuitously different parisc implementation).

There is nothing architecture-specific about PCI's 'latency timer' so this patch pulls the setup functionality up into the PCI core by creating a generic 'pcibios_set_master()' function using the '__weak' attribute which can be used by all architectures as a default which, if necessary, can then be over-ridden by architecture-specific code.

The series starts out by converting architecture-specific inlined versions of 'pcibios_set_master()' - all of which are no-ops - into non-inlined equivalents. This is necessary to allow a subsequent patch to create a generic version using the '__weak' attribute and is done for the following architectures: arm, blackfin*, h8300*, ia64, microblaze, powerpc, sparc, tile, unicore32, and xtensa.

Without the conversions, the compiler sees the architecture- specific version, defined as a static inline function typically in <asm/pci.h>, and will have no knowledge about the __weak version once it is introduced, which leads to compile failures as in:
drivers/pci/pci.c: 2605: error: redefinition of 'pcibios_set_master' arch/powerpc/include/asm/pci.h: 49: note: previous definition of
'pcibios_set_master' was here

Next the generic 'pcibios_set_master()' function is introduced in PCI's core. With the generic 'pcibios_set_master()' function in place the series removes the now redundant function from the following
architectures: frv, mips, mn10300, sh, and x86.

It would be nice to have all architectures follow suit and end up using only the single, generic, 'pcibios_set_master()' function.

-v2:
- In the original series I tried to not touch any of the architectures that were not going to end up using the generic 'pcibios_set_master()' function but this just created compile problems for those so I had to generate a number of pre-cursor patches to the series as noted above.
- * blackfin and h8300 architectures do not seem to support PCI (no root bus scanning etc. exists within them) but they do have PCI header files. I removed the inline definitions for each of these within the patch that introduces the generic 'pcibios_set_master()' function so that the __weak version would satisfy any necessary references.

I have only tested x86 although I was able to compile test powerpc in addition this time.
---

Myron Stowe (16):
PCI: latency timer doesn't apply to PCIe
PCI: x86: use generic pcibios_set_master()
PCI: sh: use generic pcibios_set_master()
PCI: mn10300: use generic pcibios_set_master()
PCI: MIPS: use generic pcibios_set_master()
PCI: frv: use generic pcibios_set_master()
PCI: Pull PCI 'latency timer' setup up into the core
PCI: Xtensa: convert pcibios_set_master() to a non-inlined function
PCI: UniCore: convert pcibios_set_master() to a non-inlined function
PCI: TILE: convert pcibios_set_master() to a non-inlined function
PCI: SPARC: convert pcibios_set_master() to a non-inlined function
PCI: PowerPC: convert pcibios_set_master() to a non-inlined function
PCI: MicroBlaze: convert pcibios_set_master() to a non-inlined function
PCI: IA64: convert pcibios_set_master() to a non-inlined function
PCI: ARM: convert pcibios_set_master() to a non-inlined function
PCI: add declaration for pcibios_set_master() to pci core

 arch/arm/common/it8152.c                |    3 +++
 arch/arm/include/asm/pci.h              |   12 -----------
 arch/arm/kernel/bios32.c                |    7 +++++++
 arch/blackfin/include/asm/pci.h         |    4 ----
 arch/frv/mb93090-mb00/pci-frv.c         |   20 -------------------
 arch/frv/mb93090-mb00/pci-frv.h         |    2 --
 arch/h8300/include/asm/pci.h            |    5 -----
 arch/ia64/include/asm/pci.h             |    6 ------
 arch/ia64/pci/pci.c                     |    5 +++++
 arch/microblaze/include/asm/pci.h       |    5 -----
 arch/microblaze/pci/pci-common.c        |    5 +++++
 arch/mips/pci/pci.c                     |   21 --------------------
 arch/mn10300/unit-asb2305/pci-asb2305.c |   22 ---------------------
 arch/mn10300/unit-asb2305/pci-asb2305.h |    2 --
 arch/powerpc/include/asm/pci.h          |    5 -----
 arch/powerpc/kernel/pci-common.c        |    5 +++++
 arch/sh/drivers/pci/pci.c               |   21 --------------------
 arch/sparc/include/asm/pci_32.h         |    5 -----
 arch/sparc/include/asm/pci_64.h         |    5 -----
 arch/sparc/kernel/pci.c                 |    5 +++++
 arch/tile/include/asm/pci.h             |    7 -------
 arch/tile/kernel/pci.c                  |    5 +++++
 arch/unicore32/include/asm/pci.h        |    5 -----
 arch/unicore32/kernel/pci.c             |    5 +++++
 arch/x86/include/asm/pci_x86.h          |    2 --
 arch/x86/pci/i386.c                     |   20 -------------------
 arch/xtensa/include/asm/pci.h           |    5 -----
 arch/xtensa/kernel/pci.c                |    5 +++++
 drivers/pci/pci.c                       |   33 +++++++++++++++++++++++++++++++
 include/linux/pci.h                     |    5 +++++
 30 files changed, 83 insertions(+), 174 deletions(-)