Skip to content

Commit 20c384f

Browse files
jasowangmstsirkin
authored andcommitted
vhost: refine vhost and vringh kconfig
Currently, CONFIG_VHOST depends on CONFIG_VIRTUALIZATION. But vhost is not necessarily for VM since it's a generic userspace and kernel communication protocol. Such dependency may prevent archs without virtualization support from using vhost. To solve this, a dedicated vhost menu is created under drivers so CONIFG_VHOST can be decoupled out of CONFIG_VIRTUALIZATION. While at it, also squash Kconfig.vringh into vhost Kconfig file. This avoids the trick of conditional inclusion from VOP or CAIF. Then it will be easier to introduce new vringh users and common dependency for both vringh and vhost. Signed-off-by: Jason Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 5a6b4cc commit 20c384f

File tree

11 files changed

+23
-37
lines changed

11 files changed

+23
-37
lines changed

arch/arm/kvm/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@ config KVM_ARM_HOST
5454
---help---
5555
Provides host support for ARM processors.
5656

57-
source "drivers/vhost/Kconfig"
58-
5957
endif # VIRTUALIZATION

arch/arm64/kvm/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,4 @@ config KVM_ARM_PMU
6464
config KVM_INDIRECT_VECTORS
6565
def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS)
6666

67-
source "drivers/vhost/Kconfig"
68-
6967
endif # VIRTUALIZATION

arch/mips/kvm/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,4 @@ config KVM_MIPS_DEBUG_COP0_COUNTERS
7272

7373
If unsure, say N.
7474

75-
source "drivers/vhost/Kconfig"
76-
7775
endif # VIRTUALIZATION

arch/powerpc/kvm/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,4 @@ config KVM_XIVE
204204
default y
205205
depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE
206206

207-
source "drivers/vhost/Kconfig"
208-
209207
endif # VIRTUALIZATION

arch/s390/kvm/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,4 @@ config KVM_S390_UCONTROL
5555

5656
If unsure, say N.
5757

58-
# OK, it's a little counter-intuitive to do this, but it puts it neatly under
59-
# the virtualization menu.
60-
source "drivers/vhost/Kconfig"
61-
6258
endif # VIRTUALIZATION

arch/x86/kvm/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,4 @@ config KVM_MMU_AUDIT
107107
This option adds a R/W kVM module parameter 'mmu_audit', which allows
108108
auditing of KVM MMU events at runtime.
109109

110-
# OK, it's a little counter-intuitive to do this, but it puts it neatly under
111-
# the virtualization menu.
112-
source "drivers/vhost/Kconfig"
113-
114110
endif # VIRTUALIZATION

drivers/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ source "drivers/virt/Kconfig"
138138

139139
source "drivers/virtio/Kconfig"
140140

141+
source "drivers/vhost/Kconfig"
142+
141143
source "drivers/hv/Kconfig"
142144

143145
source "drivers/xen/Kconfig"

drivers/misc/mic/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,4 @@ config VOP
133133
OS and tools for MIC to use with this driver are available from
134134
<http://software.intel.com/en-us/mic-developer>.
135135

136-
if VOP
137-
source "drivers/vhost/Kconfig.vringh"
138-
endif
139-
140136
endmenu

drivers/net/caif/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,4 @@ config CAIF_VIRTIO
5858
---help---
5959
The CAIF driver for CAIF over Virtio.
6060

61-
if CAIF_VIRTIO
62-
source "drivers/vhost/Kconfig.vringh"
63-
endif
64-
6561
endif # CAIF_DRIVERS

drivers/vhost/Kconfig

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2+
config VHOST_RING
3+
tristate
4+
help
5+
This option is selected by any driver which needs to access
6+
the host side of a virtio ring.
7+
8+
config VHOST
9+
tristate
10+
select VHOST_IOTLB
11+
help
12+
This option is selected by any driver which needs to access
13+
the core of vhost.
14+
15+
menuconfig VHOST_MENU
16+
bool "VHOST drivers"
17+
default y
18+
19+
if VHOST_MENU
20+
221
config VHOST_NET
322
tristate "Host kernel accelerator for virtio net"
423
depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP)
@@ -23,8 +42,8 @@ config VHOST_SCSI
2342
config VHOST_VSOCK
2443
tristate "vhost virtio-vsock driver"
2544
depends on VSOCKETS && EVENTFD
26-
select VIRTIO_VSOCKETS_COMMON
2745
select VHOST
46+
select VIRTIO_VSOCKETS_COMMON
2847
default n
2948
---help---
3049
This kernel module can be loaded in the host kernel to provide AF_VSOCK
@@ -34,12 +53,6 @@ config VHOST_VSOCK
3453
To compile this driver as a module, choose M here: the module will be called
3554
vhost_vsock.
3655

37-
config VHOST
38-
tristate
39-
---help---
40-
This option is selected by any driver which needs to access
41-
the core of vhost.
42-
4356
config VHOST_CROSS_ENDIAN_LEGACY
4457
bool "Cross-endian support for vhost"
4558
default n
@@ -54,3 +67,4 @@ config VHOST_CROSS_ENDIAN_LEGACY
5467
adds some overhead, it is disabled by default.
5568

5669
If unsure, say "N".
70+
endif

0 commit comments

Comments
 (0)