ipc: Remove internal API for clearing shared memory

Clearing of shared memory by one side of the communication
is no longer required after
commit 0620cb1fe1
("ipc: ipc_service: icmsg: Increase reliability of bonding")
was merged.

Signed-off-by: Emil Obalski <Emil.Obalski@nordicsemi.no>
This commit is contained in:
Emil Obalski 2023-04-17 11:30:27 +02:00 committed by Carles Cufí
commit 52e203f800
6 changed files with 6 additions and 112 deletions

View file

@ -276,30 +276,6 @@ int icmsg_release_rx_buffer(const struct icmsg_config_t *conf,
const void *data);
#endif
/** @brief Clear memory in TX buffer.
*
* This function is intended to be called at an early stage of boot process,
* before the instance is initialized and before the remote core has started.
*
* @param[in] conf Structure containing configuration parameters for the icmsg
* instance being created.
*
* @retval 0 on success.
*/
int icmsg_clear_tx_memory(const struct icmsg_config_t *conf);
/** @brief Clear memory in RX buffer.
*
* This function is intended to be called at an early stage of boot process,
* before the instance is initialized and before the remote core has started.
*
* @param[in] conf Structure containing configuration parameters for the icmsg
* instance being created.
*
* @retval 0 on success.
*/
int icmsg_clear_rx_memory(const struct icmsg_config_t *conf);
/**
* @}
*/

View file

@ -17,13 +17,6 @@ config IEEE802154_NRF5
config HEAP_MEM_POOL_SIZE
default 4096 if NRF_802154_SER_HOST
if IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR || IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER
config IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET
default y
endif # IPC_SERVICE_BACKEND_ICMSG_ME_INITIATOR || IPC_SERVICE_BACKEND_ICMSG_ME_FOLLOWER
if IPC_SERVICE_BACKEND_RPMSG
config IPC_SERVICE_BACKEND_RPMSG_SHMEM_RESET

View file

@ -28,15 +28,6 @@ config IPC_SERVICE_BACKEND_ICMSG_ME_EP_NAME_LEN
Maximal length of a string used to discover endpoints between the
initiator and the follower.
config IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET
bool "Clear shared memory before initialization"
help
Clearint TX buffer before icmsg instance initialization is needed
if the memory was not cleared by hardware or other software modules.
The memory content remaining from the previous run, or garbage data
is going to be incorrectly interpreted by spsc and icmsg instances.
This option adds performance overhead in the initialization process.
config IPC_SERVICE_BACKEND_ICMSG_ME_NOCOPY_RX
bool "Nocopy feature for receive path"
select IPC_SERVICE_ICMSG_ME_NOCOPY_RX

View file

@ -337,7 +337,8 @@ static int backend_init(const struct device *instance)
return icmsg_me_init(conf, &dev_data->icmsg_me_data);
}
#define BACKEND_CONFIG_POPULATE(i) \
#define DEFINE_BACKEND_DEVICE(i) \
static const struct icmsg_config_t backend_config_##i = \
{ \
.tx_shm_size = DT_REG_SIZE(DT_INST_PHANDLE(i, tx_region)), \
.tx_shm_addr = DT_REG_ADDR(DT_INST_PHANDLE(i, tx_region)), \
@ -345,11 +346,7 @@ static int backend_init(const struct device *instance)
.rx_shm_addr = DT_REG_ADDR(DT_INST_PHANDLE(i, rx_region)), \
.mbox_tx = MBOX_DT_CHANNEL_GET(DT_DRV_INST(i), tx), \
.mbox_rx = MBOX_DT_CHANNEL_GET(DT_DRV_INST(i), rx), \
}
#define DEFINE_BACKEND_DEVICE(i) \
static const struct icmsg_config_t backend_config_##i = \
BACKEND_CONFIG_POPULATE(i); \
}; \
static struct backend_data_t backend_data_##i; \
\
DEVICE_DT_INST_DEFINE(i, \
@ -362,25 +359,3 @@ static int backend_init(const struct device *instance)
&backend_ops);
DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE)
#if defined(CONFIG_IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET)
#define BACKEND_CONFIG_DEFINE(i) BACKEND_CONFIG_POPULATE(i),
static int shared_memory_prepare(void)
{
const struct icmsg_config_t *backend_config;
const struct icmsg_config_t backend_configs[] = {
DT_INST_FOREACH_STATUS_OKAY(BACKEND_CONFIG_DEFINE)
};
for (backend_config = backend_configs;
backend_config < backend_configs + ARRAY_SIZE(backend_configs);
backend_config++) {
icmsg_clear_tx_memory(backend_config);
icmsg_clear_rx_memory(backend_config);
}
return 0;
}
SYS_INIT(shared_memory_prepare, PRE_KERNEL_1, 1);
#endif /* CONFIG_IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET */

