From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Subject: Re: [PATCH v2 06/16] KVM: PPC: Book3S HV: XIVE: add controls for the EQ configuration Date: Wed, 13 Mar 2019 09:46:08 +0100 Message-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> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org To: David Gibson Return-path: In-Reply-To: <20190313040327.GK9881@umbus.fritz.box> Content-Language: en-US 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 On 3/13/19 5:03 AM, David Gibson wrote: > On Tue, Mar 12, 2019 at 06:00:38PM +0100, Cédric Le Goater wrote: >> On 2/25/19 3:39 AM, David Gibson wrote: >>> On Fri, Feb 22, 2019 at 12:28:30PM +0100, Cédric 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. > > Hrm. What's the actual difference in the semantics between the two > cases. None. But we don't need to set the EQ state in the case of the HCALL and it's (very) practical to run guests with XIVE enabled without the OPAL support. The latter is the main reason clearly. Thinking of it, I could test the EQ toggle bit and index passed to KVM and skip the OPAL call which restores the EQ state if they are zero. This is because I know that the OPAL call configuring the EQ resets them. That will do. No need for a flag. > The guest shouldn't have awareness of whether or not OPAL is involved. yes. Thanks, C. From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Date: Wed, 13 Mar 2019 08:46:08 +0000 Subject: Re: [PATCH v2 06/16] KVM: PPC: Book3S HV: XIVE: add controls for the EQ configuration Message-Id: 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: <20190313040327.GK9881@umbus.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: David Gibson Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org 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 None.=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. = The latter is the main reason clearly. 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 That will do. No need for a flag. > The guest shouldn't have awareness of whether or not OPAL is involved. yes. Thanks, C.=20