From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6xrA-0000ol-ED for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6xr3-00072H-44 for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:08:28 -0400 Message-ID: <5201F261.7080800@suse.de> Date: Wed, 07 Aug 2013 09:08:17 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1375777673-20274-1-git-send-email-aik@ozlabs.ru> <1375777673-20274-7-git-send-email-aik@ozlabs.ru> <5200CC0D.5000908@suse.de> <5201F12B.6050101@ozlabs.ru> In-Reply-To: <5201F12B.6050101@ozlabs.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 6/6] xics-kvm: Support for in-kernel XICS interrupt controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Anthony Liguori , Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Paul Mackerras , David Gibson Am 07.08.2013 09:03, schrieb Alexey Kardashevskiy: > On 08/06/2013 08:12 PM, Andreas F=C3=A4rber wrote: >>> + /* Call emulated XICS implementation for consistency */ >>> + assert(xics_info && xics_info->cpu_setup); >>> + xics_info->cpu_setup(icp, cpu); >>> +} >>> + >>> +void xics_kvm_set_nr_irqs(XICSState *icp, uint32_t nr_irqs) >>> +{ >>> + icp->ics =3D ICS(object_new(TYPE_ICS_KVM)); >>> + object_property_add_child(OBJECT(icp), "ics", OBJECT(icp->ics), = NULL); >>> + icp->ics->icp =3D icp; >> >> instance_init + object_initialize()? >=20 > Create ICS_KVM in instance_init of XICS_KVM and initialize it here? Why= split? Answered on 5/6 (mail bounced at first due to kernel.crashing.org). >>> + icp->nr_irqs =3D icp->ics->nr_irqs =3D nr_irqs; >>> +} >>> + >>> +void xics_kvm_set_nr_servers(XICSState *icp, uint32_t nr_servers) >>> +{ >>> + int i; >>> + >>> + icp->nr_servers =3D nr_servers; >>> + >>> + icp->ss =3D g_malloc0(icp->nr_servers*sizeof(ICPState)); >>> + for (i =3D 0; i < icp->nr_servers; i++) { >>> + char buffer[32]; >>> + object_initialize(&icp->ss[i], TYPE_ICP_KVM); >>> + snprintf(buffer, sizeof(buffer), "icp[%d]", i); >>> + object_property_add_child(OBJECT(icp), buffer, OBJECT(&icp->= ss[i]), NULL); >>> + } >>> +} [...] >>> +static void xics_kvm_realize(DeviceState *dev, Error **errp) >>> +{ >>> + KVMXICSState *icpkvm =3D KVM_XICS(dev); >>> + XICSState *icp =3D XICS_COMMON(dev); >>> + int i, rc; >>> + Error *error =3D NULL; >>> + struct kvm_create_device xics_create_device =3D { >>> + .type =3D KVM_DEV_TYPE_XICS, >>> + .flags =3D 0, >>> + }; >>> + >>> + assert(kvm_enabled()); >>> + assert(kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)); >> >> error_setg() - if device can be created without accel=3Dkvm (which it >> looks as if it can) then you should just error out the nice way here. >=20 >=20 > I check kvm_enabled() (I thought I check both but was wrong, will fix i= t) > where I try to create XICS_KVM so we should not be here if that check f= ailed. -device, -object and patch Anthony's patch QMP are other ways to instantiate the same type. :) Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg