* [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian
@ 2025-03-12 10:48 Philippe Mathieu-Daudé
2025-03-12 11:13 ` Peter Maydell
2025-03-12 12:54 ` Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-12 10:48 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Peter Maydell, Tony Nguyen, Philippe Mathieu-Daudé
We only build ARM system emulators using little
endianness, so the MO_TE definition always expands to
MO_LE, and DEVICE_TARGET_ENDIAN to DEVICE_LITTLE_ENDIAN.
Replace the definitions by their expanded value, making
it closer to the Armv7-M Architecture Reference Manual
(ARM DDI 0403E) description:
The System Control Space (SCS, address range 0xE000E000 to
0xE000EFFF) is a memory-mapped 4KB address space that provides
32-bit registers for configuration, status reporting and control.
All accesses to the SCS are little endian.
Fixes: d5d680cacc ("memory: Access MemoryRegion with endianness")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/armv7m.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index 98a69846119..64009174b97 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -140,7 +140,7 @@ static MemTxResult v7m_sysreg_ns_write(void *opaque, hwaddr addr,
/* S accesses to the alias act like NS accesses to the real region */
attrs.secure = 0;
return memory_region_dispatch_write(mr, addr, value,
- size_memop(size) | MO_TE, attrs);
+ size_memop(size) | MO_LE, attrs);
} else {
/* NS attrs are RAZ/WI for privileged, and BusFault for user */
if (attrs.user) {
@@ -160,7 +160,7 @@ static MemTxResult v7m_sysreg_ns_read(void *opaque, hwaddr addr,
/* S accesses to the alias act like NS accesses to the real region */
attrs.secure = 0;
return memory_region_dispatch_read(mr, addr, data,
- size_memop(size) | MO_TE, attrs);
+ size_memop(size) | MO_LE, attrs);
} else {
/* NS attrs are RAZ/WI for privileged, and BusFault for user */
if (attrs.user) {
@@ -174,7 +174,7 @@ static MemTxResult v7m_sysreg_ns_read(void *opaque, hwaddr addr,
static const MemoryRegionOps v7m_sysreg_ns_ops = {
.read_with_attrs = v7m_sysreg_ns_read,
.write_with_attrs = v7m_sysreg_ns_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
+ .endianness = DEVICE_LITTLE_ENDIAN,
};
static MemTxResult v7m_systick_write(void *opaque, hwaddr addr,
@@ -187,7 +187,7 @@ static MemTxResult v7m_systick_write(void *opaque, hwaddr addr,
/* Direct the access to the correct systick */
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->systick[attrs.secure]), 0);
return memory_region_dispatch_write(mr, addr, value,
- size_memop(size) | MO_TE, attrs);
+ size_memop(size) | MO_LE, attrs);
}
static MemTxResult v7m_systick_read(void *opaque, hwaddr addr,
@@ -199,14 +199,14 @@ static MemTxResult v7m_systick_read(void *opaque, hwaddr addr,
/* Direct the access to the correct systick */
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->systick[attrs.secure]), 0);
- return memory_region_dispatch_read(mr, addr, data, size_memop(size) | MO_TE,
- attrs);
+ return memory_region_dispatch_read(mr, addr, data,
+ size_memop(size) | MO_LE, attrs);
}
static const MemoryRegionOps v7m_systick_ops = {
.read_with_attrs = v7m_systick_read,
.write_with_attrs = v7m_systick_write,
- .endianness = DEVICE_NATIVE_ENDIAN,
+ .endianness = DEVICE_LITTLE_ENDIAN,
};
/*
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian
2025-03-12 10:48 [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian Philippe Mathieu-Daudé
@ 2025-03-12 11:13 ` Peter Maydell
2025-03-12 12:54 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2025-03-12 11:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-arm, Tony Nguyen
On Wed, 12 Mar 2025 at 10:48, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> We only build ARM system emulators using little
> endianness, so the MO_TE definition always expands to
> MO_LE, and DEVICE_TARGET_ENDIAN to DEVICE_LITTLE_ENDIAN.
>
> Replace the definitions by their expanded value, making
> it closer to the Armv7-M Architecture Reference Manual
> (ARM DDI 0403E) description:
>
> The System Control Space (SCS, address range 0xE000E000 to
> 0xE000EFFF) is a memory-mapped 4KB address space that provides
> 32-bit registers for configuration, status reporting and control.
> All accesses to the SCS are little endian.
>
> Fixes: d5d680cacc ("memory: Access MemoryRegion with endianness")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian
2025-03-12 10:48 [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian Philippe Mathieu-Daudé
2025-03-12 11:13 ` Peter Maydell
@ 2025-03-12 12:54 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2025-03-12 12:54 UTC (permalink / raw)
To: qemu-devel
On 3/12/25 03:48, Philippe Mathieu-Daudé wrote:
> We only build ARM system emulators using little
> endianness, so the MO_TE definition always expands to
> MO_LE, and DEVICE_TARGET_ENDIAN to DEVICE_LITTLE_ENDIAN.
>
> Replace the definitions by their expanded value, making
> it closer to the Armv7-M Architecture Reference Manual
> (ARM DDI 0403E) description:
>
> The System Control Space (SCS, address range 0xE000E000 to
> 0xE000EFFF) is a memory-mapped 4KB address space that provides
> 32-bit registers for configuration, status reporting and control.
> All accesses to the SCS are little endian.
>
> Fixes: d5d680cacc ("memory: Access MemoryRegion with endianness")
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/arm/armv7m.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-12 12:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 10:48 [PATCH-for-10.1 v2] hw/arm/armv7m: Expose and access System Control Space as little endian Philippe Mathieu-Daudé
2025-03-12 11:13 ` Peter Maydell
2025-03-12 12:54 ` Richard Henderson
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).