From patchwork Mon Nov 24 15:43:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41410 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2FF424524 for ; Mon, 24 Nov 2014 15:44:06 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id u10sf3329322lbd.2 for ; Mon, 24 Nov 2014 07:44:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=qcb5HTRMEuCe4OO/UL7tJlyEvbQzKhpoNR2tQwcBll4=; b=ZCmwueL0Y2TIoU/ioJnibXJXhfyUE6Yqe0eXIbRPPBFmVrxjndSRKLXf5eciGyv2md zlPNruuRNM7xdmieu5Lpcz6oQ9lYCyZCTRQ5jCiL6KA76mwoMtQwLh5puMuMSfpjBUCj widuqQe3k+sF+ru67sWed4yTMmmITRJqA9wmu4TCbqo8Gtmx9kKEBDLur+1aXfTUZTyL HXdrakGa522787yuvaHxLcvXTiQ8sUr60KG8vuCSGHzcr1kJrVFQUIV47flYc/g79oRL XKcfhPIC5lu6x+XQmZpzmXYDCx7vSoRQMQ93SgZXJEAbm2sWeVRUeHkOovylq/NhPTe+ oXiw== X-Gm-Message-State: ALoCoQnpYLvQU5dX0Ce8/dRoNurrCb2pn6jGRvQuU1idslXizkrj3F3RT5I4xuKosdqVJfVbEzya X-Received: by 10.112.55.10 with SMTP id n10mr746273lbp.14.1416843845758; Mon, 24 Nov 2014 07:44:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.99 with SMTP id bf3ls458283lab.13.gmail; Mon, 24 Nov 2014 07:44:05 -0800 (PST) X-Received: by 10.152.27.73 with SMTP id r9mr18671772lag.33.1416843845217; Mon, 24 Nov 2014 07:44:05 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id o2si15529421lal.101.2014.11.24.07.44.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:44:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so7644967lab.22 for ; Mon, 24 Nov 2014 07:44:05 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr20897146lbo.32.1416843845081; Mon, 24 Nov 2014 07:44:05 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp276825lbc; Mon, 24 Nov 2014 07:44:04 -0800 (PST) X-Received: by 10.224.80.71 with SMTP id s7mr28792932qak.35.1416843843506; Mon, 24 Nov 2014 07:44:03 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m79si15991959qgm.83.2014.11.24.07.44.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:44:03 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xsvo1-0005To-Jv; Mon, 24 Nov 2014 15:44:01 +0000 Received: from mail-lb0-f178.google.com ([209.85.217.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xsvnv-0005Tj-Ab for lng-odp@lists.linaro.org; Mon, 24 Nov 2014 15:43:55 +0000 Received: by mail-lb0-f178.google.com with SMTP id f15so6734420lbj.37 for ; Mon, 24 Nov 2014 07:43:49 -0800 (PST) X-Received: by 10.112.8.69 with SMTP id p5mr191997lba.97.1416843829295; Mon, 24 Nov 2014 07:43:49 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id z2sm1667841lal.45.2014.11.24.07.43.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Nov 2014 07:43:48 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 24 Nov 2014 17:43:43 +0200 Message-Id: <1416843823-29940-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH KS2] linux-keystone2: allocate memregion from RM X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Instead of hardcoding memory region number and start link memory index allocate them from RM. Signed-off-by: Taras Kondratiuk --- 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(-) diff --git a/platform/linux-keystone2/include/api/mcsdk_tune.h b/platform/linux-keystone2/include/api/mcsdk_tune.h index 204330e..e87fd3c 100644 --- a/platform/linux-keystone2/include/api/mcsdk_tune.h +++ b/platform/linux-keystone2/include/api/mcsdk_tune.h @@ -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 diff --git a/platform/linux-keystone2/include/api/odp_state.h b/platform/linux-keystone2/include/api/odp_state.h index 7975ca8..2406245 100644 --- a/platform/linux-keystone2/include/api/odp_state.h +++ b/platform/linux-keystone2/include/api/odp_state.h @@ -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 */ diff --git a/platform/linux-keystone2/include/api/odp_ti_mcsdk.h b/platform/linux-keystone2/include/api/odp_ti_mcsdk.h index 21b609d..6dd0dd1 100644 --- a/platform/linux-keystone2/include/api/odp_ti_mcsdk.h +++ b/platform/linux-keystone2/include/api/odp_ti_mcsdk.h @@ -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, diff --git a/platform/linux-keystone2/include/odp_debug_internal.h b/platform/linux-keystone2/include/odp_debug_internal.h index 7b9c361..a93e282 100644 --- a/platform/linux-keystone2/include/odp_debug_internal.h +++ b/platform/linux-keystone2/include/odp_debug_internal.h @@ -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 diff --git a/platform/linux-keystone2/mcsdk/mcsdk_init.c b/platform/linux-keystone2/mcsdk/mcsdk_init.c index 24c357a..fbc9bb5 100644 --- a/platform/linux-keystone2/mcsdk/mcsdk_init.c +++ b/platform/linux-keystone2/mcsdk/mcsdk_init.c @@ -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"); diff --git a/platform/linux-keystone2/mcsdk/mcsdk_navig.c b/platform/linux-keystone2/mcsdk/mcsdk_navig.c index dd1caba..bdfc8e1 100644 --- a/platform/linux-keystone2/mcsdk/mcsdk_navig.c +++ b/platform/linux-keystone2/mcsdk/mcsdk_navig.c @@ -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; } diff --git a/platform/linux-keystone2/odp_buffer_pool.c b/platform/linux-keystone2/odp_buffer_pool.c index 3ff0180..13656a9 100644 --- a/platform/linux-keystone2/odp_buffer_pool.c +++ b/platform/linux-keystone2/odp_buffer_pool.c @@ -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;