[PATCH RFC 00/15] PCI bus support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <thuth@xxxxxxxxxx>
Cc: Andrew Jones <drjones@xxxxxxxxxx>

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

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux