diff mbox series

[3/3] hw/ppc: Add stub for pnv_chip_find_core()

Message ID 20250526112346.48744-4-philmd@linaro.org
State New
Headers show
Series hw/ppc: Fix --without-default-devices build | expand

Commit Message

Philippe Mathieu-Daudé May 26, 2025, 11:23 a.m. UTC
Since commit 9808ce6d5cb, building QEMU configured with
'--without-default-devices' fails:

  Undefined symbols for architecture arm64:
    "_pnv_chip_find_core", referenced from:
        _helper_load_sprd in target_ppc_misc_helper.c.o
        _helper_store_sprd in target_ppc_misc_helper.c.o
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1

Fix by adding a stub when CONFIG_POWERNV is not available.

Reported-by: Thomas Huth <thuth@redhat.com>
Fixes: 9808ce6d5cb ("target/ppc: Big-core scratch register fix")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/pnv_stub.c  | 15 +++++++++++++++
 hw/ppc/meson.build |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 hw/ppc/pnv_stub.c

Comments

Cédric Le Goater May 26, 2025, 11:48 a.m. UTC | #1
On 5/26/25 13:23, Philippe Mathieu-Daudé wrote:
> Since commit 9808ce6d5cb, building QEMU configured with
> '--without-default-devices' fails:
> 
>    Undefined symbols for architecture arm64:
>      "_pnv_chip_find_core", referenced from:
>          _helper_load_sprd in target_ppc_misc_helper.c.o
>          _helper_store_sprd in target_ppc_misc_helper.c.o
>    ld: symbol(s) not found for architecture arm64
>    clang: error: linker command failed with exit code 1
> > Fix by adding a stub when CONFIG_POWERNV is not available.

The fix would be to add an abstract handler to implement SPRD accesses
on the PowerNV machine.

Thanks,

C.



> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Fixes: 9808ce6d5cb ("target/ppc: Big-core scratch register fix")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/pnv_stub.c  | 15 +++++++++++++++
>   hw/ppc/meson.build |  3 ++-
>   2 files changed, 17 insertions(+), 1 deletion(-)
>   create mode 100644 hw/ppc/pnv_stub.c
> 
> diff --git a/hw/ppc/pnv_stub.c b/hw/ppc/pnv_stub.c
> new file mode 100644
> index 00000000000..8d11c8b65bb
> --- /dev/null
> +++ b/hw/ppc/pnv_stub.c
> @@ -0,0 +1,15 @@
> +/*
> + * QEMU PowerPC PowerNV stubs
> + *
> + *  Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/ppc/pnv.h"
> +
> +PnvCore *pnv_chip_find_core(PnvChip *chip, uint32_t core_id)
> +{
> +    g_assert_not_reached();
> +}
> diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
> index 9893f8adebb..02f248f5f46 100644
> --- a/hw/ppc/meson.build
> +++ b/hw/ppc/meson.build
> @@ -55,7 +55,8 @@ ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
>     'pnv_pnor.c',
>     'pnv_nest_pervasive.c',
>     'pnv_n1_chiplet.c',
> -))
> +), if_false: files('pnv_stub.c'))
> +
>   # PowerPC 4xx boards
>   ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
>     'ppc440_bamboo.c',
Philippe Mathieu-Daudé May 26, 2025, 11:51 a.m. UTC | #2
On 26/5/25 13:48, Cédric Le Goater wrote:
> On 5/26/25 13:23, Philippe Mathieu-Daudé wrote:
>> Since commit 9808ce6d5cb, building QEMU configured with
>> '--without-default-devices' fails:
>>
>>    Undefined symbols for architecture arm64:
>>      "_pnv_chip_find_core", referenced from:
>>          _helper_load_sprd in target_ppc_misc_helper.c.o
>>          _helper_store_sprd in target_ppc_misc_helper.c.o
>>    ld: symbol(s) not found for architecture arm64
>>    clang: error: linker command failed with exit code 1
>> > Fix by adding a stub when CONFIG_POWERNV is not available.
> 
> The fix would be to add an abstract handler to implement SPRD accesses
> on the PowerNV machine.

I don't know what "SPRD" is so I'll let someone more familiar with
this area do the proper cleanup.

Regards,

Phil.

> 
> Thanks,
> 
> C.
diff mbox series

Patch

diff --git a/hw/ppc/pnv_stub.c b/hw/ppc/pnv_stub.c
new file mode 100644
index 00000000000..8d11c8b65bb
--- /dev/null
+++ b/hw/ppc/pnv_stub.c
@@ -0,0 +1,15 @@ 
+/*
+ * QEMU PowerPC PowerNV stubs
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/ppc/pnv.h"
+
+PnvCore *pnv_chip_find_core(PnvChip *chip, uint32_t core_id)
+{
+    g_assert_not_reached();
+}
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index 9893f8adebb..02f248f5f46 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -55,7 +55,8 @@  ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
   'pnv_pnor.c',
   'pnv_nest_pervasive.c',
   'pnv_n1_chiplet.c',
-))
+), if_false: files('pnv_stub.c'))
+
 # PowerPC 4xx boards
 ppc_ss.add(when: 'CONFIG_PPC440', if_true: files(
   'ppc440_bamboo.c',