Re: [PATCH v2 08/11] swiotlb-xen: introduce phys_to_dma/dma_to_phys translations

From: Christoph Hellwig
Date: Tue Jun 09 2020 - 01:32:58 EST


On Mon, Jun 08, 2020 at 04:06:57PM -0700, Stefano Stabellini wrote:
> I understand what you are suggesting about having something like:
>
> xen_phys_to_dma(...)
> {
> phys_addr_t phys = xen_phys_to_bus(dev, paddr)
> return phys_to_dma(phys);
> }
>
> I thought about it myself. I'll do it.

"something", yes. Except that I think the bus is a little confusing,
isn't it? What is the Xen term for these addresses? Also we probably
don't need the extra local variable.

> But I don't think I understood the comment about XEN_PFN_PHYS.

There is a comment above xen_phys_to_bus that it avoids using
XEN_PFN_PHYS because XEN_PFN_PHYS of the phys_addr_t vs dma_addr_t
mismatch. But XEN_PFN_PHYS could just use a u64 instead of the
phys_addr_t and then we could use it. Especially as XEN_PFN_PHYS
isn't actually used anywhere except in swiotlb-xen.c. Or we could
remove XEN_PFN_PHYS enirely, as it isn't all that useful to start
with.