Message ID | 20190722230859.5436-8-logang@deltatee.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PCI/P2PDMA: Support transactions that hit the host bridge | expand |
On Mon, Jul 22, 2019 at 05:08:52PM -0600, Logan Gunthorpe wrote: > diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c > index 143e11d2a5c3..70c262b7c731 100644 > --- a/drivers/pci/p2pdma.c > +++ b/drivers/pci/p2pdma.c > @@ -168,6 +168,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size, > pgmap->res.end = pgmap->res.start + size - 1; > pgmap->res.flags = pci_resource_flags(pdev, bar); > pgmap->type = MEMORY_DEVICE_PCI_P2PDMA; > + pgmap->pci_p2pdma_provider = pdev; > pgmap->pci_p2pdma_bus_offset = pci_bus_address(pdev, bar) - > pci_resource_start(pdev, bar); I think we need to bite the bullet and move the PCIe P2P specific information out of struct dev_pagemap and into a pci-specific structure that embedds struct dev_pagemap.
On 2019-07-24 12:32 a.m., Christoph Hellwig wrote: > On Mon, Jul 22, 2019 at 05:08:52PM -0600, Logan Gunthorpe wrote: >> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c >> index 143e11d2a5c3..70c262b7c731 100644 >> --- a/drivers/pci/p2pdma.c >> +++ b/drivers/pci/p2pdma.c >> @@ -168,6 +168,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size, >> pgmap->res.end = pgmap->res.start + size - 1; >> pgmap->res.flags = pci_resource_flags(pdev, bar); >> pgmap->type = MEMORY_DEVICE_PCI_P2PDMA; >> + pgmap->pci_p2pdma_provider = pdev; >> pgmap->pci_p2pdma_bus_offset = pci_bus_address(pdev, bar) - >> pci_resource_start(pdev, bar); > > I think we need to bite the bullet and move the PCIe P2P specific > information out of struct dev_pagemap and into a pci-specific structure > that embedds struct dev_pagemap. OK, I was going to do that, but you just removed the p2p specific page map. ;) I'll change this for a v2. Logan
On Wed, Jul 24, 2019 at 09:50:03AM -0600, Logan Gunthorpe wrote: > OK, I was going to do that, but you just removed the p2p specific page > map. ;) Only because it was empty at that time..
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 143e11d2a5c3..70c262b7c731 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -168,6 +168,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size, pgmap->res.end = pgmap->res.start + size - 1; pgmap->res.flags = pci_resource_flags(pdev, bar); pgmap->type = MEMORY_DEVICE_PCI_P2PDMA; + pgmap->pci_p2pdma_provider = pdev; pgmap->pci_p2pdma_bus_offset = pci_bus_address(pdev, bar) - pci_resource_start(pdev, bar); diff --git a/include/linux/memremap.h b/include/linux/memremap.h index f8a5b2a19945..91aee61796bc 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -112,6 +112,7 @@ struct dev_pagemap { struct device *dev; enum memory_type type; unsigned int flags; + struct pci_dev *pci_p2pdma_provider; u64 pci_p2pdma_bus_offset; const struct dev_pagemap_ops *ops; };
The provider will be needed to figure out how to properly map a device. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- drivers/pci/p2pdma.c | 1 + include/linux/memremap.h | 1 + 2 files changed, 2 insertions(+)