From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8ixa-0006NK-55 for qemu-devel@nongnu.org; Fri, 03 Jun 2016 02:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8ixY-0003fJ-PW for qemu-devel@nongnu.org; Fri, 03 Jun 2016 02:51:58 -0400 Date: Fri, 3 Jun 2016 16:14:51 +1000 From: David Gibson Message-ID: <20160603061451.GN1087@voom.fritz.box> References: <1463024905-28401-1-git-send-email-bharata@linux.vnet.ibm.com> <1463024905-28401-11-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p1Od3smaOkJqivj4" Content-Disposition: inline In-Reply-To: <1463024905-28401-11-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [for-2.7 PATCH v3 10/15] xics, xics_kvm: Handle CPU unplug correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, afaerber@suse.de, imammedo@redhat.com, armbru@redhat.com, thuth@redhat.com, aik@ozlabs.ru, agraf@suse.de, pbonzini@redhat.com, ehabkost@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com, eblake@redhat.com, mjrosato@linux.vnet.ibm.com, borntraeger@de.ibm.com --p1Od3smaOkJqivj4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 12, 2016 at 09:18:20AM +0530, Bharata B Rao wrote: > XICS is setup for each CPU during initialization. Provide a routine > to undo the same when CPU is unplugged. While here, move ss->cs management > into xics from xics_kvm since there is nothing KVM specific in it. > Also ensure xics reset doesn't set irq for CPUs that are already unplugge= d. >=20 > This allows reboot of a VM that has undergone CPU hotplug and unplug > to work correctly. >=20 > Signed-off-by: Bharata B Rao > Reviewed-by: David Gibson This patch stands on its own, so I've merged it to the ppc-cpu-hotplug bran= ch. > --- > hw/intc/xics.c | 14 ++++++++++++++ > hw/intc/xics_kvm.c | 8 ++++---- > include/hw/ppc/xics.h | 1 + > 3 files changed, 19 insertions(+), 4 deletions(-) >=20 > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 8659be0..cce7f3d 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -48,6 +48,18 @@ static int get_cpu_index_by_dt_id(int cpu_dt_id) > return -1; > } > =20 > +void xics_cpu_destroy(XICSState *icp, PowerPCCPU *cpu) > +{ > + CPUState *cs =3D CPU(cpu); > + ICPState *ss =3D &icp->ss[cs->cpu_index]; > + > + assert(cs->cpu_index < icp->nr_servers); > + assert(cs =3D=3D ss->cs); > + > + ss->output =3D NULL; > + ss->cs =3D NULL; > +} > + > void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu) > { > CPUState *cs =3D CPU(cpu); > @@ -57,6 +69,8 @@ void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu) > =20 > assert(cs->cpu_index < icp->nr_servers); > =20 > + ss->cs =3D cs; > + > if (info->cpu_setup) { > info->cpu_setup(icp, cpu); > } > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > index 9029d9e..a2daeae 100644 > --- a/hw/intc/xics_kvm.c > +++ b/hw/intc/xics_kvm.c > @@ -113,8 +113,10 @@ static void icp_kvm_reset(DeviceState *dev) > icp->pending_priority =3D 0xff; > icp->mfrr =3D 0xff; > =20 > - /* Make all outputs are deasserted */ > - qemu_set_irq(icp->output, 0); > + /* Make all outputs as deasserted only if the CPU thread is in use */ > + if (icp->output) { > + qemu_set_irq(icp->output, 0); > + } > =20 > icp_set_kvm_state(icp, 1); > } > @@ -347,8 +349,6 @@ static void xics_kvm_cpu_setup(XICSState *icp, PowerP= CCPU *cpu) > if (icpkvm->kernel_xics_fd !=3D -1) { > int ret; > =20 > - ss->cs =3D cs; > - > ret =3D kvm_vcpu_enable_cap(cs, KVM_CAP_IRQ_XICS, 0, > icpkvm->kernel_xics_fd, kvm_arch_vcpu_= id(cs)); > if (ret < 0) { > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index f60b06a..9091054 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -167,5 +167,6 @@ int xics_alloc_block(XICSState *icp, int src, int num= , bool lsi, bool align, > void xics_free(XICSState *icp, int irq, int num); > =20 > void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu); > +void xics_cpu_destroy(XICSState *icp, PowerPCCPU *cpu); > =20 > #endif /* __XICS_H__ */ --=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 --p1Od3smaOkJqivj4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXUSBbAAoJEGw4ysog2bOS5GEP+QEmF1SD0dswkB2KMVUWoB/1 txyQtCjORmNKQkCC68YAN0vT+SID/RDoVU6CjB/icmc32u6vMF3leZRFVI8Va0We X2SubJqlsPA5a+BvZ2+EcNc/5O/PKr6NXJCFrm6di0ihhDqbWv+JVNwzZV1lF5uI d56wTjhAFPo4PAmqC1JeZt6Aysl7+Ma+396dXEo8RhdX5O9OzxaziNSqNaZW9/mB mj2jILlKEau7oomFCsRkHpBaBsjY/UrF7wCcAdDf4uC3ld0Pf1SpG5j3Zo07Was3 ZOM8dDcmSBhzejzBayh9XbmBFI8B/JbfDNNbddonwI+8+VT6QfLy6GRX3kiYv6cH dj1hlwJHEQfPSp5g/c5B/749Ka9pM0+2SyPVrIW3lMB5s0Jx2wB2MRPBdVKj1xtH A7I6gc6QuZWHa4q/7lmxYQtsZWXz2X00KF5Gg6DOMahhrt4jsu0vFiPfet6hUEcW f/xsqIyqnPM+EWgjoEDcdI4Vza7tL9uxfIoaTUcyjzukZj1XdnGjHAUyRDyagQUZ vlzjsU/0vkazCCYQC/1XyfDuY97XfvUeC2v4ojxrEwnOWnmzcUSj3LiiIyc3V4no 2o08k16dpL9ce8HGJM4Y8hQv5eDqtF0i/6G0sm/BX7Y8MQfocY0k8tMb+vkaXOcC 5NsF1Alh82wMOHBXqjnW =CpnT -----END PGP SIGNATURE----- --p1Od3smaOkJqivj4--