[U-Boot] [PATCH 2/6] usb:udc:samsung: Remove redundant cache operation from Samsung UDC driver

Lukasz Majewski l.majewski at samsung.com
Mon Feb 3 09:05:06 CET 2014


Hi Marek,

> On Saturday, February 01, 2014 at 10:56:27 AM, Lukasz Majewski wrote:
> > On Sat, 1 Feb 2014 03:50:26 +0100
> > 
> > Marek Vasut <marex at denx.de> wrote:
> > > On Friday, January 31, 2014 at 01:16:25 PM, Lukasz Majewski wrote:
> > > > A set of cache operations (both invalidation and flush) were
> > > > redundant in the S3C HS OTG Samsung driver.
> > > > 
> > > > Test condition
> > > > - test HW + measurement: Trats - Exynos4210 rev.1
> > > > - test HW Trats2 - Exynos4412 rev.1
> > > > 400 MiB compressed rootfs image download with `thor 0 mmc 0`
> > > 
> > > The commit message is missing a proper explanation _WHY_ were they
> > > redundant. I do not understand why they were redundant ... and no,
> > > the test you performed does not justify removal of cache
> > > management calls.
> > 
> > The s3c UDC driver is in u-boot since 2011. It has been added when
> > at Samsung boards (s5p_goni) we didn't have cache enabled.
> > 
> > Then there was a transition, after which L1 was enabled. Since UDC
> > is co-working with gadgets on the beginning it was easier to
> > perform the cache management inside the UDC driver.
> > 
> > That is why we had to copy the buffers (since e.g. device
> > descriptors tends to be unaligned) - which also degraded
> > performance.
> > 
> > Now, all gadget code seems to be memalign'ed and ready for direct
> > buffer passing (despite the two overlooked kmallocs in the mass
> > storage gadget - which I fix in this patch set).
> > 
> > To sum up:
> > 
> > 1. s3c_udc_ep0_zlp - EP0 ZLP packets don't need to invalidate the
> > cache (since it is zero length transmission)
> > 
> > 2. s3c_udc_pre_setup - cache invalidation is not needed when I setup
> > buffer for OUT EP0 transmission.
> > 
> > The above two invalidation calls had been added by me, and are mine
> > mistakes. Those don't contribute to transmission speed up (and
> > shall be regarded as a cosmetic changes)
> > 
> > 3. setdma_rx - here I invalidate parts of the s3c UDC driver's
> > internal buffer. This call is not needed anymore since we reuse the
> > buffers passed from gadgets.
> 
> And you do correct cache management on those in the UDC driver or in
> the gadget driver ?

For download, buffers are allocated in gadgets. Then buffer is passed
to the UDC driver in a USB request. 
After receiving data via USB the UDC driver takes care to invalidate
cache, hence the gadget can work on the data.

Cache management is performed in the UDC driver.

>  
> > This is the key speed improvement here.
> 
> This should be in the commit message really ;-)

I wrongly assumed, that code explains what was the rationale :-). I'm
going to prepare more verbose commit message for v2.

> 
> Best regards,
> Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list