From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0060.outbound.protection.outlook.com [104.47.34.60]) by dpdk.org (Postfix) with ESMTP id C30425F6E for ; Fri, 9 Mar 2018 09:35:55 +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=tOG9hQRgjdkAqfKoG3iSS9Pefmhj2/XpefklAtVxhOYUvHhbVULmAg3fkZUWATNbafN/heoTyCMeElUYWEbtWgFCae0rOftIrOu7vs6d5cWJLELQwZLawWtn+jef6wGS7hAwx/C6He3utyTkqalcut+JEME3rDlV+8o8DC7NLOY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by MWHPR12MB1518.namprd12.prod.outlook.com (2603:10b6:301:b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.14; Fri, 9 Mar 2018 08:35:53 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Fri, 9 Mar 2018 03:35:09 -0500 Message-Id: <1520584520-130522-9-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520584520-130522-1-git-send-email-Ravi1.kumar@amd.com> References: <1515577379-18453-1-git-send-email-Ravi1.kumar@amd.com> <1520584520-130522-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: MA1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:20::12) To MWHPR12MB1518.namprd12.prod.outlook.com (2603:10b6:301:b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a84d9e6c-88a0-4487-fee3-08d58598c5d1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR12MB1518; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 3:CkeC7lOWCGn1fYlA5V44Ro4+pA77fsmoZI+10VrWPz+wbAkDfOjLghpQAU9iCVrWQJUyVI5thr55Cw99p3KhaNUJ3JZSe2o5sOqCrRyz2KfpS/w0cRwkoouKCIlwQHC2A7Xrb9W3l9Spcso4dXciwhjBUL8Jl0GfQ/aoetC625IkYvwk8cl+NclbDapQXyuICcIx9PGH/msXbjvSz/JRzLLj3WU6f7IyAwg4IycOwY5nXNetnxusPPEMo2t2Q/6B; 25:j0uTMK+U6kkZg8Pz0elvFkexbij8v+eEbOtUViXuYyV9uF/ZmGkSIXUfr54ULmr5qXcI+69uDpd7+B5JMlJx9LjFJ324FwQVLCa7nQg7krlt0pX7jzXyH3ogpvL+3W2u3clPhUtAzqUgCmtaVGs4fCC2YeV/J9JLWy91+ITSgsL5KzwtgLnn/Se58IZcF+TxotUSugD9MEUYj9nWXsygcjBK1MtCPw0P47jzvu5FamHu7qwsQQFOTRdqxpHfuTAubsWsPG2OQKgS1ul7BusteK+a/+WIuElogE7a/gtJz/TGHZour48Us5M3wHc+cFwWyZyVY22lRkNVKDZZFHAAdw==; 31:AGY/ft8XjtKibnr44feWvUou8VZzEHSfMcoQ+uJz1fQ1oyu2pB7XfrQqqhOUCzKLZmAHvVoQQETVOMgM06swPDyY5u6tjItobET9kKW+WWVYtf7KA+ggMakPac0aM2yhYeehVqEm0B2XYr4CcT+0PffqOMVmfEl+TlHCD0GgeleCwtw1dEm9BfUDmKq/3wAKqWGLUfMdKp9wO7BFiHEBg9XO+Dv92VSURis/ZYTZQZA= X-MS-TrafficTypeDiagnostic: MWHPR12MB1518: X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 20:XujoDHTgGRTBbLghhjU5Thw4jzUHyW5dUhpeiWk8Pi2lxHc2MvczAMxNqQQojp2u69da0/MvyMXf8T9BMcL39gAB/j4MNAqN9Fpe9sd2eL/ZVvVFVAHYN+JNtzaAMBkEuPhvcIdkFAFHnkLPW+1nd+GL1xjHgIZBhyLsYeL+FY6SOYIpigkypn+l6mtOQ3NigmU8MKS4oMVl4WtwAUzJ70vGO7i3zWvVK+f7s3urrPVHmNY9U3VsbP6XX0HJRCEeZpc084IpY/w+ZVa+QfriblPSFJC7YtbNTL2wCt6yhdxDOnBOmdIrYHTfdrqZjoDG2ELpKKATTFF1Oz2ef/R4cLWe4cTnMI0LqpZz21vm8lCFyCTUm+7A7eNEIWMf96+4XswN9eBq+HsvoT78o8QF0Okw03EtNG5MgapcAoerDMDZhueoTl9ANzy455dZK3qEcJnWtuZQXCew2hPRPn+CPhFPx39G2DRMctkG9uvzguqfSmBMVqN2/u6U9O8JpSxk; 4:BBZa3QLAWkAEgpUpL+N9mLmIUYKkxlsNRy4Cq0nfoxQCg9bTCS9S+Z9LWCUQM6DA8me1j9jZMZptZFBFyNnuWb2QuGnju84vM7MdfZ+8ZICw4sPPy+1R+0l/Bcm9i5LOvFhffDXRZvNloxicvtmf7WHDuJpRmQCerDbjM5DL1GUxePDHuKgz9xQquXORPMaHGKEFc6s5PcHeW/jaRrwVRYtjR40tDnWgc1dpr7PsM1kx0T4yz22c2Eda6Eq0M/JB5M4vwftFZhXs8QTSwiOCMtAN14LszBbdMyaG9Qrher+VdtuPYK3VWNKzJRaegHUD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231220)(944501244)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR12MB1518; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1518; X-Forefront-PRVS: 0606BBEB39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(366004)(376002)(346002)(199004)(189003)(16586007)(26005)(81156014)(16526019)(8676002)(186003)(81166006)(25786009)(7736002)(3846002)(386003)(305945005)(4326008)(6116002)(6666003)(316002)(86362001)(76176011)(52116002)(8936002)(51416003)(575784001)(50226002)(5660300001)(2906002)(2950100002)(6916009)(7696005)(36756003)(106356001)(105586002)(6486002)(68736007)(48376002)(97736004)(53416004)(2361001)(2351001)(53936002)(50466002)(478600001)(47776003)(66066001)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1518; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; MWHPR12MB1518; 23:QIIr0r42Jn07KkDhgVdPp860IsyXL7ms2oeZINEkp?= =?us-ascii?Q?XLGzmGNLDmH9YuNCV7IfKxHLNdECUPiAdkZOZEbdlfNO1iN+anl20hDBqxXt?= =?us-ascii?Q?CqSO7KFGVX+1JDHJ8fnpcmBnJ4LD0R3iax0QzYBW/UC0J5PoYBxgsGeMw3BT?= =?us-ascii?Q?Tx+Yv2WoJEZh6Pd0fQkDcj9syqBukz4P081iJtSNBjbTmklaSr1MZYuCm/a5?= =?us-ascii?Q?7ux8PMF4+55o4z4w6MDrfgS8lwKBORWuqNkzuSpYxrsDkAm7ieZX/glQAngY?= =?us-ascii?Q?Jk/2vXGPW0wUBWRx7ELxFBQfNBm6j0DdTNbUL4zDiN3CZ9cHdunNV1q8rD7W?= =?us-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FWorCZLnuIGkYxer1ADWvGHeJq+CJ1gYM5xRjJ0A9DPYg2EixXFFagRTIY+SHXYd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 20:R9P4Eiq9oLzsu6n+bReA9+r1JUjE1xUjm4Qs+OHHPCINyCMr+VJDXscrcIApMqC5pFvUfdgKi3sTrFfSaaTB7yjBEI1kbsbY5EJ8pKh3vdpL9DIx9zH68pVu4Eu2aeM9VWh29xbsUcNRhho2lNPEA2ywKnDepEyF+OuF8SPDS8KGzC+PkBg0xak0Zi3JJN/OipGs34cFTNq8TPktgZnJ3reBT/yNmf4HGwIaAgwEU/tyfr7hxqyfmeUQ9WdzFXYP X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2018 08:35:53.4752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a84d9e6c-88a0-4487-fee3-08d58598c5d1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1518 Subject: [dpdk-dev] [PATCH v4 09/20] 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: Fri, 09 Mar 2018 08:35:56 -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