|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 08/17] xen/arm: ITS: Add APIs to add and assign device
Hi Vijay, On 10/07/2015 09:42, vijay.kilari@xxxxxxxxx wrote: The check "nr_lpis != nr_ites" is here to ensure that its_lpi_alloc_chuncks allocate the right number of LPI, right? If so, given this is the only place you call its_lpi_alloc_chunks, why don't you put the check within the function? It would avoid one parameter. + + dev->itt_addr = itt; + dev->nr_ites = nr_ites; + dev->lpi_map = lpi_map; + dev->lpi_base = lpi_base; + dev->nr_lpis = nr_lpis; + dev->device_id = devid; + + return dev; + +lpi_err: + xfree(itt); + xfree(lpi_map); +err: + xfree(dev); + + return NULL; +} + +/* Device assignment. Should be called from PHYSDEVOPS_pci_device_add */ This comment is wrong. It's not device assignment but making aware Xen that this device exists. Also, I would drop the second part of the comment as it may be call from other place than PHYSDEVOP_pci_device_add. +int its_add_device(u32 devid) [...] + /* Map device to its ITT */ + its_send_mapd(dev, 1); + + /* TODO: Use nr_cpu_ids? */ I though you fixed nr_cpu_ids? If not can you please do it and use this value here. Why not? The invert of MAPVI is DISCARD. [...] +int its_assign_device(struct domain *d, u32 vdevid, u32 pdevid) [...] This should be part of its_add_device and not its_assign_device. + lpi_set_config(desc, 1); The goal of route_irq_to_guest is to setup everything in order to route correctly the IRQ (here LPI) to the guest. As said on v3, if the current function doesn't fit you need, please introduce a new one. In this case, lpi_set_config is used to configure the IRQ (i.e set property ...). It's likely the same as gic_set_irq_properties. Implementing there would avoid the is_lpi you added in this function.Furthermore, enabling the interrupt here is very fragile. As soon as the LPI is enabled for the given device, he can send an interrupt. See the thread on the draft F [1] for more details. I don't think this is really important to have it until PCI passthrough is added. But at least a comment would be nice. I would prefer if you don't introduce its_detach_device until you used when PCI passthrough will be added. This would avoid take spend time on reviewing if everything is correctly done when you release an IRQ. Which doesn't seem to be the case based on the TODO. + release_irq(plpi, d); release_irq is for IRQ assigned to Xen and not guest IRQ. You would have to use release_guest_irq here. Furthermore, there will be some extra care to do when a domain crashed... This function is not a GIC function but a function which handle irq_desc. Please name accordingly i.e irqdesc_set_collection. Furthermore, given the size of the function, an inline function would have been better. Finally, I think the function can directly get an irq_desc in parameter.My remarks are the same for gic_get_irq_collection (from patch #5) which I didn't spot before. Regards, [1] http://lists.xen.org/archives/html/xen-devel/2015-06/msg02591.html -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |