Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1877466pxb; Fri, 10 Sep 2021 16:50:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6Gjw9o53kO+9ORebvrtdO6axxMla3vAMBRebTbQ4zRkFcKyq0uahWXmOfAY3ULmAGGnlM X-Received: by 2002:a05:6e02:12c2:: with SMTP id i2mr143198ilm.261.1631317848997; Fri, 10 Sep 2021 16:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631317848; cv=none; d=google.com; s=arc-20160816; b=xaLgvJL2mqqqU3zk5Msxnq8nKcPhoQpPZ0IGxZTd+JqsjXm4+celaL9IQgobYbhE4E NKD607eREnwyvRbp2VGwmxZKDJykYtXMOqFbtZozeTwlhDsHO8lh8Bzn1kpt/21mqP0h cL42CZSgqtjZeXZWpK+du47i251TDTNgDr3/O+Rv4DDCsgpG5yG6lZZuk6G1E/A3Dqte u91wNqxY/QO+zcqwOE+TAxj6vJS9c0IO59Yjo03PLdJvAqV4DIuLmkWJVSCuwOPyYzG8 Nsx1QM/8ZSabgyxcoXJHs7LCwNtEJYzgm25KmHbhQtwM94W56UY49h3y0YxMFj35R9JX sCpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=lXshhyTcBvPCDKUedETjKKnxGbGSYpgMiZewcnh9KXE=; b=MmaOyYZHIgJus3eIHgwSTjfWrlK+g/7XOBA40gEd4VnQdLfBZcHpoBKwIcXqF9FlMK akBvqtJt8fSRD70dl/B0+Cx2HMm0s0ehZcNeaaD8B9hOF/vHk4wHVuS86y2H1a/vTQNO BXF4X6EXfkEQFQt+fuSV+pLSpXPbueaMg+DbfX0pQB66qzeg8tRqpmdZcxfWfFRR9ruX a0w1aGgAJTmVF/snbw115wUBA7AwwLMpQn7P6H11S1ee8VyATc8HhBGdW1VOqjAQ2jLV Ylz1yCgG7oZNYLLUA8d/CNDLFr/0vGG0QUYTfegph2rMqIyniIeRYpowFdsY6MifzFwv QpRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NBh9bj15; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si90719iow.31.2021.09.10.16.50.37; Fri, 10 Sep 2021 16:50:48 -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=pass header.i=@kernel.org header.s=k20201202 header.b=NBh9bj15; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234876AbhIJXuA (ORCPT + 99 others); Fri, 10 Sep 2021 19:50:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:41540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234787AbhIJXt4 (ORCPT ); Fri, 10 Sep 2021 19:49:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C6A561209; Fri, 10 Sep 2021 23:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631317725; bh=CT+zN2hvsAGlq3FXd8oqicFmjUPdT7vc0738cJVqDhc=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=NBh9bj15FRDBR+BDeOLotaclfeKGuxxEoc4JgAJKKHSox00tTCMgZLOGby7uUyLYQ pUtT8PJgxMce1q0BfXQGk+qIw445gAvZ6NLhM4y8jA3YmI46zR+zNzroZXVu/pZbaM pTbn7Eto3WbEs5hwCEQxgUa7pk5OieVIazdXrixmWnVA0ZXVHOPpeLJa2vQT1Ei7aF /ufGH9sxsebTeWF+phKh0lNfjV8oBhSvhX22Iap+CYZELu0dBswL/q/Q1LCFKtPJe6 t2CcUFqSt5aknM/ek0YF2QSjZKjYczxCuqCMGiGxDka+iZ6w5jVDpn2rd6xDDUxgLZ AD+jGYwhQZKlw== Date: Fri, 10 Sep 2021 16:48:44 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Christoph Hellwig cc: Jan Beulich , Juergen Gross , Boris Ostrovsky , Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" , the arch/x86 maintainers , Thomas Gleixner , Ingo Molnar , Borislav Petkov Subject: Re: [PATCH 12/12] swiotlb-xen: this is PV-only on x86 In-Reply-To: Message-ID: References: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> <004feaef-f3bb-e4bb-fb10-f205a9f69f28@suse.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Sep 2021, Christoph Hellwig wrote: > On Tue, Sep 07, 2021 at 02:13:21PM +0200, Jan Beulich wrote: > > The code is unreachable for HVM or PVH, and it also makes little sense > > in auto-translated environments. On Arm, with > > xen_{create,destroy}_contiguous_region() both being stubs, I have a hard > > time seeing what good the Xen specific variant does - the generic one > > ought to be fine for all purposes there. Still Arm code explicitly > > references symbols here, so the code will continue to be included there. > > Can the Xen/arm folks look into that? Getting ARM out of using > swiotlb-xen would be a huge step forward cleaning up some DMA APIs. On ARM swiotlb-xen is used for a different purpose compared to x86. Many ARM SoCs still don't have an IOMMU covering all DMA-mastering devices (e.g. Raspberry Pi 4). As a consequence we map Dom0 1:1 (guest physical == physical address). Now if it was just for Dom0, thanks to the 1:1 mapping, we wouldn't need swiotlb-xen. But when we start using PV drivers to share the network or disk between Dom0 and DomU we are going to get DomU pages mapped in Dom0, we call them "foreign pages". They are not mapped 1:1. It can happen that one of these foreign pages are used for DMA operations (e.g. related to the NIC). swiotlb-xen is used to detect these situations and translate the guest physical address to physical address of foreign pages appropriately. If an IOMMU is available and the DMA-mastering device is behind it, then swiotlb-xen is not necessary. FYI there is community interest in selectively disabling swiotlb-xen for devices that are behind an IOMMU. > > Instead of making PCI_XEN's "select" conditional, simply drop it - > > SWIOTLB_XEN will be available unconditionally in the PV case anyway, and > > is - as explained above - dead code in non-PV environments. > > > > This in turn allows dropping the stubs for > > xen_{create,destroy}_contiguous_region(), the former of which was broken > > anyway - it failed to set the DMA handle output. > > Looks good: > > Reviewed-by: Christoph Hellwig Reviewed-by: Stefano Stabellini