dde_linux: implement memory barriers in USB driver

This patch implements the memory barrier macros in the USB driver for ARMv7
and x86.

Fixes #1159.
This commit is contained in:
Christian Prochaska 2014-05-20 22:52:56 +02:00 committed by Christian Helmuth
parent 0ed68a56b7
commit 14951649e4
10 changed files with 99 additions and 17 deletions

View File

@ -0,0 +1,3 @@
INC_DIR += $(LIB_INC_DIR)/armv6
include $(REP_DIR)/lib/mk/arm/usb.inc

View File

@ -0,0 +1,3 @@
INC_DIR += $(LIB_INC_DIR)/armv7
include $(REP_DIR)/lib/mk/arm/usb.inc

View File

@ -2,7 +2,7 @@ SRC_C += usbnet.c asix_devices.c asix_common.c ax88172a.c ax88179_178a.c
include $(REP_DIR)/lib/mk/xhci.inc
include $(REP_DIR)/lib/mk/usb.inc
include $(REP_DIR)/lib/mk/arm/usb.inc
include $(REP_DIR)/lib/mk/armv7/usb.inc
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED -DCONFIG_OF -DCONFIG_USB_DWC3_HOST \
-DCONFIG_USB_OTG_UTILS -DCONFIG_USB_XHCI_PLATFORM -DDWC3_QUIRK

View File

@ -1,7 +1,7 @@
SRC_C += usbnet.c smsc95xx.c
include $(REP_DIR)/lib/mk/usb.inc
include $(REP_DIR)/lib/mk/arm/usb.inc
include $(REP_DIR)/lib/mk/armv7/usb.inc
CC_OPT += -DCONFIG_USB_EHCI_HCD_OMAP -DCONFIG_USB_EHCI_TT_NEWSCHED -DVERBOSE_DEBUG
SRC_CC += platform.cc

View File

@ -23,7 +23,7 @@ SRC_C += \
SRC_C += usbnet.c smsc95xx.c
include $(REP_DIR)/lib/mk/usb.inc
include $(REP_DIR)/lib/mk/arm/usb.inc
include $(REP_DIR)/lib/mk/armv6/usb.inc
CC_OPT += -DDWC_LINUX -DPLATFORM_INTERFACE

View File

@ -13,6 +13,8 @@
#ifndef _ARM__PLATFORM__LX_EMUL_H_
#define _ARM__PLATFORM__LX_EMUL_H_
#include <platform/lx_emul_barrier.h>
/*************************
** asm-generic/sizes.h **
*************************/
@ -266,5 +268,4 @@ void set_fiq_regs(struct pt_regs const *regs);
void enable_fiq();
void set_fiq_handler(void *start, unsigned int length);
#endif /* _ARM__PLATFORM__LX_EMUL_H_ */

View File

@ -0,0 +1,32 @@
/*
* \brief ARMv6-specific part of the Linux API emulation
* \author Christian Prochaska
* \date 2014-05-28
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARMV6__PLATFORM__LX_EMUL_BARRIER_H_
#define _ARMV6__PLATFORM__LX_EMUL_BARRIER_H_
/*******************
** asm/barrier.h **
*******************/
#define mb() asm volatile ("": : :"memory")
#define rmb() mb()
#define wmb() asm volatile ("": : :"memory")
#define smp_mb() asm volatile ("": : :"memory")
#define smp_rmb() smp_mb()
#define smp_wmb() asm volatile ("": : :"memory")
static inline void barrier() { asm volatile ("": : :"memory"); }
#endif /* _ARMV6__PLATFORM__LX_EMUL_BARRIER_H_ */

View File

@ -0,0 +1,37 @@
/*
* \brief ARMv7-specific part of the Linux API emulation
* \author Christian Prochaska
* \date 2014-05-28
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _ARMV7__PLATFORM__LX_EMUL_BARRIER_H_
#define _ARMV7__PLATFORM__LX_EMUL_BARRIER_H_
/*******************
** asm/barrier.h **
*******************/
/*
* This is the "safe" implementation as needed for a configuration
* with bufferable DMA memory and SMP enabled.
*/
#define mb() asm volatile ("dsb": : :"memory")
#define rmb() mb()
#define wmb() asm volatile ("dsb st": : :"memory")
#define smp_mb() asm volatile ("dmb ish": : :"memory")
#define smp_rmb() smp_mb()
#define smp_wmb() asm volatile ("dmb ishst": : :"memory")
static inline void barrier() { asm volatile ("": : :"memory"); }
#endif /* _ARMV7__PLATFORM__LX_EMUL_BARRIER_H_ */

View File

@ -249,19 +249,6 @@ typedef uint32_t u_int32_t;
#include <linux/usb/storage.h>
/******************
** asm/system.h **
******************/
#define mb() asm volatile ("": : :"memory")
#define rmb() mb()
#define wmb() asm volatile ("": : :"memory")
#define smp_wmb() wmb()
#define smp_mb() mb()
static inline void barrier() { mb(); }
/**********************
** linux/compiler.h **
**********************/

View File

@ -19,4 +19,23 @@ struct platform_device
void *data;
};
/*******************
** asm/barrier.h **
*******************/
#define mb() asm volatile ("mfence": : :"memory")
#define rmb() asm volatile ("lfence": : :"memory")
#define wmb() asm volatile ("sfence": : :"memory")
/*
* This is the "safe" implementation as needed for a configuration
* with SMP enabled.
*/
#define smp_mb() mb()
#define smp_rmb() barrier()
#define smp_wmb() barrier()
static inline void barrier() { asm volatile ("": : :"memory"); }
#endif /* _X86_32__PLATFORM__LX_EMUL_ */