Message ID | 20240612135443.30239-4-kabel@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Updates for turris-mox-rwtm driver | expand |
On Wed, 12 Jun 2024, Marek Behún wrote: > The 4096 bytes limit in mox_hwrng_read() is due to the DMA buffer being > allocated to one PAGE_SIZE bytes. The PAGE_SIZE macro is used when > allocating the buffer, use it in mox_hwrng_read() as well. > > Signed-off-by: Marek Behún <kabel@kernel.org> > --- > drivers/firmware/turris-mox-rwtm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c > index 3f4758e03c81..5acdde1bb6d9 100644 > --- a/drivers/firmware/turris-mox-rwtm.c > +++ b/drivers/firmware/turris-mox-rwtm.c > @@ -287,8 +287,8 @@ static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) > struct armada_37xx_rwtm_tx_msg msg; > int ret; > > - if (max > 4096) > - max = 4096; > + if (max > PAGE_SIZE) > + max = PAGE_SIZE; Wouldn't it be better to bind these to the alloc side with a local define that is set to PAGE_SIZE?
On Thu, 13 Jun 2024 11:01:42 +0300 (EEST) Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote: > On Wed, 12 Jun 2024, Marek Behún wrote: > > > The 4096 bytes limit in mox_hwrng_read() is due to the DMA buffer being > > allocated to one PAGE_SIZE bytes. The PAGE_SIZE macro is used when > > allocating the buffer, use it in mox_hwrng_read() as well. > > > > Signed-off-by: Marek Behún <kabel@kernel.org> > > --- > > drivers/firmware/turris-mox-rwtm.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c > > index 3f4758e03c81..5acdde1bb6d9 100644 > > --- a/drivers/firmware/turris-mox-rwtm.c > > +++ b/drivers/firmware/turris-mox-rwtm.c > > @@ -287,8 +287,8 @@ static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) > > struct armada_37xx_rwtm_tx_msg msg; > > int ret; > > > > - if (max > 4096) > > - max = 4096; > > + if (max > PAGE_SIZE) > > + max = PAGE_SIZE; > > Wouldn't it be better to bind these to the alloc side with a local define > that is set to PAGE_SIZE? OK.
diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 3f4758e03c81..5acdde1bb6d9 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -287,8 +287,8 @@ static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) struct armada_37xx_rwtm_tx_msg msg; int ret; - if (max > 4096) - max = 4096; + if (max > PAGE_SIZE) + max = PAGE_SIZE; msg.command = MBOX_CMD_GET_RANDOM; msg.args[0] = 1;
The 4096 bytes limit in mox_hwrng_read() is due to the DMA buffer being allocated to one PAGE_SIZE bytes. The PAGE_SIZE macro is used when allocating the buffer, use it in mox_hwrng_read() as well. Signed-off-by: Marek Behún <kabel@kernel.org> --- drivers/firmware/turris-mox-rwtm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)