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