firmware: protect uart_tx_queue against ISR

cardem:
- dispatch_usb_command_cardem() appends to uart_tx_queue from the main loop
- tx_byte_tpdu() dequeues from the USART IRQ handler @ NVIC prio 0

card_handle_reset() has the same issue, drains queue and
frees uart_tx_msg from main loop while the ISR may own them.

All of this needs protection against the irq.

Needs a fixed llist_add_tail_irqsafe(), which called __enable_irq() instead of
restoring the saved PRIMASK for some unknown reason?!?!?!?

Change-Id: I7d9cdcc56263b27dfd4649dfb1da1d67761ee923
This commit is contained in:
Eric Wild authored and lynxis lazus committed 2026-08-10 16:13:59 +00:00
1 parent b36adff672
commit f7170aff42
3 files changed
+21 -8

No files matched your search

+2 -1
View File
@@ -737,7 +737,8 @@ static void dispatch_usb_command_cardem(struct msgb *msg, struct cardem_inst *ci
switch (hdr->msg_type) {
case SIMTRACE_MSGT_DT_CEMU_TX_DATA:
queue = card_emu_get_uart_tx_queue(ci->ch);
llist_add_tail(&msg->list, queue);
/* drained from the USART IRQ handler at highest NVIC prio */
llist_add_tail_irqsafe(&msg->list, queue);
card_emu_have_new_uart_tx(ci->ch);
break;
case SIMTRACE_MSGT_DT_CEMU_SET_ATR: