lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2026

  • 1 participants
  • 1933 discussions
[XS] Change in osmo-bts[master]: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED
by pespin 30 Mar '26

30 Mar '26
Attention is currently required from: fixeria. pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email ) Change subject: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1 Gerrit-Change-Number: 42524 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 30 Mar 2026 07:27:56 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-bts[master]: osmo-bts-trx: rx_rach_fn(): remove redundant fall-back
by pespin 30 Mar '26

30 Mar '26
Attention is currently required from: fixeria. pespin has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-bts/+/42523?usp=email ) Change subject: osmo-bts-trx: rx_rach_fn(): remove redundant fall-back ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42523?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I4cdc03dc6631ca17d13a3067ad03020e3e97eab1 Gerrit-Change-Number: 42523 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 30 Mar 2026 07:25:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-bts[master]: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED
by laforge 29 Mar '26

29 Mar '26
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email ) Change subject: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1 Gerrit-Change-Number: 42524 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 29 Mar 2026 23:04:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-bts[master]: osmo-bts-trx: rx_rach_fn(): remove redundant fall-back
by laforge 29 Mar '26

29 Mar '26
Attention is currently required from: fixeria. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-bts/+/42523?usp=email ) Change subject: osmo-bts-trx: rx_rach_fn(): remove redundant fall-back ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42523?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I4cdc03dc6631ca17d13a3067ad03020e3e97eab1 Gerrit-Change-Number: 42523 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 29 Mar 2026 23:03:26 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-bts[master]: osmo-bts-trx: rx_data_fn(): fix copy-paste in comment
by laforge 29 Mar '26

29 Mar '26
Attention is currently required from: fixeria. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-bts/+/42522?usp=email ) Change subject: osmo-bts-trx: rx_data_fn(): fix copy-paste in comment ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42522?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ibf35c468310a690fd873cf968bb2c44b493ca5ea Gerrit-Change-Number: 42522 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 29 Mar 2026 23:02:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ccid-firmware[master]: firmware: add tear-free 64bit load/store helpers for jiffies
by laforge 29 Mar '26

29 Mar '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42504?usp=email ) Change subject: firmware: add tear-free 64bit load/store helpers for jiffies ...................................................................... firmware: add tear-free 64bit load/store helpers for jiffies On Cortex-M4 a 64bit load may compile to two separate LDR instructions which can lead to torn reads due to interrupts. LDRD/STRD are restartable, they either complete or restart from scratch, so the result is always consistent. The only "downside" is the required alignment, which is fine. Change-Id: I729c0fdfb5b228b03c2df1cf098743100b1ea625 --- M sysmoOCTSIM/libosmo_emb.c A sysmoOCTSIM/libosmo_emb.h 2 files changed, 63 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved lynxis lazus: Looks good to me, but someone else must approve diff --git a/sysmoOCTSIM/libosmo_emb.c b/sysmoOCTSIM/libosmo_emb.c index 81b29e3..37f6126 100644 --- a/sysmoOCTSIM/libosmo_emb.c +++ b/sysmoOCTSIM/libosmo_emb.c @@ -15,8 +15,19 @@ #include <sys/time.h> #include "driver_init.h" +#include "libosmo_emb.h" -volatile uint64_t jiffies; +volatile uint64_t jiffies __attribute__((aligned(8))); + +uint64_t get_jiffies(void) +{ + ldrd_u64(&jiffies); +} + +void store_jiffies(uint64_t j) +{ + strd_u64(&jiffies, j); +} void SysTick_Handler(void) { @@ -25,8 +36,9 @@ int _gettimeofday(struct timeval *tv, void *tz) { - tv->tv_sec = jiffies / 1000; - tv->tv_usec = (jiffies % 1000) * 1000; + uint64_t j = get_jiffies(); + tv->tv_sec = j / 1000; + tv->tv_usec = (j % 1000) * 1000; return 0; } diff --git a/sysmoOCTSIM/libosmo_emb.h b/sysmoOCTSIM/libosmo_emb.h new file mode 100644 index 0000000..4b576c6 --- /dev/null +++ b/sysmoOCTSIM/libosmo_emb.h @@ -0,0 +1,48 @@ +/* Tear-free 64-bit load/store for Cortex-M4. + * + * LDRD/STRD are restartable: if an interrupt arrives mid-instruction the + * core restarts the access from scratch, so the result is always consistent. + * This requires 8-byte alignment (unaligned LDRD silently becomes two + * separate word accesses, losing the restart guarantee). + * + * Worst-case outcome is being off by one tick (1 ms) which is irrelevant + * for the timeout use-case. + */ + +#include <stdint.h> + +#if defined(__arm__) +static inline uint64_t ldrd_u64(const volatile uint64_t *p) +{ + uint32_t lo, hi; + __asm__ volatile( + "ldrd %0, %1, [%2]\n" + : "=&r"(lo), "=&r"(hi) + : "r"(p) + : "memory"); + return ((uint64_t)hi << 32) | lo; +} + +static inline void strd_u64(volatile uint64_t *p, uint64_t v) +{ + uint32_t lo = (uint32_t)v; + uint32_t hi = (uint32_t)(v >> 32); + __asm__ volatile( + "strd %1, %2, [%0]\n" + : : "r"(p), "r"(lo), "r"(hi) + : "memory"); +} +#else +/* host */ +static inline uint64_t ldrd_u64(const volatile uint64_t *p) +{ + return *p; +} +static inline void strd_u64(volatile uint64_t *p, uint64_t v) +{ + *p = v; +} +#endif + +uint64_t get_jiffies(void); +void store_jiffies(uint64_t j); -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42504?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I729c0fdfb5b228b03c2df1cf098743100b1ea625 Gerrit-Change-Number: 42504 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in osmo-ccid-firmware[master]: firmware: replace libosmocore fsm timers
by laforge 29 Mar '26

