On Wed, Sep 24, 2025 at 06:13:56PM +0200, Simon Richter wrote: > > The problem here is that the CPU physical (aka BAR Address) is only > > usable by the CPU. > > The address you receive from mapping a dma_buf for a particular device > is not a CPU physical address, even if it is identical on pretty much > all PC hardware because it is uncommon to configure the root bridge with > a translation there.
I said already, you cannot convert from a dma_addr_t back to a phys_addr_t. There is just no universal API for this and your examples like PPC explain why it cannot work even if some hacks appear to be okay on one x86 system. I think Christian's suggestion is to pass a (struct pci_dev *, bar index, bar offset) between dmabuf exporter/importer That would work for alot of use case, we could make iommufd and kvm work with that. The Xe PF driver could detect the vram by checking if the pci_dev * is a VF of itself and then using its internal knowledge of the provisioned VF BAR to compute the VRAM location. If it is not this case then it would fall back to the normal 'exporter does dma map' fllow. Jason
