On Thu, 13 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. Use new local macro constant > RWTM_DMA_BUFFER_SIZE at allocation time and when used in mox_hwrng_read(). > > Signed-off-by: Marek Behún > --- > drivers/firmware/turris-mox-rwtm.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c > index 3f4758e03c81..b8deb13aed98 100644 > --- a/drivers/firmware/turris-mox-rwtm.c > +++ b/drivers/firmware/turris-mox-rwtm.c > @@ -19,6 +19,8 @@ > > #define DRIVER_NAME "turris-mox-rwtm" > > +#define RWTM_DMA_BUFFER_SIZE PAGE_SIZE > + > /* > * The macros and constants below come from Turris Mox's rWTM firmware code. > * This firmware is open source and it's sources can be found at > @@ -287,8 +289,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 > RWTM_DMA_BUFFER_SIZE) > + max = RWTM_DMA_BUFFER_SIZE; > > msg.command = MBOX_CMD_GET_RANDOM; > msg.args[0] = 1; > @@ -479,8 +481,8 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) > return -ENOMEM; > > rwtm->dev = dev; > - rwtm->buf = dmam_alloc_coherent(dev, PAGE_SIZE, &rwtm->buf_phys, > - GFP_KERNEL); > + rwtm->buf = dmam_alloc_coherent(dev, RWTM_DMA_BUFFER_SIZE, > + &rwtm->buf_phys, GFP_KERNEL); > if (!rwtm->buf) > return -ENOMEM; Reviewed-by: Ilpo Järvinen -- i.