Message ID | 20201008115224.1591-11-peter.ujfalusi@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | firmware/soc: ti_sci, ringacc/inta: Preparation for AM64 DMA support | expand |
On 14:52-20201008, Peter Ujfalusi wrote: > - ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, > + ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, > ring->size * (4 << ring->elm_size), > &ring->ring_mem_dma, GFP_KERNEL); Any chance of getting a cleanup of the file for 5.11? I know this series has'nt introduced this warning or set of warnings, but I am starting to get concerned that we are carrying over too much of a debt now? https://pastebin.ubuntu.com/p/tT2kPDsCWD/ Checkpatch does point this: --- /tmp/kernel-patch-verify.25812/ptest_check-start 2020-10-08 19:33:31.025898581 +0000 +++ /tmp/kernel-patch-verify.25812/ptest_check-end 2020-10-08 19:33:31.593893830 +0000 @@ -0,0 +1,6 @@ +CHECK: Alignment should match open parenthesis +#84: FILE: drivers/soc/ti/k3-ringacc.c:657: ++ ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, + ring->size * (4 << ring->elm_size),
Nishanth, On 09/10/2020 6.02, Nishanth Menon wrote: > On 14:52-20201008, Peter Ujfalusi wrote: >> - ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, >> + ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, >> ring->size * (4 << ring->elm_size), >> &ring->ring_mem_dma, GFP_KERNEL); > > Any chance of getting a cleanup of the file for 5.11? I know this series > has'nt introduced this warning or set of warnings, but I am starting to > get concerned that we are carrying over too much of a debt now? > > https://pastebin.ubuntu.com/p/tT2kPDsCWD/ Right, you know that git blame points the finger at you on ti_sci.c errors? Never the less, I have run the tool locally on my linux-next-wip with these patches: https://pastebin.ubuntu.com/p/myJwjvKYw8/ and I don't see the noise you see. > Checkpatch does point this: > > --- /tmp/kernel-patch-verify.25812/ptest_check-start 2020-10-08 > 19:33:31.025898581 +0000 > +++ /tmp/kernel-patch-verify.25812/ptest_check-end 2020-10-08 > 19:33:31.593893830 +0000 > @@ -0,0 +1,6 @@ > +CHECK: Alignment should match open parenthesis > +#84: FILE: drivers/soc/ti/k3-ringacc.c:657: > ++ ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, > + ring->size * (4 << ring->elm_size), Yes, that's correct. Readability VS very long lines - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
On 10:43-20201009, Peter Ujfalusi wrote: > Nishanth, > > On 09/10/2020 6.02, Nishanth Menon wrote: > > On 14:52-20201008, Peter Ujfalusi wrote: > >> - ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, > >> + ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, > >> ring->size * (4 << ring->elm_size), > >> &ring->ring_mem_dma, GFP_KERNEL); > > > > Any chance of getting a cleanup of the file for 5.11? I know this series > > has'nt introduced this warning or set of warnings, but I am starting to > > get concerned that we are carrying over too much of a debt now? > > > > https://pastebin.ubuntu.com/p/tT2kPDsCWD/ > > Right, you know that git blame points the finger at you on ti_sci.c errors? > > Never the less, I have run the tool locally on my linux-next-wip with > these patches: > https://pastebin.ubuntu.com/p/myJwjvKYw8/ > > and I don't see the noise you see. Hmm.. Looks like gcc9/10 make W=2 does generate those warnings with container_of .. I will investigate it later today.. just checking to see if it is just me seeing this.. Yes, I introduced the container_of() usage, which is pretty standard usage in other subsystems as well, but lots of checks have gotten stricter and catches new issues since I introduced things in 2016.. Time to get the new issues (if valid) fixed up. > > > Checkpatch does point this: > > > > --- /tmp/kernel-patch-verify.25812/ptest_check-start 2020-10-08 > > 19:33:31.025898581 +0000 > > +++ /tmp/kernel-patch-verify.25812/ptest_check-end 2020-10-08 > > 19:33:31.593893830 +0000 > > @@ -0,0 +1,6 @@ > > +CHECK: Alignment should match open parenthesis > > +#84: FILE: drivers/soc/ti/k3-ringacc.c:657: > > ++ ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, > > + ring->size * (4 << ring->elm_size), > > Yes, that's correct. Readability VS very long lines checkpatch limit in linux kernel is now 100 chars (I know, it is hard to update .vimrc etc.. to the new norm..)but, anyways.. will be good not to see such warnings esp when you are touching the same lines.
On 09/10/2020 14.59, Nishanth Menon wrote: > On 10:43-20201009, Peter Ujfalusi wrote: >> Nishanth, >> >> On 09/10/2020 6.02, Nishanth Menon wrote: >>> On 14:52-20201008, Peter Ujfalusi wrote: >>>> - ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, >>>> + ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, >>>> ring->size * (4 << ring->elm_size), >>>> &ring->ring_mem_dma, GFP_KERNEL); >>> >>> Any chance of getting a cleanup of the file for 5.11? I know this series >>> has'nt introduced this warning or set of warnings, but I am starting to >>> get concerned that we are carrying over too much of a debt now? >>> >>> https://pastebin.ubuntu.com/p/tT2kPDsCWD/ >> >> Right, you know that git blame points the finger at you on ti_sci.c errors? >> >> Never the less, I have run the tool locally on my linux-next-wip with >> these patches: >> https://pastebin.ubuntu.com/p/myJwjvKYw8/ >> >> and I don't see the noise you see. > > > Hmm.. Looks like gcc9/10 make W=2 does generate those warnings with > container_of .. I will investigate it later today.. just checking to see > if it is just me seeing this.. It looks that way. W=2 is a kind of noisy if you throw it at a random file, like: make kernel/exec_domain.o W=2 > Yes, I introduced the container_of() usage, which is pretty standard > usage in other subsystems as well, but lots of checks have gotten > stricter and catches new issues since I introduced things in 2016.. > Time to get the new issues (if valid) fixed up. > >> >>> Checkpatch does point this: >>> >>> --- /tmp/kernel-patch-verify.25812/ptest_check-start 2020-10-08 >>> 19:33:31.025898581 +0000 >>> +++ /tmp/kernel-patch-verify.25812/ptest_check-end 2020-10-08 >>> 19:33:31.593893830 +0000 >>> @@ -0,0 +1,6 @@ >>> +CHECK: Alignment should match open parenthesis >>> +#84: FILE: drivers/soc/ti/k3-ringacc.c:657: >>> ++ ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, >>> + ring->size * (4 << ring->elm_size), >> >> Yes, that's correct. Readability VS very long lines > > > checkpatch limit in linux kernel is now 100 chars (I know, it is > hard to update .vimrc etc.. to the new norm..)but, anyways.. will > be good not to see such warnings esp when you are touching the same > lines. Right, I can send v3 on Monday after a bit of re-adjustment of my editors ;) - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c index 9ddd77113c5a..7d0b4092fce8 100644 --- a/drivers/soc/ti/k3-ringacc.c +++ b/drivers/soc/ti/k3-ringacc.c @@ -141,6 +141,7 @@ struct k3_ring_state { * @parent: Pointer on struct @k3_ringacc * @use_count: Use count for shared rings * @proxy_id: RA Ring Proxy Id (only if @K3_RINGACC_RING_USE_PROXY) + * @dma_dev: device to be used for DMA API (allocation, mapping) */ struct k3_ring { struct k3_ring_rt_regs __iomem *rt; @@ -160,6 +161,7 @@ struct k3_ring { struct k3_ringacc *parent; u32 use_count; int proxy_id; + struct device *dma_dev; }; struct k3_ringacc_ops { @@ -508,11 +510,12 @@ int k3_ringacc_ring_free(struct k3_ring *ring) k3_ringacc_ring_free_sci(ring); - dma_free_coherent(ringacc->dev, + dma_free_coherent(ring->dma_dev, ring->size * (4 << ring->elm_size), ring->ring_mem_virt, ring->ring_mem_dma); ring->flags = 0; ring->ops = NULL; + ring->dma_dev = NULL; if (ring->proxy_id != K3_RINGACC_PROXY_NOT_USED) { clear_bit(ring->proxy_id, ringacc->proxy_inuse); ring->proxy = NULL; @@ -633,8 +636,12 @@ int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) switch (ring->mode) { case K3_RINGACC_RING_MODE_RING: ring->ops = &k3_ring_mode_ring_ops; + ring->dma_dev = cfg->dma_dev; + if (!ring->dma_dev) + ring->dma_dev = ringacc->dev; break; case K3_RINGACC_RING_MODE_MESSAGE: + ring->dma_dev = ringacc->dev; if (ring->proxy) ring->ops = &k3_ring_mode_proxy_ops; else @@ -646,7 +653,7 @@ int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) goto err_free_proxy; } - ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, + ring->ring_mem_virt = dma_alloc_coherent(ring->dma_dev, ring->size * (4 << ring->elm_size), &ring->ring_mem_dma, GFP_KERNEL); if (!ring->ring_mem_virt) { @@ -669,12 +676,13 @@ int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) return 0; err_free_mem: - dma_free_coherent(ringacc->dev, + dma_free_coherent(ring->dma_dev, ring->size * (4 << ring->elm_size), ring->ring_mem_virt, ring->ring_mem_dma); err_free_ops: ring->ops = NULL; + ring->dma_dev = NULL; err_free_proxy: ring->proxy = NULL; return ret; diff --git a/include/linux/soc/ti/k3-ringacc.h b/include/linux/soc/ti/k3-ringacc.h index 5a472eca5ee4..658dc71d2901 100644 --- a/include/linux/soc/ti/k3-ringacc.h +++ b/include/linux/soc/ti/k3-ringacc.h @@ -67,6 +67,9 @@ struct k3_ring; * few times. It's usable when the same ring is used as Free Host PD ring * for different flows, for example. * Note: Locking should be done by consumer if required + * @dma_dev: Master device which is using and accessing to the ring + * memory when the mode is K3_RINGACC_RING_MODE_RING. Memory allocations + * should be done using this device. */ struct k3_ring_cfg { u32 size; @@ -74,6 +77,8 @@ struct k3_ring_cfg { enum k3_ring_mode mode; #define K3_RINGACC_RING_SHARED BIT(1) u32 flags; + + struct device *dma_dev; }; #define K3_RINGACC_RING_ID_ANY (-1)