From patchwork Fri Aug 31 11:03:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10583617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A67A2112B for ; Fri, 31 Aug 2018 11:04:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 928542B486 for ; Fri, 31 Aug 2018 11:04:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84E1B2B55E; Fri, 31 Aug 2018 11:04:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 178B02B486 for ; Fri, 31 Aug 2018 11:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727574AbeHaPLd (ORCPT ); Fri, 31 Aug 2018 11:11:33 -0400 Received: from mail-eopbgr60067.outbound.protection.outlook.com ([40.107.6.67]:41216 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726990AbeHaPLd (ORCPT ); Fri, 31 Aug 2018 11:11:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kofZSURTPaPiEW8mhEhdR1I4i5/w9fo0rVOqFqMQ3WE=; b=wEFRstrcEV+rbSX+NTk/6VrXP8y/UHDwSCan35SAP97s4UCiPfEVqP7vI6gZEOOOaXOKrWKzzcf1Y4ZvQg/6be54jgxZmO8kRclwcA8QFNsZ6OcdfgMQq9y16O6ufEaADM/d8gRR+CwG+5PLEwoFbbQMIa4yeGV4CxMAHO19CWg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; Received: from Seraj-pc.hh.imgtec.org (195.88.9.101) by AM4P191MB0243.EURP191.PROD.OUTLOOK.COM (2603:10a6:200:67::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.14; Fri, 31 Aug 2018 11:04:28 +0000 From: Seraj Alijan To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, dan.j.williams@intel.com, james.hartley@sondrel.com, sifan.naeem@sondrel.com, ed.blake@sondrel.com, Seraj Alijan Subject: [PATCH V2 4/5] dmaengine: dmatest: Add transfer_size parameter Date: Fri, 31 Aug 2018 12:03:43 +0100 Message-Id: <1535713424-11322-5-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535713424-11322-1-git-send-email-seraj.alijan@sondrel.com> References: <1535713424-11322-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: VI1P195CA0048.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::37) To AM4P191MB0243.EURP191.PROD.OUTLOOK.COM (2603:10a6:200:67::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dcd98a54-acb1-42e5-4858-08d60f31855f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM4P191MB0243; X-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neS5QWUDqLtKm2pe71lhoo0E8zLczEM5aJ+wrnJRSLnFCbgQXzCQAh5V5TmMmdlAmyCcEklINWHihNtm+LxpW2tidMnxfBIJoD/6N7P0M8stx3P3gVBICUb4Zt3/EIPjXhMDpPBU5oefyDHyBlpkujW+4swHhi1vGysJD5sGxSjjVJl67zGrvzIlce5ylYAMgFYPIRcL8w3iz6G+jIqMyhSKMCUOXpGB8XZTE5rl+Ww2So7Erv64E/LOho4rd6azDXh7vbfQTfwRhDBsl7A8SyzwcUhZN2jnfVliNR3AfOGY0DgJcEIXKauNCUCeU3mzqwfo5oy/hgmNG6W14GENd/fLbzc4MT2h1ciVOU0Prn9zulBpzu42ODhBAQ3GdpFm;4:JYJmRSD0S36Isti9NPqT9Cy94s6rVzzqY9pBVDdMbtNoGOC3WxbmRgPC/LVKwz6Pdb5xn6spzPmxQUfBVxMsl7+2zLnzNlaC8DPznrJkvLGA67abjJMEZSOb0TYhUVwcp3s4UUOiWHSw0mwuiw0FE4zahyeQXNWoQqHA2LrKB2bsGsxjOB+Bc0hV2aDCQazslu2SxrgxqqFtj48rHOE/5FrmjTrR8Qy7K64tjb2n3Nf29K7n2+UIV5hwZjDEHwFOp5jvlwi5E8yvqixhngpyCg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699016);SRVR:AM4P191MB0243;BCL:0;PCL:0;RULEID:;SRVR:AM4P191MB0243; X-Forefront-PRVS: 07817FCC2D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(396003)(346002)(366004)(376002)(136003)(199004)(189003)(6916009)(6486002)(386003)(5660300001)(6666003)(53936002)(478600001)(6506007)(4326008)(16586007)(6512007)(25786009)(97736004)(14444005)(305945005)(107886003)(52116002)(51416003)(48376002)(76176011)(7736002)(50466002)(81166006)(36756003)(81156014)(8936002)(3846002)(16526019)(316002)(66066001)(26005)(2351001)(6116002)(50226002)(2906002)(106356001)(446003)(68736007)(11346002)(186003)(105586002)(2361001)(486006)(47776003)(8676002)(2616005)(956004)(476003)(44832011)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4P191MB0243;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;AM4P191MB0243;23:bjbX6qK/uOFyd6fO0EGZDabQRxdn6Ulz6lKLdGvEDFSBJvMGSMv/M+cdSUJ3HncEJVqTwzAxTMTq/hGikjGQ1if8g3w9G6ZwnNcYYNZR/OTxdT13V/FEvR0UTaT2RGz11CHRPV+2uGP1ygDnnyr/tBAQn65npqBfzvwDkstNlY2jZUud74B8vMp1I9J1WFw07SBtK4xTd9g5LIPHrMWBudqv9RiobvzYUcTVAiLiTS9EAm/A/8yNnMZuYApnfDtI/jWhSxwQsr4Q1QE+NHJnhYVJVAg61XFrFmtVZ/HGFnGOd5CC/1t5JShKH7Sybq3dB4OgeoJHYJBgKBgqKSpWSA2g/P94yMwh44VI6Snurvg+1zYMSpoQkg6CLjfxPUD5XYu0uI1mnTSDJ2cnbyTQjRfl5oQf26pEWY9jO7e9uM4JUOYZeJhORaRW14OgWpJ1nul42o03EXGtjVCrbuOkEmVPN6E0iY6ZFfSs5UMQ1UpDO8ZrH0dfbYaLK7k0cEvZzbpRYTDIbVqH9r6RE/2oacVbpxfRukvu4FeKtjLPxYu0eQ0Cfd78ymPKm34xzxTelVY/L3ORnJLu5XJRF2O2M3LCm2UlIt1A67ZqBN0KMXYe/OMh1HZxVzoQ1asECNJ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EMvGkJjDfVWkRMNNc4vXeyvTYf3YB1WU0J+LwqujwIaOtno/LX72ldPwoSf+6zpXnUS8rqal9qC+jsFofQLRdyQaq/ecfnU18FJiJc8s6Br2pMG7lckHZHQ4BH3lc1/3mK5cJGR8Zk5L7c4oWi+L2EGqOhS3gUexgBRB05FEuCl4HOiXYxZ3iuWIFIwxWtbo31c42Pc5TFcnB0E1Z5VpfU5icloZwU129wTzLgjUdU+sCJSDxq6D0t0AixdWlrXUuTO6xWue2qDA9b47jz9qf4ukkBnjoQUt+32iII8cubpuSeVnNOPEiwc2bH3qEA8l/koFBDRss8aMnGPlNR7UGQtpSgxvFgJ46jdNB4VtKKmhktqj4KM19uJ3OiSEQM9Q28Qb36nfMrX1dfQIbAfH8B0CWU71TzCkB06/026d8Pw2rtJd0mL9f2P3NTgEAVKjF8pq8ln6uGIvN5Q==;5:KRl8JH8VimbXcjcPD47E5v7PZXs3cBXvG96j4b/n1f1o4IAXoDTyD6trR+J1NQZU07wtJSAC3XaQvPDmXyNcqDaGouqJ4AAFYzleGyLYKBKLKhuukRzJDVyVOkb4RsGLFlyEge4LxKx+XtCxTMLEVaMPQVj6rW0NoIARBrW1kBs=;7:PrJho/OZIh/5cV8/XVqBRy00nxxaXThIG2He6yukE+e30HgzTYzEDDD/vLErkRYajYi9gKU8kwpxc+Y52f8m50BoufB/Hj9JhAfm16p4ls/XL5YHAgnFGNmMMpoCiEvxQUbwhPWIpAxuw9J29J6cEhjD8JDR2+/3FSl7r7qpVWxwTjGKXw06FPJdgsKuy4JBdRBqIW7Ouk0HKAv45pLuYTyjZ2bKHU81CzCpkqhiZAEFUtQzJ7TMf/PkNxxp4h5i SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2018 11:04:28.0088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dcd98a54-acb1-42e5-4858-08d60f31855f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4P191MB0243 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Existing transfer size "len" is either generated randomly or set to the size of test_buf_size. In some cases we need to explicitly specify a transfer size that is different from the buffer size and non aligned to test the target device's ability to handle unaligned transfers. This patch adds optional parameter "transfer_size" to allow setting explicit transfer size for dma transfers. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index c980865..937acb0 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -83,6 +83,10 @@ static int alignment = -1; module_param(alignment, int, 0644); MODULE_PARM_DESC(alignment, "Custom data address alignment taken as 2^(alignment) (default: not used (-1))"); +static unsigned int transfer_size; +module_param(transfer_size, uint, 0644); +MODULE_PARM_DESC(transfer_size, "Optional custom transfer size in bytes (default: not used (0))"); + /** * struct dmatest_params - test parameters. * @buf_size: size of the memcpy test buffer @@ -108,6 +112,7 @@ struct dmatest_params { bool noverify; bool norandom; int alignment; + unsigned int transfer_size; }; /** @@ -636,15 +641,25 @@ static int dmatest_func(void *data) break; } - if (params->norandom) + if (params->transfer_size) { + if (params->transfer_size >= params->buf_size) { + pr_err("%u-byte transfer size must be lower than %u-buffer size\n", + params->transfer_size, params->buf_size); + break; + } + len = params->transfer_size; + } else if (params->norandom) { len = params->buf_size; - else + } else { len = dmatest_random() % params->buf_size + 1; + } - len = (len >> align) << align; - if (!len) - len = 1 << align; - + /* Do not alter transfer size explicitly defined by user */ + if (!params->transfer_size) { + len = (len >> align) << align; + if (!len) + len = 1 << align; + } total_len += len; if (params->norandom) { @@ -1042,6 +1057,7 @@ static void add_threaded_test(struct dmatest_info *info) params->noverify = noverify; params->norandom = norandom; params->alignment = alignment; + params->transfer_size = transfer_size; request_channels(info, DMA_MEMCPY); request_channels(info, DMA_MEMSET);