From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B470C433E0 for ; Fri, 22 May 2020 18:16:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13057206F6 for ; Fri, 22 May 2020 18:16:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="DyxCae+o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13057206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jcCDM-0000v5-Ux; Fri, 22 May 2020 18:16:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jcCDK-0000uw-V8 for xen-devel@lists.xenproject.org; Fri, 22 May 2020 18:16:11 +0000 X-Inumbo-ID: 5011d0b0-9c58-11ea-9887-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5011d0b0-9c58-11ea-9887-bc764e2007e4; Fri, 22 May 2020 18:16:10 +0000 (UTC) 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 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 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, konrad.wilk@oracle.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, Stefano Stabellini Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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