[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190128133215.GC744@infradead.org>
Date: Mon, 28 Jan 2019 05:32:15 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Thomas Bogendoerfer <tbogendoerfer@...e.de>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
James Hogan <jhogan@...nel.org>, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-pci@...r.kernel.org,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Paul Burton <paul.burton@...s.com>,
Ralf Baechle <ralf@...ux-mips.org>
Subject: Re: [PATCH 6/7] MIPS: SGI-IP27: use generic PCI driver
On Thu, Jan 24, 2019 at 06:47:27PM +0100, Thomas Bogendoerfer wrote:
> Converted bridge code to a platform driver using the PCI generic driver
> framework and use adding platform devices during xtalk scan. This allows
> easier sharing bridge drvier for other SGI platforms like IP30 (Octane) and
Typo: s/drvier/driver/.
In theory this would also have allowed sharing the code with ia64/SN,
except that instead of porting the old mess to Linux 2.6 and cleaning it
up SGI moved the support into the firmware hidden behind PAL calls :(
> +#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.
> +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.
Powered by blists - more mailing lists