From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 972724CA263 for ; Thu, 11 Jun 2026 18:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781203070; cv=none; b=NlYw/W3zDWy50uJ69XKDs3UVmbx/xdi1VrCAaXeU7sLccWphdkkOJEAuQSvgWp4tdIcpzGE1XfbDllWn2VP4AIZWskLpm1v8vo7INXqUCrCofR7Pj97wckKvS2rycT2sxr6RwNKuIVnTXigo6o7uFxVmsp00OHQCKyJOPYIdZm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781203070; c=relaxed/simple; bh=oPRuHZd15dUUmcqh2bABeoIFDALTVfx3kPDHeu3o98s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oMCe0BBFidihx5WKNdrt2jL7+Dlgo4CKi2LQeTNnGpLqq4KTw86h8gicgicHsQreA1VuMPZbTXk+VyXTb++X+m8GEPp6hn8bL9X69A+WeUMMfU6rieq/1ySUx6gyrzZvZMXVQMxE6BXeccMU1KRPcBjhw2rMIjkpWngw3fBHPao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aW+atQ5M; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aW+atQ5M" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2bf2d865383so14795ad.1 for ; Thu, 11 Jun 2026 11:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781203068; x=1781807868; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/TFfh87PJEUZx1rJ8R/E1mrJDSDu5E1AnG3uHnDgisU=; b=aW+atQ5MKBCMrL3cI29ayyN3oAsACp17FOk7gijyVhzYqKclTp+UDt1gJuoUhaHCCF hOHgiLxI9aGfjbLtJhyCNgtG9DCTWToTXgOHlYRwYI/UbcQCSI+45XzLljlA+ZR8FNQE axHiTD7XOwIqH6PPMtj6OJFNPo0ZYmh+/CQVd7hLBzK5LtpUfU1PvlzzZVgaDPnX9xir o8gCHO6qvuiQ27V2YT/kfPPiI5NxNbMbs1c2j5a3cEU7Z5mO5/UaU+47H7nFF0tbhBlS 6Wd3T3OedpWYP2sGa+g4bU15eX360oaUmhaYZiK/yYuuHnZ9Cswu3CKwOCxJ9Z+h+mLh Iarw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781203068; x=1781807868; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/TFfh87PJEUZx1rJ8R/E1mrJDSDu5E1AnG3uHnDgisU=; b=Q0f9sX8dAS7+2z75uOR3GX7SzhcLjpGuvaoJ28UpGg6asGgjcw/BfY0qHZss0E5pRM wgvFtANVI3N7UApjj4yheWTBb52/P1sv2yBlJkqQK3DrOtLiTeLM+8wuPhnyX8ipDvXe 4YVOkrWRYxajfm+3+Nvij0Vu7bT/KS/7+mUy33+WI0zBic76uVS+n+gAkcQVnxxi8fO8 GHoKjQjJuakUZOcmSMxNn4qf58UIhYSYa7U5RNelpdFKMbBRU0+QZqCrYjeb5QsRSgq1 2BYpLtjPXcA7t/Mnz8pq6KCyvZ2R9DTLTPPgFjQx1n4zeuYzwsg4gzwqiY7T7Yvu2Gof 6RWQ== X-Forwarded-Encrypted: i=1; AFNElJ/cFQGG2lr8aHmbTAzWrlOYr+eAyijF6F1I00BF/LZngAxAH1aou6LJ8svCvjMV+0DHhtytQ1TLcdm6wL8=@vger.kernel.org X-Gm-Message-State: AOJu0YxPFBQngsj78BjcLeORmt2CBQUbco0gNeHEkj2MXlw3Z1BXtzrF D4DCGglo6UfRSJDZHqxmCq2aBiszIgzkUGeqd+tiP6e88txW6sIVbt+jT25tWR8xJQ== X-Gm-Gg: Acq92OEuvUzOm8isJeqUFiBMggAJzPEpmO6BCpjbH1iHYLErAqFWKxP5aAQspKgT07A mLCqjCOWGwoS9KCKozGxSyXLEYxZ+ZbZMadzXNkhjdCco2Gd/hRzI31vwhDOT/s56vzqfQHIixD 7TVryzOgR0eIKclZEuZmID5Qg5rFzrDZtDwJqC33/OYF8J0w7ynZ3sElltewkDxnNBoRkD0Usg9 eN9hHBFBiMwBV8m/PEYJZmOV4R4hyZHmW9xk+Q799+M3yIVTd7ICzio1GDJXIx+02CIC+kBjZ8y V3eFR/HxUdhaCnOc/lOJ+PMGDq2wqFI+qWy5qhYVzD9HULc0OFvl1HVfjx4YroagNWGQBgrvuTO 11We6gybg6SleYV4kkg4X0O7QUuLedBgmEEHGmmyct2K4OHIp/HHgl1J0TRkB8qjXPW2gVYm5EK LZ48Vb8XQh7AXWRVJUJgrRnuf7Z/qWW6FVBq4hTTahFdC4ZedJ3OXVTi7PSpb9 X-Received: by 2002:a17:902:ce02:b0:2bf:b01:2b4c with SMTP id d9443c01a7336-2c3e3f69092mr255655ad.9.1781203067344; Thu, 11 Jun 2026 11:37:47 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c865880c00dsm2085451a12.24.2026.06.11.11.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 11:37:46 -0700 (PDT) Date: Thu, 11 Jun 2026 18:37:39 +0000 From: Pranjal Shrivastava To: Matt Evans Cc: Alex Williamson , Leon Romanovsky , Jason Gunthorpe , Alex Mastro , Christian =?iso-8859-1?Q?K=F6nig?= , Bjorn Helgaas , Logan Gunthorpe , Mahmoud Adam , David Matlack , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Sumit Semwal , Kevin Tian , Ankit Agrawal , Alistair Popple , Vivek Kasireddy , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, kvm@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v3 1/9] PCI/P2PDMA: Add CONFIG_PCI_P2PDMA_CORE Message-ID: References: <20260610154327.37758-1-matt@ozlabs.org> <20260610154327.37758-2-matt@ozlabs.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260610154327.37758-2-matt@ozlabs.org> On Wed, Jun 10, 2026 at 04:43:15PM +0100, Matt Evans wrote: > The P2PDMA code currently provides two features under the same > CONFIG_PCI_P2PDMA option: > > 1. Locate providers via pcim_p2pdma_provider() > 2. Manage actual P2P DMA > > Some drivers (such as vfio-pci) depend on 1, without having a hard > dependency on 2. > > A future commit expands the use of DMABUF in vfio-pci for non-P2P > scenarios, relying on pcim_p2pdma_provider() always being present. If > that depended on CONFIG_PCI_P2PDMA, it would make vfio-pci only > available if CONFIG_ZONE_DEVICE is present (e.g. 64-bit systems), even > when P2P is not needed. > > To resolve this, introduce CONFIG_PCI_P2PDMA_CORE and refactor the > basic provider functionality into a new p2pdma_core.c file. This is > available even if the CONFIG_PCI_P2PDMA feature is disabled (or > unavailable due to !CONFIG_ZONE_DEVICE). Then, drivers can enable any > additional P2P features with the original CONFIG_PCI_P2PDMA (available > when CONFIG_ZONE_DEVICE is set). > > Signed-off-by: Matt Evans > --- > MAINTAINERS | 2 +- > drivers/pci/Kconfig | 10 ++-- > drivers/pci/Makefile | 1 + > drivers/pci/p2pdma.c | 109 ++-------------------------------- > drivers/pci/p2pdma.h | 29 +++++++++ > drivers/pci/p2pdma_core.c | 118 +++++++++++++++++++++++++++++++++++++ > include/linux/pci-p2pdma.h | 24 ++++---- > include/linux/pci.h | 2 +- > 8 files changed, 174 insertions(+), 121 deletions(-) > create mode 100644 drivers/pci/p2pdma.h > create mode 100644 drivers/pci/p2pdma_core.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index c2c6d79275c6..b21523b3bd8b 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -20617,7 +20617,7 @@ B: https://bugzilla.kernel.org > C: irc://irc.oftc.net/linux-pci > T: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git > F: Documentation/driver-api/pci/p2pdma.rst > -F: drivers/pci/p2pdma.c > +F: drivers/pci/p2pdma* > F: include/linux/pci-p2pdma.h > > PCI POWER CONTROL > diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig > index 33c88432b728..59d70bc84cc9 100644 > --- a/drivers/pci/Kconfig > +++ b/drivers/pci/Kconfig > @@ -206,11 +206,7 @@ config PCIE_TPH > config PCI_P2PDMA > bool "PCI peer-to-peer transfer support" > depends on ZONE_DEVICE > - # > - # The need for the scatterlist DMA bus address flag means PCI P2PDMA > - # requires 64bit > - # > - depends on 64BIT > + select PCI_P2PDMA_CORE > select GENERIC_ALLOCATOR > select NEED_SG_DMA_FLAGS > help Nit: Did we drop depends on 64BIT intentionally here? I guess the full PCI_P2PDMA stack still selects NEED_SG_DMA_FLAGS? IIRC, NEED_SG_DMA_FLAGS doesn't select 64BIT? With the nit (and Bjorn's comments addressed) Reviewed-by: Pranjal Shrivastava Thanks, Praan