View file

@ -239,7 +239,8 @@ static int backend_init(const struct device *instance)
return icmsg_me_init(conf, &dev_data->icmsg_me_data);
}
#define BACKEND_CONFIG_POPULATE(i) \
#define DEFINE_BACKEND_DEVICE(i) \
static const struct icmsg_config_t backend_config_##i = \
{ \
.tx_shm_size = DT_REG_SIZE(DT_INST_PHANDLE(i, tx_region)), \
.tx_shm_addr = DT_REG_ADDR(DT_INST_PHANDLE(i, tx_region)), \
@ -247,11 +248,7 @@ static int backend_init(const struct device *instance)
.rx_shm_addr = DT_REG_ADDR(DT_INST_PHANDLE(i, rx_region)), \
.mbox_tx = MBOX_DT_CHANNEL_GET(DT_DRV_INST(i), tx), \
.mbox_rx = MBOX_DT_CHANNEL_GET(DT_DRV_INST(i), rx), \
}
#define DEFINE_BACKEND_DEVICE(i) \
static const struct icmsg_config_t backend_config_##i = \
BACKEND_CONFIG_POPULATE(i); \
}; \
static struct backend_data_t backend_data_##i; \
\
DEVICE_DT_INST_DEFINE(i, \
@ -264,25 +261,3 @@ static int backend_init(const struct device *instance)
&backend_ops);
DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE)
#if defined(CONFIG_IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET)
#define BACKEND_CONFIG_DEFINE(i) BACKEND_CONFIG_POPULATE(i),
static int shared_memory_prepare(void)
{
const struct icmsg_config_t *backend_config;
const struct icmsg_config_t backend_configs[] = {
DT_INST_FOREACH_STATUS_OKAY(BACKEND_CONFIG_DEFINE)
};
for (backend_config = backend_configs;
backend_config < backend_configs + ARRAY_SIZE(backend_configs);
backend_config++) {
icmsg_clear_tx_memory(backend_config);
icmsg_clear_rx_memory(backend_config);
}
return 0;
}
SYS_INIT(shared_memory_prepare, PRE_KERNEL_1, 1);
#endif /* CONFIG_IPC_SERVICE_BACKEND_ICMSG_ME_SHMEM_RESET */

View file

@ -461,19 +461,3 @@ int icmsg_release_rx_buffer(const struct icmsg_config_t *conf,
return 0;
}
#endif /* CONFIG_IPC_SERVICE_ICMSG_NOCOPY_RX */
int icmsg_clear_tx_memory(const struct icmsg_config_t *conf)
{
/* Clear spsc_pbuf header and a part of the magic number. */
memset((void *)conf->tx_shm_addr, 0, sizeof(struct spsc_pbuf) + sizeof(int));
return 0;
}
int icmsg_clear_rx_memory(const struct icmsg_config_t *conf)
{
/* Clear spsc_pbuf header and a part of the magic number. */
memset((void *)conf->rx_shm_addr, 0, sizeof(struct spsc_pbuf) + sizeof(int));
return 0;
}