From patchwork Wed Sep 19 19:52:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10606433 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 3F428112B for ; Wed, 19 Sep 2018 19:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 301CA2BA2A for ; Wed, 19 Sep 2018 19:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 240852BAA1; Wed, 19 Sep 2018 19:53: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 A75CD2BA2A for ; Wed, 19 Sep 2018 19:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731253AbeITBdC (ORCPT ); Wed, 19 Sep 2018 21:33:02 -0400 Received: from mail-eopbgr00060.outbound.protection.outlook.com ([40.107.0.60]:27849 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731823AbeITBdC (ORCPT ); Wed, 19 Sep 2018 21:33:02 -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=R5XWRhLIH8haF2s6q1xacM0IwPKpDKMGkHofhx/hxD8=; b=MSREiKulNSjVLzuT3s6OER+Lg/nBDCJbQC4sXkVvVHJERFP7cRP3KwlMponsdLtarneSlc3hYJRO0KCRoRuZrP4z49bmsm1OPkBAvNP8XYzjIeB2lXuf8W65/pWeN/raZCE9hGlCkTa4v9ZHCj0sMLZdndgz4DgLa1EY/SICmiI= 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 DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 19:53:27 +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 V3 4/5] dmaengine: dmatest: Add transfer_size parameter Date: Wed, 19 Sep 2018 20:52:53 +0100 Message-Id: <1537386774-20749-5-git-send-email-seraj.alijan@sondrel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> References: <1537386774-20749-1-git-send-email-seraj.alijan@sondrel.com> MIME-Version: 1.0 X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: CWLP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::28) To DB6P191MB0245.EURP191.PROD.OUTLOOK.COM (2603:10a6:4:8e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b87d54f-51cd-4a6c-b5bb-08d61e699117 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6P191MB0245; X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ByOPk/UVpdaat44y7RvHunYs81tXxNCpP9+Skokz5Fqq/C+1J/B4QICZvbiZ9viHXYxBSlKY7tOvq6ZGNBWLrqPioafzETPcHBV1NR79moR2atTbzBHT7MaV6W1xPKEKAmfEO1R/tKBTaSCG2sonRLvFjFWP/3cvdOmcCxxutoXdt57Z585jFUjZMQpxQryPEYfcwyqhpgppn7RKDsh39OwGXQs6jat4t1VdHPKD7aV7BUenrI96xhwOiAmMVIhxaw2ULjH0IEPeC1iDIeYJH5PdC8QUHyEE1pRxUw7VAsQjQauA+L14q62kSqa9DT85XJ2vfWCK3NpSLncMB3fg/CLyk5vp4nYShSVBEQViYKmCPem7hAvxUmsk7XISpvSmJw9Bvwy6uROLTM;4:eKuMLmJ6yPkjcBPA0oH7fkVa1+8bIEQDiAkci3JOOFoauSwgueAAoA8Z0KlqPIU2rI4ecv4glS5LC3FQ5xcKaaj5vvs463Zkdu+iF4s5hOPvbvF47qXwaL2ME6uATq17PnGkDg2aQ2mDYXKx2WnDnNfvbrlamHA2xrLAdee4Ujx+31zmTF/2hGOFtwIYIIIUE/EHqDTc3uPfjLbWfShq6NzUrHZODljmvt4abhgr6x/neENERkUn+qb07VPUB4I2hx6eHLbkT9pDRtQIXQ/SmQ== 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)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051);SRVR:DB6P191MB0245;BCL:0;PCL:0;RULEID:;SRVR:DB6P191MB0245; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(316002)(16586007)(53936002)(25786009)(5660300001)(2351001)(76176011)(81166006)(50466002)(52116002)(51416003)(2906002)(36756003)(6916009)(6116002)(3846002)(14444005)(48376002)(8936002)(386003)(478600001)(81156014)(6506007)(66066001)(97736004)(486006)(107886003)(2361001)(105586002)(106356001)(6666003)(6486002)(7736002)(6512007)(4326008)(47776003)(50226002)(956004)(16526019)(11346002)(476003)(186003)(2616005)(26005)(44832011)(446003)(68736007)(305945005)(8676002)(16060500001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6P191MB0245;H:Seraj-pc.hh.imgtec.org;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB6P191MB0245;23:wIUkszKZwVxKQyi1S1S/OcsBH7f+aA71ST09U0SA3QyAmwREnRer/6dgti6g6LllNru/QNekZCuebLMJ5y6YwGyOWtWBEssUAUhFQjC1eVPwvhnncRiqbArSf7+5TRJaxIUJAfe9yG5hu4fZVNZ6z2C1dyh7A60a9Rfaiz3JzoOeWt2cQxLVYxYa/mGUDKJWf/8OeAXUmkCSQbj9v6Jg4ysI9QYwSKHXpVXWD4fcH3fqACV4u18cd1l8yGYz03T4oCcIKKdUL4l5zUPSb4czHXuFuVlPVEpGgU3K39X/KHgLsLbryMo3YiN57Xd/uZmKIswrEwPo7RGbuTdGMdSgMd321zPpwvHuhmvBrK0PIUl1eUOQEFHcWLwNDUyH+bRj0dLEcHpqMH79VZLuHB1S8SZgXYx8VroaQAHJtuZLI8cCSnm0NaAKSEHkKDDAI/snIcHVoZoCRO0qwTOMM3/trhr9L0oM7+QpJV2aIrqs006EeMe2pAadr0uexpkx7MD4jF3UrJNj6WtmpviKra9HBGp5yMqfu60cgr/E6SUgU4JzDe7Xtmo6QoZAjXNN/7zCVOPfWTOl3gJ3E5ZLBjsdqND5TcRLZtqISTzDu/N0budh0hzeNlOkKaIenEOO/niE0U7XQNx9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KcSQDugNU7r7wSN8GYIhCMmRmaD4Py8O1g4RVZX39VtYGOvttuFpyFoeEFq+EcLYmArzkC/dQJM44skpprn6OTjwTw16vvRVDPe2iyeT+ZI8CaU91HplRhVChwgSkLOiTuWPhQQu3RS/nWLeZOncWzwlamZWk9/As8/7m3vEL6AFaqfGePMPc5/oGtoOmiM3r/9Yb0aBSEBA7OURRrPOACMTQvb9oNu4p6UFkZkHZBe+Vnc/9ZKRTABKAZ6dCeaFR/yTjE/LWyj6z184JoBT+MPbOkcdfIsPpZNspH7njjyvuxMHej+fsd3NNM4/ISAm/JjFe/dQdh15oscX4aV6OZLM0KbJd1kYDZwjyTJDQRqJT5M1MDXh5qPIurF8fE24zoQ5zdxEd4krcFyBPQUXRzoxA2fuYHaTikb8W3gWD6eBX+pB1x9WMS5RE+w==;5:F0UyA1LGxLf9kGrO/adwk2hcUWSKPMGT/ToA4QGadMf0+SmC0WH/Ay030crVrXyz20dR7FiUhCQdrx3bRTxGqEBm7cHIJLD6Giloe2IokOh0dfKQ6RHmvQp6TPgl8pfCT7vxfsgjYymQ5h3GTKrO7zOoxHdGpVAUQe/mqIB6zDo=;7:nkIigE+O+eJQXVD7/03GKtREm+xXMaRjHGnTriXZJiNLDG3yFC50enLnAYY5Wv++REmsI3h6AbqGrSX/NhvjpsPFzM5VpbFSOibEaiIoMk+cRRko2I5ukYv9NWKlKkgU7J16R4yttYIPXlWYrrn0usa7meA96ukOCwekMBe44bApBx1RTlrV2nBQBG7/zIvIN1tUIX/bT8nfKuNlzzRNGO2v4oECTCV4XM/MN6yFdphmpaOHtu2T+4oIztQB/mb5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2018 19:53:27.1781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b87d54f-51cd-4a6c-b5bb-08d61e699117 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P191MB0245 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 300fe4c..b6e613b 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; }; /** @@ -643,15 +648,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) { @@ -1049,6 +1064,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);