Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp54294pxa; Mon, 3 Aug 2020 22:36:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1mLpp1OADwaqaGanMqzOiN2WY4T7PUZOBPCxxNdXZZo5G5pvH6hqHJm7AABbA2XUk6Av9 X-Received: by 2002:a17:906:69d7:: with SMTP id g23mr9894779ejs.262.1596519405106; Mon, 03 Aug 2020 22:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596519405; cv=none; d=google.com; s=arc-20160816; b=jxv1WND/6C31vSe2aBgASZrzB1rueTwmKdVmXWcx8lt28xORGRukVK7dXMlPA66wXe KFqEm3CZAOH0nY/mr/GosZInOr6sDOB3pipS/PvwCkJTKtKk6ztlpb2v8GhJmC+bsi+w RG7PVB7bwORqkSqS6S9ndjFIzVoYOE4VO+X6+OElABvmeQXA5jLWaRv+LKSDUxu+3rIy ATgU+TMxUMtBsCuodyv8X79BdkgQblrNC5x2sTHDJ4+j9GmjYXLuLVqwKOC/5HVUYykb pQPVw1bXrWqtPXlnZ7PO0KdMAYua8eyKmRHl8oSZ1lKrFPt8Tra9hcnnAHgSVLuZhVop dyMg== 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; bh=+OgaSNt4xR/2E76LvN1+mMU7cw7myIrhoutYxWiTrog=; b=xnPyXuipxrtKperHthP3JsIm+KREJaI0Ub5z2FyqTOiyy9zSk5ZB9m9DeVqG5bymi5 eqjV3pAenZmGfSP4EetirPXeteF5PIsoK3/IsoS+fLiKe2Pi98wD/2qqb9ARPgh6QKJT b9nPGoDItXhjbRRIqd4LPZObqqPuBS3crFPimrgQrkvVkMSQF2YrqBgS3M2D2ZhJtFas zRtdTbl5QyCFw+5elpbhISABhFwFsS3FT+jf2EBWmgiw2auqsr3u1YasZIdpdKL43R0F NBWG0jtDGXfDekhSBko538G5n4xWW3rfltGCN9xwPKHmf9SDXl+qd7Mj6MVef4pKA95F kCWg== ARC-Authentication-Results: i=1; mx.google.com; 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 o8si11695991edq.435.2020.08.03.22.36.23; Mon, 03 Aug 2020 22:36:45 -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; 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 S1728761AbgHDFec (ORCPT + 99 others); Tue, 4 Aug 2020 01:34:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:41656 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726797AbgHDFea (ORCPT ); Tue, 4 Aug 2020 01:34:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7A2D4ACB5; Tue, 4 Aug 2020 05:34:45 +0000 (UTC) Subject: Re: [PATCH v3 09/11] swiotlb-xen: introduce phys_to_dma/dma_to_phys translations To: Stefano Stabellini , boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, hch@infradead.org, Stefano Stabellini References: <20200710223427.6897-9-sstabellini@kernel.org> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <2f68bb03-60b6-44d6-b9cd-d21ef20a4a68@suse.com> Date: Tue, 4 Aug 2020 07:34:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200710223427.6897-9-sstabellini@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.07.20 00:34, Stefano Stabellini wrote: > From: Stefano Stabellini > > With some devices physical addresses are different than dma addresses. > To be able to deal with these cases, we need to call phys_to_dma on > physical addresses (including machine addresses in Xen terminology) > before returning them from xen_swiotlb_alloc_coherent and > xen_swiotlb_map_page. > > We also need to convert dma addresses back to physical addresses using > dma_to_phys in xen_swiotlb_free_coherent and xen_swiotlb_unmap_page if > we want to do any operations on them. > > Call dma_to_phys in is_xen_swiotlb_buffer. > Introduce xen_phys_to_dma and call phys_to_dma in its implementation. > Introduce xen_dma_to_phys and call dma_to_phys in its implementation. > Call xen_phys_to_dma/xen_dma_to_phys instead of > xen_phys_to_bus/xen_bus_to_phys through swiotlb-xen.c. > > Everything is taken care of by these changes except for > xen_swiotlb_alloc_coherent and xen_swiotlb_free_coherent, which need a > few explicit phys_to_dma/dma_to_phys calls. > > Signed-off-by: Stefano Stabellini > Tested-by: Corey Minyard > Tested-by: Roman Shaposhnik Reviewed-by: Juergen Gross Juergen