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=-7.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 13D08C4320A for ; Tue, 31 Aug 2021 21:50:39 +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 D05D960200 for ; Tue, 31 Aug 2021 21:50:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D05D960200 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.175984.320385 (Exim 4.92) (envelope-from ) id 1mLBeD-0005xB-N1; Tue, 31 Aug 2021 21:50:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 175984.320385; Tue, 31 Aug 2021 21:50:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mLBeD-0005x4-Je; Tue, 31 Aug 2021 21:50:25 +0000 Received: by outflank-mailman (input) for mailman id 175984; Tue, 31 Aug 2021 21:50:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mLBeC-0005wy-Tg for xen-devel@lists.xenproject.org; Tue, 31 Aug 2021 21:50:24 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 71e39252-0aa5-11ec-ad88-12813bfff9fa; Tue, 31 Aug 2021 21:50:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4826360200; Tue, 31 Aug 2021 21:50:23 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 71e39252-0aa5-11ec-ad88-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630446623; bh=LLs5/U3xoDrfZP6xHjj4M1l0zoAdilk2UEoctdzkmkw=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=DDRJeT+egUxWhkd+MEil9XwX27Ga7B1ME7bCKNFx9o0lgJwUAB7gOtVUGKbyr61lX UnPpy/jF7auzNcm+iCPd3R/TmOWC7y9EiJ67EL2FXMpLgbIdHqxbpbP0CLFaWdYDZh d2Ask9gqCGGStg0uoFNVZlKuzeoGyw/53WyxpbK38RRp3x9UieAjotTl5MCliBrNlQ RuYU86FakFf0qf4Nrq9vNptcqJ+v3IoZP5pSQuyCE+ck+ub6SksMfDeDG6wV7J/x8h HuNWfrg7ZKtbA5Ej4eLM0TWBH/jZ9RIE0d8R0kYhj0vEpss/DHp1Ht3Mutq+7advs7 KrW1qs706HjyA== Date: Tue, 31 Aug 2021 14:50:22 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Roman Skakun cc: Stefano Stabellini , Julien Grall , "xen-devel@lists.xenproject.org" , Bertrand Marquis , Andrii Anisov , Roman Skakun Subject: Re: Disable IOMMU in Dom0 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Tue, 31 Aug 2021, Roman Skakun wrote: > Hi, Stefano! > > I have seen your negotiation of disabling xen-swiotlb for devices which are controlled by IOMMU in Dom0: > https://patchwork.kernel.org/project/xen-devel/patch/alpine.DEB.2.21.2102161333090.3234@sstabellini-ThinkPad-T480s/ > > As I was thinking to create a common implementation because I have the issue > when device controlled by IOMMU using xen-swiotlb fops and bounce buffer as the result. > https://lore.kernel.org/xen-devel/060b5741-922c-115c-7e8c-97d8aa5f46f4@xen.org/T/ > > Do you have any future plans to finish implementation for upstream? Hi Roman, The feature is already upstream in Linux as f5079a9a2, and the new feature flags are XENFEAT_direct_mapped and XENFEAT_not_direct_mapped. If you have a setup where Dom0 is not 1:1 mapped (which is not currently possible with upstream Xen but it is possible with cache coloring) and uses the IOMMU to make device DMA work like regular DomUs, then passing XENFEAT_not_direct_mapped to Linux would make it work. Without XENFEAT_not_direct_mapped, Linux would try to use swiotlb-xen which has code that relies on Linux being 1:1 mapped to work properly. Is that the same problem that you have, or is dom0 1:1 mapped in your case? If dom0 is 1:1 mapped then swiotlb-xen should work regardless of whether the IOMMU is enabled or disabled. I hope this helps. Cheers, Stefano