diff mbox series

[RFC,v2,26/37] scsi: express dependencies with Kconfig

Message ID 20190115141108.934-27-yang.zhong@intel.com
State New
Headers show
Series Support Kconfig in QEMU | expand

Commit Message

Yang Zhong Jan. 15, 2019, 2:10 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

This lets you disable SCSI altogether with "CONFIG_SCSI=n".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
---
 hw/scsi/Kconfig       | 12 ++++++++++++
 hw/scsi/Makefile.objs |  2 +-
 hw/usb/Kconfig        |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

Comments

Thomas Huth Jan. 16, 2019, 11:50 a.m. UTC | #1
On 2019-01-15 15:10, Yang Zhong wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> This lets you disable SCSI altogether with "CONFIG_SCSI=n".

Sorry for my ignorant question, but: Can we really disable SCSI if the
Kconfig files use "select SCSI" all over the place? I'd rather expect
that "CONFIG_SCSI=n" only works if we only use "depends on SCSI" everywhere?

I'm fine if we use select SCSI in this patch, but maybe the commit
message should be tweaked in case you can not really disable SCSI like
this anymore?

 Thomas


> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> ---
>  hw/scsi/Kconfig       | 12 ++++++++++++
>  hw/scsi/Makefile.objs |  2 +-
>  hw/usb/Kconfig        |  2 ++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
> index 812a12522b..7a9d373382 100644
> --- a/hw/scsi/Kconfig
> +++ b/hw/scsi/Kconfig
> @@ -5,24 +5,29 @@ config LSI_SCSI_PCI
>      bool
>      default y
>      depends on PCI
> +    select SCSI
>  
>  config MPTSAS_SCSI_PCI
>      bool
>      default y
>      depends on PCI
> +    select SCSI
>  
>  config MEGASAS_SCSI_PCI
>      bool
>      default y
>      depends on PCI
> +    select SCSI
>  
>  config VMW_PVSCSI_SCSI_PCI
>      bool
>      default y
>      depends on PCI
> +    select SCSI
>  
>  config ESP
>      bool
> +    select SCSI
>  
>  config ESP_PCI
>      bool
> @@ -30,8 +35,15 @@ config ESP_PCI
>      depends on PCI
>      select ESP
>  
> +config SPAPR_VSCSI
> +    bool
> +    depends on PSERIES
> +    select SCSI
> +
>  config VIRTIO_SCSI
>      bool
> +    default y
> +    select SCSI
>  
>  config VHOST_USER_SCSI
>      bool
> diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs
> index 45167baeaf..54b36ed8b1 100644
> --- a/hw/scsi/Makefile.objs
> +++ b/hw/scsi/Makefile.objs
> @@ -6,7 +6,7 @@ common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o
>  common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o
>  common-obj-$(CONFIG_ESP) += esp.o
>  common-obj-$(CONFIG_ESP_PCI) += esp-pci.o
> -obj-$(CONFIG_PSERIES) += spapr_vscsi.o
> +obj-$(CONFIG_SPAPR_VSCSI) += spapr_vscsi.o
>  
>  ifeq ($(CONFIG_VIRTIO_SCSI),y)
>  obj-y += virtio-scsi.o virtio-scsi-dataplane.o
> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
> index 0b8f41040e..db46c56cc8 100644
> --- a/hw/usb/Kconfig
> +++ b/hw/usb/Kconfig
> @@ -52,11 +52,13 @@ config USB_STORAGE_BOT
>      bool
>      default y
>      depends on USB
> +    select SCSI
>  
>  config USB_STORAGE_UAS
>      bool
>      default y
>      depends on USB
> +    select SCSI
>  
>  config USB_AUDIO
>      bool
>
Paolo Bonzini Jan. 16, 2019, 1:57 p.m. UTC | #2
On 16/01/19 12:50, Thomas Huth wrote:
>> From: Paolo Bonzini <pbonzini@redhat.com>
>>
>> This lets you disable SCSI altogether with "CONFIG_SCSI=n".
> Sorry for my ignorant question, but: Can we really disable SCSI if the
> Kconfig files use "select SCSI" all over the place? I'd rather expect
> that "CONFIG_SCSI=n" only works if we only use "depends on SCSI" everywhere?

Right.  It would work if the controllers depended on SCSI, but you can
say instead "this automatically removes the SCSI subsystem from the
binary altogether if no controllers are selected".  Same for I2C, etc.

Paolo

> I'm fine if we use select SCSI in this patch, but maybe the commit
> message should be tweaked in case you can not really disable SCSI like
> this anymore?
diff mbox series

Patch

diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
index 812a12522b..7a9d373382 100644
--- a/hw/scsi/Kconfig
+++ b/hw/scsi/Kconfig
@@ -5,24 +5,29 @@  config LSI_SCSI_PCI
     bool
     default y
     depends on PCI
+    select SCSI
 
 config MPTSAS_SCSI_PCI
     bool
     default y
     depends on PCI
+    select SCSI
 
 config MEGASAS_SCSI_PCI
     bool
     default y
     depends on PCI
+    select SCSI
 
 config VMW_PVSCSI_SCSI_PCI
     bool
     default y
     depends on PCI
+    select SCSI
 
 config ESP
     bool
+    select SCSI
 
 config ESP_PCI
     bool
@@ -30,8 +35,15 @@  config ESP_PCI
     depends on PCI
     select ESP
 
+config SPAPR_VSCSI
+    bool
+    depends on PSERIES
+    select SCSI
+
 config VIRTIO_SCSI
     bool
+    default y
+    select SCSI
 
 config VHOST_USER_SCSI
     bool
diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs
index 45167baeaf..54b36ed8b1 100644
--- a/hw/scsi/Makefile.objs
+++ b/hw/scsi/Makefile.objs
@@ -6,7 +6,7 @@  common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o
 common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o
 common-obj-$(CONFIG_ESP) += esp.o
 common-obj-$(CONFIG_ESP_PCI) += esp-pci.o
-obj-$(CONFIG_PSERIES) += spapr_vscsi.o
+obj-$(CONFIG_SPAPR_VSCSI) += spapr_vscsi.o
 
 ifeq ($(CONFIG_VIRTIO_SCSI),y)
 obj-y += virtio-scsi.o virtio-scsi-dataplane.o
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index 0b8f41040e..db46c56cc8 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -52,11 +52,13 @@  config USB_STORAGE_BOT
     bool
     default y
     depends on USB
+    select SCSI
 
 config USB_STORAGE_UAS
     bool
     default y
     depends on USB
+    select SCSI
 
 config USB_AUDIO
     bool