u-boot-brain/drivers
Philipp Tomsich 889239d6b5 usb: dwc3: gadget: make cache-maintenance on event buffers more robust
Merely using dma_alloc_coherent does not ensure that there is no stale
data left in the caches for the allocated DMA buffer (i.e. that the
affected cacheline may still be dirty).

The original code was doing the following (on AArch64, which
translates a 'flush' into a 'clean + invalidate'):
  # during initialisation:
      1. allocate buffers via memalign
      	 => buffers may still be modified (cached, dirty)
  # during interrupt processing
      2. clean + invalidate buffers
      	 => may commit stale data from a modified cacheline
      3. read from buffers

This could lead to garbage info being written to buffers before
reading them during even-processing.

To make the event processing more robust, we use the following sequence
for the cache-maintenance:
  # during initialisation:
      1. allocate buffers via memalign
      2. clean + invalidate buffers
      	 (we only need the 'invalidate' part, but dwc3_flush_cache()
	  always performs a 'clean + invalidate')
  # during interrupt processing
      3. read the buffers
      	 (we know these lines are not cached, due to the previous
	  invalidation and no other code touching them in-between)
      4. clean + invalidate buffers
      	 => writes back any modification we may have made during event
	    processing and ensures that the lines are not in the cache
	    the next time we enter interrupt processing

Note that with the original sequence, we observe reproducible
(depending on the cache state: i.e. running dhcp/usb start before will
upset caches to get us around this) issues in the event processing (a
fatal synchronous abort in dwc3_gadget_uboot_handle_interrupt on the
first time interrupt handling is invoked) when running USB mass
storage emulation on our RK3399-Q7 with data-caches on.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-04-14 16:44:16 +02:00
..
adc dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
bios_emulator bios_emulator: Fix cast for 64-bit compilation 2016-10-11 11:55:33 +08:00
block dm: core: Add flags parameter to device_remove() 2017-04-04 20:15:10 -06:00
bootcount Blackfin: Remove 2017-04-05 13:52:01 -04:00
clk rockchip: clk: rk3399: 24MHz is not a power of 2 2017-04-04 20:01:57 -06:00
core dm: core: Allow driver model to be disabled for TPL 2017-04-05 16:36:58 -04:00
cpu cpu: Add get_vendor callback 2016-10-19 09:01:51 +02:00
crypto crypto: Move CONFIG_SYS_FSL_SEC_LE and _BE to Kconfig 2017-01-04 19:40:19 -05:00
ddr board_f: Drop return value from initdram() 2017-04-05 13:59:20 -04:00
demo dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
dfu dfu: align array in dfu_get_dev_type with enum dfu_device_type 2016-11-03 11:55:25 +01:00
dma treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
fpga fpga: zynqmp: Remove empty functions 2017-01-10 10:18:11 +01:00
gpio gpio: Add Rapid GPIO2P driver for i.MX7ULP 2017-03-17 09:27:08 +01:00
hwmon mailaddr: Update mail address 2016-01-27 15:32:05 +01:00
i2c i2c: Drop unused i2c_soft...() functions 2017-04-05 13:55:10 -04:00
input dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
led dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
mailbox dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
memory memory: Move TI_AEMIF config to KCONFIG 2016-04-18 17:11:43 -04:00
misc mxc_ocotp: Update driver to support OCOTP controller on i.MX7ULP 2017-03-17 09:27:08 +01:00
mmc dm: core: Add flags parameter to device_remove() 2017-04-04 20:15:10 -06:00
mtd mtd: nand: am335x_spl_bch: Incorporate tWB delay in nand_command function 2017-04-08 21:34:50 -04:00
net Merge branch 'master' of git://git.denx.de/u-boot-sunxi 2017-04-08 09:28:02 -04:00
pch dm: Use dm_scan_fdt_dev() directly where possible 2016-07-27 14:15:54 -06:00
pci Merge git://git.denx.de/u-boot-dm 2017-04-04 09:18:57 -04:00
pcmcia powerpc: mpc824x: remove MPC824X cpu support 2015-01-05 12:08:55 -05:00
phy/marvell dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
pinctrl rockchip: pinctrl: rk3399: add GMAC (RGMII only) support 2017-04-04 20:01:57 -06:00
power sunxi: prepare for sharing MACH_SUN8I_H3 config symbol 2017-04-05 15:03:17 +05:30
pwm pwm: remove unneeded ifdef CONFIG_DM_PWM ... endif 2017-02-08 16:24:26 -05:00
qe powerpc: P1025: Remove macro CONFIG_P1025 2016-11-23 23:42:10 -08:00
ram ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM 2015-08-18 13:46:02 -04:00
remoteproc dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
reset reset: Add STi reset support 2017-03-26 13:22:58 -06:00
rtc dm: rtc: Add 16-bit read/write support 2017-04-10 10:02:03 +08:00
serial serial: Add serial driver for Intel MID 2017-04-10 10:02:03 +08:00
soc Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
sound of: clean up OF_CONTROL ifdef conditionals 2015-08-18 13:46:05 -04:00
spi Blackfin: Remove 2017-04-05 13:52:01 -04:00
spmi dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
sysreset rockchip: rk3328: add sysreset driver 2017-03-16 16:03:46 -06:00
thermal imx: thermal: Kconfig: add MX7 2017-01-02 17:08:25 +01:00
timer drivers: timer: Introduce ARC timer driver 2017-03-29 07:38:11 +02:00
tpm lib: tpm: Add command to list resources 2017-03-26 13:22:58 -06:00
twserial drivers: convert makefiles to Kbuild style 2013-10-31 13:26:01 -04:00
usb usb: dwc3: gadget: make cache-maintenance on event buffers more robust 2017-04-14 16:44:16 +02:00
video rockchip: video: Split out HDMI controller code 2017-04-04 20:01:57 -06:00
watchdog ti: wdt: omap: Disable watchdog timer before performing initialization 2017-04-08 21:32:49 -04:00
Kconfig fsl_ddr: Move DDR config options to driver Kconfig 2017-01-04 19:40:41 -05:00
Makefile dm: core: Allow driver model to be disabled for TPL 2017-04-05 16:36:58 -04:00