Browse Source

build: switch to Kconfig

The make_device_config.sh script is replaced by minikconf, which
is modified to support the same command line as its predecessor.

The roots of the parsing are default-configs/*.mak, Kconfig.host and
hw/Kconfig.  One difference with make_device_config.sh is that all symbols
have to be defined in a Kconfig file, including those coming from the
configure script.  This is the reason for the Kconfig.host file introduced
in the previous patch. Whenever a file in default-configs/*.mak used
$(...) to refer to a config-host.mak symbol, this is replaced by a
Kconfig dependency; this part must be done already in this patch
for bisectability.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <2019012306.3520-28-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tags/v4.0.0-rc0
Paolo Bonzini 5 months ago
parent
commit
e0e312f352

+ 8
- 1
Kconfig.host View File

@@ -1,5 +1,6 @@
1 1
 # These are "proxy" symbols used to pass config-host.mak values
2
-# down to Kconfig.
2
+# down to Kconfig.  See also MINIKCONF_ARGS in the Makefile:
3
+# these two need to be kept in sync.
3 4
 
4 5
 config KVM
5 6
     bool
@@ -10,9 +11,15 @@ config LINUX
10 11
 config OPENGL
11 12
     bool
12 13
 
14
+config X11
15
+    bool
16
+
13 17
 config SPICE
14 18
     bool
15 19
 
20
+config IVSHMEM
21
+    bool
22
+
16 23
 config TPM
17 24
     bool
18 25
 

+ 21
- 5
Makefile View File

@@ -327,8 +327,8 @@ DOCS=
327 327
 endif
328 328
 
329 329
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
330
-SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
331
-SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
330
+SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(filter %-softmmu, $(TARGET_DIRS)))
331
+SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
332 332
 
333 333
 ifeq ($(SUBDIR_DEVICES_MAK),)
334 334
 config-all-devices.mak:
@@ -343,9 +343,25 @@ endif
343 343
 
344 344
 -include $(SUBDIR_DEVICES_MAK_DEP)
345 345
 
346
-%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
347
-	$(call quiet-command, \
348
-            $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp,"GEN","$@.tmp")
346
+# This has to be kept in sync with Kconfig.host.
347
+MINIKCONF_ARGS = \
348
+    $@ $*-config.devices.mak.d $< $(MINIKCONF_INPUTS) \
349
+    CONFIG_KVM=$(CONFIG_KVM) \
350
+    CONFIG_SPICE=$(CONFIG_SPICE) \
351
+    CONFIG_IVSHMEM=$(CONFIG_IVSHMEM) \
352
+    CONFIG_TPM=$(CONFIG_TPM) \
353
+    CONFIG_XEN=$(CONFIG_XEN) \
354
+    CONFIG_OPENGL=$(CONFIG_OPENGL) \
355
+    CONFIG_X11=$(CONFIG_X11) \
356
+    CONFIG_VHOST_USER=$(CONFIG_VHOST_USER) \
357
+    CONFIG_VIRTFS=$(CONFIG_VIRTFS) \
358
+    CONFIG_LINUX=$(CONFIG_LINUX)
359
+
360
+MINIKCONF_INPUTS = $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig
361
+MINIKCONF = $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \
362
+
363
+$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIKCONF_INPUTS) $(BUILD_DIR)/config-host.mak
364
+	$(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) > $@.tmp, "GEN", "$@.tmp")
349 365
 	$(call quiet-command, if test -f $@; then \
350 366
 	  if cmp -s $@.old $@; then \
351 367
 	    mv $@.tmp $@; \

+ 6
- 1
Makefile.target View File

@@ -4,9 +4,12 @@ BUILD_DIR?=$(CURDIR)/..
4 4
 
5 5
 include ../config-host.mak
6 6
 include config-target.mak
7
-include config-devices.mak
8 7
 include $(SRC_PATH)/rules.mak
9 8
 
9
+ifdef CONFIG_SOFTMMU
10
+include config-devices.mak
11
+endif
12
+
10 13
 $(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
11 14
 ifdef CONFIG_LINUX
12 15
 QEMU_CFLAGS += -I../linux-headers
@@ -201,7 +204,9 @@ all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
201 204
 all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
202 205
 all-obj-$(CONFIG_SOFTMMU) += $(slirp-obj-y)
203 206
 
207
+ifdef CONFIG_SOFTMMU
204 208
 $(QEMU_PROG_BUILD): config-devices.mak
209
+endif
205 210
 
206 211
 COMMON_LDADDS = ../libqemuutil.a
207 212
 

+ 6
- 0
configure View File

@@ -7438,12 +7438,18 @@ fi
7438 7438
 
7439 7439
 if supported_xen_target $target; then
7440 7440
     echo "CONFIG_XEN=y" >> $config_target_mak
7441
+    echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak
7441 7442
     if test "$xen_pci_passthrough" = yes; then
7442 7443
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
7443 7444
     fi
7445
+else
7446
+    echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak
7444 7447
 fi
7445 7448
 if supported_kvm_target $target; then
7446 7449
     echo "CONFIG_KVM=y" >> $config_target_mak
7450
+    echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak
7451
+else
7452
+    echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak
7447 7453
 fi
7448 7454
 if supported_hax_target $target; then
7449 7455
     echo "CONFIG_HAX=y" >> $config_target_mak

+ 0
- 3
default-configs/arm-softmmu.mak View File

@@ -51,7 +51,6 @@ CONFIG_ARM_V7M=y
51 51
 CONFIG_NETDUINO2=y
52 52
 
53 53
 CONFIG_ARM_GIC=y
54
-CONFIG_ARM_GIC_KVM=$(CONFIG_KVM)
55 54
 CONFIG_ARM_TIMER=y
56 55
 CONFIG_ARM_MPTIMER=y
57 56
 CONFIG_A9_GTIMER=y
@@ -126,8 +125,6 @@ CONFIG_VERSATILE_PCI=y
126 125
 CONFIG_VERSATILE_I2C=y
127 126
 
128 127
 CONFIG_PCI_EXPRESS_GENERIC_BRIDGE=y
129
-CONFIG_VFIO=$(CONFIG_LINUX)
130
-CONFIG_VFIO_PLATFORM=y
131 128
 CONFIG_VFIO_XGMAC=y
132 129
 CONFIG_VFIO_AMD_XGBE=y
133 130
 

+ 1
- 4
default-configs/i386-softmmu.mak View File

@@ -4,7 +4,6 @@ include pci.mak
4 4
 include sound.mak
5 5
 include usb.mak
6 6
 include hyperv.mak
7
-CONFIG_QXL=$(CONFIG_SPICE)
8 7
 CONFIG_VGA_ISA=y
9 8
 CONFIG_VGA_CIRRUS=y
10 9
 CONFIG_VMWARE_VGA=y
@@ -37,8 +36,6 @@ CONFIG_HPET=y
37 36
 CONFIG_APPLESMC=y
38 37
 CONFIG_I8259=y
39 38
 CONFIG_PFLASH_CFI01=y
40
-CONFIG_TPM_TIS=$(CONFIG_TPM)
41
-CONFIG_TPM_CRB=$(CONFIG_TPM)
42 39
 CONFIG_MC146818RTC=y
43 40
 CONFIG_PCI_PIIX=y
44 41
 CONFIG_WDT_IB700=y
@@ -66,9 +63,9 @@ CONFIG_ACPI_SMBUS=y
66 63
 CONFIG_SMBUS_EEPROM=y
67 64
 CONFIG_FW_CFG_DMA=y
68 65
 CONFIG_I2C=y
69
-CONFIG_SEV=$(CONFIG_KVM)
70 66
 CONFIG_VTD=y
71 67
 CONFIG_AMD_IOMMU=y
72 68
 CONFIG_PAM=y
69
+CONFIG_PC=y
73 70
 CONFIG_I440FX=y
74 71
 CONFIG_Q35=y

+ 0
- 1
default-configs/lm32-softmmu.mak View File

@@ -2,7 +2,6 @@
2 2
 
3 3
 CONFIG_LM32=y
4 4
 CONFIG_MILKYMIST=y
5
-CONFIG_MILKYMIST_TMU2=$(call land,$(CONFIG_X11),$(CONFIG_OPENGL))
6 5
 CONFIG_FRAMEBUFFER=y
7 6
 CONFIG_PTIMER=y
8 7
 CONFIG_PFLASH_CFI01=y

+ 0
- 1
default-configs/pci.mak View File

@@ -47,6 +47,5 @@ CONFIG_VGA_PCI=y
47 47
 CONFIG_BOCHS_DISPLAY=y
48 48
 CONFIG_IVSHMEM_DEVICE=$(CONFIG_IVSHMEM)
49 49
 CONFIG_ROCKER=y
50
-CONFIG_VFIO=$(CONFIG_LINUX)
51 50
 CONFIG_VFIO_PCI=y
52 51
 CONFIG_EDID=y

+ 0
- 1
default-configs/ppc-softmmu.mak View File

@@ -18,7 +18,6 @@ CONFIG_I8259=y
18 18
 CONFIG_XILINX=y
19 19
 CONFIG_XILINX_ETHLITE=y
20 20
 CONFIG_E500=y
21
-CONFIG_OPENPIC_KVM=$(call land,$(CONFIG_E500),$(CONFIG_KVM))
22 21
 CONFIG_PLATFORM_BUS=y
23 22
 CONFIG_ETSEC=y
24 23
 CONFIG_PPC405=y

+ 0
- 5
default-configs/ppc64-softmmu.mak View File

@@ -13,11 +13,6 @@ CONFIG_ISA_IPMI_BT=y
13 13
 # For pSeries
14 14
 CONFIG_PSERIES=y
15 15
 CONFIG_VIRTIO_VGA=y
16
-CONFIG_XICS=$(CONFIG_PSERIES)
17
-CONFIG_XICS_SPAPR=$(CONFIG_PSERIES)
18
-CONFIG_XICS_KVM=$(call land,$(CONFIG_PSERIES),$(CONFIG_KVM))
19
-CONFIG_XIVE=$(CONFIG_PSERIES)
20
-CONFIG_XIVE_SPAPR=$(CONFIG_PSERIES)
21 16
 CONFIG_MEM_DEVICE=y
22 17
 CONFIG_DIMM=y
23 18
 CONFIG_SPAPR_RNG=y

+ 1
- 3
default-configs/s390x-softmmu.mak View File

@@ -1,12 +1,10 @@
1 1
 CONFIG_PCI=y
2
-CONFIG_VIRTIO_PCI=$(CONFIG_PCI)
2
+CONFIG_VIRTIO_PCI=y
3 3
 include virtio.mak
4 4
 CONFIG_SCLPCONSOLE=y
5 5
 CONFIG_TERMINAL3270=y
6 6
 CONFIG_S390_FLIC=y
7
-CONFIG_S390_FLIC_KVM=$(CONFIG_KVM)
8 7
 CONFIG_WDT_DIAG288=y
9 8
 CONFIG_S390_CCW_VIRTIO=y
10
-CONFIG_VFIO=$(CONFIG_LINUX)
11 9
 CONFIG_VFIO_CCW=y
12 10
 CONFIG_VFIO_AP=y

+ 0
- 3
default-configs/virtio.mak View File

@@ -1,5 +1,3 @@
1
-CONFIG_VHOST_USER_SCSI=$(CONFIG_VHOST_USER)
2
-CONFIG_VHOST_USER_BLK=$(CONFIG_VHOST_USER)
3 1
 CONFIG_VIRTIO=y
4 2
 CONFIG_VIRTIO_9P=$(CONFIG_VIRTFS)
5 3
 CONFIG_VIRTIO_BALLOON=y
@@ -12,4 +10,3 @@ CONFIG_VIRTIO_RNG=y
12 10
 CONFIG_SCSI=y
13 11
 CONFIG_VIRTIO_SCSI=y
14 12
 CONFIG_VIRTIO_SERIAL=y
15
-CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX)

+ 2
- 0
hw/9pfs/Kconfig View File

@@ -1,2 +1,4 @@
1 1
 config VIRTIO_9P
2 2
     bool
3
+    default y
4
+    depends on VIRTFS

+ 1
- 0
hw/arm/Kconfig View File

@@ -1,5 +1,6 @@
1 1
 config ARM_VIRT
2 2
     bool
3
+    imply VFIO_PLATFORM
3 4
 
4 5
 config DIGIC
5 6
     bool

+ 2
- 0
hw/block/Kconfig View File

@@ -27,3 +27,5 @@ config VIRTIO_BLK
27 27
 
28 28
 config VHOST_USER_BLK
29 29
     bool
30
+    default y
31
+    depends on VHOST_USER && LINUX

+ 3
- 0
hw/display/Kconfig View File

@@ -51,6 +51,8 @@ config FRAMEBUFFER
51 51
 
52 52
 config MILKYMIST_TMU2
53 53
     bool
54
+    default y
55
+    depends on OPENGL && X11
54 56
 
55 57
 config SM501
56 58
     bool
@@ -66,6 +68,7 @@ config VGA
66 68
 
67 69
 config QXL
68 70
     bool
71
+    depends on SPICE && PCI
69 72
 
70 73
 config VIRTIO_GPU
71 74
     bool

+ 8
- 0
hw/i386/Kconfig View File

@@ -1,5 +1,13 @@
1 1
 config SEV
2 2
     bool
3
+    depends on KVM
4
+
5
+config PC
6
+    bool
7
+    imply QXL
8
+    imply SEV
9
+    imply TPM_CRB
10
+    imply TPM_TIS
3 11
 
4 12
 config I440FX
5 13
     bool

+ 5
- 0
hw/input/Kconfig View File

@@ -19,5 +19,10 @@ config TSC2005
19 19
 config VIRTIO_INPUT
20 20
     bool
21 21
 
22
+config VIRTIO_INPUT_HOST
23
+    bool
24
+    default y
25
+    depends on LINUX
26
+
22 27
 config TSC210X
23 28
     bool

+ 12
- 0
hw/intc/Kconfig View File

@@ -21,18 +21,28 @@ config APIC
21 21
 
22 22
 config ARM_GIC_KVM
23 23
     bool
24
+    default y
25
+    depends on ARM_GIC && KVM
24 26
 
25 27
 config OPENPIC_KVM
26 28
     bool
29
+    default y
30
+    depends on OPENPIC && KVM
27 31
 
28 32
 config XICS
29 33
     bool
34
+    default y
35
+    depends on PSERIES
30 36
 
31 37
 config XICS_SPAPR
32 38
     bool
39
+    default y
40
+    depends on PSERIES
33 41
 
34 42
 config XICS_KVM
35 43
     bool
44
+    default y
45
+    depends on XICS && KVM
36 46
 
37 47
 config ALLWINNER_A10_PIC
38 48
     bool
@@ -42,6 +52,8 @@ config S390_FLIC
42 52
 
43 53
 config S390_FLIC_KVM
44 54
     bool
55
+    default y
56
+    depends on S390_FLIC && KVM
45 57
 
46 58
 config OMPIC
47 59
     bool

+ 2
- 0
hw/misc/Kconfig View File

@@ -48,6 +48,8 @@ config MACIO
48 48
 
49 49
 config IVSHMEM_DEVICE
50 50
     bool
51
+    default y
52
+    depends on PCI && LINUX && IVSHMEM
51 53
 
52 54
 config ECCMEMCTL
53 55
     bool

+ 4
- 0
hw/ppc/Kconfig View File

@@ -39,6 +39,10 @@ config VIRTEX
39 39
 
40 40
 config XIVE
41 41
     bool
42
+    default y
43
+    depends on PSERIES
42 44
 
43 45
 config XIVE_SPAPR
44 46
     bool
47
+    default y
48
+    depends on PSERIES

+ 7
- 0
hw/scsi/Kconfig View File

@@ -19,8 +19,15 @@ config ESP
19 19
 config ESP_PCI
20 20
     bool
21 21
 
22
+config SPAPR_VSCSI
23
+    bool
24
+    default y
25
+    depends on PSERIES
26
+
22 27
 config VIRTIO_SCSI
23 28
     bool
24 29
 
25 30
 config VHOST_USER_SCSI
26 31
     bool
32
+    default y
33
+    depends on VHOST_USER && LINUX

+ 2
- 0
hw/tpm/Kconfig View File

@@ -3,9 +3,11 @@ config TPM
3 3
 
4 4
 config TPM_TIS
5 5
     bool
6
+    depends on TPM
6 7
 
7 8
 config TPM_CRB
8 9
     bool
10
+    depends on TPM
9 11
 
10 12
 config TPM_PASSTHROUGH
11 13
     bool

+ 9
- 0
hw/vfio/Kconfig View File

@@ -1,14 +1,21 @@
1 1
 config VFIO
2 2
     bool
3
+    depends on LINUX
3 4
 
4 5
 config VFIO_PCI
5 6
     bool
7
+    select VFIO
8
+    depends on LINUX
6 9
 
7 10
 config VFIO_CCW
8 11
     bool
12
+    select VFIO
13
+    depends on LINUX
9 14
 
10 15
 config VFIO_PLATFORM
11 16
     bool
17
+    select VFIO
18
+    depends on LINUX
12 19
 
13 20
 config VFIO_XGMAC
14 21
     bool
@@ -18,3 +25,5 @@ config VFIO_AMD_XGBE
18 25
 
19 26
 config VFIO_AP
20 27
     bool
28
+    select VFIO
29
+    depends on LINUX

+ 1
- 1
hw/xtensa/Kconfig View File

@@ -1,5 +1,5 @@
1 1
 config XTENSA_SIM
2 2
     bool
3 3
 
4
-config XTENSA_FPGA
4
+config XTENSA_XTFPGA
5 5
     bool

+ 1
- 1
rules.mak View File

@@ -144,7 +144,7 @@ cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
144 144
 cc-c-option = $(if $(shell $(CC) $1 $2 -c -o /dev/null -xc /dev/null \
145 145
                 >/dev/null 2>&1 && echo OK), $2, $3)
146 146
 
147
-VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc
147
+VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc Kconfig%
148 148
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
149 149
 
150 150
 # install-prog list, dir

+ 0
- 30
scripts/make_device_config.sh View File

@@ -1,30 +0,0 @@
1
-#! /bin/sh
2
-# Writes a target device config file to stdout, from a default and from
3
-# include directives therein.  Also emits Makefile dependencies.
4
-#
5
-# Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST
6
-
7
-src=$1
8
-dep=$2
9
-target=$3
10
-src_dir=$(dirname $src)
11
-all_includes=
12
-
13
-process_includes () {
14
-  cat $1 | grep '^include' | \
15
-  while read include file ; do
16
-    all_includes="$all_includes $src_dir/$file"
17
-    process_includes $src_dir/$file
18
-  done
19
-}
20
-
21
-f=$src
22
-while [ -n "$f" ] ; do
23
-  f=$(cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}')
24
-  [ $? = 0 ] || exit 1
25
-  all_includes="$all_includes $f"
26
-done
27
-process_includes $src
28
-
29
-cat $src $all_includes | grep -v '^include'
30
-echo "$target: $all_includes" > $dep

Loading…
Cancel
Save