[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH] plat/common/pci: register more then one pci per file



Hi,

> do we expect multiple drivers within the library.
no, this should not normally happen. But what was in the code before is
a bit confusing. If we would want to enforce one-driver-per-library rule
at the code level, we would need to do it in a bit more explicit way,
rather then having totally misleading compilation error.

However, I don't think we should do it. I would rather keep flexibility
and leave this to be a design option.

The reason I touched this at all, is that I've been toying with the idea
of the module self-test. And I needed to fill the list of available
drivers with dummies. Creating a separate file for every dummy-driver is
a bit annoying. In other words, testing code might be a case for having
multiple drivers within the library.

> Do we also intend to change the ukbus library and virtio library which
> have a similar macro?
That is a valid note. Yes we do. And it will be in v2 :)

- Yuri.

Sharan Santhanam <sharan.santhanam@xxxxxxxxx> writes:

> Hello Yuri,
>
> This patch looks fine.
>
> I like the idea of making the driver unique but since we decompose every 
> components into smaller libraries do we expect multiple drivers within 
> the library.
>
> Do we also intend to change the ukbus library and virtio library which 
> have a similar macro?
>
> Thanks & Regards
> Sharan
>
>
> On 12/05/2018 05:42 PM, Yuri Volchkov wrote:
>> So far it was possible to use PCI_REGISTER_DRIVER only once in one
>> file. Add a counter to the generated function name, to avoid the name
>> conflict.
>> 
>> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
>> ---
>>   plat/common/include/pci/pci_bus.h | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>> 
>> diff --git a/plat/common/include/pci/pci_bus.h 
>> b/plat/common/include/pci/pci_bus.h
>> index 4e02282..be2ee1f 100644
>> --- a/plat/common/include/pci/pci_bus.h
>> +++ b/plat/common/include/pci/pci_bus.h
>> @@ -156,14 +156,14 @@ struct pci_device {
>>   UK_TAILQ_HEAD(pci_device_list, struct pci_device);
>>   
>>   
>> -#define PCI_REGISTER_DRIVER(b)                  \
>> -    _PCI_REGISTER_DRIVER(__LIBNAME__, b)
>> +#define PCI_REGISTER_DRIVER(b)                                      \
>> +    _PCI_REGISTER_DRIVER(__LIBNAME__, __COUNTER__, b)
>>   
>> -#define _PCI_REGFNNAME(x, y)      x##y
>> +#define _PCI_REGFNNAME(x, y, z)      x##y##z
>>   
>> -#define _PCI_REGISTER_DRIVER(libname, b)                            \
>> +#define _PCI_REGISTER_DRIVER(libname, id, b)                                
>> \
>>      static void __constructor_prio(103)                             \
>> -    _PCI_REGFNNAME(libname, _pci_register_driver)(void)             \
>> +    _PCI_REGFNNAME(libname, id, _pci_register_driver)(void)         \
>>      {                                                               \
>>              _pci_register_driver((b));                              \
>>      }
>> 

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.