Skip to content

RFC PCI bus support

Alexander Gordeev kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest15 patches 54 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15Update ioremap() prototype to conform to the Linux onelib/alloc.h lib/asm-generic/io.h lib/libcflat.h+9 -91 reply
2/15x86: Add basic ioremap() implementationlib/x86/io.c lib/x86/io.h+17 -01 reply
3/15x86/vmexit: Make use of ioremap()x86/vmexit.c+3 -92 replies
4/15pci: Fix indentation in generic PCI fileslib/pci.c lib/pci.h+19 -193 replies
5/15pci/x86: Rename pci_config_read() to pci_config_readl()lib/pci.c lib/x86/asm/pci.h+5 -53 replies
6/15pci/x86: Add remaining PCI configuration space accessorslib/x86/asm/pci.h+21 -21 reply
7/15pci: Add pci_probe() and pci_shutdown()lib/asm-generic/pci.h lib/pci.c lib/pci.h+16 -23 replies
8/15pci: Rework pci_bar_addr()lib/asm-generic/pci.h lib/pci.c lib/pci.h+87 -95 replies
9/15pci: Add pci_bar_set()lib/pci.c lib/pci.h+9 -04 replies
10/15pci: Add pci_print() and pci_type_desc()lib/asm-generic/pci.h lib/pci.c lib/pci.h+76 -07 replies
11/15pci/x86: Adopt PCI framework changeslib/x86/asm/pci.h x86/vmexit.c+6 -01 reply
12/15Factor out generic architecture codelib/asm-generic/io.h lib/x86/asm/page.h lib/x86/io.h +5 more+79 -388 replies
13/15pci/arm: Add generic ECAM host supportarm/Makefile.common arm/pci-test.c lib/arm64/asm/pci.h +2 more+435 -15 replies
14/15pci: Add pci-testdev PCI bus test devicelib/pci-testdev.c lib/pci.h+195 -05 replies
15/15pci/arm: Add pci-testdev PCI device operation testarm/Makefile.common arm/pci-test.c arm/run+14 -15 replies

Reviews trailers per patch

3 of 15 patches have a Reviewed-by or Acked-by.

PatchAndrew JonesThomas Huth
1/15
2/15
3/15
4/15
5/15R-b R-b
6/15R-b
7/15
8/15
9/15R-b
10/15
11/15
12/15
13/15
14/15
15/15

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 RFC 00/15] PCI bus support

Hi Andrew,

This is PCI test RFC. The code is far from done, but all (re)work suggestions are present and up to comments.

One major idea we discussed is missing from this RFC. That is switching from 'pcidevaddr_t' to 'struct pci_dev *' for accessing PCI devices (and further down the chain - busses and bridges). The reasons are:

- the amount of altered code is quite big already and I would like first to check if the suggested changes are reasonable, before introducing further changes;

- the current implementation with 'pcidevaddr_t' does not seem likable to me, but it is the minimalistic indeed. So I would like to take the last chance to assess the trade-off between 'nice' and 'small' implementations;

Few highlights regarding the new implementation:

- many, but not all your previous comments were addressed -

    I tried to fix most important ones;

- patch 'Factor out generic architecture code' most likely is not this series specific. It seems architectures do contain a code that could be factored out Linux-style;

- I did not put much thought into generic and x86 reworks. I only focused on PCI changes while putting off possible following decent implementation;

- an all-in-one helper:

	bool pci_get_bar(void *conf, int bar, pci_res_type_t *type,
			 u64 *addr, u64 *size, bool *is64);

    got replaced with a set of interfaces, which are less handy,
    but seems what you were after:

	phys_addr_t pci_bar_addr(pcidevaddr_t dev, int bar_num);
	phys_addr_t pci_bar_size(pcidevaddr_t dev, int bar_num);
	bool pci_bar_is64(pcidevaddr_t dev, int bar_num);
	bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num);
	bool pci_bar_is_valid(pcidevaddr_t dev, int bar_num);

- a need to translate PCI bus address to CPU physical address led to introduction of a new arch-specific interface:

phys_addr_t pci_xlate_addr(pcidevaddr_t dev, uint64_t pci_addr);

An arch would have to override this one in case PCI addresses and CPU physical addresses are not identical. Linux does it once - when creates a list of PCI resources. By contrast, this RFC calls pci_xlate_addr() each time pci_bar_addr() is called. That lets to avoid extra data structures;

Cc Thomas Huth <[email protected]>
Cc Andrew Jones <[email protected]>

Alexander Gordeev (15):
Update ioremap() prototype to conform to the Linux one
x86: Add basic ioremap() implementation x86/vmexit: Make use of ioremap()
pci: Fix indentation in generic PCI files pci/x86: Rename pci_config_read() to pci_config_readl() pci/x86: Add remaining PCI configuration space accessors
pci: Add pci_probe() and pci_shutdown()
pci: Rework pci_bar_addr()
pci: Add pci_bar_set()
pci: Add pci_print() and pci_type_desc() pci/x86: Adopt PCI framework changes
Factor out generic architecture code
pci/arm: Add generic ECAM host support
pci: Add pci-testdev PCI bus test device pci/arm: Add pci-testdev PCI device operation test

 arm/Makefile.common    |   7 +-
 arm/pci-test.c         |  27 +++++
 arm/run                |  10 +-
 lib/alloc.h            |   7 --
 lib/arm64/asm/pci.h    |  29 +++++
 lib/asm-generic/io.h   |  59 ++++++++-
 lib/asm-generic/pci.h  |  29 ++++-
 lib/libcflat.h         |   7 ++
 lib/pci-host-generic.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/pci-host-generic.h |  57 +++++++++
 lib/pci-testdev.c      | 188 +++++++++++++++++++++++++++++
 lib/pci.c              | 182 +++++++++++++++++++++++++---
 lib/pci.h              |  19 ++-
 lib/x86/asm/page.h     |   1 +
 lib/x86/asm/pci.h      |  27 ++++-
 lib/x86/io.c           |  12 ++
 lib/x86/io.h           |  41 +++++--
 lib/x86/smp.h          |   4 -
 lib/x86/vm.c           |   1 -
 lib/x86/vm.h           |  12 +-
 x86/eventinj.c         |   7 +-
 x86/kvmclock.c         |   1 +
 x86/vmexit.c           |  16 ++-
 23 files changed, 980 insertions(+), 84 deletions(-)
 create mode 100644 arm/pci-test.c
 create mode 100644 lib/arm64/asm/pci.h
 create mode 100644 lib/pci-host-generic.c
 create mode 100644 lib/pci-host-generic.h
 create mode 100644 lib/pci-testdev.c
 create mode 100644 lib/x86/asm/page.h
Signature · 1 line
1.8.3.1