From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by dpdk.org (Postfix) with ESMTP id 61EDB1B231 for ; Wed, 10 Jan 2018 10:43:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ik5N05DF0rNI8a+4yTIqHdwqsm1UXAVIA6T1f8qFnFA=; b=uMnGIwKc9j5HPqGzkFTyo+fdL2DSrEuZJMKKzCfQhL6a99ZAjYjcq0R9bzUhfw122VcVo4i6QRmOr+EAjo5knDn6M06xral4O/kKBu3u+HPd9Tr3M2mXmAYV/0eD4XfmEA4OzwRmnrtzq3iicgKMxI9z0yhLMkYs+KP2AV62GtY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by CY4PR12MB1509.namprd12.prod.outlook.com (10.172.68.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 09:43:33 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Wed, 10 Jan 2018 04:42:49 -0500 Message-Id: <1515577379-18453-9-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515577379-18453-1-git-send-email-Ravi1.kumar@amd.com> References: <1515145198-97367-1-git-send-email-Ravi1.kumar@amd.com> <1515577379-18453-1-git-send-email-Ravi1.kumar@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0024.INDPRD01.PROD.OUTLOOK.COM (10.174.62.34) To CY4PR12MB1509.namprd12.prod.outlook.com (10.172.68.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 69e29119-9ed1-4063-4652-08d5580e9db0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020049)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR12MB1509; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 3:BWoEvwxUdPg+YTfhGCx7PLCp87yz0gxnIy56YdEOehtgu6qNL6l0iqGKXmBO2I/eGOG/nbnN+x0eSKce0K1PygdzRUOIHsR1/f5tl73RwnEdvTsx6HyBjcZh55eQdZKggcOOkAR2bDfHGIDGGrQeZxmkDuJdYVUUwChvUrOlPGILmg09f5s/7AQhol68AnWqVF9DSkb4OuF8RPw1uA7QAUmxmza53d3ctFy++/Ui0QSiHEmEzyXwvjz51C/B+7Ct; 25:OZwei+hhTncwFHtfcErAzOENwLjggmF7inY4OuhHjbtpxXUas6oIntw0ZXPmgE+cKkBQtaRy8VxfdBAqU4p2JwsGgcBwHoqU3Jv4/4A0vzMsI/t2lbxrRRNsVdzshQnTd+98kAsH26BqrqmZHcI0njvF7SGG+BONHI1zNZOj/vMj5K3gxLryb1mQ7lZ6eyItlwGJZRmTckmjdhauigaWs/BOsuM7GT0upjmJNLr82D507atc/vJaNpvrOFF7z+jnmErfYmfCC24cykXddIU9LO/WU9ij0+BFjM9GepoquHM61LdQ4yRH7Y/R3z47psP4Mkr5RZa5DMvf/nUZcA8e6A==; 31:JFNhBanljkIhghB3l4o679qFThwqSx7nR+h+K2QIzelPrmBso4f1tUFEuYpZ68g/Vo9Ug5BC+1Uwn6WrgdfVl9ErJ+eJvmZwk2m9+K/k25bc2MYxo4qrfFjQKASXXsGClmzZ3sKyfwPAvAQb4PQiDc+b1h0ahkmoTYtGbHTyMCEOtUQtTxdHyrMSTn0aI8EAFxrkWbUmDHyON1XBeRp1Yzbk9drbrPxt2zzHeZfO37I= X-MS-TrafficTypeDiagnostic: CY4PR12MB1509: X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 20:MhOTVOOZ/Qne++g+9dDyskSlwL+cXuwHSwgWZ6l0HR21icvBltiVSgOc1tbUtLH1jkrMl5ld3wydoyexCM4S9iXy2KA6KVeZDIO9/p77fiJq+sqU8pQCX1NepEVqcEy2TQlBkAYxSZ4/2Ze/DniwceQBjR4D8S7rjm/RIbubLjfuRaeH2joNe+6Xwt+iaD1s4rUy794xf4LQYk/dWvK1U112I/V1lVGKz0vwz7XtKpL4DIJwp+CgYr61LgPl16x3NTjTawNEs3757r/WIuzxTdqPsnSGA8Vtm4VA7DEYesw96y6WJBmCu9d0R+I/KawRJfLhXyjLpMjnMgIH9CFd0OxviDW+h2TlS+grsowllkD75WN/PTTy4rSeIHYYDinHYtOYJpocTr3AzmanH0hVNlGF8OUSPtN78oyQVpbId0/K5xFKABu7d/h7zbMQmUY3zF1VRFWZak3FXVemas120+bEMeS2bQ3MRdgKUq9pNu4BicEnWPb7lqW2dymGi1Q9; 4:xbW6loq/UGIk8+NHquKhTjF1HqM5FcIJFELw47UHJgWH7ecFSoH8fXe6IoHX0kSupmuLQdp6nC0XkR+9oXv2tVCe6P6cLEoerwiT4FMqXXsXIWthMI7Tblkci91BciQ79aAGAkXkpHv91WKVOUQ6/ypDvuLq34qpMd/+fHdUXppwrwehl7OgQ6BV8dqQm9a32xZwOqGcZ3HsgUi+QMzmwDeCLyZYmLXH5GrZCH8JcMTECvXRocPlsaQIyPtrXWWRtP9sJCP/gK8UkNUp7qAG+3CclSz+NVxav4Bxtnr7GEg0lI/g+VvhMgolDe9qDhiJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231023)(944501119)(6055026)(6041268)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR12MB1509; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR12MB1509; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(39380400002)(189003)(199004)(25786009)(8676002)(81166006)(47776003)(48376002)(6666003)(2950100002)(81156014)(6916009)(66066001)(50226002)(68736007)(36756003)(8936002)(16586007)(72206003)(50466002)(16526018)(316002)(53936002)(478600001)(5660300001)(86362001)(575784001)(4326008)(386003)(2361001)(2351001)(6486002)(53416004)(97736004)(51416003)(76176011)(106356001)(105586002)(7736002)(6116002)(3846002)(2906002)(305945005)(7696005)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1509; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1509; 23:Ne+rW8f2TM5htwsKb9+GFfkSL6+IiC7keUIMghagK?= =?us-ascii?Q?h8jLAjkiNiteiTyYal25ZdRNhyfzA/wpa01qvcYce/OIVOdm1JohD1E565wn?= =?us-ascii?Q?+OxwZqDXxds4hhXcnyZZCpRzX32hZZ7YBR6Ut3gQfuVYwp/eWyif8Qru7/go?= =?us-ascii?Q?jG6do/liYZn5Gb2VhFNjZnWFCxycHUWdtJqcHLhQzfPxlrv620+c2QOaAg6u?= =?us-ascii?Q?FkpVlK9kTJUdgNXZeqfTzxLAbFfLyfgR7mpsTydUt5monKOMhIhyqjm8Sp+I?= =?us-ascii?Q?SXdI74E4kVCTS6KNwzflnfYHgEtoRCx6qn1LKz1Odq8ICLMA2R1Pn9Y4K/jq?= =?us-ascii?Q?v7S2TIdwg7HZa9WA/fK8So3rfZ/6zogLCVG0DOV54uJ3Y1uXqdeOpxx6q66v?= =?us-ascii?Q?IX9N2kcI/2CVwd/nn3+rmTXAuvbzAacDsaF09ROnGMiyFjKJA+21DWqih7bb?= =?us-ascii?Q?xBBw66lY6UahB9Yh0ah71GCHuoH6mGQZntoiFib4lhSjlY7xXYh308G+sbvn?= =?us-ascii?Q?Fv3yEE2KPuGRIHmluNWW4WEonDgcla53IkV4j5MnILjp11HFDdu6XkND1xIO?= =?us-ascii?Q?RjdDg9bbwEezuqoXGV0rFb16UYxMjIv9F7eBVo8ryTjPq3OtXxTTDg/KWg5L?= =?us-ascii?Q?c0qgnkGieeOo+qeO6mmiPYHVplAOy9vNMtQJwRep+c4a/2aRsf8lKt7asHEr?= =?us-ascii?Q?g3VnvFIu8iSkFDrBbVI9/9kVBG7S3rqXRT5HBwrO0y/etSVUGhmIAHWU0n1Q?= =?us-ascii?Q?u3Mc4AXuvjkm5PDQ8s6Ov65DUi9iBDCzLcNMF+aXQgW91XW9aKfl2TgQTUUc?= =?us-ascii?Q?R8LusnOt4sB5VzCanBbNKBwxhyLzWpiNXDjvnI7R8QmpMrtQBp6Ca2J8GvEu?= =?us-ascii?Q?+Thc3L5zxYhVbC8359CL1IMn1IgcikFvGmA9wGAPseLpVebjzy+LmwAe4C0y?= =?us-ascii?Q?/MFfmzHiFvubV0RpLpG5UTD5dioIpL+l2/dbtCHYI0DKDndnGHwNHKbed9kx?= =?us-ascii?Q?bR9aWmx800iNtkJT1fv/cS5sIw7gHAjFh5DUMroKvGzrTuFGKBBzBfB1w75T?= =?us-ascii?Q?u/BHY26nTVjYeFVqYDDcNZ9sep85C1x4TF0m+RIJygcOJu2PFgBtr1ol2vs8?= =?us-ascii?Q?5zADvb1719PolDxc14qwoNG5mbytn5zGe1D3pdxcu4DCD8LxrFHhw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 6:vRCkcUc9KV2BMAuBn06HMoPvZm0pirZS9hZeD57bKoAZXbR+4eySNJewyUizN9ec2MjD5ARHHHHfD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JsaMgyZzhgG6mtNaSMFnZ7rUUnUnNkBb/xIZZ7k4E9DMgZt6ZFL8vyh7uQw0mPLF3likL2lNeA7FtPJOBWMg9PXYF3GSjz X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 09:43:33.1936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69e29119-9ed1-4063-4652-08d5580e9db0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1509 Subject: [dpdk-dev] [PATCH v3 09/19] crypto/ccp: support ccp hwrng feature 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: Wed, 10 Jan 2018 09:43:36 -0000 Signed-off-by: Ravi Kumar --- drivers/crypto/ccp/ccp_dev.c | 20 ++++++++++++++++++++ drivers/crypto/ccp/ccp_dev.h | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/crypto/ccp/ccp_dev.c b/drivers/crypto/ccp/ccp_dev.c index fee90e3..d8c0ab4 100644 --- a/drivers/crypto/ccp/ccp_dev.c +++ b/drivers/crypto/ccp/ccp_dev.c @@ -88,6 +88,26 @@ ccp_allot_queue(struct rte_cryptodev *cdev, int slot_req) return NULL; } +int +ccp_read_hwrng(uint32_t *value) +{ + struct ccp_device *dev; + + TAILQ_FOREACH(dev, &ccp_list, next) { + void *vaddr = (void *)(dev->pci.mem_resource[2].addr); + + while (dev->hwrng_retries++ < CCP_MAX_TRNG_RETRIES) { + *value = CCP_READ_REG(vaddr, TRNG_OUT_REG); + if (*value) { + dev->hwrng_retries = 0; + return 0; + } + } + dev->hwrng_retries = 0; + } + return -1; +} + static const struct rte_memzone * ccp_queue_dma_zone_reserve(const char *queue_name, uint32_t queue_size, diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h index cfb3b03..a5c9ef3 100644 --- a/drivers/crypto/ccp/ccp_dev.h +++ b/drivers/crypto/ccp/ccp_dev.h @@ -47,6 +47,7 @@ /**< CCP sspecific */ #define MAX_HW_QUEUES 5 +#define CCP_MAX_TRNG_RETRIES 10 /**< CCP Register Mappings */ #define Q_MASK_REG 0x000 @@ -223,6 +224,8 @@ struct ccp_device { /**< protection for shared lsb region allocation */ int qidx; /**< current queue index */ + int hwrng_retries; + /**< retry counter for CCP TRNG */ } __rte_cache_aligned; /**< CCP H/W engine related */ @@ -454,4 +457,12 @@ int ccp_probe_devices(const struct rte_pci_id *ccp_id); */ struct ccp_queue *ccp_allot_queue(struct rte_cryptodev *dev, int slot_req); +/** + * read hwrng value + * + * @param trng_value data pointer to write RNG value + * @return 0 on success otherwise -1 + */ +int ccp_read_hwrng(uint32_t *trng_value); + #endif /* _CCP_DEV_H_ */ -- 2.7.4