From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH v2 11/16] KVM: introduce a 'mmap' method for KVM devices Date: Wed, 27 Feb 2019 10:22:30 +1100 Message-ID: <20190226232230.GV6872@umbus.fritz.box> References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-12-clg@kaod.org> <20190225033309.GO7668@umbus.fritz.box> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Rsp728Nwk8twChKq" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , =?iso-8859-1?Q?C=E9dric?= Le Goater , linuxppc-dev@lists.ozlabs.org To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org --Rsp728Nwk8twChKq Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 26, 2019 at 01:52:39PM +0100, Paolo Bonzini wrote: > On 25/02/19 11:57, C=E9dric Le Goater wrote: > > Hello Paolo, > >=20 > > On 2/25/19 4:33 AM, David Gibson wrote: > >> On Fri, Feb 22, 2019 at 12:28:35PM +0100, C=E9dric Le Goater wrote: > >>> Some KVM devices will want to handle special mappings related to the > >>> underlying HW. For instance, the XIVE interrupt controller of the > >>> POWER9 processor has MMIO pages for thread interrupt management and > >>> for interrupt source control that need to be exposed to the guest when > >>> the OS has the required support. > >>> > >>> Signed-off-by: C=E9dric Le Goater > >> > >> Ah, when I suggested mmap() on the base device fd, I hadn't realized > >> there wasn't a facility for that yet. > >> > >> Have you discussed this with Paolo? =20 > >=20 > > Not yet. > >=20 > >> We'll need some core KVM buy in to merge this. > >=20 > > Here is an extension of the KVM device to allow special mappings. > > Something we would need for the support of the POWER9 XIVE interrupt=20 > > controller. > >=20 > > There are two MMIOs we need to expose to the guest :=20 > >=20 > > 1. HW MMIO controlling of the interrupt presenter registers (TIMA) > > 2. HW MMIO of the interrupt sources for interrupt management (ESB) > >=20 > > The TIMA could have been exposed with a page offset in the vCPU mapping > > but as it only makes sense when the XIVE interrupt mode is active, we= =20 > > chose to use directly the KVM device fd for that. Is that ok ?=20 > >=20 > > An alternate solution is to use a device ioctl to allocate an anon fd > > and do the mapping, but that seems like extra fuss for the same result.= =20 >=20 > It's okay, it's a natural extension to dev_ops - but thanks for asking > anyway. :) Ok, cool. Given that, do you want to merge directly - since this looks sound enough, even though the rest of the series needs some polish? Or would you prefer it to come in via Paulus' tree? --=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 --Rsp728Nwk8twChKq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlx1yjYACgkQbDjKyiDZ s5KYkw//YZG/omKMn5bZAAgTKvcH3tS/3tWmqrIiObKbtdhtJGP7tgmJ62WgdZPX Iq9AL2BmKKlgWt845SrCRVt6S+0+7TQrvtYTSDFcIVVq3WXXpk9ixowYGJAgnJT1 4f8xXCI2S36IzlUDDMFjARwa+iDlXVZ6L2GoHZCYwa5qFVwdxqo0B8+hK/+p9InX WJKnnu2SEPIeZ5e5ylg7y/ODpwpZEoMi0KOSm9cVykO1HFE4m+uVhosk+Sp4UUzU OabFylbA3gE6RfG4eZa4lVQjccoKg4hO+pRuSfchCyDwb7dDXUkXi/4kYFMIgP2W 2pCo9HutwuXJAAhYPVrV8jzLwWUhlcy4JMWZhQwHeFKAOUspxkwZrD8nIrboGk2S ksUAqc1G0eQolepLjOFs0QhwHvUeRqUPcT9HyQOMCGQizaimTx94l2nsPeHynxkc +So/NZSVvTsAkfxbjawIgVDWTK3xqQhBNvGr4temx3mfdPTSUtKd2m1u1dMiCGJm HXhjUKTo2zjX/d5R5+eNVNl45ZBriJbSy/bzwHAGKfCziitR2MRBSalgE7woXxt/ Q0HqUDIepfOgNqR2SlOEFTmIOg3CxrasRhM8Roo60urHiAk8YKwKylyE0WtxZyE2 zlisCEpXvU6GHE4d4uyKD9C/R+cdRSYj1j3w8T/Jz0siITnLb6g= =c2lV -----END PGP SIGNATURE----- --Rsp728Nwk8twChKq-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Date: Tue, 26 Feb 2019 23:22:30 +0000 Subject: Re: [PATCH v2 11/16] KVM: introduce a 'mmap' method for KVM devices Message-Id: <20190226232230.GV6872@umbus.fritz.box> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Rsp728Nwk8twChKq" List-Id: References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-12-clg@kaod.org> <20190225033309.GO7668@umbus.fritz.box> In-Reply-To: To: Paolo Bonzini Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , =?iso-8859-1?Q?C=E9dric?= Le Goater , linuxppc-dev@lists.ozlabs.org --Rsp728Nwk8twChKq Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 26, 2019 at 01:52:39PM +0100, Paolo Bonzini wrote: > On 25/02/19 11:57, C=E9dric Le Goater wrote: > > Hello Paolo, > >=20 > > On 2/25/19 4:33 AM, David Gibson wrote: > >> On Fri, Feb 22, 2019 at 12:28:35PM +0100, C=E9dric Le Goater wrote: > >>> Some KVM devices will want to handle special mappings related to the > >>> underlying HW. For instance, the XIVE interrupt controller of the > >>> POWER9 processor has MMIO pages for thread interrupt management and > >>> for interrupt source control that need to be exposed to the guest when > >>> the OS has the required support. > >>> > >>> Signed-off-by: C=E9dric Le Goater > >> > >> Ah, when I suggested mmap() on the base device fd, I hadn't realized > >> there wasn't a facility for that yet. > >> > >> Have you discussed this with Paolo? =20 > >=20 > > Not yet. > >=20 > >> We'll need some core KVM buy in to merge this. > >=20 > > Here is an extension of the KVM device to allow special mappings. > > Something we would need for the support of the POWER9 XIVE interrupt=20 > > controller. > >=20 > > There are two MMIOs we need to expose to the guest :=20 > >=20 > > 1. HW MMIO controlling of the interrupt presenter registers (TIMA) > > 2. HW MMIO of the interrupt sources for interrupt management (ESB) > >=20 > > The TIMA could have been exposed with a page offset in the vCPU mapping > > but as it only makes sense when the XIVE interrupt mode is active, we= =20 > > chose to use directly the KVM device fd for that. Is that ok ?=20 > >=20 > > An alternate solution is to use a device ioctl to allocate an anon fd > > and do the mapping, but that seems like extra fuss for the same result.= =20 >=20 > It's okay, it's a natural extension to dev_ops - but thanks for asking > anyway. :) Ok, cool. Given that, do you want to merge directly - since this looks sound enough, even though the rest of the series needs some polish? Or would you prefer it to come in via Paulus' tree? --=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 --Rsp728Nwk8twChKq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlx1yjYACgkQbDjKyiDZ s5KYkw//YZG/omKMn5bZAAgTKvcH3tS/3tWmqrIiObKbtdhtJGP7tgmJ62WgdZPX Iq9AL2BmKKlgWt845SrCRVt6S+0+7TQrvtYTSDFcIVVq3WXXpk9ixowYGJAgnJT1 4f8xXCI2S36IzlUDDMFjARwa+iDlXVZ6L2GoHZCYwa5qFVwdxqo0B8+hK/+p9InX WJKnnu2SEPIeZ5e5ylg7y/ODpwpZEoMi0KOSm9cVykO1HFE4m+uVhosk+Sp4UUzU OabFylbA3gE6RfG4eZa4lVQjccoKg4hO+pRuSfchCyDwb7dDXUkXi/4kYFMIgP2W 2pCo9HutwuXJAAhYPVrV8jzLwWUhlcy4JMWZhQwHeFKAOUspxkwZrD8nIrboGk2S ksUAqc1G0eQolepLjOFs0QhwHvUeRqUPcT9HyQOMCGQizaimTx94l2nsPeHynxkc +So/NZSVvTsAkfxbjawIgVDWTK3xqQhBNvGr4temx3mfdPTSUtKd2m1u1dMiCGJm HXhjUKTo2zjX/d5R5+eNVNl45ZBriJbSy/bzwHAGKfCziitR2MRBSalgE7woXxt/ Q0HqUDIepfOgNqR2SlOEFTmIOg3CxrasRhM8Roo60urHiAk8YKwKylyE0WtxZyE2 zlisCEpXvU6GHE4d4uyKD9C/R+cdRSYj1j3w8T/Jz0siITnLb6g= =c2lV -----END PGP SIGNATURE----- --Rsp728Nwk8twChKq--