* [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property
@ 2017-05-22 21:12 Rick Altherr
2017-05-22 21:12 ` [PATCH v2 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data Rick Altherr
2017-06-01 5:07 ` [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Rick Altherr @ 2017-05-22 21:12 UTC (permalink / raw)
To: linux-crypto
Cc: devicetree, linux-kernel, Rob Herring, Herbert Xu, Mark Rutland,
Matt Mackall
Signed-off-by: Rick Altherr <raltherr@google.com>
---
Changes in v2: None
Documentation/devicetree/bindings/rng/timeriomem_rng.txt | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/rng/timeriomem_rng.txt b/Documentation/devicetree/bindings/rng/timeriomem_rng.txt
index 6616d15866a3..214940093b55 100644
--- a/Documentation/devicetree/bindings/rng/timeriomem_rng.txt
+++ b/Documentation/devicetree/bindings/rng/timeriomem_rng.txt
@@ -5,6 +5,13 @@ Required properties:
- reg : base address to sample from
- period : wait time in microseconds to use between samples
+Optional properties:
+- quality : estimated number of bits of true entropy per 1024 bits read from the
+ rng. Defaults to zero which causes the kernel's default quality to
+ be used instead. Note that the default quality is usually zero
+ which disables using this rng to automatically fill the kernel's
+ entropy pool.
+
N.B. currently 'reg' must be four bytes wide and aligned
Example:
--
2.13.0.303.g4ebf302169-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data
2017-05-22 21:12 [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Rick Altherr
@ 2017-05-22 21:12 ` Rick Altherr
2017-06-01 5:07 ` [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Rick Altherr @ 2017-05-22 21:12 UTC (permalink / raw)
To: linux-crypto; +Cc: linux-kernel, Thomas Gleixner, Herbert Xu, Matt Mackall
When a hw_random device's quality is non-zero, it will automatically be
used to fill the kernel's entropy pool. Since timeriomem_rng is used by
many different devices, the quality needs to be provided by platform
data or device tree.
Signed-off-by: Rick Altherr <raltherr@google.com>
---
Changes in v2:
- Adjust header comment for platform data quality property to match code
and DT bindings
drivers/char/hw_random/timeriomem-rng.c | 7 +++++++
include/linux/timeriomem-rng.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index a0faa5f05deb..03ff5483d865 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "missing period\n");
return -EINVAL;
}
+
+ if (!of_property_read_u32(pdev->dev.of_node,
+ "quality", &i))
+ priv->rng_ops.quality = i;
+ else
+ priv->rng_ops.quality = 0;
} else {
period = pdata->period;
+ priv->rng_ops.quality = pdata->quality;
}
priv->period = ns_to_ktime(period * NSEC_PER_USEC);
diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h
index 46eb27ddbfab..3e00122bcf88 100644
--- a/include/linux/timeriomem-rng.h
+++ b/include/linux/timeriomem-rng.h
@@ -13,4 +13,7 @@ struct timeriomem_rng_data {
/* measures in usecs */
unsigned int period;
+
+ /* bits of entropy per 1024 bits read */
+ unsigned int quality;
};
--
2.13.0.303.g4ebf302169-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property
2017-05-22 21:12 [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Rick Altherr
2017-05-22 21:12 ` [PATCH v2 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data Rick Altherr
@ 2017-06-01 5:07 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2017-06-01 5:07 UTC (permalink / raw)
To: Rick Altherr
Cc: linux-crypto, devicetree, linux-kernel, Rob Herring,
Mark Rutland, Matt Mackall
On Mon, May 22, 2017 at 02:12:23PM -0700, Rick Altherr wrote:
> Signed-off-by: Rick Altherr <raltherr@google.com>
Both patches applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-01 5:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 21:12 [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Rick Altherr
2017-05-22 21:12 ` [PATCH v2 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data Rick Altherr
2017-06-01 5:07 ` [PATCH v2 1/2] dt-bindings: timeriomem_rng: Add entropy quality property Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®