Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4164617ybg; Mon, 8 Jun 2020 00:14:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfz6HWxKX6m6/V1QNkC6JZLNS3Wxsvy1H4czZW8zQC3ilL5bQ7lv47UUvc3LSx46vtpTw7 X-Received: by 2002:a17:906:4944:: with SMTP id f4mr19633851ejt.3.1591600484899; Mon, 08 Jun 2020 00:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591600484; cv=none; d=google.com; s=arc-20160816; b=a1gsZm4EnhN+i4tXp4mehPx9Q/2wPSIS6lHG5O8tV9ZTMqLtdXPtHzvnGa5U/8ODlw Mt2KBFuX82wnqkzj643cj5P+UtnSJA6GUHRGattaa/7nUGU1kCOyz14gDCNAktb5NDGT Sn7bYDmmhdoNzrbWkMsCnKxbgDMNwSGlVXPANU9UFhERDFTHr+boBmAhcGuWCT+noiqv qZ4Cv112FHG5HuAs4P9OLpAL7DsPjbsm5q3Qhe0CzlGVBgqPfETI0zyK3nZ6Elo3Aozk bpFvaAbLUg+mMkcLtuDYa/BDGn9m63TMhlpBF7gz0TljWO8jslgauFfY5TMea37cOdCg SRfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=emLpIRFKODtAY8nraJqoNKwCIZphU+FBPDM0NtY/3Cg=; b=IdVNLAprGBSKhwJhbbjWoruEIThV4FuA9haF6XNUDBagBJ5g19bSDjlkLWepgJCziW 9rUJxlI/0hwCVApQbeMsxNInUtgKXSSL9uRKRqHgO/dVyB6svi3nuzt1qn5ieg2fHR5Z CrLJ9X3YKQpbJ9n6SpokwYA9dDcoRq9QvA0xjmVZAPWoKqijrNv5LkxDMNv3WuwGJ9XV XWlXtZY28wTdx8fwshYmERsDn6ztqPL+Q+afrETTPEoI2aDOYvx6MfwlqNGWe1jKBxyT AkFwTxcPJ2UDlO3XEG/auB/G1QFkVS2roLKCm4mkSJLTqQZwUzjCeEf4rtt5CwbD3eba WxpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qKLVusHb; 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 j28si8159294edy.293.2020.06.08.00.14.22; Mon, 08 Jun 2020 00:14:44 -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=@infradead.org header.s=bombadil.20170209 header.b=qKLVusHb; 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 S1729077AbgFHHM0 (ORCPT + 99 others); Mon, 8 Jun 2020 03:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728948AbgFHHMY (ORCPT ); Mon, 8 Jun 2020 03:12:24 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D00C08C5C3 for ; Mon, 8 Jun 2020 00:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=emLpIRFKODtAY8nraJqoNKwCIZphU+FBPDM0NtY/3Cg=; b=qKLVusHbJYznuKqC4wYTwNYxiq Xb6vUmAIBx0gFjK3PxshUq4aOfkih9+uu++SCVrvyUUF5llRcys6YJGKrp517NSaA1JJZ7bNS+09r tXPPUoOVLkozSIBGBOEzhUFUoCkjs9Hg8EpdQGxOKEi4WxCluYOlXDbEJSOUbc6v0ItEHJ/I3jaBs Dv89DRKpkXZiuuiTOZHep+TxL8cYs4ex18Xqp94Rx+vbQJpwXr/VaHpkErBL23hnksk3bs5mByiAh SgBM5UQujchw6Unrh83lvTzP8E86P7LrQhjrwnpE3ZZd1kHV2+IssHu6Jh2EeGhfooWhxvL/aTlgc WenzY0Ng==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiBxF-0006OS-9X; Mon, 08 Jun 2020 07:12:21 +0000 Date: Mon, 8 Jun 2020 00:12:21 -0700 From: Christoph Hellwig 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, tamas@tklengyel.com, roman@zededa.com, Stefano Stabellini Subject: Re: [PATCH v2 10/11] xen/arm: introduce phys/dma translations in xen_dma_sync_for_* Message-ID: <20200608071221.GF15742@infradead.org> References: <20200603222247.11681-10-sstabellini@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200603222247.11681-10-sstabellini@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 03, 2020 at 03:22:46PM -0700, Stefano Stabellini wrote: > From: Stefano Stabellini > > xen_dma_sync_for_cpu, xen_dma_sync_for_device, xen_arch_need_swiotlb are > getting called passing dma addresses. On some platforms dma addresses > could be different from physical addresses. Before doing any operations > on these addresses we need to convert them back to physical addresses > using dma_to_phys. > > Add dma_to_phys calls to xen_dma_sync_for_cpu, xen_dma_sync_for_device, > and xen_arch_need_swiotlb. > > dma_cache_maint is fixed by the next patch. The calling conventions because really weird now because xen_dma_sync_for_{device,cpu} already get both a phys_addr_t and a dma_addr_t. > > - if (pfn_valid(PFN_DOWN(handle))) > + if (pfn_valid(PFN_DOWN(dma_to_phys(dev, handle)))) But here we translate the dma address to a phys addr > arch_sync_dma_for_cpu(paddr, size, dir); While this still uses the passed in paddr. I think the uses of addresses in this code really needs a major rethink.