29 Mar '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42481?usp=email ) Change subject: firmware: replace libosmocore fsm timers ...................................................................... firmware: replace libosmocore fsm timers Concurrent access from main loop and the different uart irqs was not going well and caused crashes. The libosmocore fsm does still allocate one internal timer, but it is not used by the firmware, so libosmocore will not touch the rbtree. Additionally ignore checkpatch jiffies complaints because we're trying to do firmware here. Closes: SYS#7877 Change-Id: Id2bd67b3946bb451008965f0b68b4a919f4d10bd --- M .checkpatch.conf M ccid_common/ccid_slot_fsm.c M ccid_common/cuart.c M ccid_common/cuart.h M ccid_common/iso7816_fsm.c M ccid_host/Makefile A ccid_host/libosmo_emb.c A ccid_host/libosmo_emb.h M sysmoOCTSIM/main.c 9 files changed, 112 insertions(+), 46 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/.checkpatch.conf b/.checkpatch.conf index 76a4cc5..0421be5 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -16,3 +16,4 @@ --ignore LEADING_SPACE --ignore SUSPECT_CODE_INDENT --ignore SPACE_BEFORE_TAB +--ignore JIFFIES_COMPARISON diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c index 05024c9..22d3f70 100644 --- a/ccid_common/ccid_slot_fsm.c +++ b/ccid_common/ccid_slot_fsm.c @@ -207,7 +207,7 @@ volatile void * volatile data = cs->event_data; if (!event) - return 0; + goto out; // if(event && !data) // return 0; @@ -340,6 +340,8 @@ break; } +out: + card_uart_wtime_poll(ss->cuart); return 0; } diff --git a/ccid_common/cuart.c b/ccid_common/cuart.c index d228c13..bb17c4b 100644 --- a/ccid_common/cuart.c +++ b/ccid_common/cuart.c @@ -21,7 +21,6 @@ #include <string.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/utils.h> -#include <osmocom/core/timer.h> #include "cuart.h" @@ -56,36 +55,37 @@ return 1e6 / cuart->driver->ops->ctrl(cuart, CUART_CTL_GET_BAUDRATE, 0); } -/* software waiting-time timer has expired */ -static void card_uart_wtime_cb(void *data) -{ - struct card_uart *cuart = (struct card_uart *) data; - card_uart_notification(cuart, CUART_E_RX_TIMEOUT, NULL); - /* should we automatically disable the receiver? */ -} - void card_uart_wtime_restart(struct card_uart *cuart) { - int secs, usecs; - if (!cuart->current_wtime_byte) return; int etu_in_us = get_etu_in_us(cuart) + 1; cuart->wtime_etu = cuart->wtime_etu ? cuart->wtime_etu : 1; - /* timemout is wtime * ETU * expected number of bytes */ - usecs = etu_in_us * cuart->wtime_etu * cuart->current_wtime_byte; + /* timeout is wtime * ETU * expected number of bytes */ + uint32_t usecs = etu_in_us * cuart->wtime_etu * cuart->current_wtime_byte; /* limit lower wait time to reasonable value */ - usecs = usecs < 300000 ? 300000 : usecs; + if (usecs < 300000) + usecs = 300000; - if (usecs > 1000000) { - secs = usecs / 1000000; - usecs = usecs % 1000000; - } else - secs = 0; - osmo_timer_schedule(&cuart->wtime_tmr, secs, usecs); + uint32_t ms = (usecs + 999) / 1000; + cuart_set_deadline(cuart, get_jiffies() + ms); +} + +static inline void card_uart_wtime_stop(struct card_uart *cuart) +{ + cuart_set_deadline(cuart, 0); +} + +void card_uart_wtime_poll(struct card_uart *cuart) +{ + uint64_t deadline = cuart_get_deadline(cuart); + if (deadline && (int64_t)(get_jiffies() - deadline) >= 0) { + cuart_set_deadline(cuart, 0); + card_uart_notification(cuart, CUART_E_RX_TIMEOUT, NULL); + } } int card_uart_open(struct card_uart *cuart, const char *driver_name, const char *device_name) @@ -99,7 +99,7 @@ cuart->wtime_etu = 9600; /* ISO 7816-3 Section 8.1 */ cuart->rx_enabled = true; cuart->rx_threshold = 1; - osmo_timer_setup(&cuart->wtime_tmr, card_uart_wtime_cb, cuart); + cuart_set_deadline(cuart, 0); rc = drv->ops->open(cuart, device_name); if (rc < 0) @@ -137,16 +137,14 @@ case CUART_CTL_RX: cuart->rx_enabled = arg ? true : false; if (!cuart->rx_enabled) - osmo_timer_del(&cuart->wtime_tmr); -// else -// card_uart_wtime_restart(cuart); + card_uart_wtime_stop(cuart); break; case CUART_CTL_RX_TIMER_HINT: cuart->current_wtime_byte = arg; if(arg) card_uart_wtime_restart(cuart); else - osmo_timer_del(&cuart->wtime_tmr); + card_uart_wtime_stop(cuart); break; case CUART_CTL_POWER_5V0: case CUART_CTL_POWER_3V0: @@ -154,7 +152,7 @@ /* we have to reset this somewhere, and powering down loses all state * this is not hw specific so it belongs here, after handling the hw specific part */ if (!arg) { - osmo_timer_del(&cuart->wtime_tmr); + card_uart_wtime_stop(cuart); cuart->tx_busy = false; cuart->rx_threshold = 1; cuart->wtime_etu = 9600; /* ISO 7816-3 Section 8.1 */ diff --git a/ccid_common/cuart.h b/ccid_common/cuart.h index c8573c5..a9afc1d 100644 --- a/ccid_common/cuart.h +++ b/ccid_common/cuart.h @@ -21,10 +21,9 @@ #include <stdint.h> #include <stdbool.h> #include <osmocom/core/linuxlist.h> -#include <osmocom/core/timer.h> - #include <osmocom/core/select.h> #include "utils_ringbuffer.h" +#include "libosmo_emb.h" struct usart_async_descriptor; @@ -101,7 +100,9 @@ uint32_t rx_threshold; uint32_t wtime_etu; - struct osmo_timer_list wtime_tmr; + /* deadline in jiffies (ms) for card response timeout, 0 = inactive. + * Set from IRQ context, checked from main loop */ + volatile uint64_t wtime_deadline __attribute__((aligned(8))); /* expected number of bytes, for timeout */ uint32_t current_wtime_byte; @@ -133,6 +134,16 @@ } u; }; +static inline uint64_t cuart_get_deadline(struct card_uart *cuart) +{ + return ldrd_u64(&cuart->wtime_deadline); +} + +static inline void cuart_set_deadline(struct card_uart *cuart, uint64_t deadline) +{ + strd_u64(&cuart->wtime_deadline, deadline); +} + /*! Open the Card UART */ int card_uart_open(struct card_uart *cuart, const char *driver_name, const char *device_name); @@ -153,6 +164,11 @@ /* (re)start the software WTIME timer */ void card_uart_wtime_restart(struct card_uart *cuart); +/* poll wtime deadline from main loop, fires CUART_E_RX_TIMEOUT if expired */ +void card_uart_wtime_poll(struct card_uart *cuart); + void card_uart_notification(struct card_uart *cuart, enum card_uart_event evt, void *data); int card_uart_driver_register(struct card_uart_driver *drv); + +struct card_uart *cuart4slot_nr(uint8_t slot_nr); diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c index a035148..4f01bd7 100644 --- a/ccid_common/iso7816_fsm.c +++ b/ccid_common/iso7816_fsm.c @@ -137,12 +137,6 @@ TPDU_S_DONE, }; -/* FSM timer enumeration */ -enum iso7816_3_timer { - T_WAIT_ATR = 1, - T_GUARD, -}; - /* forward declarations */ static struct osmo_fsm iso7816_3_fsm; static struct osmo_fsm atr_fsm; @@ -264,6 +258,17 @@ return (struct iso7816_3_priv *) fi->priv; } +/* libosmocore fsm timers can't be used to to concurrency issues. + * Expiry fires CUART_E_RX_TIMEOUT from main loop -> ISO7816_E_WTIME_EXP + */ +static void atr_state_chg_guard(struct osmo_fsm_inst *atr_fi, uint32_t new_state, uint32_t timeout_ms) +{ + struct osmo_fsm_inst *parent_fi = atr_fi->proc.parent; + struct iso7816_3_priv *ip = get_iso7816_3_priv(parent_fi); + osmo_fsm_inst_state_chg(atr_fi, new_state, 0, 0); + cuart_set_deadline(ip->uart, timeout_ms ? get_jiffies() + timeout_ms : 0); +} + /* convert from clock cycles of the CLK line to milli-seconds */ uint32_t fi_cycles2ms(struct osmo_fsm_inst *fi, uint32_t cyclces) { @@ -741,7 +746,7 @@ /* fall-through */ case 0x3f: /* inverse convention used and correctly decoded */ atr_append_byte(fi, byte); - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_T0, atr_fi_gt_ms(fi), T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_T0, atr_fi_gt_ms(fi)); break; default: LOGPFSML(fi, LOGL_ERROR, "Invalid TS received: 0x%02X\n", byte); @@ -783,28 +788,28 @@ atp->y = (byte & 0xf0); /* remember incoming interface bytes */ atp->i++; if (atp->y & 0x10) { - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_TA, guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_TA, guard_time_ms); break; } /* fall-through */ case ATR_S_WAIT_TA: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ if (atp->y & 0x20) { - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_TB, guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_TB, guard_time_ms); break; } /* fall-through */ case ATR_S_WAIT_TB: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ if (atp->y & 0x40) { - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_TC, guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_TC, guard_time_ms); break; } /* fall-through */ case ATR_S_WAIT_TC: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ if (atp->y & 0x80) { - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_TD, guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_TD, guard_time_ms); break; } else if (atp->hist_len) { - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_HIST, guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_HIST, guard_time_ms); break; } /* fall-through */ @@ -814,8 +819,7 @@ if (atp->hist_len == 0) { if (atp->protocol_support > 1) { /* wait for check byte */ - osmo_fsm_inst_state_chg_ms(fi, ATR_S_WAIT_TCK, - guard_time_ms, T_GUARD); + atr_state_chg_guard(fi, ATR_S_WAIT_TCK, guard_time_ms); break; } else { /* no TCK present, ATR complete; notify parent */ diff --git a/ccid_host/Makefile b/ccid_host/Makefile index 718377a..f72a4ad 100644 --- a/ccid_host/Makefile +++ b/ccid_host/Makefile @@ -18,6 +18,7 @@ cuart_driver_tty.o \ utils_ringbuffer.o \ logging.o \ + libosmo_emb.o \ ../ccid_common/cuart.o \ ../ccid_common/ccid_proto.o \ ../ccid_common/ccid_device.o \ @@ -32,6 +33,7 @@ cuart_test: cuart_test.o \ cuart_driver_tty.o \ utils_ringbuffer.o \ + libosmo_emb.o \ ../ccid_common/cuart.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) @@ -39,6 +41,7 @@ logging.o \ cuart_driver_tty.o \ utils_ringbuffer.o \ + libosmo_emb.o \ ../ccid_common/iso7816_fsm.o \ ../ccid_common/iso7816_3.o \ ../ccid_common/cuart.o diff --git a/ccid_host/libosmo_emb.c b/ccid_host/libosmo_emb.c new file mode 100644 index 0000000..c144b86 --- /dev/null +++ b/ccid_host/libosmo_emb.c @@ -0,0 +1,29 @@ +/* Host-side jiffies: milliseconds from gettimeofday(). + * + * Copyright (C) 2026 sysmocom -s.f.m.c. GmbH, Author: Eric Wild <ewild(a)sysmocom.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + */ + +#include <stddef.h> +#include <osmocom/core/timer.h> +#include "libosmo_emb.h" + +uint64_t get_jiffies(void) +{ + struct timespec ts; + osmo_clock_gettime(CLOCK_MONOTONIC, &ts); + return (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000; +} diff --git a/ccid_host/libosmo_emb.h b/ccid_host/libosmo_emb.h new file mode 100644 index 0000000..ffc0324 --- /dev/null +++ b/ccid_host/libosmo_emb.h @@ -0,0 +1,15 @@ +#pragma once +/* Host-side jiffies emulation */ + +#include <stdint.h> + +static inline uint64_t ldrd_u64(const volatile uint64_t *p) +{ + return *p; +} +static inline void strd_u64(volatile uint64_t *p, uint64_t v) +{ + *p = v; +} + +uint64_t get_jiffies(void); diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c index e1e83c7..7873c86 100644 --- a/sysmoOCTSIM/main.c +++ b/sysmoOCTSIM/main.c @@ -22,7 +22,6 @@ #include <errno.h> #include <osmocom/core/utils.h> -#include <osmocom/core/timer.h> #include <hal_cache.h> #include <hri_port_e54.h> @@ -714,7 +713,6 @@ g_ci.slot_ops->handle_fsm_events(&g_ci.slot[i], true); } feed_ccid(); - osmo_timers_update(); int qs = llist_count_at(&g_ccid_s.free_q); if (qs > NUM_OUT_BUF) for (int i = 0; i < qs - NUM_OUT_BUF; i++) { -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42481?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: Id2bd67b3946bb451008965f0b68b4a919f4d10bd Gerrit-Change-Number: 42481 Gerrit-PatchSet: 10 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in osmo-ccid-firmware[master]: firmware: add tear-free 64bit load/store helpers for jiffies
by laforge 29 Mar '26

