Messages in this thread | | | Subject | Re: [PATCH 02/10] swiotlb-xen: remove start_dma_addr | From | Julien Grall <> | Date | Fri, 22 May 2020 19:16:06 +0100 |
| |
Hi,
On 22/05/2020 04:55, Stefano Stabellini wrote: > On Thu, 21 May 2020, Julien Grall wrote: >> Hi, >> >> On 21/05/2020 00:45, Stefano Stabellini wrote: >>> From: Stefano Stabellini <stefano.stabellini@xilinx.com> >>> >>> It is not strictly needed. Call virt_to_phys on xen_io_tlb_start >>> instead. It will be useful not to have a start_dma_addr around with the >>> next patches. >>> >>> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> >>> --- >>> drivers/xen/swiotlb-xen.c | 5 +---- >>> 1 file changed, 1 insertion(+), 4 deletions(-) >>> >>> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c >>> index a42129cba36e..b5e0492b07b9 100644 >>> --- a/drivers/xen/swiotlb-xen.c >>> +++ b/drivers/xen/swiotlb-xen.c >>> @@ -52,8 +52,6 @@ static unsigned long xen_io_tlb_nslabs; >>> * Quick lookup value of the bus address of the IOTLB. >>> */ >>> -static u64 start_dma_addr; >>> - >>> /* >>> * Both of these functions should avoid XEN_PFN_PHYS because phys_addr_t >>> * can be 32bit when dma_addr_t is 64bit leading to a loss in >>> @@ -241,7 +239,6 @@ int __ref xen_swiotlb_init(int verbose, bool early) >>> m_ret = XEN_SWIOTLB_EFIXUP; >>> goto error; >>> } >>> - start_dma_addr = xen_virt_to_bus(xen_io_tlb_start); >>> if (early) { >>> if (swiotlb_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs, >>> verbose)) >>> @@ -389,7 +386,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device >>> *dev, struct page *page, >>> */ >>> trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force); >>> - map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, >>> + map = swiotlb_tbl_map_single(dev, virt_to_phys(xen_io_tlb_start), >>> phys, >> >> xen_virt_to_bus() is implemented as xen_phys_to_bus(virt_to_phys()). Can you >> explain how the two are equivalent? > > They are not equivalent. Looking at what swiotlb_tbl_map_single expects, > and also the implementation of swiotlb_init_with_tbl, I think > virt_to_phys is actually the one we want. > > swiotlb_tbl_map_single compares the argument with __pa(tlb) which is > __pa(xen_io_tlb_start) which is virt_to_phys(xen_io_tlb_start).
I can't find such check in master. What is your baseline? Could you point to the exact line of code?
Cheers,
-- Julien Grall
| |