From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z97Fp-0006XF-89 for qemu-devel@nongnu.org; Sun, 28 Jun 2015 03:43:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z97Ff-0001an-OM for qemu-devel@nongnu.org; Sun, 28 Jun 2015 03:43:53 -0400 Received: from mout.web.de ([212.227.17.12]:54740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z97Ff-0001aP-EY for qemu-devel@nongnu.org; Sun, 28 Jun 2015 03:43:43 -0400 Message-ID: <558FA5A8.4000700@web.de> Date: Sun, 28 Jun 2015 09:43:36 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qx2bANQ15uxBR1lJVG9I0uLddgLdwDEsS" Subject: Re: [Qemu-devel] Allocate PCI MMIO without BAR requests. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David kiarie , qemu-devel@nongnu.org, Valentine Sinitsyn This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Qx2bANQ15uxBR1lJVG9I0uLddgLdwDEsS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi David, On 2015-06-26 17:32, David kiarie wrote: > Hi all, >=20 > Some efforts to emulate AMD IOMMU have being going over the past few mo= nths. >=20 > In real hardware AMD IOMMU is implemented as a PCI function. When > emulating it in Qemu we want to allocate it MMIO space but real AMD > IOMMU manage to reserve memory without making a BAR request, probably > through a static address that's written by the device.(This is > something similar to what non-PCI bus devices do).Trying to reserve > memory via a BAR request results in address conflicts(in Linux) and > all other PCI devices reserve platform resources via BAR requests. The AMD IOMMU spec makes it even clearer: "3 Registers The IOMMU is configured and controlled via two sets of registers =E2=80=94= one in the PCI configuration space and another set mapped in system address space. [...] 3.1 PCI Resources [...] A PCI Function containing an IOMMU capability block does not include PCI BAR registers." >=20 > I would like to hear suggestions on how to reserve a memory region for > the device without making a BAR request. I see two approaches: - Let the IOMMU sit on two buses, PCI and system, i.e. become a PCI and SysBus device at the same time - I suspect, though, that this cannot be modeled with QOM right now. - Model the MMIO registers via the BAR interface but overwrite the PCI config space so that no BAR becomes visible and make sure that writes to the PCI command register cannot disable this region (which would be the case with normal BARs). Hackish, but it seems feasible. Jan --Qx2bANQ15uxBR1lJVG9I0uLddgLdwDEsS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlWPpakACgkQitSsb3rl5xSdggCaAs/hyh+H9doG5tgIGRUsGZFx IY8An0p9JwCd9GnL6n28BUjW2Qr1wK0S =NAAA -----END PGP SIGNATURE----- --Qx2bANQ15uxBR1lJVG9I0uLddgLdwDEsS--