Re: [kvm-unit-tests PATCH v4 10/12] arm/arm64: pci: Add PCI bus operation test

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

 



On Wed, Jun 08, 2016 at 08:53:42AM +0200, Alexander Gordeev wrote:
> On Mon, Jun 06, 2016 at 06:39:40PM +0200, Andrew Jones wrote:
> > > diff --git a/lib/arm/asm/pci.h b/lib/arm/asm/pci.h
> > > new file mode 100644
> > > index 000000000000..8263821ad511
> > > --- /dev/null
> > > +++ b/lib/arm/asm/pci.h
> > > @@ -0,0 +1,26 @@
> > > +#ifndef _ASMARM_PCI_H_
> > > +#define _ASMARM_PCI_H_
> > > +/*
> > > + * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@xxxxxxxxxx>
> > > + *
> > > + * This work is licensed under the terms of the GNU LGPL, version 2.
> > > + */
> > > +#include "libcflat.h"
> > > +
> > > +phys_addr_t pci_host_bridge_get_paddr(uint64_t addr);
> > > +
> > > +static inline
> > > +phys_addr_t pci_translate_addr(pcidevaddr_t __unused dev, uint64_t addr)
> > 
> > __unused after dev
> > 
> > > +{
> > > +	/*
> > > +	 * Assume we only have single PCI host bridge in a system.
> > > +	 */
> > > +	return pci_host_bridge_get_paddr(addr);
> > > +}
> > > +
> > > +uint8_t pci_config_readb(pcidevaddr_t dev, uint8_t reg);
> > > +uint16_t pci_config_readw(pcidevaddr_t dev, uint8_t reg);
> > > +uint32_t pci_config_readl(pcidevaddr_t dev, uint8_t reg);
> > > +void pci_config_writel(pcidevaddr_t dev, uint8_t reg, uint32_t val);
> > > +
> > > +#endif
> > 
> > The code in lib/arm/asm/pci.h could probably be in a generic
> > include instead, and then included by lib/arm/asm/pci.h, but
> > I'm OK with this until we add ppc64 support.
> 
> You mean moving the PCI accessor declarations to asm-generic/pci.h?
> But a generic include is rather for default implementations, not
> just declarations that still whould have be defined somewhere?

Right, but the implementation of pci_translate_addr above looks pretty
generic :-) Also putting the declarations somewhere common avoids
every arch that needs them from adding them. Arches that don't want
them, x86, simply don't include the common header. The common header
doesn't need to be named asm-generic/pci.h. It can be asm/pci-host-bridge.h
(or whatever). Since arm and ppc need the host bridge code for pci, then
it makes sense for them to include host bridge headers from their
asm/pci.h header.

Thanks,
drew
--
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