vexpress_ca9x4: Disable EFI_LOADER on this platform
PATCH 1/1 vexpress_ca9x4: Disable EFI_LOADER on this platform
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
---
I believe at one point Norther was using this platform, in QEMU, for a reference platform via EFI for using Mender. As such, this would likely make this platform not useful anymore. I believe Ilias can better explain what needs to be done to fix this properly but there's no one with the available time to take care of this in the community at large, and this is part of what's blocking updating QEMU to a newer version that provides other platform and feature support we do want to use. Alternatively, we could just let this platform go and remove it, if that path makes more sense.
--- configs/vexpress_ca9x4_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/vexpress_ca9x4_defconfig +4 -0
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca9" CONFIG_SYS_LOAD_ADDR=0x90000000 CONFIG_ENV_ADDR=0x47F80000 CONFIG_SYS_MONITOR_BASE=0x40000000 +# CONFIG_EFI_LOADER is not set CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTCOMMAND="run distro_bootcmd; run bootflash" CONFIG_DEFAULT_FDT_FILE="vexpress-v2p-ca9.dtb"
@@ -20,6 +21,7 @@ CONFIG_SYS_CBSIZE=512 CONFIG_SYS_PBSIZE=532 # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_LAST_STAGE_INIT=y # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_XIMG is not set
@@ -55,4 +57,6 @@ CONFIG_SMC911X=y CONFIG_SMC911X_32_BIT=y CONFIG_BAUDRATE=38400 CONFIG_DM_SERIAL=y +CONFIG_FAT_WRITE=y +CONFIG_FAT_RENAME=y CONFIG_SYS_TIMER_COUNTS_DOWN=y
Signature · 1 line
2.43.0
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 11 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue? Does it imply that we should discourage EFI use on all ARMv7 systems? It would be good if somebody at ARM could find out if they ever delivered designs that match QEMU's behavior.
Best regards
Heinrich
Quoted 48 lines
---
I believe at one point Norther was using this platform, in QEMU, for a reference platform via EFI for using Mender. As such, this would likely make this platform not useful anymore. I believe Ilias can better explain what needs to be done to fix this properly but there's no one with the available time to take care of this in the community at large, and this is part of what's blocking updating QEMU to a newer version that provides other platform and feature support we do want to use. Alternatively, we could just let this platform go and remove it, if that path makes more sense.Cc Josef Holzmayr <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Ilias Apalodimas <[email protected]>---
configs/vexpress_ca9x4_defconfig | 4 ++++1 file changed, 4 insertions(+)configs/vexpress_ca9x4_defconfig +0
-0@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca9"
CONFIG_SYS_LOAD_ADDR=0x90000000CONFIG_ENV_ADDR=0x47F80000CONFIG_SYS_MONITOR_BASE=0x40000000
+#CONFIG_EFI_LOADERis not setCONFIG_DISTRO_DEFAULTS=yCONFIG_BOOTCOMMAND="rundistro_bootcmd; run bootflash"CONFIG_DEFAULT_FDT_FILE="vexpress-v2p-ca9.dtb"configs/vexpress_ca9x4_defconfig +0
-0@@ -20,6 +21,7 @@ CONFIG_SYS_CBSIZE=512
CONFIG_SYS_PBSIZE=532
#CONFIG_DISPLAY_CPUINFOis not set
#CONFIG_DISPLAY_BOARDINFOis not set
+CONFIG_LAST_STAGE_INIT=y
#CONFIG_CMD_CONSOLEis not set
#CONFIG_CMD_BOOTDis not set
#CONFIG_CMD_XIMGis not setconfigs/vexpress_ca9x4_defconfig +0
-0@@ -55,4 +57,6 @@ CONFIG_SMC911X=y
CONFIG_SMC911X_32_BIT=yCONFIG_BAUDRATE=38400CONFIG_DM_SERIAL=yconfigs/vexpress_ca9x4_defconfig +2
-0+CONFIG_FAT_WRITE=y +CONFIG_FAT_RENAME=y
CONFIG_SYS_TIMER_COUNTS_DOWN=y
Ilias Apalodimas
Reviewed-byHi Heinrich
Quoted 11 lines · Heinrich Schuchardt
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 9 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
Quoted 4 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7 systems?
The spec says the MMU must be enabled, so I think yes. I thought about disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enabling the MMU with a simple identity mapping.
Quoted 1 line
It would be good if somebody at ARM could find out if they ever delivered designs that match QEMU's behavior.
I'll ask around and see if I can find something
Quoted 55 lines
Best regards
Heinrich
Quoted 48 lines
---
I believe at one point Norther was using this platform, in QEMU, for a reference platform via EFI for using Mender. As such, this would likely make this platform not useful anymore. I believe Ilias can better explain what needs to be done to fix this properly but there's no one with the available time to take care of this in the community at large, and this is part of what's blocking updating QEMU to a newer version that provides other platform and feature support we do want to use. Alternatively, we could just let this platform go and remove it, if that path makes more sense.Cc Josef Holzmayr <[email protected]>Cc Heinrich Schuchardt <[email protected]>Cc Ilias Apalodimas <[email protected]>---
configs/vexpress_ca9x4_defconfig | 4 ++++1 file changed, 4 insertions(+)configs/vexpress_ca9x4_defconfig +0
-0@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca9"
CONFIG_SYS_LOAD_ADDR=0x90000000CONFIG_ENV_ADDR=0x47F80000CONFIG_SYS_MONITOR_BASE=0x40000000
+#CONFIG_EFI_LOADERis not setCONFIG_DISTRO_DEFAULTS=yCONFIG_BOOTCOMMAND="rundistro_bootcmd; run bootflash"CONFIG_DEFAULT_FDT_FILE="vexpress-v2p-ca9.dtb"configs/vexpress_ca9x4_defconfig +0
-0@@ -20,6 +21,7 @@ CONFIG_SYS_CBSIZE=512
CONFIG_SYS_PBSIZE=532
#CONFIG_DISPLAY_CPUINFOis not set
#CONFIG_DISPLAY_BOARDINFOis not set
+CONFIG_LAST_STAGE_INIT=y
#CONFIG_CMD_CONSOLEis not set
#CONFIG_CMD_BOOTDis not set
#CONFIG_CMD_XIMGis not setconfigs/vexpress_ca9x4_defconfig +0
-0@@ -55,4 +57,6 @@ CONFIG_SMC911X=y
CONFIG_SMC911X_32_BIT=yCONFIG_BAUDRATE=38400CONFIG_DM_SERIAL=yconfigs/vexpress_ca9x4_defconfig +2
-0+CONFIG_FAT_WRITE=y +CONFIG_FAT_RENAME=y
CONFIG_SYS_TIMER_COUNTS_DOWN=y
Quoted 2 lines
From: Ilias Apalodimas <[email protected]>
Date: Sat, 12 Jul 2025 09:28:07 +0300
Hi Ilias, Heinrich and Tom,
As you probably know, OpenBSD/armv7 relies on EFI_LOAD, so disabling EFI_LOADER on a platform means you can't boot OpenBSD on it. Ilias and I talked about this a while ago. We talked about telling QEMU to use an older version of the architecture that didn't do this alignment check, but that may have been based on a misunderstanding of the changes in QEMU.
At the time I didn't look any further into this, but I did now. And I'm confused because...
Quoted 14 lines
Hi Heinrich
Quoted 11 lines · Heinrich Schuchardt
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 9 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
There is code in U-Boot to enable the MMU and the D-cache. The code turns on the MMU gets turned on when we turn on the D-cache, which happens when we call dcache_enable(). That function typically gets called from the board.c file and the one used by vexpress_ca9x4 doesn't seem to do that. But other ARMv7 targets do. For example in arch/arm/mach-sunxi/board.c we have:
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && defined(CONFIG_CPU_V7A) void enable_caches(void)
{
/* Enable D-cache. I-cache is already enabled in start.S */
dcache_enable();
}#endif
Note the CONFIG_CPU_V7A there. This means that for the Allwinner ARMv7 SoCs, which typically use Cortex-A7 cores that do include the virtualization extensions and therefore should implement the stricter unaligned access checks, we do enable the MMU.
Quoted 1 line
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7 systems?
So no, it does *not* imply we should discourage EFI use on all ARMv7 systems.
Quoted 4 lines
The spec says the MMU must be enabled, so I think yes. I thought about disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enabling the MMU with a simple identity mapping.
That should be as simple the diff below. I've not verified if that fixes the QEMU issue, but I strongly suspect it will. Whether this works on actual vexpress hardware is a different issue though.
board/armltd/vexpress/vexpress_common.c +8 -0
@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr) writel(addr, CONFIG_SYSFLAGS_ADDR); }#endif + +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif
Quoted 66 lines
Date: Sat, 12 Jul 2025 12:35:44 +0200
From: Mark Kettenis <[email protected]>Quoted 2 lines
From: Ilias Apalodimas <[email protected]>
Date: Sat, 12 Jul 2025 09:28:07 +0300Hi Ilias, Heinrich and Tom,
As you probably know, OpenBSD/armv7 relies on
EFI_LOAD, so disablingEFI_LOADERon a platform means you can't boot OpenBSD on it. Ilias and I talked about this a while ago. We talked about telling QEMU to use an older version of the architecture that didn't do this alignment check, but that may have been based on a misunderstanding of the changes in QEMU.At the time I didn't look any further into this, but I did now. And I'm confused because...
Quoted 14 lines
Hi Heinrich
Quoted 11 lines · Heinrich Schuchardt
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 9 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
There is code in U-Boot to enable the MMU and the D-cache. The code turns on the MMU gets turned on when we turn on the D-cache, which happens when we call
dcache_enable(). That function typically gets called from theboard.cfile and the one used byvexpress_ca9x4doesn't seem to do that. But other ARMv7 targets do. For example inarch/arm/mach-sunxi/board.cwe have:#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) &&
defined(CONFIG_CPU_V7A)voidenable_caches(void){ /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); }#endif
Note the
CONFIG_CPU_V7Athere. This means that for the Allwinner ARMv7 SoCs, which typically use Cortex-A7 cores that do include the virtualization extensions and therefore should implement the stricter unaligned access checks, we do enable the MMU.Quoted 1 line
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7 systems?
So no, it does *not* imply we should discourage EFI use on all ARMv7 systems.
Quoted 8 lines
Quoted 4 lines
The spec says the MMU must be enabled, so I think yes. I thought about disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enabling the MMU with a simple identity mapping.That should be as simple the diff below. I've not verified if that fixes the QEMU issue, but I strongly suspect it will. Whether this works on actual vexpress hardware is a different issue though.
Fixes the issue with QEMU 9.2.2. Before it would reset, now it boots into the OpenBSD installer just fine.
Quoted 17 lines
board/armltd/vexpress/vexpress_common.c +8
-0@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr) writel(addr, CONFIG_SYSFLAGS_ADDR); }#endif + +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif
Quoted 78 lines · Mark Kettenis
Quoted 66 lines
Date: Sat, 12 Jul 2025 12:35:44 +0200
From: Mark Kettenis <[email protected]>Quoted 2 lines
From: Ilias Apalodimas <[email protected]>
Date: Sat, 12 Jul 2025 09:28:07 +0300Hi Ilias, Heinrich and Tom,
As you probably know, OpenBSD/armv7 relies on
EFI_LOAD, so disablingEFI_LOADERon a platform means you can't boot OpenBSD on it. Ilias and I talked about this a while ago. We talked about telling QEMU to use an older version of the architecture that didn't do this alignment check, but that may have been based on a misunderstanding of the changes in QEMU.At the time I didn't look any further into this, but I did now. And I'm confused because...
Quoted 14 lines
Hi Heinrich
Quoted 11 lines · Heinrich Schuchardt
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 9 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
There is code in U-Boot to enable the MMU and the D-cache. The code turns on the MMU gets turned on when we turn on the D-cache, which happens when we call
dcache_enable(). That function typically gets called from theboard.cfile and the one used byvexpress_ca9x4doesn't seem to do that. But other ARMv7 targets do. For example inarch/arm/mach-sunxi/board.cwe have:#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) &&
defined(CONFIG_CPU_V7A)voidenable_caches(void){ /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); }#endif
Note the
CONFIG_CPU_V7Athere. This means that for the Allwinner ARMv7 SoCs, which typically use Cortex-A7 cores that do include the virtualization extensions and therefore should implement the stricter unaligned access checks, we do enable the MMU.Quoted 1 line
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7 systems?
So no, it does *not* imply we should discourage EFI use on all ARMv7 systems.
Quoted 8 lines
Quoted 4 lines
The spec says the MMU must be enabled, so I think yes. I thought about disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enabling the MMU with a simple identity mapping.That should be as simple the diff below. I've not verified if that fixes the QEMU issue, but I strongly suspect it will. Whether this works on actual vexpress hardware is a different issue though.
Fixes the issue with QEMU 9.2.2. Before it would reset, now it boots into the OpenBSD installer just fine.
Quoted 16 lines
Quoted 6 lines
board/armltd/vexpress/vexpress_common.c +0
-0@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr)writel (addr,CONFIG_SYSFLAGS_ADDR );board/armltd/vexpress/vexpress_common.c void smp_set_core_boot_addr(unsigned long addr, int corenr) · line 175
Quoted 10 lines
board/armltd/vexpress/vexpress_common.c +8
-0}#endif + +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif
Thanks Mark! I was hoping this would spur some further discussion and perhaps a patch. Please post this formal patch and I'll go reject the patch I posted now.
Signature · 1 line
Tom
Quoted 94 lines
Date: Sat, 12 Jul 2025 09:48:47 -0600
From: Tom Rini <[email protected]>Quoted 90 lines · Mark Kettenis
Quoted 66 lines
Date: Sat, 12 Jul 2025 12:35:44 +0200
From: Mark Kettenis <[email protected]>Quoted 2 lines
From: Ilias Apalodimas <[email protected]>
Date: Sat, 12 Jul 2025 09:28:07 +0300Hi Ilias, Heinrich and Tom,
As you probably know, OpenBSD/armv7 relies on
EFI_LOAD, so disablingEFI_LOADERon a platform means you can't boot OpenBSD on it. Ilias and I talked about this a while ago. We talked about telling QEMU to use an older version of the architecture that didn't do this alignment check, but that may have been based on a misunderstanding of the changes in QEMU.At the time I didn't look any further into this, but I did now. And I'm confused because...
Quoted 14 lines
Hi Heinrich
Quoted 11 lines · Heinrich Schuchardt
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <[email protected]>:
Quoted 9 lines
As part of upgrading to QEMU 10.0.0 we discovered that the EFI loader tests would no longer pass CI, on this specific platform, while still passing on real hardware. Upon further investigation it turns out that on ARMv7 we rely on some undefined behavior with respect to enabling unaligned access. And while this is seemingly fine on real hardware, QEMU is now correct enough in implementation to no longer allow this. In order to not rely on this undefined behavior we would need to implement some MMU configuration (and then ensure proper tear-down possibly).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to document this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
There is code in U-Boot to enable the MMU and the D-cache. The code turns on the MMU gets turned on when we turn on the D-cache, which happens when we call
dcache_enable(). That function typically gets called from theboard.cfile and the one used byvexpress_ca9x4doesn't seem to do that. But other ARMv7 targets do. For example inarch/arm/mach-sunxi/board.cwe have:#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) &&
defined(CONFIG_CPU_V7A)voidenable_caches(void){ /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); }#endif
Note the
CONFIG_CPU_V7Athere. This means that for the Allwinner ARMv7 SoCs, which typically use Cortex-A7 cores that do include the virtualization extensions and therefore should implement the stricter unaligned access checks, we do enable the MMU.Quoted 1 line
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7 systems?
So no, it does *not* imply we should discourage EFI use on all ARMv7 systems.
Quoted 8 lines
Quoted 4 lines
The spec says the MMU must be enabled, so I think yes. I thought about disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enabling the MMU with a simple identity mapping.That should be as simple the diff below. I've not verified if that fixes the QEMU issue, but I strongly suspect it will. Whether this works on actual vexpress hardware is a different issue though.
Fixes the issue with QEMU 9.2.2. Before it would reset, now it boots into the OpenBSD installer just fine.
Quoted 12 lines
board/armltd/vexpress/vexpress_common.c +4
-0@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr)writel (addr,CONFIG_SYSFLAGS_ADDR ); }#endif + +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) +void enable_caches (void ) +{
Quoted 8 lines
Quoted 4 lines
board/armltd/vexpress/vexpress_common.c void smp_set_core_boot_addr(unsigned long addr, int corenr) · line 175
Quoted 4 lines
board/armltd/vexpress/vexpress_common.c +4
-0+/* Enable D-cache. I-cache is already enabled in start.S */ + dcache_enable(); +} +#endif Thanks Mark! I was hoping this would spur some further discussion and perhaps a patch. Please post this formal patch and I'll go reject the patch I posted now.
Done. I also noticed that the vexpress_ca9x4 board was added back specifically for use with QEMU. So any concerns about real hardware are probably unwarranted.
Cheers,
Mark
Hi all,
thanks for keeping me in the loop. Not sure I understood everything, but I'll check with folks here and figure out how to move forward.
Greetz,
*Josef Holzmayr* (he/him)
Developer Enablement Expert
Mender <https://mender.io/> | GitHub
<https://github.com/theyoctojester> | Mender
Hub <https://hub.mender.io>
<https://www.linkedin.com/company/northern.tech>
<https://twitter.com/northerntechhq> <https://northern.tech> Northern.tech
<https://northern.tech> | Securing the world's connected devices
Quoted 128 lines · Mark Kettenis
Quoted 16 lines
Date: Sat, 12 Jul 2025 09:48:47 -0600
From: Tom Rini <[email protected]>Quoted 12 lines · Mark Kettenis
Quoted 12 lines
Date: Sat, 12 Jul 2025 12:35:44 +0200
From: Mark Kettenis <[email protected]>Quoted 2 lines
From: Ilias Apalodimas <[email protected]>
Date: Sat, 12 Jul 2025 09:28:07 +0300Hi Ilias, Heinrich and Tom,
As you probably know, OpenBSD/armv7 relies on
EFI_LOAD, so disablingEFI_LOADERon a platform means you can't boot OpenBSD on it. Ilias and I talked about this a while ago. We talked about telling QEMU to use an older version of the architecture that didn't do thisalignment
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
check, but that may have been based on a misunderstanding of the changes in QEMU.
At the time I didn't look any further into this, but I did now. And I'm confused because...
Quoted 3 lines
Hi Heinrich
On Fri, 11 Jul 2025 at 22:35, Heinrich Schuchardt <
Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Am 11. Juli 2025 20:55:12 MESZ schrieb Tom Rini <
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
As part of upgrading to QEMU 10.0.0 we discovered that the EFI
loader
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
tests would no longer pass CI, on this specific platform, while
still
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
passing on real hardware. Upon further investigation it turns
out that
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
on ARMv7 we rely on some undefined behavior with respect to
enabling
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
unaligned access. And while this is seemingly fine on real
hardware,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
QEMU is now correct enough in implementation to no longer allow
this. In
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
order to not rely on this undefined behavior we would need to
implement
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
some MMU configuration (and then ensure proper tear-down
possibly).
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
At the moment, the most reasonable path forward seems to be to
document
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
this and disable the support here.
Where will we document the issue?
I think we can add it on the EFI documentation? IIRC we only enable the i-cache not the mmu + d-cache. I can double check and send a patch.
There is code in U-Boot to enable the MMU and the D-cache. The code turns on the MMU gets turned on when we turn on the D-cache, which happens when we call
dcache_enable(). That function typically gets called from theboard.cfile and the one used byvexpress_ca9x4doesn't seem to do that. But other ARMv7 targets do. For example inarch/arm/mach-sunxi/board.cwe have:#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) &&
defined(CONFIG_CPU_V7A)voidenable_caches(void){ /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); }#endif
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Note the
CONFIG_CPU_V7Athere. This means that for the Allwinner ARMv7 SoCs, which typically use Cortex-A7 cores that do include the virtualization extensions and therefore should implement the stricter unaligned access checks, we do enable the MMU.Quoted 1 line
Quoted 1 line
Does it imply that we should discourage EFI use on all ARMv7
systems?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
So no, it does *not* imply we should discourage EFI use on all ARMv7 systems.
Quoted 1 line
The spec says the MMU must be enabled, so I think yes. I thought
about
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
disabling it, but that's too strict.
Perhaps someone that uses v7 and *needs* EFI can look at enablingthe
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
MMU with a simple identity mapping.
That should be as simple the diff below. I've not verified if that fixes the QEMU issue, but I strongly suspect it will. Whether this works on actual vexpress hardware is a different issue though.
Fixes the issue with QEMU 9.2.2. Before it would reset, now it boots into the OpenBSD installer just fine.
Review
Quoted 1 line
(quoted diff) +0
-0
b/board/armltd/vexpress/vexpress_common.cQuoted 4 lines
Quoted 4 lines
board/armltd/vexpress/vexpress_common.c void smp_set_core_boot_addr(unsigned long addr,
Quoted 4 lines
index
6c374e25e32..3833af59b09100644board/armltd/vexpress/vexpress_common.c +0
-0@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr,int corenr)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
board/armltd/vexpress/vexpress_common.c +4
-0writel (addr,CONFIG_SYSFLAGS_ADDR ); }#endif + +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) +void enable_caches (void ) +{Quoted 8 lines
Quoted 4 lines
board/armltd/vexpress/vexpress_common.c void smp_set_core_boot_addr(unsigned long addr, int corenr) · line 175
Quoted 4 lines
board/armltd/vexpress/vexpress_common.c +4
-0+/* Enable D-cache. I-cache is already enabled in start.S */ + dcache_enable(); +} +#endif Thanks Mark! I was hoping this would spur some further discussion and perhaps a patch. Please post this formal patch and I'll go reject the patch I posted now.
Done. I also noticed that the
vexpress_ca9x4board was added back specifically for use with QEMU. So any concerns about real hardware are probably unwarranted.Cheers,
Mark