Re: [PATCH] PCI/P2PDMA: Avoid returning a provider for non_mappable_bars
From: Leon Romanovsky
Date: Sun Apr 26 2026 - 07:22:56 EST
On Thu, Apr 23, 2026 at 04:55:29PM +0200, Niklas Schnelle wrote:
> On Wed, 2026-04-22 at 18:19 +0300, Leon Romanovsky wrote:
> > On Wed, Apr 22, 2026 at 03:22:53PM +0100, Matt Evans wrote:
> > > Hi Leon,
> > >
> > > On 21/04/2026 20:49, Leon Romanovsky wrote:
> > > >
> > > > On Tue, Apr 21, 2026 at 10:43:51AM -0700, Matt Evans wrote:
> > > > > Extend pcim_p2pdma_provider()'s checks to exclude functions that have
> > > > > pdev->non_mappable_bars set.
> > > > >
> > > > > Consumers such as VFIO were previously able to map these for access by
> > > > > the CPU or P2P. Update the comment on non_mappable_bars to show it
> > > > > refers to any access, not just userspace CPU access.
> > > > >
> > > > > Fixes: 372d6d1b8ae3c ("PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation")
> > > >
> > > > I don't object to the patch, but this Fixes line doesn't look correct.
> > > > non_mappable_bars applies only to s390, which doesn't support p2p. That
> > > > wasn't prevented before 372d6d1b8ae3c refactoring too.
> > >
> > > Thanks; I'd chosen that commit as it adds the function that the additional
> > > test is being added to.
> >
> > Can I suggest slightly different solution?
> > If CONFIG_..._S390 is set, we will unset CONFIG_PCI_P2PDMA and pcim_p2pdma_provider()
> > will be compiled to return NULL, without changing non_mappable_bars
> > description.
> >
> > Thanks
>
> Hi Leon,
>
> I'm not sure this is an ideal solution for the longer term. While ISM
> definitely can't do P2P and is more akin to an emulated PCI device in
> its actual implementation, other PCI devices on the platform such as
> ConnectX family NICs, NVMes and the IBM Spyre Accelerator are much more
> run off the mill.
Thanks, Niklas and Matt,
I hadn’t realized that the non_mappable_bars apply only to a specific
portion of the system. You’re right — the change should be made as you
suggested.
Thanks