meson: cleanup Kconfig.host handling

Build the array of command line arguments coming from config_host
once for all targets.  Add all accelerators to accel/Kconfig so
that the command line arguments for accelerators can be computed
easily in the existing "foreach sym: accelerators" loop.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-11-17 14:58:32 +01:00
parent 2f2a376a42
commit 0a18911074
3 changed files with 35 additions and 36 deletions

View File

@ -1,3 +1,12 @@
config WHPX
bool
config HAX
bool
config HVF
bool
config TCG config TCG
bool bool

View File

@ -288,21 +288,20 @@ they will include all these symbols and some help text on what they do.
---------------- ----------------
In some special cases, a configurable element depends on host features In some special cases, a configurable element depends on host features
that are detected by QEMU's configure script; for example some devices that are detected by QEMU's configure or ``meson.build`` scripts; for
depend on the availability of KVM or on the presence of a library on example some devices depend on the availability of KVM or on the presence
the host. of a library on the host.
These symbols should be listed in ``Kconfig.host`` like this:: These symbols should be listed in ``Kconfig.host`` like this::
config KVM config TPM
bool bool
and also listed as follows in the top-level Makefile's ``MINIKCONF_ARGS`` and also listed as follows in the top-level meson.build's host_kconfig
variable:: variable::
MINIKCONF_ARGS = \ host_kconfig = \
$@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \ ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
CONFIG_KVM=$(CONFIG_KVM) \ ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
CONFIG_SPICE=$(CONFIG_SPICE) \ ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
CONFIG_TPM=$(CONFIG_TPM) \
... ...

View File

@ -958,21 +958,19 @@ if link_language == 'cpp'
} }
endif endif
kconfig_external_symbols = [ host_kconfig = \
'CONFIG_KVM', ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
'CONFIG_XEN', ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
'CONFIG_TPM', ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
'CONFIG_SPICE', ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
'CONFIG_IVSHMEM', ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \
'CONFIG_OPENGL', ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
'CONFIG_X11', ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
'CONFIG_VHOST_USER', ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
'CONFIG_VHOST_VDPA', ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
'CONFIG_VHOST_KERNEL', ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
'CONFIG_VIRTFS', ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
'CONFIG_LINUX',
'CONFIG_PVRDMA',
]
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
@ -1007,7 +1005,7 @@ foreach target : target_dirs
} }
endif endif
have_accel = false accel_kconfig = []
foreach sym: accelerators foreach sym: accelerators
if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
config_target += { sym: 'y' } config_target += { sym: 'y' }
@ -1015,10 +1013,10 @@ foreach target : target_dirs
if sym == 'CONFIG_XEN' and have_xen_pci_passthrough if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
endif endif
have_accel = true accel_kconfig += [ sym + '=y' ]
endif endif
endforeach endforeach
if not have_accel if accel_kconfig.length() == 0
if default_targets if default_targets
continue continue
endif endif
@ -1072,13 +1070,6 @@ foreach target : target_dirs
configuration: config_target_data)} configuration: config_target_data)}
if target.endswith('-softmmu') if target.endswith('-softmmu')
base_kconfig = []
foreach sym : kconfig_external_symbols
if sym in config_target or sym in config_host
base_kconfig += '@0@=y'.format(sym)
endif
endforeach
config_devices_mak = target + '-config-devices.mak' config_devices_mak = target + '-config-devices.mak'
config_devices_mak = configure_file( config_devices_mak = configure_file(
input: ['default-configs/devices' / target + '.mak', 'Kconfig'], input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
@ -1087,7 +1078,7 @@ foreach target : target_dirs
capture: true, capture: true,
command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
config_devices_mak, '@DEPFILE@', '@INPUT@', config_devices_mak, '@DEPFILE@', '@INPUT@',
base_kconfig]) host_kconfig, accel_kconfig])
config_devices_data = configuration_data() config_devices_data = configuration_data()
config_devices = keyval.load(config_devices_mak) config_devices = keyval.load(config_devices_mak)