Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp489014ybr; Fri, 22 May 2020 11:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRnGXmT1Rsj+leq+Mi6WaTbslALX+7RpQ5eVb2ul5VDMuTaaWYxVmpIdHdAtQxGo8h7vOg X-Received: by 2002:a17:906:3095:: with SMTP id 21mr9456931ejv.32.1590171609964; Fri, 22 May 2020 11:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590171609; cv=none; d=google.com; s=arc-20160816; b=gla4MgJXY34ftOAYHft/OBnr0YzFGoSmU0dUeZsH53+aHYUYM6HYwgLWban4d7qduR anW+YQRHhbEbHe7A9U/zMJrpBu1BhSx53nW4lGh3napSbd+VJVpip4/Ooi218kwo9Rd5 ayo6fp2dCePnjG7dGUXMluukCeeBvSX6jLAEHK4gO1l0hzek6cv8B5tHzbI1LOLJS1aJ wl8sWjOEPJnNyuAVwbNGYCLb1j+kl0W1J4xjkGQuaUu5aSaR7HBkdYpSYG1leDkTcJtP XUa6H15uw68C6SsjXTIHvYXZ4401r3WGU8+bOBGHFCnHD8WRDObOpGgFFYrCAPEA2e4j DbUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=hLKSuZTQ4zo02OD599iePD2/rvDfeT9Ihh6Ut+Ss5iQ=; b=j20n6jRp1ARgFHUkW7g1XF0AT524pt2MactitQ5QAcyI/zeg+Uq6UrGaj3LDyKikBb ADeNV6FMA7uoxBlYPBjqgeFikDUNjnGMccstPKplhExjiAcurQ6a4U5Z/zyprllIW8IS AeSp32ENJAmubpxzg0o4agmOOoCRh19oVgYgrCmSvkx2DrBC6KO1ZI2G8dHac4Cyjrs7 KdUL+TwYhkvyTNHJHlNdwJcWY+ij7n7SUmbLb2HxFcXL7fwp3Xf3/hxKAwihVIDS6fFA 7XHN6/c041Fqaes4OBtCqLQW4ePtWs+0ir6L0sclTUSxk29eaHJSyDZu5WaaCmlSF01Z Rg4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@xen.org header.s=20200302mail header.b=DyxCae+o; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si5395838ejb.220.2020.05.22.11.19.47; Fri, 22 May 2020 11:20:09 -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=fail header.i=@xen.org header.s=20200302mail header.b=DyxCae+o; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730802AbgEVSQK (ORCPT + 99 others); Fri, 22 May 2020 14:16:10 -0400 Received: from mail.xenproject.org ([104.130.215.37]:58818 "EHLO mail.xenproject.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726373AbgEVSQK (ORCPT ); Fri, 22 May 2020 14:16:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hLKSuZTQ4zo02OD599iePD2/rvDfeT9Ihh6Ut+Ss5iQ=; b=DyxCae+oxFpfbkgZWHTM5ZUy30 QNvkMcKVhEsiKm65FENKqqRVklyCPJplTthhwbFSX5pNHFWGcMlwchcEd58WvagHoo2/Knwx0WCKi 1VCuyhyQtCmyJ7q8REVY+XFLjUDnZloNlsyddVIjeKQZ4GLFweJW5+XnQUD1pO/1+JeU=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jcCDI-0001HQ-Sg; Fri, 22 May 2020 18:16:08 +0000 Received: from 54-240-197-238.amazon.com ([54.240.197.238] helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jcCDI-0004LV-Ix; Fri, 22 May 2020 18:16:08 +0000 Subject: Re: [PATCH 02/10] swiotlb-xen: remove start_dma_addr To: Stefano Stabellini Cc: jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Stefano Stabellini References: <20200520234520.22563-2-sstabellini@kernel.org> <6241b8f6-5c51-0486-55ae-d571b117a184@xen.org> From: Julien Grall Message-ID: Date: Fri, 22 May 2020 19:16:06 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> >>> 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). I can't find such check in master. What is your baseline? Could you point to the exact line of code? Cheers, -- Julien Grall