hw/ppc: Fix --without-default-devices build
cover hw/ppc: Fix --without-default-devices build
Fix build issue reported by Thomas:
https://lore.kernel.org/qemu-devel/[email protected]/
Philippe Mathieu-Daudé (3):
hw/acpi: Build IPMI stubs when ACPI is disabled
hw/ppc: PowerNV machines expose a I2C bus
hw/ppc: Add stub for pnv_chip_find_core()
hw/ppc/pnv_stub.c | 15 +++++++++++++++ hw/acpi/meson.build | 10 ++++++++-- hw/ppc/Kconfig | 1 + hw/ppc/meson.build | 3 ++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 hw/ppc/pnv_stub.c
Signature · 1 line
2.47.1
PATCH 1/3 hw/acpi: Build IPMI stubs when ACPI is disabled
When ACPI is disabled, no ACPI code depends on IPMI, so we don't need the stubs.
We need them when IPMI is enabled and ACPI disabled, otherwise when using '--without-default-devices' we get:
Undefined symbols for architecture arm64:
"_build_ipmi_dev_aml", referenced from:
_isa_ipmi_bt_class_init in hw_ipmi_isa_ipmi_bt.c.o
ld: symbol(s) not found for architecture arm64
Split the source set list to avoid a too long line.
--- hw/acpi/meson.build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
hw/acpi/meson.build +8 -2
@@ -26,12 +26,18 @@ acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c' acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c', 'ich9_timer.c')) acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c')) -acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) +acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) if have_tpm acpi_ss.add(files('tpm.c')) endif -system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c')) +system_ss.add(when: 'CONFIG_ACPI', if_false: files( + 'acpi-stub.c', + 'acpi_interface.c', + 'aml-build-stub.c', + 'ghes-stub.c', + 'ipmi-stub.c', +)) system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c')) system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) system_ss.add(files('acpi-qmp-cmds.c'))
Signature · 1 line
2.47.1
Re: [PATCH 1/3] hw/acpi: Build IPMI stubs when ACPI is disabled
Quoted 27 lines · Philippe Mathieu-Daudé
When ACPI is disabled, no ACPI code depends on IPMI, so we don't need the stubs.
We need them when IPMI is enabled and ACPI disabled, otherwise when using '--without-default-devices' we get:
Undefined symbols for architecture arm64:
"_build_ipmi_dev_aml", referenced from:
_isa_ipmi_bt_class_initin hw_ipmi_isa_ipmi_bt.c.o
ld: symbol(s) not found for architecture arm64Split the source set list to avoid a too long line.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/acpi/meson.build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)hw/acpi/meson.build +0
-0@@ -26,12 +26,18 @@ acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c' acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c', 'ich9_timer.c')) acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))
hw/acpi/meson.build acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c' · line 36
Quoted 10 lines
hw/acpi/meson.build +4
-2-acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) +acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) if have_tpm acpi_ss.add(files('tpm.c')) endif -system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c')) +system_ss.add(when: 'CONFIG_ACPI', if_false: files( + 'acpi-stub.c', + 'acpi_interface.c',
While you're at it, I think acpi_interface.c is always needed (it's also added earlier in this file already when CONFIG_ACPI is enabled), so I think this should rather go to a separate "system_ss.add(...)" line?
Thomas
Quoted 7 lines
hw/acpi/meson.build +4
-0+ 'aml-build-stub.c', + 'ghes-stub.c', + 'ipmi-stub.c', +)) system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c')) system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) system_ss.add(files('acpi-qmp-cmds.c'))
Re: [PATCH 1/3] hw/acpi: Build IPMI stubs when ACPI is disabled
Quoted 35 lines · Thomas Huth
Quoted 34 lines · Philippe Mathieu-Daudé
When ACPI is disabled, no ACPI code depends on IPMI, so we don't need the stubs.
We need them when IPMI is enabled and ACPI disabled, otherwise when using '--without-default-devices' we get:
Undefined symbols for architecture arm64:
"_build_ipmi_dev_aml", referenced from:
_isa_ipmi_bt_class_initin hw_ipmi_isa_ipmi_bt.c.o
ld: symbol(s) not found for architecture arm64Split the source set list to avoid a too long line.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/acpi/meson.build | 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)hw/acpi/meson.build +0
-0@@ -26,12 +26,18 @@ acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false:files('acpi-pci-hotplug-stub.c'
acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c'))acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c', 'ich9_timer.c'))acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))-acpi_ss.add(when: 'CONFIG_IPMI',if_true: files('ipmi.c'),if_false:
files('ipmi-stub.c'))
+acpi_ss.add(when: 'CONFIG_IPMI',if_true: files('ipmi.c'))
acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
ifhave_tpm
acpi_ss.add(files('tpm.c'))
Quoted 8 lines
Quoted 6 lines
endif
-system_ss.add(when: 'CONFIG_ACPI',if_false:files('acpi-stub.c', 'aml- build-stub.c', 'ghes-stub.c', 'acpi_interface.c')) +system_ss.add(when: 'CONFIG_ACPI',if_false: files(
+ 'acpi-stub.c',
+ 'acpi_interface.c',While you're at it, I think
acpi_interface.cis always needed (it's also added earlier in this file already whenCONFIG_ACPIis enabled), so I think this should rather go to a separate "system_ss.add(...)" line?
Or maybe it could rather get removed from the list here? ... it does not look like it's really needed for the build at a quick glance...
Thomas
PATCH 2/3 hw/ppc: PowerNV machines expose a I2C bus
In reply to Philippe Mathieu-DaudéSince commit 263b81ee15a, PowerNV machines instanciate a I2C controller, so expose a I2C bus. Express that in Kconfig, otherwise we get a configure error when trying to use '--without-default-devices':
The following clauses were found for PCA9552
config PCA9552 depends on I2C
select PCA9552 if POWERNV
--- hw/ppc/Kconfig | 1 + 1 file changed, 1 insertion(+)
hw/ppc/Kconfig +1 -0
@@ -29,6 +29,7 @@ config POWERNV depends on PPC64 && FDT imply PCI_DEVICES imply TEST_DEVICES + select I2C select ISA_IPMI_BT select IPMI_LOCAL select ISA_BUS
Signature · 1 line
2.47.1
Re: [PATCH 2/3] hw/ppc: PowerNV machines expose a I2C bus
Quoted 20 lines · Philippe Mathieu-Daudé
Since commit
263b81ee15a, PowerNV machines instanciate a I2C controller, so expose a I2C bus. Express that inKconfig, otherwise we get a configure error when trying to use '--without-default-devices':The following clauses were found for PCA9552
config PCA9552 depends on I2C
select PCA9552 if POWERNVFixes 263b81ee15a ("ppc/pnv: Add an I2C controller model")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/Kconfig | 1 + 1 file changed, 1 insertion(+)hw/ppc/Kconfig +0
-0
hw/ppc/Kconfig config POWERNV · line 35
Quoted 7 lines
hw/ppc/Kconfig +1
-0@@ -29,6 +29,7 @@ config POWERNV depends on PPC64 && FDT imply PCI_DEVICES imply TEST_DEVICES + select I2C select ISA_IPMI_BT select IPMI_LOCAL select ISA_BUS
Re: [PATCH 2/3] hw/ppc: PowerNV machines expose a I2C bus
In reply to Philippe Mathieu-DaudéQuoted 20 lines · Philippe Mathieu-Daudé
Since commit
263b81ee15a, PowerNV machines instanciate a I2C controller, so expose a I2C bus. Express that inKconfig, otherwise we get a configure error when trying to use '--without-default-devices':The following clauses were found for PCA9552
config PCA9552 depends on I2C
select PCA9552 if POWERNVFixes 263b81ee15a ("ppc/pnv: Add an I2C controller model")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/Kconfig | 1 + 1 file changed, 1 insertion(+)hw/ppc/Kconfig +0
-0
hw/ppc/Kconfig config POWERNV · line 35
Quoted 7 lines
hw/ppc/Kconfig +1
-0@@ -29,6 +29,7 @@ config POWERNV depends on PPC64 && FDT imply PCI_DEVICES imply TEST_DEVICES + select I2C select ISA_IPMI_BT select IPMI_LOCAL select ISA_BUS
Thanks,
C.
PATCH 3/3 hw/ppc: Add stub for pnv_chip_find_core()
In reply to Philippe Mathieu-Daudé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.
--- 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
hw/ppc/pnv_stub.c new file +15 -0
@@ -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 (); +}
hw/ppc/meson.build +2 -1
@@ -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',
Signature · 1 line
2.47.1
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Quoted 10 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis not available.
The fix would be to add an abstract handler to implement SPRD accesses on the PowerNV machine.
Thanks,
C.
Quoted 45 lines
Reported-by Thomas Huth <[email protected]>Fixes 9808ce6d5cb ("target/ppc: Big-core scratch register fix")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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.chw/ppc/pnv_stub.c new file +15
-0@@ -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 (); +}hw/ppc/meson.build +2
-1@@ -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',
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis 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.
Quoted 4 lines
Thanks,
C.
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Hi!
Has this change been forgotten?
Thanks,
/mjt
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1Quoted 4 lines
Quoted 1 line
Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis 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.
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Quoted 3 lines · Michael Tokarev
Hi!
Has this change been forgotten?
Another ping?
Or can we assume this change isn't needed anymore? :)
Thanks,
/mjt
Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Cédric Le Goater
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1Quoted 4 lines
Quoted 1 line
Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis 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.
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Quoted 8 lines · Michael Tokarev
Quoted 3 lines · Michael Tokarev
Hi!
Has this change been forgotten?
Another ping?
Or can we assume this change isn't needed anymore? :)
Thanks for the pings Michael.
About the change, we will post a patch-set soon with the suggested change by Cedric.
I was on vacation past week, so couldn't see the mails.
Thanks,
- Aditya G
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
In reply to Philippe Mathieu-DaudéHi Cédric and Philippe,
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis not available.The fix would be to add an abstract handler to implement SPRD accesses on the PowerNV machine.
Is this what you meant by an abstract handler ?
https://github.com/adi-g15-ibm/qemu/commit/0abac37032a5ef66d64a649ce04f24876bf9007d
The thing done, is just to introduce a function pointer in 'PowerPCCPUClass', namely 'handle_sprd_store' and 'handle_sprd_load'
These will be set in the PNV chip realize path, so now the SPRD code in target/ppc, will only call this for PowerNV.
Separated the powernv specific code, so target/ppc code doesn't depend on pnv calls now.
Not well tested, will try somethings.
Thanks,
Aditya Gupta
Quoted 14 lines
I don't know what "SPRD" is so I'll let someone more familiar with this area do the proper cleanup.
Regards,
Phil.
Quoted 4 lines
Thanks,
C.
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
Quoted 15 lines · Aditya Gupta
Hi Cédric and Philippe,
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis not available.The fix would be to add an abstract handler to implement SPRD accesses on the PowerNV machine.
Is this what you meant by an abstract handler ?
https://github.com/adi-g15-ibm/qemu/ commit/0abac37032a5ef66d64a649ce04f24876bf9007d
I think so.
Avoid using target_ulong if possible (I suppose SPRD only exists on 64-bit CPUs so can be uint64_t).
Quoted 35 lines
The thing done, is just to introduce a function pointer in 'PowerPCCPUClass', namely '
handle_sprd_store' and 'handle_sprd_load'These will be set in the PNV chip realize path, so now the SPRD code in target/ppc, will only call this for PowerNV.
Separated the powernv specific code, so target/ppc code doesn't depend on pnv calls now.
Not well tested, will try somethings.
Thanks,
Aditya Gupta
Quoted 14 lines
I don't know what "SPRD" is so I'll let someone more familiar with this area do the proper cleanup.
Regards,
Phil.
Quoted 4 lines
Thanks,
C.
Re: [PATCH 3/3] hw/ppc: Add stub for pnv_chip_find_core()
+Michael
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Aditya Gupta
Hi Cédric and Philippe,
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Cédric Le Goater
Quoted 10 lines · Philippe Mathieu-Daudé
Since commit
9808ce6d5cb, building QEMU configured with '--without-default-devices' fails:Undefined symbols for architecture arm64:
"_pnv_chip_find_core", referenced from:
_helper_load_sprdin target_ppc_misc_helper.c.o_helper_store_sprdin target_ppc_misc_helper.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1Quoted 1 line
Fix by adding a stub when
CONFIG_POWERNVis not available.The fix would be to add an abstract handler to implement SPRD accesses on the PowerNV machine.
Quoted 7 lines
Quoted 2 lines
Is this what you meant by an abstract handler ?
https://github.com/adi-g15-ibm/qemu/ commit/0abac37032a5ef66d64a649ce04f24876bf9007dI think so.
Avoid using
target_ulongif possible (I suppose SPRD only exists on 64-bit CPUs so can beuint64_t).
Thanks Phil. Posted along with your suggested change:
https://lore.kernel.org/qemu-devel/[email protected]/
Thanks,
- Aditya G