From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0044.outbound.protection.outlook.com [104.47.1.44]) by dpdk.org (Postfix) with ESMTP id 157C1255 for ; Tue, 18 Sep 2018 15:37:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5fR2BIjZoM5TyGF6L+O5xXhAzqnz1+3WzqTShE8lUZk=; b=go2Ng1norWrKI9WWJeMm2WHWIPq53b7+Wuykf8A0jPUumiqvTxp7K3Xrnti7A5fO9WbVCD9c+NSPjtLxuutsAvP11RYdwd3CMx42pbHbCmqthqd6d2pSvsXfXT1dx3qtpoyVbKLdlvjDYbkwDJEdrvN/5PuFGqiMs78tRWFcYlo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=akhil.goyal@nxp.com; Received: from [10.232.134.144] (14.143.30.134) by AM6PR04MB4888.eurprd04.prod.outlook.com (2603:10a6:20b:6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Tue, 18 Sep 2018 13:37:39 +0000 To: Gagandeep Singh , dev@dpdk.org Cc: Hemant Agrawal References: <20180913060846.29930-1-g.singh@nxp.com> <20180913060846.29930-4-g.singh@nxp.com> From: Akhil Goyal Message-ID: <72c9a8b1-6fcd-b45f-6e06-b4ff80a6d51e@nxp.com> Date: Tue, 18 Sep 2018 19:07:28 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180913060846.29930-4-g.singh@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [14.143.30.134] X-ClientProxiedBy: BM1PR0101CA0054.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::16) To AM6PR04MB4888.eurprd04.prod.outlook.com (2603:10a6:20b:6::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67dac20b-eb64-497e-1dd5-08d61d6be75e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR04MB4888; X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4888; 3:2hFE/fHMJ7uPDH3cYKo36LVDF19n22sjIs32HktXbF1D98qMzNmhYWSuPZfR8RhbbBA9wQCp80QXAUjp0q89AqZ7p1oGpgnGLcn//bRSWKXwJflInHZIZqlCbuZ7L82nVJP4sqfizQPmu6wte8YaHRn5lzWlystIEgndV+EvhOu034UTacgIoziQHhk/a+NMN3L/QfDOLDqe6xukEMkQGp5i6qkyOWzRsJZ/ip7K82TwLk70LBFEqdgj7uKPDpCl; 25:6LmPMR4wxpzgbE8qoZqTZms+GRcjJiJfPAJQ5Bvl2/CQ/rv9m1e4fMn4rdPlcoXgmZA9ePxdrfZMmKwntwqbXqfcYTnVeF9YlyT2pK5GT3sBAL7Ad3Mi7fIqSjmrcFkM3Oropvx0CPOHMG939+InQiDxY7jTCVQ5qUS442+Mj8Cl64nqLBrKVWTMVr78UxT6Vhjkw+Mvdjej04FuGJTeEVni42dPSKGvtdbksljRQSKUBFJBMFT+dBktIUajv19PE+RI+ky5K6aIoz482mYyTJIVRPKPtwPlmOpahYGuOrToZHch3LB1z/y3Z7c4E4//F16jgO0WJdaHdQWKxYReeQ==; 31:gytgZbjh1jSyxknWM2OyWQfjie5aKFpvLBmOCPHqfANOSrdzJUuZoJbGMyFMj19FMH75NxlzMk9nY6o75czauMyc/Xc5wuAVgi5CLm2lWWiKnIGqvU/jL54TkPRyLPXc5fwQfs+eQ2mXrpYoZTqkxBwmk3cVOt4mtn/LX+gT+C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486261705)(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699050); SRVR:AM6PR04MB4888; BCL:0; PCL:0; RULEID:; SRVR:AM6PR04MB4888; X-Forefront-PRVS: 0799B1B2D7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(346002)(376002)(136003)(396003)(39860400002)(366004)(189003)(199004)(446003)(25786009)(2616005)(11346002)(105586002)(53936002)(52116002)(31696002)(6666003)(65826007)(67846002)(8676002)(8936002)(4326008)(68736007)(97736004)(3260700006)(26005)(44832011)(2486003)(3846002)(81166006)(81156014)(16526019)(386003)(7736002)(486006)(77096007)(956004)(230700001)(23676004)(106356001)(316002)(58126008)(16576012)(31686004)(305945005)(53546011)(476003)(6246003)(76176011)(6116002)(65956001)(65806001)(47776003)(14444005)(64126003)(36756003)(66066001)(229853002)(52146003)(6486002)(478600001)(5009440100003)(2906002)(5660300001)(86362001)(50466002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR04MB4888; H:[10.232.134.144]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTZQUjA0TUI0ODg4OzIzOm51VWhwOGJCTGh5NlFCT0tSK1MrRWM0dzZv?= =?utf-8?B?MVlVVzJJWVhTR2lVeVNadFY4NXQ1RXVLMmFGWkJmTUtoeFUwQUp5TEJlVVJW?= =?utf-8?B?OEVEUDdXOW04Ni8xTFFlb0U5Y1R1VW5LVGdWbnRVcHczSis1OHU0eCtuNEw5?= =?utf-8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DLBTxATgDF2fWxMItk1c2mKjG/jOoloteJa2pJavZzP+t/rtq9AjpLXea4cVha3iSFMIabcVkGhC5tUmVqH7Vm5tBu2Ee95q6XQ=; 7:fLqeFEKCmfmZt1meh43xEzHnfBKSarbmywTBA+RnQDH8f/TtqV0zBUrv7nfJbSKExYk6wJxFt8ODaTE8fDDrikr6d4+2Bom/yVTmQSUzZyc9fxmoQv8pEwvSW8DB++aB7n2umSiZuCEOTcr8GV8YANfHkDWfQ7dV7VhwTjKAuJZnUwrtBfhx/ECsPW00Fur3YQPgPLM6nyBs2h3A0Rn3XecNW/YqW7OQMFoWZdW8y3+fwyU2jliVqAjMWbWYDRvi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2018 13:37:39.2179 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67dac20b-eb64-497e-1dd5-08d61d6be75e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4888 Subject: Re: [dpdk-dev] [PATCH 03/10] crypto/caam_jr: add HW config for job rings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2018 13:37:41 -0000 Hi Gagan, On 9/13/2018 11:38 AM, Gagandeep Singh wrote: > From: Hemant Agrawal > > Signed-off-by: Gagandeep Singh > Signed-off-by: Hemant Agrawal > --- > drivers/crypto/caam_jr/Makefile | 6 + > drivers/crypto/caam_jr/caam_jr.c | 329 +++++++++++- > drivers/crypto/caam_jr/caam_jr_config.h | 207 ++++++++ > drivers/crypto/caam_jr/caam_jr_hw.c | 365 ++++++++++++++ > drivers/crypto/caam_jr/caam_jr_hw_specific.h | 503 +++++++++++++++++++ > drivers/crypto/caam_jr/caam_jr_pvt.h | 285 +++++++++++ > drivers/crypto/caam_jr/caam_jr_uio.c | 491 ++++++++++++++++++ > drivers/crypto/caam_jr/meson.build | 5 +- > 8 files changed, 2188 insertions(+), 3 deletions(-) > create mode 100644 drivers/crypto/caam_jr/caam_jr_config.h > create mode 100644 drivers/crypto/caam_jr/caam_jr_hw.c > create mode 100644 drivers/crypto/caam_jr/caam_jr_hw_specific.h > create mode 100644 drivers/crypto/caam_jr/caam_jr_pvt.h > create mode 100644 drivers/crypto/caam_jr/caam_jr_uio.c > > diff --git a/drivers/crypto/caam_jr/Makefile b/drivers/crypto/caam_jr/Makefile > index 46d752af7..8b863b4af 100644 > --- a/drivers/crypto/caam_jr/Makefile > +++ b/drivers/crypto/caam_jr/Makefile > @@ -19,7 +19,10 @@ CFLAGS += -O3 > CFLAGS += $(WERROR_FLAGS) > endif > > +CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include > CFLAGS += -I$(RTE_SDK)/drivers/crypto/caam_jr > +#sharing the hw flib headers from dpaa2_sec pmd > +CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/ > CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include > CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal > > @@ -30,11 +33,14 @@ EXPORT_MAP := rte_pmd_caam_jr_version.map > LIBABIVER := 1 > > # library source files > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr_hw.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr_uio.c > SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr.c > # library dependencies > > LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring > LDLIBS += -lrte_cryptodev > +LDLIBS += -lrte_bus_dpaa > LDLIBS += -lrte_bus_vdev > > include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c > index 68779cba5..9d5f5b79b 100644 > --- a/drivers/crypto/caam_jr/caam_jr.c > +++ b/drivers/crypto/caam_jr/caam_jr.c > @@ -16,13 +16,146 @@ > #include > #include > #include > +#include Please give one line break between the rte_ includes and driver specific includes > > +/* RTA header files */ > +#include > +#include > +#include > +#include > #include > > #define CRYPTODEV_NAME_CAAM_JR_PMD crypto_caam_jr > static uint8_t cryptodev_driver_id; > int caam_jr_logtype; > > +enum rta_sec_era rta_sec_era; > + > +/* Lists the states possible for the SEC user space driver. */ > +enum sec_driver_state_e { > + SEC_DRIVER_STATE_IDLE, /* Driver not initialized */ > + SEC_DRIVER_STATE_STARTED, /* Driver initialized and can be used*/ > + SEC_DRIVER_STATE_RELEASE, /* Driver release is in progress */ > +}; > + > +/* Job rings used for communication with SEC HW */ > +static struct sec_job_ring_t g_job_rings[MAX_SEC_JOB_RINGS]; > + > +/* The current state of SEC user space driver */ > +static enum sec_driver_state_e g_driver_state = SEC_DRIVER_STATE_IDLE; > + > +/* The number of job rings used by SEC user space driver */ > +static int g_job_rings_no; > +static int g_job_rings_max; > + > +/* @brief Poll the HW for already processed jobs in the JR > + * and silently discard the available jobs or notify them to UA > + * with indicated error code. > + * > + * @param [in,out] job_ring The job ring to poll. > + * @param [in] do_notify Can be #TRUE or #FALSE. Indicates if > + * descriptors are to be discarded > + * or notified to UA with given error_code. > + * @param [out] notified_descs Number of notified descriptors. Can be NULL > + * if do_notify is #FALSE > + */ > +static void hw_flush_job_ring(struct sec_job_ring_t *job_ring, > + uint32_t do_notify, > + uint32_t *notified_descs) static void should be in a separate line.. Please check in rest of the code as well. > +{ > + int32_t jobs_no_to_discard = 0; > + int32_t discarded_descs_no = 0; > + > + CAAM_JR_DEBUG("Jr[%p] pi[%d] ci[%d].Flushing jr notify desc=[%d]", > + job_ring, job_ring->pidx, job_ring->cidx, do_notify); > + > + jobs_no_to_discard = hw_get_no_finished_jobs(job_ring); > + > + /* Discard all jobs */ > + CAAM_JR_DEBUG("Jr[%p] pi[%d] ci[%d].Discarding %d descs", > + job_ring, job_ring->pidx, job_ring->cidx, > + jobs_no_to_discard); > + > + while (jobs_no_to_discard > discarded_descs_no) { > + /* Get completed descriptor */ > +#if 0 > + /*TODO if we want to do something with desc*/ > + /* Since the memory is contigous, then P2V translation is a > + * mere addition to the base descriptor physical address > + */ > + current_desc = job_ring->output_ring[job_ring->cidx].desc; > +#endif Please remove dead code. > + > + discarded_descs_no++; > + /* Now increment the consumer index for the current job ring, > + * AFTER saving job in temporary location! > + * Increment the consumer index for the current job ring > + */ > + job_ring->cidx = SEC_CIRCULAR_COUNTER(job_ring->cidx, > + SEC_JOB_RING_SIZE); > + > + hw_remove_entries(job_ring, 1); > + } > + > + if (do_notify == true) { > + ASSERT(notified_descs != NULL); > + *notified_descs = discarded_descs_no; > + } > +} > + > + > +/* @brief Flush job rings of any processed descs. > + * The processed descs are silently dropped, > + * WITHOUT being notified to UA. > + */ > +static void close_job_ring(struct sec_job_ring_t *job_ring) > +{ > + if (job_ring->irq_fd) { > + /* Producer index is frozen. If consumer index is not equal > + * with producer index, then we have descs to flush. > + */ > + while (job_ring->pidx != job_ring->cidx) > + hw_flush_job_ring(job_ring, false, NULL); > + > + /* free the uio job ring */ > + free_job_ring(job_ring->irq_fd); > + job_ring->irq_fd = 0; > + caam_jr_dma_free(job_ring->input_ring); > + caam_jr_dma_free(job_ring->output_ring); > + > + g_job_rings_no--; > + > + } > +} > + > +/** @brief Release the software and hardware resources tied to a job ring. > + * @param [in] job_ring The job ring > + * > + * @retval 0 for success > + * @retval -1 for error > + */ > +static int shutdown_job_ring(struct sec_job_ring_t *job_ring) > +{ > + int ret = 0; > + > + ASSERT(job_ring != NULL); > + ret = hw_shutdown_job_ring(job_ring); > + SEC_ASSERT(ret == 0, ret, > + "Failed to shutdown hardware job ring %p", > + job_ring); > + > + if (job_ring->coalescing_en) > + hw_job_ring_disable_coalescing(job_ring); > + > + if (job_ring->jr_mode != SEC_NOTIFICATION_TYPE_POLL) { > + ret = caam_jr_disable_irqs(job_ring->irq_fd); > + SEC_ASSERT(ret == 0, ret, > + "Failed to disable irqs for job ring %p", > + job_ring); > + } > + > + return ret; > +} > > /* > * @brief Release the resources used by the SEC user space driver. > @@ -42,31 +175,195 @@ int caam_jr_logtype; > static int > caam_jr_dev_uninit(struct rte_cryptodev *dev) > { > + struct sec_job_ring_t *internals; > > if (dev == NULL) > return -ENODEV; > > + internals = dev->data->dev_private; > + rte_free(dev->security_ctx); > + > + > + /* If any descriptors in flight , poll and wait > + * until all descriptors are received and silently discarded. > + */ > + if (internals) { > + shutdown_job_ring(internals); > + close_job_ring(internals); > + rte_mempool_free(internals->ctx_pool); > + } > > CAAM_JR_INFO("Closing DPAA_SEC device %s", dev->data->name); DPAA_SEC??? check rest of the code as well > > + /* last caam jr instance) */ > + if (g_job_rings_no == 0) > + g_driver_state = SEC_DRIVER_STATE_IDLE; > > - return 0; > + return SEC_SUCCESS; > } > > +/* @brief Initialize the software and hardware resources tied to a job ring. .. [snip] > diff --git a/drivers/crypto/caam_jr/caam_jr_hw_specific.h b/drivers/crypto/caam_jr/caam_jr_hw_specific.h > new file mode 100644 > index 000000000..7c8909d2b > --- /dev/null > +++ b/drivers/crypto/caam_jr/caam_jr_hw_specific.h > @@ -0,0 +1,503 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2017 NXP > + */ > + > +#ifndef CAAM_JR_HW_SPECIFIC_H > +#define CAAM_JR_HW_SPECIFIC_H > + > +#include > + > +/* > + * Offset to the registers of a job ring. > + * Is different for each job ring. > + */ > +#define CHAN_BASE(jr) ((size_t)(jr)->register_base_addr) > + > +#ifndef unlikely > +#define unlikely(x) __builtin_expect(!!(x), 0) > +#endif likely/unlikely are already defined in DPDK > + .. [snip] > + > +static inline rte_iova_t > +caam_jr_mem_vtop(void *vaddr) > +{ > + const struct rte_memseg *ms; > + > + ms = rte_mem_virt2memseg(vaddr, NULL); > + if (ms) > + return ms->iova + RTE_PTR_DIFF(vaddr, ms->addr); > + return (size_t)NULL; > +} > + > +static inline void * > +caam_jr_dma_ptov(rte_iova_t paddr) > +{ > + return rte_mem_iova2virt(paddr); > +} > + > +/* Virtual to physical address conversion */ > +static inline rte_iova_t caam_jr_dma_vtop(void *ptr) > +{ > + //return rte_malloc_virt2iova(ptr); remove this comment. > + return caam_jr_mem_vtop(ptr); > +} > + >