From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6yDm-0003dl-Uv for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:31:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6yDb-0007B2-PN for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:31:50 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:64630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6yDb-0007Ap-J3 for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:31:39 -0400 Received: by mail-pd0-f169.google.com with SMTP id y11so573762pdj.28 for ; Wed, 07 Aug 2013 00:31:38 -0700 (PDT) Message-ID: <5201F7D4.4090903@ozlabs.ru> Date: Wed, 07 Aug 2013 17:31:32 +1000 From: Alexey Kardashevskiy 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> <5201F261.7080800@suse.de> In-Reply-To: <5201F261.7080800@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: Anthony Liguori , Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Paul Mackerras , David Gibson On 08/07/2013 05:08 PM, Andreas Färber wrote: >>>> + icp->nr_irqs = icp->ics->nr_irqs = nr_irqs; >>>> +} >>>> + >>>> +void xics_kvm_set_nr_servers(XICSState *icp, uint32_t nr_servers) >>>> +{ >>>> + int i; >>>> + >>>> + icp->nr_servers = nr_servers; >>>> + >>>> + icp->ss = g_malloc0(icp->nr_servers*sizeof(ICPState)); >>>> + for (i = 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 = KVM_XICS(dev); >>>> + XICSState *icp = XICS_COMMON(dev); >>>> + int i, rc; >>>> + Error *error = NULL; >>>> + struct kvm_create_device xics_create_device = { >>>> + .type = KVM_DEV_TYPE_XICS, >>>> + .flags = 0, >>>> + }; >>>> + >>>> + assert(kvm_enabled()); >>>> + assert(kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)); >>> >>> error_setg() - if device can be created without accel=kvm (which it >>> looks as if it can) then you should just error out the nice way here. >> >> >> I check kvm_enabled() (I thought I check both but was wrong, will fix it) >> where I try to create XICS_KVM so we should not be here if that check failed. > > -device, -object and patch Anthony's patch QMP are other ways to > instantiate the same type. :) Hmm. Nice. I thought "-device xics,nr_irqs=1,nr_servers=2" won't work but it does (well, fails, but lot further, in realize()) :) -- Alexey