* [PATCH v3] hw/misc: Set valid access size for Exynos4210 RNG
@ 2024-06-18 16:37 Zheyu Ma
2024-06-21 14:54 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2024-06-18 16:37 UTC (permalink / raw)
To: Igor Mitsyanko, Peter Maydell
Cc: Zheyu Ma, Philippe Mathieu-Daudé, qemu-arm, qemu-devel
The Exynos4210 RNG module requires 32-bit (4-byte) accesses to its registers.
According to the User Manual Section 25.3[1], the registers for RNG operations
are 32-bit. This change ensures that the memory region operations for the
RNG module enforce the correct access sizes, preventing invalid memory accesses.
[1] http://www.mediafire.com/view/8ly2fqls3c9c31c/Exynos_4412_SCP_Users_Manual_Ver.0.10.00_Preliminary0.pdf
Reproducer:
cat << EOF | qemu-system-aarch64 -display none \
-machine accel=qtest, -m 512M -machine smdkc210 -qtest stdio
readb 0x10830454
EOF
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
Changes in v3:
- point to the device specification
---
hw/misc/exynos4210_rng.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c
index 0756bd3205..674d8eece5 100644
--- a/hw/misc/exynos4210_rng.c
+++ b/hw/misc/exynos4210_rng.c
@@ -217,6 +217,8 @@ static const MemoryRegionOps exynos4210_rng_ops = {
.read = exynos4210_rng_read,
.write = exynos4210_rng_write,
.endianness = DEVICE_NATIVE_ENDIAN,
+ .valid.min_access_size = 4,
+ .valid.max_access_size = 4,
};
static void exynos4210_rng_reset(DeviceState *dev)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] hw/misc: Set valid access size for Exynos4210 RNG
2024-06-18 16:37 [PATCH v3] hw/misc: Set valid access size for Exynos4210 RNG Zheyu Ma
@ 2024-06-21 14:54 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2024-06-21 14:54 UTC (permalink / raw)
To: Zheyu Ma
Cc: Igor Mitsyanko, Philippe Mathieu-Daudé, qemu-arm, qemu-devel
On Tue, 18 Jun 2024 at 17:37, Zheyu Ma <zheyuma97@gmail.com> wrote:
>
> The Exynos4210 RNG module requires 32-bit (4-byte) accesses to its registers.
> According to the User Manual Section 25.3[1], the registers for RNG operations
> are 32-bit. This change ensures that the memory region operations for the
> RNG module enforce the correct access sizes, preventing invalid memory accesses.
>
> [1] http://www.mediafire.com/view/8ly2fqls3c9c31c/Exynos_4412_SCP_Users_Manual_Ver.0.10.00_Preliminary0.pdf
>
> Reproducer:
> cat << EOF | qemu-system-aarch64 -display none \
> -machine accel=qtest, -m 512M -machine smdkc210 -qtest stdio
> readb 0x10830454
> EOF
>
> Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
> Changes in v3:
> - point to the device specification
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-21 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 16:37 [PATCH v3] hw/misc: Set valid access size for Exynos4210 RNG Zheyu Ma
2024-06-21 14:54 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).