@@ -102,23 +102,6 @@ extern "C" {
#define TUNE_NETAPI_DESC_SIZE 128
#ifdef NETAPI_USE_DDR
-/**
- * @ingroup tune_parameters
- * @def TUNE_NETAPI_QM_START_INDEX
- * This defines the queue manager start index
- * @note This must reflect what the kernel is uding for their region,
- * see device tree blob for details.
- */
-#define TUNE_NETAPI_QM_START_INDEX 0
-
-/**
- * @ingroup tune_parameters
- * @def TUNE_NETAPI_QM_GLOBAL_REGION
- * This defines the queue manager global region
- * @note This must reflect what the kernel is using for their region,
- * see device tree blob for details.
- */
-#define TUNE_NETAPI_QM_GLOBAL_REGION 18
#else /* use msmc */
#define TUNE_NETAPI_QM_START_INDEX 0
@@ -25,6 +25,7 @@ struct odp_global_s {
Pktlib_HeapHandle sa2pa_heap; /**< Internal SA->PA heap */
Pktlib_HeapHandle pa2sa_heap; /**< Internal PA->SA head */
} nwal; /**< Global NWAL state */
+ Qmss_MemRegion public_desc_memregion;
};
/** @internal Per process ODP state */
@@ -35,6 +36,7 @@ struct odp_proc_s {
Pktlib_HeapHandle netcp_control_tx_heap; /**< tx control messages */
} nwal; /**< Per process NWAL state */
Rm_ServiceHandle *rm_service; /**< Resource Manager service handle */
+ void *descriptor_mem_base;
};
/** @internal Per thread ODP state */
@@ -42,7 +42,7 @@ int mcsdk_qmss_init(int max_descriptors);
int mcsdk_qmss_start(void);
int mcsdk_cppi_start(void);
int mcsdk_qmss_setup_memregion(uint32_t desc_num, uint32_t desc_size,
- uint32_t *desc_mem_base, Qmss_MemRegion mem_region);
+ uint32_t *desc_mem_base);
int mcsdk_nwal_init(int region2use, Pktlib_HeapIfTable *p_table);
int mcsdk_nwal_start(Pktlib_HeapHandle pkt_heap,
Pktlib_HeapHandle cmd_rx_heap,
@@ -25,7 +25,7 @@ extern "C" {
#define ODP_PRINT_LEVEL_VDBG 6
#define ODP_PRINT_LEVEL_MAX 7
-#define ODP_PRINT_LEVEL ODP_PRINT_LEVEL_WARN
+#define ODP_PRINT_LEVEL ODP_PRINT_LEVEL_DBG
/**
* Internal debug printing macro
@@ -20,7 +20,6 @@ hplib_virtualAddrInfo_T odp_vm_info;
* Global variables which needs to be populated with memory pool attributes
* which is passed to HPLIB for memory pool initialization
*/
-void *global_descriptor_mem_base;
void *sa_context_mem_base;
static uint8_t *cma_mem_alloc(uint32_t size);
@@ -533,12 +532,16 @@ int mcsdk_global_init(void)
#endif
/* Allocate QM region from contiguous chunk above */
- global_descriptor_mem_base = hplib_vmMemAlloc(
+ odp_proc.descriptor_mem_base = hplib_vmMemAlloc(
(odp_global->cfg.def_tot_descriptors_for_us
* TUNE_NETAPI_DESC_SIZE),
128, 0);
- odp_pr_dbg("global desc region=%p\n", global_descriptor_mem_base);
+ odp_pr_dbg("global desc region=%p\n", odp_proc.descriptor_mem_base);
+ if (!odp_proc.descriptor_mem_base) {
+ odp_pr_err("couldn't allocate memory for public descriptors\n");
+ return -1;
+ }
/* Initialize Queue Manager Sub System */
result = mcsdk_qmss_init(odp_global->cfg.def_max_descriptors);
@@ -558,8 +561,7 @@ int mcsdk_global_init(void)
result = mcsdk_qmss_setup_memregion(
odp_global->cfg.def_tot_descriptors_for_us,
TUNE_NETAPI_DESC_SIZE,
- global_descriptor_mem_base,
- TUNE_NETAPI_QM_GLOBAL_REGION);
+ odp_proc.descriptor_mem_base);
if (result < 0) {
odp_pr_err("can't setup QM shared region\n");
@@ -590,7 +592,7 @@ int mcsdk_global_init(void)
memset((void *)&heap_cfg, 0, sizeof(Pktlib_HeapCfg));
/* Populate the heap configuration */
heap_cfg.name = "nwal_packet";
- heap_cfg.memRegion = TUNE_NETAPI_QM_GLOBAL_REGION;
+ heap_cfg.memRegion = odp_global->public_desc_memregion;
heap_cfg.sharedHeap = 1;
heap_cfg.useStarvationQueue = 0;
heap_cfg.dataBufferSize = odp_global->cfg.def_heap_buf_size;
@@ -644,7 +646,7 @@ int mcsdk_global_init(void)
odp_proc.nwal.netcp_control_tx_heap = control_tx_heap;
/* Init NWAL */
- result = mcsdk_nwal_init(TUNE_NETAPI_QM_GLOBAL_REGION,
+ result = mcsdk_nwal_init(odp_global->public_desc_memregion,
&pktlib_if_table);
if (result < 0) {
odp_pr_err("netapi init_nwal() failed\n");
@@ -241,7 +241,7 @@ int mcsdk_cppi_start(void)
* once per SOC
********************************************************************/
int mcsdk_qmss_setup_memregion(uint32_t desc_num, uint32_t desc_size,
- uint32_t *desc_mem_base, Qmss_MemRegion mem_region)
+ uint32_t *desc_mem_base)
{
Qmss_MemRegInfo mem_info;
Int32 result;
@@ -251,8 +251,8 @@ int mcsdk_qmss_setup_memregion(uint32_t desc_num, uint32_t desc_size,
mem_info.descSize = desc_size;
mem_info.descNum = desc_num;
mem_info.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
- mem_info.memRegion = mem_region;
- mem_info.startIndex = TUNE_NETAPI_QM_START_INDEX;
+ mem_info.memRegion = Qmss_MemRegion_MEMORY_REGION_NOT_SPECIFIED;
+ mem_info.startIndex = QMSS_START_INDEX_INTERNAL;
memset(desc_mem_base, 0, (desc_size * desc_num));
@@ -263,5 +263,7 @@ int mcsdk_qmss_setup_memregion(uint32_t desc_num, uint32_t desc_size,
return -1;
}
+ odp_global->public_desc_memregion = mem_info.memRegion;
+
return 1;
}
@@ -64,7 +64,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
memset((void *)&heap_cfg, 0, sizeof(Pktlib_HeapCfg));
/* Populate the heap configuration */
heap_cfg.name = name;
- heap_cfg.memRegion = TUNE_NETAPI_QM_GLOBAL_REGION;
+ heap_cfg.memRegion = odp_global->public_desc_memregion;
heap_cfg.sharedHeap = 1;
heap_cfg.useStarvationQueue = 0;
heap_cfg.dataBufferSize = buf_size;
Instead of hardcoding memory region number and start link memory index allocate them from RM. Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> --- platform/linux-keystone2/include/api/mcsdk_tune.h | 17 ----------------- platform/linux-keystone2/include/api/odp_state.h | 2 ++ .../linux-keystone2/include/api/odp_ti_mcsdk.h | 2 +- .../linux-keystone2/include/odp_debug_internal.h | 2 +- platform/linux-keystone2/mcsdk/mcsdk_init.c | 16 +++++++++------- platform/linux-keystone2/mcsdk/mcsdk_navig.c | 8 +++++--- platform/linux-keystone2/odp_buffer_pool.c | 2 +- 7 files changed, 19 insertions(+), 30 deletions(-)