* [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig
@ 2026-08-06 11:28 Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-08-06 11:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We build for kvx in CI, but we don't yet include qemu-system-kvx.
To simplify at least manual testing, add a generic_defconfig.yaml
that correctly configures QEMU to be able to start barebox.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
test/kvx/generic_defconfig.yaml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 test/kvx/generic_defconfig.yaml
diff --git a/test/kvx/generic_defconfig.yaml b/test/kvx/generic_defconfig.yaml
new file mode 100644
index 000000000000..66b5bb308564
--- /dev/null
+++ b/test/kvx/generic_defconfig.yaml
@@ -0,0 +1,17 @@
+targets:
+ main:
+ drivers:
+ QEMUDriver:
+ qemu_bin: qemu-system-kvx
+ machine: mppa-coolidge
+ memory: 512M
+ kernel: barebox
+ display: qemu-default
+ BareboxDriver:
+ prompt: 'barebox@[^:]+:[^ ]+ '
+ bootstring: 'commandline:'
+ BareboxTestStrategy: {}
+images:
+ barebox: !template "$LG_BUILDDIR/barebox"
+imports:
+ - ../strategy.py
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION
2026-08-06 11:28 [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Ahmad Fatoum
@ 2026-08-06 11:28 ` Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx Ahmad Fatoum
2026-08-06 13:08 ` [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-08-06 11:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We have code that depends on unreferenced functions being dropped,
because otherwise they would lead to linker errors as they themself
reference functions that aren't included in the build.
To make such code not break the kvx build, enable linker garbage
collection for it.
To make this work two changes are needed in addition:
- exact .text, .data and .bss matches changed to prefix matches
as we want to merge the new subsections
- kvx_start is identified as the entry point, so linker garbage
collection knows from where to check reachability
A search for `section' in arch/kvx and drivers/soc/kvx shows that the
only custom sections are .exception and .startup, so we should have all
our bases covered.
It has been verified that barebox running in QEMU still reaches its shell
with this change applied.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/kvx/Kconfig | 1 +
arch/kvx/cpu/barebox.lds.S | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig
index bbbec6471f06..14109c3cfcb7 100644
--- a/arch/kvx/Kconfig
+++ b/arch/kvx/Kconfig
@@ -22,6 +22,7 @@ config KVX
select OFDEVICE
select PARTITION
select RESET_SOURCE
+ select LD_DEAD_CODE_DATA_ELIMINATION
default y
config 64BIT
diff --git a/arch/kvx/cpu/barebox.lds.S b/arch/kvx/cpu/barebox.lds.S
index b05c1f36e595..99a73ea0f7cc 100644
--- a/arch/kvx/cpu/barebox.lds.S
+++ b/arch/kvx/cpu/barebox.lds.S
@@ -8,6 +8,7 @@
#include <asm/barebox.lds.h>
OUTPUT_FORMAT("elf64-kvx")
+ENTRY(kvx_start)
SECTIONS
{
@@ -15,7 +16,7 @@ SECTIONS
.text ALIGN(4) : {
*(.startup);
_stext = .;
- *(.text)
+ *(.text*)
}
/* Exception vector must be aligned on a huge frontier */
@@ -59,7 +60,7 @@ SECTIONS
.data ALIGN(4): {
sdata = .;
_sdata = .;
- *(.data)
+ *(.data*)
. = ALIGN(8);
__stack_end = .;
. += CONFIG_STACK_SIZE;
@@ -79,7 +80,7 @@ SECTIONS
.bss ALIGN(16):
{
__bss_start = .;
- *(.bss)
+ *(.bss*)
. = ALIGN(16);
__bss_stop = .;
}
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx
2026-08-06 11:28 [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION Ahmad Fatoum
@ 2026-08-06 11:28 ` Ahmad Fatoum
2026-08-06 13:08 ` [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-08-06 11:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
dma_realloc_coherent calls dma_alloc_coherent internally, but on kvx.
use of dma_alloc_coherent always triggers a compile-time error.
Turn the compile-time error into a link-time error, so
dma_alloc_coherent() may be used in common code that's ultimately
discarded, regardless of whether the architecture actually implements
it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/kvx/include/asm/dma.h | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/arch/kvx/include/asm/dma.h b/arch/kvx/include/asm/dma.h
index 42329331fba9..f1457193c300 100644
--- a/arch/kvx/include/asm/dma.h
+++ b/arch/kvx/include/asm/dma.h
@@ -13,20 +13,18 @@
struct device;
#define dma_alloc_coherent dma_alloc_coherent
-static inline void *dma_alloc_coherent(struct device *dev,
- size_t size, dma_addr_t *dma_handle)
-{
- BUILD_BUG_ON_MSG(1, "dma_alloc_coherent not supported: "
- "MMU support is required to map uncached pages");
- return NULL;
-}
+
+/* dma_alloc_coherent is not supported as MMU support is required to map
+ * uncached pages. To avoid compile-time errors for ultimately unreferenced
+ * code, we declare the prototype here and let the lack of definition cause
+ * a linker error if either function ends up being used.
+ */
+extern void *dma_alloc_coherent(struct device *dev,
+ size_t size, dma_addr_t *dma_handle);
#define dma_free_coherent dma_free_coherent
-static inline void dma_free_coherent(struct device *dev,
- void *mem, dma_addr_t dma_handle,
- size_t size)
-{
- free(mem);
-}
+extern void dma_free_coherent(struct device *dev,
+ void *mem, dma_addr_t dma_handle,
+ size_t size);
#endif /* __ASM_DMA_H */
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig
2026-08-06 11:28 [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx Ahmad Fatoum
@ 2026-08-06 13:08 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-08-06 13:08 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Thu, 06 Aug 2026 13:28:01 +0200, Ahmad Fatoum wrote:
> We build for kvx in CI, but we don't yet include qemu-system-kvx.
> To simplify at least manual testing, add a generic_defconfig.yaml
> that correctly configures QEMU to be able to start barebox.
>
>
Applied, thanks!
[1/3] test: kvx: add Labgrid env YAML for generic_defconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=1962405c8e44 (link may not be stable)
[2/3] kvx: select DEAD_CODE_DATA_ELIMINATION
https://git.pengutronix.de/cgit/barebox/commit/?id=b78c544281da (link may not be stable)
[3/3] dma: fix dma_realloc_coherent compile-time error on kvx
https://git.pengutronix.de/cgit/barebox/commit/?id=23acc2f11182 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-06 13:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-06 11:28 [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx Ahmad Fatoum
2026-08-06 13:08 ` [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox