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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 1CAC0C3B196 for ; Fri, 14 Feb 2020 05:36:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E42224650 for ; Fri, 14 Feb 2020 05:36:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="Xq4sSZ6y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728698AbgBNFga (ORCPT ); Fri, 14 Feb 2020 00:36:30 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:35057 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725845AbgBNFga (ORCPT ); Fri, 14 Feb 2020 00:36:30 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 48JhvH4G3Qz9sRN; Fri, 14 Feb 2020 16:36:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1581658587; bh=zNdoB9TvN56rRqasUcuUJ/reZPQdWn4eEGEbEQxhf7g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xq4sSZ6yevHWgo7eyJ1ryOK/ibr0X/T3CGbch9K+3d9L0fY9I3uttzAelX1yBn7qU yQgy3rwNZHik1vXlUfyHex04RdUf4MX7H3BSoAy5QLSYs6O+TunsyBEoQZsazSKx1Y YBAni/lQhFydDEh8axlaW+3rPC2aS27BnZYOQ6HE= Date: Fri, 14 Feb 2020 16:36:20 +1100 From: David Gibson To: "Liu, Yi L" Cc: Peter Xu , "qemu-devel@nongnu.org" , "pbonzini@redhat.com" , "alex.williamson@redhat.com" , "mst@redhat.com" , "eric.auger@redhat.com" , "Tian, Kevin" , "Tian, Jun J" , "Sun, Yi Y" , "kvm@vger.kernel.org" , "Wu, Hao" , Jacob Pan , Yi Sun Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext Message-ID: <20200214053620.GR124369@umbus.fritz.box> References: <1580300216-86172-1-git-send-email-yi.l.liu@intel.com> <1580300216-86172-4-git-send-email-yi.l.liu@intel.com> <20200131040644.GG15210@umbus.fritz.box> <20200211165843.GG984290@xz-x1> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="teKjxxMjPsACTz/N" Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org --teKjxxMjPsACTz/N Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 12, 2020 at 07:15:13AM +0000, Liu, Yi L wrote: > Hi Peter, >=20 > > From: Peter Xu > > Sent: Wednesday, February 12, 2020 12:59 AM > > To: Liu, Yi L > > Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext > >=20 > > On Fri, Jan 31, 2020 at 11:42:13AM +0000, Liu, Yi L wrote: > > > > I'm not very clear on the relationship betwen an IOMMUContext and a > > > > DualStageIOMMUObject. Can there be many IOMMUContexts to a > > > > DualStageIOMMUOBject? The other way around? Or is it just > > > > zero-or-one DualStageIOMMUObjects to an IOMMUContext? > > > > > > It is possible. As the below patch shows, DualStageIOMMUObject is per= vfio > > > container. IOMMUContext can be either per-device or shared across dev= ices, > > > it depends on vendor specific vIOMMU emulators. > >=20 > > Is there an example when an IOMMUContext can be not per-device? >=20 > No, I don=E2=80=99t have such example so far. But as IOMMUContext is got = =66rom > pci_device_iommu_context(), in concept it possible to be not per-device. > It is kind of leave to vIOMMU to decide if different devices could share a > single IOMMUContext. On the "pseries" machine the vIOMMU only has one set of translations for a whole virtual PCI Host Bridge (vPHB). So if you attach multiple devices to a single vPHB, I believe you'd get multiple devices in an IOMMUContext. Well.. if we did the PASID stuff, which we don't at the moment. Note that on pseries on the other hand it's routine to create multiple vPHBs, rather than multiple PCI roots being an oddity as it is on x86. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --teKjxxMjPsACTz/N Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl5GMdQACgkQbDjKyiDZ s5IT8hAAnJ3xZrpCbLQPvNZEpIYEhNe6qkpg2XIs9Wqs17VvHamJfhvLtB7rRaxq bwvkgKRWB971L16f3nnY4IH85UZDRcNLHmsNE4eQJ7s+emgnboH6hXpTeJO0i/8M 7cL2zF6HtG7hNyCxGJgJw3qmz2ejik/jDUdlf4NFi+sOjl3y0TW6urTCXFXVRGSZ eXhA1TrQCgdDVsPeXize3n4GZNkbI91lVX1Si6TKtIDmmwanWPZD1vZ1Oq42jlPt Yqm7IeWuEf983d0PUC4QTZei/vbbPknNsMSX7fWCRtjgtz5Lf8flHY2Cns6VYoXu TvqDIA4xOOG1vcehBFC4cuPAxvyvtw4OqkTyMoQCDQ6z/kN15MmCVzmOEw0Dedhj z98Eb74lEycq3ppjp01XmFCyJWr3wAiz5pCRIYz78Hw+YREODi0jirdcJm4KtdOd 98AjHzTRjqNHVXTcCE8o0XiM7iBPzcZLHma9N3+Re1csdyRzkh+so315eqpGHlM8 pmPnMfKuipI0Fe9l8P02/rLlDhBz/rKJl94qAb3Gk4fCwC+lZpvziqgFVOrQVZbt yv05tqcHoPheIYjlKlR6uxO6Ro2aTExHr2WEGXTUlnljcoudCaDzk3xiFPQ0nQcE Xcul1RsnD/5mKDzEllr5LIP4F9cHPAM8jNfecK7nE8s4iAg9Bpo= =JD+i -----END PGP SIGNATURE----- --teKjxxMjPsACTz/N-- 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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E6ADDC35242 for ; Fri, 14 Feb 2020 05:37:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 B3E522067D for ; Fri, 14 Feb 2020 05:37:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="Xq4sSZ6y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3E522067D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2TfK-00049i-T4 for qemu-devel@archiver.kernel.org; Fri, 14 Feb 2020 00:37:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57711) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2TeX-0003L7-Ad for qemu-devel@nongnu.org; Fri, 14 Feb 2020 00:36:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2TeW-0007MY-0U for qemu-devel@nongnu.org; Fri, 14 Feb 2020 00:36:37 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:34103 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j2TeV-0007FF-3G for qemu-devel@nongnu.org; Fri, 14 Feb 2020 00:36:35 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 48JhvH4G3Qz9sRN; Fri, 14 Feb 2020 16:36:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1581658587; bh=zNdoB9TvN56rRqasUcuUJ/reZPQdWn4eEGEbEQxhf7g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xq4sSZ6yevHWgo7eyJ1ryOK/ibr0X/T3CGbch9K+3d9L0fY9I3uttzAelX1yBn7qU yQgy3rwNZHik1vXlUfyHex04RdUf4MX7H3BSoAy5QLSYs6O+TunsyBEoQZsazSKx1Y YBAni/lQhFydDEh8axlaW+3rPC2aS27BnZYOQ6HE= Date: Fri, 14 Feb 2020 16:36:20 +1100 From: David Gibson To: "Liu, Yi L" Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext Message-ID: <20200214053620.GR124369@umbus.fritz.box> References: <1580300216-86172-1-git-send-email-yi.l.liu@intel.com> <1580300216-86172-4-git-send-email-yi.l.liu@intel.com> <20200131040644.GG15210@umbus.fritz.box> <20200211165843.GG984290@xz-x1> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="teKjxxMjPsACTz/N" Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Tian, Kevin" , Jacob Pan , Yi Sun , "kvm@vger.kernel.org" , "mst@redhat.com" , "Tian, Jun J" , "qemu-devel@nongnu.org" , Peter Xu , "eric.auger@redhat.com" , "alex.williamson@redhat.com" , "pbonzini@redhat.com" , "Sun, Yi Y" , "Wu, Hao" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --teKjxxMjPsACTz/N Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 12, 2020 at 07:15:13AM +0000, Liu, Yi L wrote: > Hi Peter, >=20 > > From: Peter Xu > > Sent: Wednesday, February 12, 2020 12:59 AM > > To: Liu, Yi L > > Subject: Re: [RFC v3 03/25] hw/iommu: introduce IOMMUContext > >=20 > > On Fri, Jan 31, 2020 at 11:42:13AM +0000, Liu, Yi L wrote: > > > > I'm not very clear on the relationship betwen an IOMMUContext and a > > > > DualStageIOMMUObject. Can there be many IOMMUContexts to a > > > > DualStageIOMMUOBject? The other way around? Or is it just > > > > zero-or-one DualStageIOMMUObjects to an IOMMUContext? > > > > > > It is possible. As the below patch shows, DualStageIOMMUObject is per= vfio > > > container. IOMMUContext can be either per-device or shared across dev= ices, > > > it depends on vendor specific vIOMMU emulators. > >=20 > > Is there an example when an IOMMUContext can be not per-device? >=20 > No, I don=E2=80=99t have such example so far. But as IOMMUContext is got = =66rom > pci_device_iommu_context(), in concept it possible to be not per-device. > It is kind of leave to vIOMMU to decide if different devices could share a > single IOMMUContext. On the "pseries" machine the vIOMMU only has one set of translations for a whole virtual PCI Host Bridge (vPHB). So if you attach multiple devices to a single vPHB, I believe you'd get multiple devices in an IOMMUContext. Well.. if we did the PASID stuff, which we don't at the moment. Note that on pseries on the other hand it's routine to create multiple vPHBs, rather than multiple PCI roots being an oddity as it is on x86. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --teKjxxMjPsACTz/N Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl5GMdQACgkQbDjKyiDZ s5IT8hAAnJ3xZrpCbLQPvNZEpIYEhNe6qkpg2XIs9Wqs17VvHamJfhvLtB7rRaxq bwvkgKRWB971L16f3nnY4IH85UZDRcNLHmsNE4eQJ7s+emgnboH6hXpTeJO0i/8M 7cL2zF6HtG7hNyCxGJgJw3qmz2ejik/jDUdlf4NFi+sOjl3y0TW6urTCXFXVRGSZ eXhA1TrQCgdDVsPeXize3n4GZNkbI91lVX1Si6TKtIDmmwanWPZD1vZ1Oq42jlPt Yqm7IeWuEf983d0PUC4QTZei/vbbPknNsMSX7fWCRtjgtz5Lf8flHY2Cns6VYoXu TvqDIA4xOOG1vcehBFC4cuPAxvyvtw4OqkTyMoQCDQ6z/kN15MmCVzmOEw0Dedhj z98Eb74lEycq3ppjp01XmFCyJWr3wAiz5pCRIYz78Hw+YREODi0jirdcJm4KtdOd 98AjHzTRjqNHVXTcCE8o0XiM7iBPzcZLHma9N3+Re1csdyRzkh+so315eqpGHlM8 pmPnMfKuipI0Fe9l8P02/rLlDhBz/rKJl94qAb3Gk4fCwC+lZpvziqgFVOrQVZbt yv05tqcHoPheIYjlKlR6uxO6Ro2aTExHr2WEGXTUlnljcoudCaDzk3xiFPQ0nQcE Xcul1RsnD/5mKDzEllr5LIP4F9cHPAM8jNfecK7nE8s4iAg9Bpo= =JD+i -----END PGP SIGNATURE----- --teKjxxMjPsACTz/N--