[RFC PATCH v2 2/4] lib: sbi: add support for Supervisor Software Events extension

Clément Léger cleger at rivosinc.com
Thu Jan 11 02:52:23 PST 2024



On 09/01/2024 21:16, Deepak Gupta wrote:
> On Tue, Jan 09, 2024 at 11:44:54AM +0100, Clément Léger wrote:
>> +static int sse_global_init()
>> +{
>> +    struct sbi_sse_event *e;
>> +    unsigned int i, ev = 0;
>> +
>> +    for (i = 0; i < EVENT_COUNT; i++) {
>> +        if (EVENT_IS_GLOBAL(supported_events[i]))
>> +            global_event_count++;
>> +        else
>> +            local_event_count++;
>> +    }
> 
> nit: through out patch series `global` is used for global events.
> Here local event count and global event count both are setup.
> Although only global events are initialized.
> Perhaps its better to take out event counting from here and put in
> sbi_sse_init or function/macro of it's own.

Oh yes clearly that would be less misleading. I'll do that.

Thanks,

Clément

> 
> 
>> +
>> +    global_events = sbi_zalloc(sizeof(*global_events) *
>> global_event_count);
>> +    if (!global_events)
>> +        return SBI_ENOMEM;
>> +
>> +    for (i = 0; i < EVENT_COUNT; i++) {
>> +        if (!EVENT_IS_GLOBAL(supported_events[i]))
>> +            continue;
>> +
>> +        e = &global_events[ev];
>> +        sse_event_init(e, supported_events[i]);
>> +        SPIN_LOCK_INIT(e->lock);
>> +
>> +        ev++;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
> 
> 
>> -- 
>> 2.43.0
>>



More information about the opensbi mailing list