Re: [PATCH v4 02/15] soc: ti: k3: add navss ringacc driver

Peter Ujfalusi
2019-11-11T07:38:23Z

On 11/11/2019 6.21, Vinod Koul wrote:
> On 01-11-19, 10:41, Peter Ujfalusi wrote:
>> From: Grygorii Strashko <grygorii.strashko@ti.com>
>
>> +config TI_K3_RINGACC
>> + tristate "K3 Ring accelerator Sub System"
>> + depends on ARCH_K3 || COMPILE_TEST
>> + depends on TI_SCI_INTA_IRQCHIP
>> + default y
>
> You want to get an earful from Linus? We dont do default y on new stuff,
> never :)

OK

>> +struct k3_ring_rt_regs {
>> + u32 resv_16[4];
>> + u32 db; /* RT Ring N Doorbell Register */
>> + u32 resv_4[1];
>> + u32 occ; /* RT Ring N Occupancy Register */
>> + u32 indx; /* RT Ring N Current Index Register */
>> + u32 hwocc; /* RT Ring N Hardware Occupancy Register */
>> + u32 hwindx; /* RT Ring N Current Index Register */
>
> nice comments, how about moving them up into kernel-doc style? (here and
> other places as well)

Sure, I'll convert the comments.

>> +struct k3_ring *k3_ringacc_request_ring(struct k3_ringacc *ringacc,
>> + int id, u32 flags)
>> +{
>> + int proxy_id = K3_RINGACC_PROXY_NOT_USED;
>> +
>> + mutex_lock(&ringacc->req_lock);
>> +
>> + if (id == K3_RINGACC_RING_ID_ANY) {
>> + /* Request for any general purpose ring */
>> + struct ti_sci_resource_desc *gp_rings =
>> + &ringacc->rm_gp_range->desc[0];
>> + unsigned long size;
>> +
>> + size = gp_rings->start + gp_rings->num;
>> + id = find_next_zero_bit(ringacc->rings_inuse, size,
>> + gp_rings->start);
>> + if (id == size)
>> + goto error;
>> + } else if (id < 0) {
>> + goto error;
>> + }
>> +
>> + if (test_bit(id, ringacc->rings_inuse) &&
>> + !(ringacc->rings[id].flags & K3_RING_FLAG_SHARED))
>> + goto error;
>> + else if (ringacc->rings[id].flags & K3_RING_FLAG_SHARED)
>> + goto out;
>> +
>> + if (flags & K3_RINGACC_RING_USE_PROXY) {
>> + proxy_id = find_next_zero_bit(ringacc->proxy_inuse,
>> + ringacc->num_proxies, 0);
>> + if (proxy_id == ringacc->num_proxies)
>> + goto error;
>> + }
>> +
>> + if (!try_module_get(ringacc->dev->driver->owner))
>> + goto error;
>
> should this not be one of the first things to do?

I'll move it.

>
>> +
>> + if (proxy_id != K3_RINGACC_PROXY_NOT_USED) {
>> + set_bit(proxy_id, ringacc->proxy_inuse);
>> + ringacc->rings[id].proxy_id = proxy_id;
>> + dev_dbg(ringacc->dev, "Giving ring#%d proxy#%d\n", id,
>> + proxy_id);
>> + } else {
>> + dev_dbg(ringacc->dev, "Giving ring#%d\n", id);
>> + }
>
> how bout removing else and doing common print?

When the proxy is used we want to print that as well, I think it is
cleaner to have separate prints for the two cases.

- Péter