lkml.org 
[lkml]   [2019]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/7] MIPS: SGI-IP27: use generic PCI driver
On Mon, 28 Jan 2019 05:32:15 -0800
Christoph Hellwig <hch@infradead.org> wrote:

> > +#ifdef CONFIG_NUMA
> > +int pcibus_to_node(struct pci_bus *bus)
> > +{
> > + struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
> > +
> > + return bc->nasid;
> > +}
> > +EXPORT_SYMBOL(pcibus_to_node);
> > +#endif /* CONFIG_NUMA */
>
> From an abstraction point of view this doesn't really belong into
> a bridge driver as it is a global exported function. I guess we can
> keep it here with a fixme comment, but we should probably move this
> into a method call instead.

or put the nodeid into the bus struct ?

> > +dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(dev);
> > + struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus);
> > +
> > + return bc->baddr + paddr;
> > +}
> > +
> > +phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
> > +{
> > + return dma_addr & ~(0xffUL << 56);
> > +}
>
> Similarly here - these are global platform-wide hooks, so having them
> in a pci bridge driver is not the proper abstraction level.
>
> Note that we could probably fix these by just switching IP27 and
> other users of the bridge chip to use the dma_pfn_offset field
> in struct device and stop overriding these functions.

I'm all for it. I looked at the examples for using dma_pfn_offset and the
only one coming close to usefull for me is arch/sh/drivers/pci/pcie-sh7786.c
It overloads pcibios_bus_add_device() to set dma_pfn_offset, which doesn't
look much nicer. What about having a dma_pfn_offset in struct pci_bus
which all device inherit from ?

Thomas.

--
SUSE Linux GmbH
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

\
 
 \ /
  Last update: 2019-01-29 16:25    [W:0.143 / U:4.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site