On 2/9/25 12:44, Philippe Mathieu-Daudé wrote:
On 20/8/25 14:25, Aditya Gupta wrote:
Currently when CONFIG_POWERNV is not enabled, the build fails, such as
with --without-default-devices:

     $ ./configure --without-default-devices
     $ make

     [281/283] Linking target qemu-system-ppc64
     FAILED: qemu-system-ppc64
     cc -m64 @qemu-system-ppc64.rsp
     /usr/bin/ld: libqemu-ppc64-softmmu.a.p/ target_ppc_misc_helper.c.o: in function `helper_load_sprd':      .../target/ppc/misc_helper.c:335:(.text+0xcdc): undefined reference to `pnv_chip_find_core'      /usr/bin/ld: libqemu-ppc64-softmmu.a.p/ target_ppc_misc_helper.c.o: in function `helper_store_sprd':      .../target/ppc/misc_helper.c:375:(.text+0xdf4): undefined reference to `pnv_chip_find_core'
     collect2: error: ld returned 1 exit status
     ...

This is since target/ppc/misc_helper.c references PowerNV specific
'pnv_chip_find_core' call.

Split the PowerNV specific SPRD code out of the generic PowerPC code, by
moving the SPRD code to pnv.c

Fixes: 9808ce6d5cb ("target/ppc: Big-core scratch register fix")
Cc: Philippe Mathieu-Daudé <[email protected]>
Reported-by: Thomas Huth <[email protected]>
Suggested-by: Cédric Le Goater <[email protected]>
Signed-off-by: Aditya Gupta <[email protected]>
---
Note that while moving the code, the 'target_ulong' type for sprc has been
modified to 'uint64_t'.

Based on the discussion happened on [1].
Requires patch 1 and patch 2 of [1] to be applied, to fix the build.

[1]: https://lore.kernel.org/qemu-devel/20250526112346.48744-1- [email protected]/
---
---
  hw/ppc/pnv.c             | 86 ++++++++++++++++++++++++++++++++++++++++
  target/ppc/cpu.h         |  4 ++
  target/ppc/misc_helper.c | 59 +++------------------------
  3 files changed, 96 insertions(+), 53 deletions(-)

Patch queued via hw-misc, thanks.

Dropping, as it doesn't pass on CI:

../target/ppc/kvm.c: In function ‘kvmppc_load_htab_chunk’:
../target/ppc/kvm.c:2763:32: error: ‘buf’ undeclared (first use in this function)
 2763 |     size_t chunksize = sizeof(*buf) + n_valid * HASH_PTE_SIZE_64;
      |                                ^~~
../target/ppc/kvm.c:2763:32: note: each undeclared identifier is reported only once for each function it appears in

https://gitlab.com/philmd/qemu/-/jobs/11214983966
https://gitlab.com/philmd/qemu/-/jobs/11214983979

Reply via email to