From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH v2 06/16] KVM: PPC: Book3S HV: XIVE: add controls for the EQ configuration Date: Thu, 14 Mar 2019 14:29:27 +1100 Message-ID: <20190314032927.GP8211@umbus.fritz.box> References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-7-clg@kaod.org> <20190225023955.GJ7668@umbus.fritz.box> <9e732140-b2c0-dfb7-d753-ba0ec7f3b930@kaod.org> <20190313040327.GK9881@umbus.fritz.box> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yEbVe0JFHWhrOjGA" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org To: =?iso-8859-1?Q?C=E9dric?= Le Goater 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 --yEbVe0JFHWhrOjGA Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 13, 2019 at 09:46:08AM +0100, C=E9dric Le Goater wrote: > On 3/13/19 5:03 AM, David Gibson wrote: > > On Tue, Mar 12, 2019 at 06:00:38PM +0100, C=E9dric Le Goater wrote: > >> On 2/25/19 3:39 AM, David Gibson wrote: > >>> On Fri, Feb 22, 2019 at 12:28:30PM +0100, C=E9dric Le Goater wrote: > >>>> These controls will be used by the H_INT_SET_QUEUE_CONFIG and > >>>> H_INT_GET_QUEUE_CONFIG hcalls from QEMU. They will also be used to > >>>> restore the configuration of the XIVE EQs in the KVM device and to > >>>> capture the internal runtime state of the EQs. Both 'get' and 'set' > >>>> rely on an OPAL call to access from the XIVE interrupt controller the > >>>> EQ toggle bit and EQ index which are updated by the HW when event > >>>> notifications are enqueued in the EQ. > >>>> > >>>> The value of the guest physical address of the event queue is saved = in > >>>> the XIVE internal xive_q structure for later use. That is when > >>>> migration needs to mark the EQ pages dirty to capture a consistent > >>>> memory state of the VM. > >>>> > >>>> To be noted that H_INT_SET_QUEUE_CONFIG does not require the extra > >>>> OPAL call setting the EQ toggle bit and EQ index to configure the EQ, > >>>> but restoring the EQ state will. > >> > >> I think we need to add some kind of flags to differentiate the hcall > >> H_INT_SET_QUEUE_CONFIG from the restore of the EQ. The hcall does > >> not need OPAL support call and this could help in the code > >> transition. > >=20 > > Hrm. What's the actual difference in the semantics between the two > > cases. =20 >=20 > None.=20 >=20 > But we don't need to set the EQ state in the case of the HCALL and it's= =20 > (very) practical to run guests with XIVE enabled without the OPAL support= =2E=20 > The latter is the main reason clearly. >=20 > Thinking of it, I could test the EQ toggle bit and index passed to KVM=20 > and skip the OPAL call which restores the EQ state if they are zero.=20 > This is because I know that the OPAL call configuring the EQ resets them.= =20 >=20 > That will do. No need for a flag. That's a much better idea. --=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 --yEbVe0JFHWhrOjGA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlyJypcACgkQbDjKyiDZ s5KCxw//WNmsL5h8dPdmmkHFiUwiEnh4vShQ/u8lpyi/gEx6ML50BxS58Qxgnd3H uyeQK009V3kM9rNr5gjg0rt3IaRBFiuUgh7avt+bvb9DJj9wwRdJJ2pyUgZVwBT2 o8T62qJQ5nAHAlCZRGbHtxNcorglkZbdiewWG94gc5CHTvLT+bokFzffP0HppszS 6xKewtxTeQRmsnpMnKX6l45CDvFgdJlcsLOsd5jpao+43hqqR9A9hMbkDS3CLurn fkyrrGNheCuE8o/4wRW+Lino9hI2jzxEpfYt3GAWSTGwbP8FQKuwj4vyzJ3s14jR uAS6O48R6xuSAXfwbIpEcEDhyerhyC5EspIscqFb2B9YGw0vdqjbnrJjDkN6y+7S IcnPx+VwO7GR2YMMJUAdHs4LI6E1GIwIEYCD5l0bePjf632dsG1p3cehdUvDIoj1 j2o/ts8NHeCGxMQ26Ro09LpL/Fzi/k8zmS8hwF6ph4MJiPTbzMHeWx6lUcLlYFMu gu+yAVs7rD3z8eJXcKdKsPYiK8W/xV0jeWeqPGlo7DeXmV/S6ZJ+stQ9FszqVlWS Emc31bRcZ/djf1RQqfmPYHMIVBhv1GS3fYQyrKjOEq4djgLJDDqUlFGlznuNmgSC wyzZR90VzjzRfMSYkGI4vEsmhwJCXkClMgnSsqHHCR8Ra+ovvoQ= =+zOv -----END PGP SIGNATURE----- --yEbVe0JFHWhrOjGA-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Date: Thu, 14 Mar 2019 03:29:27 +0000 Subject: Re: [PATCH v2 06/16] KVM: PPC: Book3S HV: XIVE: add controls for the EQ configuration Message-Id: <20190314032927.GP8211@umbus.fritz.box> MIME-Version: 1 Content-Type: multipart/mixed; boundary="yEbVe0JFHWhrOjGA" List-Id: References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-7-clg@kaod.org> <20190225023955.GJ7668@umbus.fritz.box> <9e732140-b2c0-dfb7-d753-ba0ec7f3b930@kaod.org> <20190313040327.GK9881@umbus.fritz.box> In-Reply-To: To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org --yEbVe0JFHWhrOjGA Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 13, 2019 at 09:46:08AM +0100, C=E9dric Le Goater wrote: > On 3/13/19 5:03 AM, David Gibson wrote: > > On Tue, Mar 12, 2019 at 06:00:38PM +0100, C=E9dric Le Goater wrote: > >> On 2/25/19 3:39 AM, David Gibson wrote: > >>> On Fri, Feb 22, 2019 at 12:28:30PM +0100, C=E9dric Le Goater wrote: > >>>> These controls will be used by the H_INT_SET_QUEUE_CONFIG and > >>>> H_INT_GET_QUEUE_CONFIG hcalls from QEMU. They will also be used to > >>>> restore the configuration of the XIVE EQs in the KVM device and to > >>>> capture the internal runtime state of the EQs. Both 'get' and 'set' > >>>> rely on an OPAL call to access from the XIVE interrupt controller the > >>>> EQ toggle bit and EQ index which are updated by the HW when event > >>>> notifications are enqueued in the EQ. > >>>> > >>>> The value of the guest physical address of the event queue is saved = in > >>>> the XIVE internal xive_q structure for later use. That is when > >>>> migration needs to mark the EQ pages dirty to capture a consistent > >>>> memory state of the VM. > >>>> > >>>> To be noted that H_INT_SET_QUEUE_CONFIG does not require the extra > >>>> OPAL call setting the EQ toggle bit and EQ index to configure the EQ, > >>>> but restoring the EQ state will. > >> > >> I think we need to add some kind of flags to differentiate the hcall > >> H_INT_SET_QUEUE_CONFIG from the restore of the EQ. The hcall does > >> not need OPAL support call and this could help in the code > >> transition. > >=20 > > Hrm. What's the actual difference in the semantics between the two > > cases. =20 >=20 > None.=20 >=20 > But we don't need to set the EQ state in the case of the HCALL and it's= =20 > (very) practical to run guests with XIVE enabled without the OPAL support= =2E=20 > The latter is the main reason clearly. >=20 > Thinking of it, I could test the EQ toggle bit and index passed to KVM=20 > and skip the OPAL call which restores the EQ state if they are zero.=20 > This is because I know that the OPAL call configuring the EQ resets them.= =20 >=20 > That will do. No need for a flag. That's a much better idea. --=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 --yEbVe0JFHWhrOjGA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlyJypcACgkQbDjKyiDZ s5KCxw//WNmsL5h8dPdmmkHFiUwiEnh4vShQ/u8lpyi/gEx6ML50BxS58Qxgnd3H uyeQK009V3kM9rNr5gjg0rt3IaRBFiuUgh7avt+bvb9DJj9wwRdJJ2pyUgZVwBT2 o8T62qJQ5nAHAlCZRGbHtxNcorglkZbdiewWG94gc5CHTvLT+bokFzffP0HppszS 6xKewtxTeQRmsnpMnKX6l45CDvFgdJlcsLOsd5jpao+43hqqR9A9hMbkDS3CLurn fkyrrGNheCuE8o/4wRW+Lino9hI2jzxEpfYt3GAWSTGwbP8FQKuwj4vyzJ3s14jR uAS6O48R6xuSAXfwbIpEcEDhyerhyC5EspIscqFb2B9YGw0vdqjbnrJjDkN6y+7S IcnPx+VwO7GR2YMMJUAdHs4LI6E1GIwIEYCD5l0bePjf632dsG1p3cehdUvDIoj1 j2o/ts8NHeCGxMQ26Ro09LpL/Fzi/k8zmS8hwF6ph4MJiPTbzMHeWx6lUcLlYFMu gu+yAVs7rD3z8eJXcKdKsPYiK8W/xV0jeWeqPGlo7DeXmV/S6ZJ+stQ9FszqVlWS Emc31bRcZ/djf1RQqfmPYHMIVBhv1GS3fYQyrKjOEq4djgLJDDqUlFGlznuNmgSC wyzZR90VzjzRfMSYkGI4vEsmhwJCXkClMgnSsqHHCR8Ra+ovvoQ= =+zOv -----END PGP SIGNATURE----- --yEbVe0JFHWhrOjGA--