[Qemu-devel] [PATCH 40/52] scsi: express dependencies with Kconfig

Paolo Bonzini posted 52 patches 7 years ago
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Palmer Dabbelt <palmer@sifive.com>, Max Filippov <jcmvbkbc@gmail.com>, Alistair Francis <alistair@alistair23.me>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Max Reitz <mreitz@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Igor Mammedov <imammedo@redhat.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Fam Zheng <fam@euphon.net>, Cornelia Huck <cohuck@redhat.com>, Peter Crosthwaite <crosthwaite.peter@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>, Aleksandar Rikalo <arikalo@wavecomp.com>, Corey Minyard <minyard@acm.org>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Alex Williamson <alex.williamson@redhat.com>, Alberto Garcia <berto@igalia.com>, Anthony Green <green@moxielogic.com>, Jason Wang <jasowang@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Richard Henderson <rth@twiddle.net>, Greg Kurz <groug@kaod.org>, "Daniel P. Berrangé" <berrange@redhat.com>, Alistair Francis <Alistair.Francis@wdc.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Michael Clark <mjc@sifive.com>, Kevin Wolf <kwolf@redhat.com>, Chris Wulff <crwulff@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Stafford Horne <shorne@gmail.com>, Michael Walle <michael@walle.cc>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, David Hildenbrand <david@redhat.com>, Marek Vasut <marex@denx.de>, Paolo Bonzini <pbonzini@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Peter Maydell <peter.maydell@linaro.org>, Halil Pasic <pasic@linux.ibm.com>, Stefan Berger <stefanb@linux.ibm.com>, John Snow <jsnow@redhat.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Christian Borntraeger <borntraeger@de.ibm.com>, Artyom Tarasenko <atar4qemu@gmail.com>, Cleber Rosa <crosa@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH 40/52] scsi: express dependencies with Kconfig
Posted by Paolo Bonzini 7 years ago
This automatically removes the SCSI subsystem from the
binary altogether if no controllers are selected.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20190123065618.3520-34-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/Kconfig       | 11 ++++++++++-
 hw/scsi/Makefile.objs |  2 +-
 hw/usb/Kconfig        |  2 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
index c02d880..b9cf269 100644
--- a/hw/scsi/Kconfig
+++ b/hw/scsi/Kconfig
@@ -5,24 +5,29 @@ config LSI_SCSI_PCI
     bool
     default y if PCI_DEVICES
     depends on PCI
+    select SCSI
 
 config MPTSAS_SCSI_PCI
     bool
     default y if PCI_DEVICES
     depends on PCI
+    select SCSI
 
 config MEGASAS_SCSI_PCI
     bool
     default y if PCI_DEVICES
     depends on PCI
+    select SCSI
 
 config VMW_PVSCSI_SCSI_PCI
     bool
     default y if PCI_DEVICES
     depends on PCI
+    select SCSI
 
 config ESP
     bool
+    select SCSI
 
 config ESP_PCI
     bool
@@ -34,10 +39,14 @@ config SPAPR_VSCSI
     bool
     default y
     depends on PSERIES
+    select SCSI
 
 config VIRTIO_SCSI
     bool
+    select SCSI
 
 config VHOST_USER_SCSI
     bool
-    default y if VHOST_USER && LINUX
+    # Only PCI devices are provided for now
+    default y if VIRTIO_PCI
+    depends on VHOST_USER && LINUX
diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs
index 45167ba..54b36ed 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 e20670a..a1b7acb 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
-- 
1.8.3.1



Re: [Qemu-devel] [PATCH 40/52] scsi: express dependencies with Kconfig
Posted by Philippe Mathieu-Daudé 7 years ago
On 1/25/19 11:06 AM, Paolo Bonzini wrote:
> This automatically removes the SCSI subsystem from the
> binary altogether if no controllers are selected.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> Message-Id: <20190123065618.3520-34-yang.zhong@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/scsi/Kconfig       | 11 ++++++++++-
>  hw/scsi/Makefile.objs |  2 +-
>  hw/usb/Kconfig        |  2 ++
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
> index c02d880..b9cf269 100644
> --- a/hw/scsi/Kconfig
> +++ b/hw/scsi/Kconfig
> @@ -5,24 +5,29 @@ config LSI_SCSI_PCI
>      bool
>      default y if PCI_DEVICES
>      depends on PCI
> +    select SCSI
>  
>  config MPTSAS_SCSI_PCI
>      bool
>      default y if PCI_DEVICES
>      depends on PCI
> +    select SCSI
>  
>  config MEGASAS_SCSI_PCI
>      bool
>      default y if PCI_DEVICES
>      depends on PCI
> +    select SCSI
>  
>  config VMW_PVSCSI_SCSI_PCI
>      bool
>      default y if PCI_DEVICES
>      depends on PCI
> +    select SCSI
>  
>  config ESP
>      bool
> +    select SCSI
>  
>  config ESP_PCI
>      bool
> @@ -34,10 +39,14 @@ config SPAPR_VSCSI
>      bool
>      default y
>      depends on PSERIES
> +    select SCSI
>  
>  config VIRTIO_SCSI
>      bool
> +    select SCSI
>  
>  config VHOST_USER_SCSI
>      bool
> -    default y if VHOST_USER && LINUX
> +    # Only PCI devices are provided for now
> +    default y if VIRTIO_PCI
> +    depends on VHOST_USER && LINUX
> diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs
> index 45167ba..54b36ed 100644
> --- a/hw/scsi/Makefile.objs
> +++ b/hw/scsi/Makefile.objs
> @@ -6,7 +6,7 @@ common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o

You missed:

-common-obj-y += scsi-disk.o emulation.o
-common-obj-y += scsi-generic.o scsi-bus.o
+common-obj-$(CONFIG_SCSI) += scsi-disk.o emulation.o
+common-obj-$(CONFIG_SCSI) += scsi-generic.o scsi-bus.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 e20670a..a1b7acb 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
> 

Re: [Qemu-devel] [PATCH 40/52] scsi: express dependencies with Kconfig
Posted by Paolo Bonzini 7 years ago
On 31/01/19 22:23, Philippe Mathieu-Daudé wrote:
> You missed:
> 
> -common-obj-y += scsi-disk.o emulation.o
> -common-obj-y += scsi-generic.o scsi-bus.o
> +common-obj-$(CONFIG_SCSI) += scsi-disk.o emulation.o
> +common-obj-$(CONFIG_SCSI) += scsi-generic.o scsi-bus.o
> 

I didn't: :)

devices-dirs-$(CONFIG_SCSI) += scsi/

Paolo