From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] drivers: dma: Add function to zeroes a range of destination such as memory
Date: Mon, 4 Jun 2018 07:34:06 +0000 [thread overview]
Message-ID: <1528097645.67623.24.camel@intel.com> (raw)
In-Reply-To: <CAPnjgZ3DxnMXEPg=BWzKMqSD_vYXGF_AFt0qGghsQmU=ZfY2Vg@mail.gmail.com>
On Fri, 2018-06-01 at 08:24 -0600, Simon Glass wrote:
> Hi Tien,
>
> On 31 May 2018 at 02:08, <tien.fong.chee@intel.com> wrote:
> >
> > From: Tien Fong Chee <tien.fong.chee@intel.com>
> >
> > This new DMA class function enables DMA being used for initializing
> > a range of destination such as memory to zeros. This is quite
> > useful to
> > help accelerating the performance in scrubbing memory when ECC is
> > enabled.
> >
> > Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
> > ---
> > drivers/dma/dma-uclass.c | 15 +++++++++++++++
> > include/dma.h | 12 ++++++++++++
> > 2 files changed, 27 insertions(+)
> >
> > diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
> > index a33f7d5..cb83c24 100644
> > --- a/drivers/dma/dma-uclass.c
> > +++ b/drivers/dma/dma-uclass.c
> > @@ -61,6 +61,21 @@ int dma_memcpy(void *dst, void *src, size_t len)
> > return ops->transfer(dev, DMA_MEM_TO_MEM, dst, src, len);
> > }
> >
> > +int dma_memcpy_zeroes(struct udevice *dev, void *dst, size_t len)
> > +{
> > + const struct dma_ops *ops;
> > +
> > + ops = device_get_ops(dev);
> > + if (!ops->transfer_zeroes)
> > + return -ENOSYS;
> > +
> > + /* Invalidate the area, so no writeback into the RAM races
> > with DMA */
> > + invalidate_dcache_range((unsigned long)dst, (unsigned
> > long)dst +
> > + roundup(len, ARCH_DMA_MINALIGN));
> > +
> > + return ops->transfer_zeroes(dev, dst, len);
> > +}
> > +
> > UCLASS_DRIVER(dma) = {
> > .id = UCLASS_DMA,
> > .name = "dma",
> > diff --git a/include/dma.h b/include/dma.h
> > index 50e9652..6bad2264 100644
> > --- a/include/dma.h
> > +++ b/include/dma.h
> > @@ -46,6 +46,7 @@ struct dma_ops {
> > */
> > int (*transfer)(struct udevice *dev, int direction, void
> > *dst,
> > void *src, size_t len);
> > + int (*transfer_zeroes)(struct udevice *dev, void *dst,
> > size_t len);
> I wonder if this could be done by using transfer() with a src of NULL
> ?
>
Yes, may be with some description about src of NULL(just for DMA330
driver) on the doc. Otherwise, it would confuse people, and other DMA
driver may treating src with NULL as error or address 0x0.
What do you think?
> >
> > };
> >
> > /*
> > @@ -82,4 +83,15 @@ int dma_get_device(u32 transfer_type, struct
> > udevice **devp);
> > */
> > int dma_memcpy(void *dst, void *src, size_t len);
> >
> > +/*
> > + * dma_memcpy_zeroes - Fill up destination with zeros through DMA.
> > + *
> > + * @dev: The DMA device
> > + * @dst: destination pointer
> > + * @len: length to be copied with zero
> > + * @return: on successful transfer returns zero.
> > + * on failure returns error code.
> > + */
> > +int dma_memcpy_zeroes(struct udevice *dev, void *dst, size_t len);
> > +
> > #endif /* _DMA_H_ */
> > --
> > 2.2.0
> >
>
> Regards,
> Simon
next prev parent reply other threads:[~2018-06-04 7:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 8:08 [U-Boot] [PATCH 0/5] Add DMA driver for DMA330 controller tien.fong.chee at intel.com
2018-05-31 8:08 ` [U-Boot] [PATCH 1/5] drivers: dma: Enable DMA-330 driver support tien.fong.chee at intel.com
2018-06-01 14:24 ` Simon Glass
2018-06-06 5:22 ` Chee, Tien Fong
2018-05-31 8:08 ` [U-Boot] [PATCH 2/5] drivers: dma: Add function to zeroes a range of destination such as memory tien.fong.chee at intel.com
2018-06-01 14:24 ` Simon Glass
2018-06-04 7:34 ` Chee, Tien Fong [this message]
2018-05-31 8:08 ` [U-Boot] [PATCH 3/5] drivers: dma: Factor out dma_get_device from DMA class function tien.fong.chee at intel.com
2018-06-01 14:25 ` Simon Glass
2018-05-31 8:08 ` [U-Boot] [PATCH 4/5] include: dma: Update the function description for dma_memcpy tien.fong.chee at intel.com
2018-06-01 14:25 ` Simon Glass
2018-06-04 7:14 ` Chee, Tien Fong
2018-06-08 21:59 ` Simon Glass
2018-06-11 5:05 ` Chee, Tien Fong
2018-05-31 8:08 ` [U-Boot] [PATCH 5/5] arm: dts: socfpga: stratix10: update pdma tien.fong.chee at intel.com
2018-06-01 14:25 ` Simon Glass
2018-06-04 7:01 ` Chee, Tien Fong
2018-07-09 18:03 ` Dinh Nguyen
2018-07-09 20:28 ` Marek Vasut
2018-07-10 13:11 ` Chee, Tien Fong
2018-07-10 13:37 ` Dinh Nguyen
2018-07-11 2:55 ` Chee, Tien Fong
2018-07-10 16:13 ` Marek Vasut
2018-05-31 9:24 ` [U-Boot] [PATCH 0/5] Add DMA driver for DMA330 controller Marek Vasut
2018-05-31 9:50 ` See, Chin Liang
2018-05-31 9:58 ` Marek Vasut
2018-06-04 6:47 ` Chee, Tien Fong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1528097645.67623.24.camel@intel.com \
--to=tien.fong.chee@intel.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox