Re: [PATCH v4 02/10] PCI/P2PDMA: Add CONFIG_PCI_P2PDMA_CORE

From: Matt Evans

Date: Thu Jul 02 2026 - 13:07:40 EST


Hi Logan,

On 02/07/2026 16:45, Logan Gunthorpe wrote:
>
>
> On 2026-07-01 11:12 a.m., Matt Evans wrote:>
>> 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
>
> Can we remove this dependency on 64BIT? Althogh it looks like
> af2880ec440 complicated the issue a bit.
>
> If I remember correctly, the original reason for this is because on
> 64bit systems dma_flags fit into unusued space in struct scatterlist and
> on 32bit systems this space didn't exist and thus adding the flag
> required increasing the size of the structure which wasn't desirable at
> the time.
>
> But af2880ec440 introduced CONFIG_NEED_SG_DMA_FLAGS which doesn't depend
> on 64bit which means if CONFIG_IOMMU_DMA and CONFIG_SWIOTLB are now set
> on 32bit systems that structure will grow quite a bit.

There was some discussion on this aspect of af2880ec440 in the
corresponding v3 patch, for example:

https://lore.kernel.org/all/feaefa41-9f67-4d4f-a3e0-282dca41f3eb@xxxxxxxxxx/

It seems CONFIG_NEED_SG_DMA_FLAGS doesn't have a hard/functional
dependency on 64BIT (and it can be enabled on some !64BIT configs
already, despite what the stale comments say).

> So maybe at this point it's fine to enable this on 32bit systems and we
> can remove this requirement. However, I think we should do that
> explicitly in its own patch, not hide it in this refactoring patch.

Your question does prove it's too stealthy as-is. :) PCI_P2PDMA still
can't be enabled on 32-bit systems because of its ZONE_DEVICE ->
MEMORY_HOTPLUG -> 64BIT dependency. So we're not enabling 32-bit
support for PCI_P2PDMA here, but it's not obvious and so I'll re-add the
`depends on 64BIT`. At least then it won't be enabled without intention
if someone enables ZONE_DEVICE on 32-bit systems...


Thanks,


Matt