Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6110468imb; Fri, 8 Mar 2019 09:28:13 -0800 (PST) X-Google-Smtp-Source: APXvYqwdRRGgApI7hgm+7ghC4V3B8tmgkjQLir8Rf66ExhXRn0i76IieYgyORG7NbI704M0mZUXL X-Received: by 2002:a63:f843:: with SMTP id v3mr30126pgj.25.1552066093725; Fri, 08 Mar 2019 09:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552066093; cv=none; d=google.com; s=arc-20160816; b=CGRD0bDvoHMtFan6nDgT13NWAY8kVkzuEx7wwCCT0H4eo0ff8qYfWO2pSJr5SHFHgu 2lKVv0/41X0griXKhi82xVcF/7wJCT1PJWuP49zmaF0W+ZtbUmYVrGNkgYsFVDwrpjY3 9L2BHCgldqNnkYUWVx8AcBVYwhzChMKDKBEPAUIKtzqDsMRrcWwZbYGUkpoDY1PrvSvM 4NcECazUoTEDZCI5azOisi/168m9Wn5J+r2SZ8V9FLwQ5XC5CfehTOAkoSMV8nfHAi7K mUfqiY5NKU0s5fJpUwabIZH8xdWFGxS6GTiCw3vCGZFKjl//iJCcX6myUPOKLs75y/tN Ks5w== 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=Px2X35yr1CDkadZ9I1oKNY45OqS8UP4HpcJWMEeBVOM=; b=AVoBTHOBgjgdbg6jcqijt6n8cQnA/kWd6MUaQo1NxMM8ghfm3ROHwdbVmbiiK2WlGl EQNDml/H7oBM/3WtqvKAD/FrctXFqss5H0P29coprxPGtttK5hUSL9OQLBAl3rvFE+XG JqUosBYHPqLUVg4mQZqyYhEOKf0JGNqXROP08L/V9rqDMwY0c2v/jvQA8aFTbuu/9Xiz h4Za0wppE6hBFh0IcKGv3wQIAk0eq25xvd3R8v3AlDph7XiTne31x4P8dYgKQXgpwutr OVUtWR5NsmBXPaCyd9vyhckexy8+rVIbdIkOf89x1nqdEkXE4JZWEs6qu3IyMpPhRGwX LbFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si6712606pgv.209.2019.03.08.09.27.57; Fri, 08 Mar 2019 09:28:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbfCHR0C (ORCPT + 99 others); Fri, 8 Mar 2019 12:26:02 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33228 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbfCHR0B (ORCPT ); Fri, 8 Mar 2019 12:26:01 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37302A78; Fri, 8 Mar 2019 09:26:01 -0800 (PST) Received: from [10.1.196.50] (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F02613F575; Fri, 8 Mar 2019 09:25:58 -0800 (PST) Subject: Re: [Xen-devel] [PATCH] Revert "swiotlb: remove SWIOTLB_MAP_ERROR" To: Christoph Hellwig Cc: Arnd Bergmann , Robin Murphy , Juergen Gross , Stefano Stabellini , Andrew Morton , Konrad Rzeszutek Wilk , Linux Kernel Mailing List , Mike Rapoport , "open list:IOMMU DRIVERS" , Joerg Roedel , xen-devel , Boris Ostrovsky , Marek Szyprowski References: <20190304195951.1118807-1-arnd@arndb.de> <957e168a-2589-89c7-3a72-5071a7b6c65a@arm.com> <20190308152355.GA20230@lst.de> From: Julien Grall Message-ID: <124f4e49-9eb1-99d9-35f4-c2ef3dff8415@arm.com> Date: Fri, 8 Mar 2019 17:25:57 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190308152355.GA20230@lst.de> 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 Hi Christoph, On 08/03/2019 15:23, Christoph Hellwig wrote: > On Tue, Mar 05, 2019 at 09:41:46AM +0000, Julien Grall wrote: >> On Xen, dma_addr_t will always be 64-bit while the phys_addr_t will depend >> on the MMU type. So we may have phys_addr_t smaller than dma_addr_t from >> the kernel point of view. > > How can dma_addr_t on arm have value > 32-bit when physical > addresses are 32-bit only? The number of platform with IOMMU protected all DMA-capable device is not yet there. So we decided to not require IOMMU for Dom0. Instead, its memory is be directly mapped (i.e guest physical address == host physical address) and will always be below 4GB to cater the short page table case. In the common case, Dom0 also contains the PV backend drivers. Those drivers may directly use the guest buffer in the DMA request (so a copy is avoided). To avoid using a bounce buffer too much, xen-swiotlb will find the host physical address associated to the guest buffer and will use it to compute the DMA address. While Dom0 kernel may only deal with 32-bit physical address, the hypervisor can still deal with up to 40-bit physical address. This means the guest memory can be allocated above the 4GB threshold. Hence why the dma_addr_t is always 64-bit with CONFIG_XEN=y. Cheers, -- Julien Grall