Skip to content

Commit b7acb6b

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: openisa: Fix to use compiler memory barrier
Fix OpenISA port to include compiler memory barrier as in commit 1a14f8b ("Bluetooth: controller: Use DMB instead of DSB"). Relates to commit 1af2b91 ("Bluetooth: controller: Fix Tx Buffer Overflow") and to commit ef2ece8 ("Bluetooth: controller: openisa: Fix sanitycheck failures") and to commit c2fc629 ("Bluetooth: controller: 255 byte AD payload support"). Fixes #31937. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 59616c0 commit b7acb6b

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

subsys/bluetooth/controller/ll_sw/openisa/hal/cpu.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ static inline void cpu_sleep(void)
1111
/* __SEV(); */
1212
__WFE();
1313
}
14+
15+
static inline void cpu_dmb(void)
16+
{
17+
/* FIXME: Add necessary host machine required Data Memory Barrier
18+
* instruction alongwith the below defined compiler memory
19+
* clobber.
20+
*/
21+
__asm__ volatile ("" : : : "memory");
22+
}

subsys/bluetooth/controller/ll_sw/openisa/lll/lll_adv.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#include <stdbool.h>
88
#include <stddef.h>
99

10-
#include <zephyr/types.h>
11-
#include <sys/byteorder.h>
12-
1310
#include <toolchain.h>
11+
#include <soc.h>
1412
#include <bluetooth/hci.h>
13+
#include <sys/byteorder.h>
1514

15+
#include "hal/cpu.h"
1616
#include "hal/ccm.h"
1717
#include "hal/radio.h"
1818
#include "hal/ticker.h"
@@ -40,7 +40,6 @@
4040

4141
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_adv
4242
#include "common/log.h"
43-
#include <soc.h>
4443
#include "hal/debug.h"
4544

4645
static int init_reset(void);
@@ -212,14 +211,11 @@ struct pdu_adv *lll_adv_pdu_alloc(struct lll_adv_pdu *pdu, uint8_t *idx)
212211
uint8_t first_latest;
213212

214213
pdu->last = first;
215-
/* FIXME: Ensure that data is synchronized so that an ISR
214+
/* NOTE: Ensure that data is synchronized so that an ISR
216215
* vectored, after pdu->last has been updated, does
217-
* access the latest value. __DMB() is used in ARM
218-
* Cortex M4 architectures. Use appropriate
219-
* instructions on other platforms.
220-
*
221-
* cpu_dmb();
216+
* access the latest value.
222217
*/
218+
cpu_dmb();
223219
first_latest = pdu->first;
224220
if (first_latest != first) {
225221
last++;

subsys/bluetooth/controller/ll_sw/openisa/lll/lll_conn.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
#include <stddef.h>
99

1010
#include <toolchain.h>
11-
#include <zephyr/types.h>
11+
#include <soc.h>
1212
#include <sys/util.h>
1313

14+
#include "hal/cpu.h"
15+
#include "hal/ccm.h"
16+
#include "hal/radio.h"
17+
1418
#include "util/mem.h"
1519
#include "util/memq.h"
1620
#include "util/mfifo.h"
1721

18-
#include "hal/ccm.h"
19-
#include "hal/radio.h"
20-
2122
#include "pdu.h"
2223

2324
#include "lll.h"
@@ -29,7 +30,6 @@
2930

3031
#define LOG_MODULE_NAME bt_ctlr_llsw_openisa_lll_conn
3132
#include "common/log.h"
32-
#include <soc.h>
3333
#include "hal/debug.h"
3434

3535
static int init_reset(void);

0 commit comments

Comments
 (0)