From patchwork Tue Oct 6 16:12:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 7336951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C92CBEEA4 for ; Tue, 6 Oct 2015 16:18:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7323820718 for ; Tue, 6 Oct 2015 16:17:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F52120604 for ; Tue, 6 Oct 2015 16:17:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZjUty-0005Dd-Si; Tue, 06 Oct 2015 16:15:42 +0000 Received: from mail-wi0-f176.google.com ([209.85.212.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZjUtv-00053f-3G for linux-arm-kernel@lists.infradead.org; Tue, 06 Oct 2015 16:15:40 +0000 Received: by wicfx3 with SMTP id fx3so166440545wic.0 for ; Tue, 06 Oct 2015 09:15:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cePiwLigPM5Rd+SUu5b9uTdAAE/IqZk54iKGMzSiyj0=; b=b5EDAAnmHrsz65/JiAyX7tnHwV2/c4GJWa0pEidABKhr9GLpNWu5WW3nG24AsA9bN4 jaHWgzMLW74np5dbSgfR7eSFXYVwbgwOKd4uZX1mshEdRt98c+Qr/2L475GF8qkC1bR7 oeWpa/2QX7o7xho2jSvkRXzed6BGu6alk7YPmDsQJaa2DBJFg7Abg0AMEsktP1QzJ0nY vZI5lHK7+8mA4wGT3JH301/aXd+Td/G9FangXFMGME9WAtFXSsqYQ/asnoIx/QZBVWwS zl+QKpNdeLuLuxDyTG0LA8dD1UafKYx6CqdqQ8qhQ9/wDWmjgviKCLxGCQ1wmplDomAM ZtFQ== X-Gm-Message-State: ALoCoQndPbcsEVZMJUsoaBv3b2949Qg7tUazz1mK796Bwk8EB48qyOMrvkCNg664/5lpAYonoCm6 X-Received: by 10.194.179.137 with SMTP id dg9mr37297224wjc.55.1444148116878; Tue, 06 Oct 2015 09:15:16 -0700 (PDT) Received: from localhost.localdomain (host81-129-171-83.range81-129.btcentralplus.com. [81.129.171.83]) by smtp.gmail.com with ESMTPSA id ki7sm33447912wjc.28.2015.10.06.09.15.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Oct 2015 09:15:16 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RESEND 3/3] hwrng: st: Report correct FIFO size Date: Tue, 6 Oct 2015 17:12:51 +0100 Message-Id: <1444147971-25778-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444147971-25778-1-git-send-email-lee.jones@linaro.org> References: <1444147971-25778-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151006_091539_310880_4254A364 X-CRM114-Status: GOOD ( 15.09 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter@korsgaard.com, kernel@stlinux.com, Lee Jones , daniel.thompson@linaro.org, pankaj.dev@st.com, linux-crypto@vger.kernel.org, festevam@gmail.com, herbert@gondor.apana.org.au MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The values supplied to the 'read random data from FIFO' arithmetic are not correct. The value fed in to initialise the iterator describes the FIFO depth, but then the iterator is treated in Bytes and subsequently increased by 2 in value for every read word. This means only 4 of the 8 available values are being read during each invocation of .read(). This change increased the device bandwidth by a factor of 2. Reported-by: Daniel Thompson Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones --- drivers/char/hw_random/st-rng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c index a1ff080..3b1432c 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -29,8 +29,9 @@ #define ST_RNG_STATUS_BAD_ALTERNANCE BIT(1) #define ST_RNG_STATUS_FIFO_FULL BIT(5) -#define ST_RNG_FIFO_SIZE 8 #define ST_RNG_SAMPLE_SIZE 2 /* 2 Byte (16bit) samples */ +#define ST_RNG_FIFO_DEPTH 8 +#define ST_RNG_FIFO_SIZE (ST_RNG_FIFO_DEPTH * ST_RNG_SAMPLE_SIZE) /* * Samples are documented to be available every 0.667us, so in theory