Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1955494ybk; Thu, 21 May 2020 20:59:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSr7bnR/UtFKe8yBmujjavBw7ofnsZKplrTbO4h+uwN0Ldu5zWPCv//z9d+zD7hoGn0FFw X-Received: by 2002:a17:906:c344:: with SMTP id ci4mr6042031ejb.331.1590119976799; Thu, 21 May 2020 20:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590119976; cv=none; d=google.com; s=arc-20160816; b=YzfJ8fxAUS62EGa0j6CSYhGtVpklzd52rNRRaMVfzKAKodOk+9svIKe5S/wNL9TnmC 8+q1s4hynHs0nCRoRMJGjyEzUsDxTII/pFg3FVD1URxPa2KEOWQcP/dY0z6VMMAFpgkz xGZckYDwxLUPpAtQN0HAvuryO2o5a4dihQZALR3HmyCklM85WAkUBdGyA4FVKaD4tnLn SQSuIqtS/6Q37X2j8hR34IYQQEH4ZtXq3kbZBUAKN97HAV9DuQnCYiqwg9dm6ebzs12Y iAUWfi5eWBmN/YfedPs2F7n03XoifJmKl4U1mbmZw3YbEWyYWg7eBL+gQTQJ9zlvVmxX 16PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=HePTH6EbkJ4S1Z0OP7FO+MKxah0hlQiFKHOWznQQyyQ=; b=CTH8Sjo6VaHNL2GLpuL9IvwjTHihFO2P+S32HdjRSRGdXdeOEd2jI5U/dUVgBPnr3s ZouX0YdTBwYR34c9Z+RUHP2MWamrvaQRKh3vUS4zn++kmxbedXxF5z8ehLau0MKYz9TV hmXbzIMy+lmqWNrPAnK3Rkv9PlO+pC8yHdAUm1H+e1hQQx9g3i0+l0uwTYTaXd2ndXcd APFkTtBeIPPK5/vjfjgOpJrq825ieZrZ7ytmF90M1le0yEUTh9ppPxMplBjH7KSPrXeX aDTM7H13iEx+hyuXdYjj0dKEHLOFIB0LrWn3Qtl4vG2aQRQWy59FJhfJyZPQvUhaUueP rsrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xg72ogsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx1si4073538edb.573.2020.05.21.20.59.13; Thu, 21 May 2020 20:59:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xg72ogsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728348AbgEVDzU (ORCPT + 99 others); Thu, 21 May 2020 23:55:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:50036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727924AbgEVDzT (ORCPT ); Thu, 21 May 2020 23:55:19 -0400 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F8B620759; Fri, 22 May 2020 03:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590119719; bh=X9liTyH3K6qtc7i+pOoBtNjTMSeIvTNSkx5f9x/WbU8=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=xg72ogsw7M4B8R9hfY5qynnL5VL4GU1PiWUwtI59DbCpIADLESAPLlV2eTHnsymLA sI5fe9xs5/3QQuJ4+IL97JYVroylQwE6gUKikmi03+bTwUuB3BuQ2Q/HUw8mkdD8UH 5vvjEMO2HqFyTflVHshis/W14h45AxXdtBMq+M58= Date: Thu, 21 May 2020 20:55:18 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Julien Grall cc: Stefano Stabellini , jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Stefano Stabellini Subject: Re: [PATCH 02/10] swiotlb-xen: remove start_dma_addr In-Reply-To: <6241b8f6-5c51-0486-55ae-d571b117a184@xen.org> Message-ID: References: <20200520234520.22563-2-sstabellini@kernel.org> <6241b8f6-5c51-0486-55ae-d571b117a184@xen.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 May 2020, Julien Grall wrote: > Hi, > > On 21/05/2020 00:45, Stefano Stabellini wrote: > > From: Stefano Stabellini > > > > 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 > > --- > > 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).