Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8FF7DC4332F for ; Tue, 1 Nov 2022 20:26:44 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.435227.688354 (Exim 4.92) (envelope-from ) id 1opxq8-0002jh-Uu; Tue, 01 Nov 2022 20:26:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 435227.688354; Tue, 01 Nov 2022 20:26:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1opxq8-0002ja-RZ; Tue, 01 Nov 2022 20:26:28 +0000 Received: by outflank-mailman (input) for mailman id 435227; Tue, 01 Nov 2022 20:26:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1opxq7-0002jQ-Iw for xen-devel@lists.xenproject.org; Tue, 01 Nov 2022 20:26:27 +0000 Received: from mailhost.m5p.com (mailhost.m5p.com [74.104.188.4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7440c6ad-5a23-11ed-91b5-6bf2151ebd3b; Tue, 01 Nov 2022 21:26:25 +0100 (CET) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.16.1/8.15.2) with ESMTPS id 2A1KPbpm019236 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 1 Nov 2022 16:25:43 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.16.1/8.15.2/Submit) id 2A1KPaSh019235; Tue, 1 Nov 2022 13:25:36 -0700 (PDT) (envelope-from ehem) 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: 7440c6ad-5a23-11ed-91b5-6bf2151ebd3b Date: Tue, 1 Nov 2022 13:25:36 -0700 From: Elliott Mitchell To: Bertrand Marquis Cc: Stefano Stabellini , Julien Grall , Rahul Singh , Xen developer discussion , Michal Orzel , Oleksandr Tyshchenko , Oleksandr Andrushchenko , Volodymyr Babchuk , Jan Beulich , Roger Pau =?iso-8859-1?Q?Monn=E9?= , Andrew Cooper , Juergen Gross Subject: Re: Proposal for virtual IOMMU binding b/w vIOMMU and passthrough devices Message-ID: References: <227AD28E-DFB8-4EB3-9E0E-61C70A0D19EB@arm.com> <34B31FA6-72D8-4F03-AC94-3DC795D0FF55@arm.com> <222ed837-594d-6301-edec-6f9d26e1fadf@xen.org> <82c45bc1-6052-502b-3007-8a16fbd1d433@xen.org> <9F323893-B1C9-4D31-9A40-213345421860@arm.com> <947E315E-6537-48DC-8AC6-5218C12B604C@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <947E315E-6537-48DC-8AC6-5218C12B604C@arm.com> On Tue, Nov 01, 2022 at 04:30:31PM +0000, Bertrand Marquis wrote: > > > On 1 Nov 2022, at 15:01, Elliott Mitchell wrote: > > > > On Mon, Oct 31, 2022 at 01:26:44PM +0000, Bertrand Marquis wrote: > >> > >>> On 30 Oct 2022, at 21:14, Stefano Stabellini wrote: > >>> > >>> Ideally this would be something quick that can be easily invoked as the > >>> first step of an external third-party build process. > >> > >> I think that we are making this problem a lot to complex and I am not sure > >> that all this complexity is required. > > > > Speaking of complexity. Is it just me or does a vIOMMU had an odd sort > > of similarity with a Grant Table? > > > > Both are about allowing foreign entities access to portions of the > > current domain's memory. Just in the case of a Grant Table the entity > > happens to be another domain, whereas for a vIOMMU it is a hardware > > device. > > > > Perhaps some functionality could be shared between the two? Perhaps > > this is something for the designer of the next version of IOMMU to think > > about? (or perhaps I'm off the deep end and bringing in a silly idea) > > I am not quite sure what you mean here. > > The IOMMU is something not Xen specific. Linux is using it to restrict the area > of memory accessible to a device using its DMA engine. Here we just try to give > the same possibility when running on top Xen in a transparent way so that the > Linux (or an other guest) can continue to do the same even if it is running on > top of Xen. > In practice, the guest is not telling us what it does, we just get the pointer to the > first level of page table and we write it in the hardware which is doing the rest. > We need to have a vIOMMU because we need to make sure the guest is only > doing this for devices assigned to him and that it is not modifying the second > level of page tables which is used by Xen to make sure that only the memory > from the guest is accessible using the DMA engine. > > So I am not exactly seeing the common part with grant tables here. With Grant Tables, one domain is allocating pages and then allowing another domain to read and potentially write to them. What is being given to Xen is the tuple of page address and other domain. With the model presently being discussed you would have a vIOMMU for each other domain. The the pages access is being granted to are the pages being entered into the vIOMMU page table. Allocate a domain Id to each IOMMU domain and this very much seems quite similar to Xen's grant tables. I'm unsure the two can be unified, but they appear to have many common aspects. -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sigmsg@m5p.com PGP 87145445 | ) / \_CS\ | _____ -O #include O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445