29 Mar '26
Attention is currently required from: Hoernchen. laforge has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42504?usp=email ) Change subject: firmware: add tear-free 64bit load/store helpers for jiffies ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42504?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: I729c0fdfb5b228b03c2df1cf098743100b1ea625 Gerrit-Change-Number: 42504 Gerrit-PatchSet: 3 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Comment-Date: Sun, 29 Mar 2026 23:02:08 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ccid-firmware[master]: firmware: replace libosmocore fsm timers
by laforge 29 Mar '26

29 Mar '26
Attention is currently required from: Hoernchen, jolly. laforge has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42481?usp=email ) Change subject: firmware: replace libosmocore fsm timers ...................................................................... Patch Set 10: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42481?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-Change-Id: Id2bd67b3946bb451008965f0b68b4a919f4d10bd Gerrit-Change-Number: 42481 Gerrit-PatchSet: 10 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Comment-Date: Sun, 29 Mar 2026 23:01:58 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-bts[master]: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED
by fixeria 29 Mar '26

29 Mar '26
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email ) Change subject: bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED ...................................................................... bts_shutdown_fsm: fix spurious RAMP_COMPL events in WAIT_TRX_CLOSED With multiple TRXes ramping down in lockstep, both their final ramp-timer callbacks fire back-to-back in the same event loop pass, setting p_total_cur_mdBm to the target value for both before any async hardware acknowledgement arrives. When the first SETPOWER ack returns and fires ramp_down_compl_cb() for TRX0, the remaining-TRX check in st_wait_ramp_down_compl() inspects p_total_cur_mdBm for TRX1 and finds it already at the target - concluding that all TRXes are done. The FSM then transitions to WAIT_TRX_CLOSED, and the second ack (for TRX1) fires ramp_down_compl_cb() into the wrong state, producing: BTS_SHUTDOWN(...){WAIT_TRX_CLOSED}: Event BTS_SHUTDOWN_EV_TRX_RAMP_COMPL not permitted The root cause is that p_total_cur_mdBm is a *requested* value set in the timer callback, not a confirmed one. The hardware confirmation arrives asynchronously via power_trx_change_compl() -> power_ramp_do_step(), which is also where compl_cb() is invoked. Fix by adding a 'complete' flag to trx_power_params.ramp that is: * cleared when _power_ramp_start() begins a new ramp, and * set just before compl_cb() is called in power_ramp_do_step() The shutdown FSM remaining-TRX count then checks !ramp.complete instead of comparing p_total_cur_mdBm against the target, correctly reflecting which TRXes have actually received hardware confirmation of ramp completion. Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1 --- M include/osmo-bts/tx_power.h M src/common/bts_shutdown_fsm.c M src/common/tx_power.c 3 files changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/24/42524/1 diff --git a/include/osmo-bts/tx_power.h b/include/osmo-bts/tx_power.h index 73134c8..52c02f5 100644 --- a/include/osmo-bts/tx_power.h +++ b/include/osmo-bts/tx_power.h @@ -1,6 +1,7 @@ #pragma once #include <stdint.h> +#include <stdbool.h> #include <osmocom/core/timer.h> /* our unit is 'milli dB" or "milli dBm", i.e. 1/1000 of a dB(m) */ @@ -59,6 +60,8 @@ struct osmo_timer_list step_timer; /* call-back called when target is reached */ ramp_compl_cb_t compl_cb; + /* set to true after compl_cb has been called (ramp target confirmed by hardware) */ + bool complete; } ramp; }; diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c index 13a0e1d..a8c8f9d 100644 --- a/src/common/bts_shutdown_fsm.c +++ b/src/common/bts_shutdown_fsm.c @@ -110,7 +110,7 @@ llist_for_each_entry(trx, &bts->trx_list, list) { if (trx->mo.nm_state.operational == NM_OPSTATE_ENABLED && - trx->power_params.p_total_cur_mdBm > BTS_SHUTDOWN_POWER_RAMP_TGT) + !trx->power_params.ramp.complete) remaining++; } diff --git a/src/common/tx_power.c b/src/common/tx_power.c index 1e026dd..575fe2f 100644 --- a/src/common/tx_power.c +++ b/src/common/tx_power.c @@ -210,6 +210,7 @@ /* we had finished in last loop iteration */ if (!first && tpp->ramp.attenuation_mdB == 0) { + tpp->ramp.complete = true; if (tpp->ramp.compl_cb) tpp->ramp.compl_cb(trx); return; @@ -261,6 +262,7 @@ /* set the new target */ tpp->p_total_tgt_mdBm = p_total_tgt_mdBm; tpp->ramp.compl_cb = ramp_compl_cb; + tpp->ramp.complete = false; if (skip_ramping) { /* Jump straight to the target power */ -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42524?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia71393e871187d6b44b7f520eb421bab354aafd1 Gerrit-Change-Number: 42524 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • ...
  • 194
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.