Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 212

kvm-83-164.el5_5.30.src.rpm

From fb0c53366cbec890730043b9cf1ddefb94029ca1 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 21 Jul 2009 22:27:06 +0200
Subject: [PATCH 02/16] add option to disable scsi

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <cbb8c524097dc4fe23ac50c7d84d048ab04d1da5.1248207931.git.quintela@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Bugzilla: 512837
Message-Id: <cbb8c524097dc4fe23ac50c7d84d048ab04d1da5.1248095796.git.quintela@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Upstream-status: pending
Acked-by: Dor Laor <dlaor@redhat.com>
Acked-by: "Daniel P. Berrange" <berrange@redhat.com>
---
 qemu/Makefile         |    6 ++++--
 qemu/Makefile.target  |    2 ++
 qemu/configure        |    9 +++++++++
 qemu/hw/pc.c          |    2 ++
 qemu/hw/pci-hotplug.c |    4 ++++
 qemu/hw/pci.h         |    2 ++
 qemu/vl.c             |    2 ++
 7 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/qemu/Makefile b/qemu/Makefile
index bdfb37a..3659c2e 100644
--- a/qemu/Makefile
+++ b/qemu/Makefile
@@ -79,8 +79,10 @@ OBJS+=irq.o
 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
 OBJS+=tmp105.o lm832x.o
-OBJS+=scsi-disk.o cdrom.o
-OBJS+=scsi-generic.o
+OBJS+=cdrom.o
+ifdef CONFIG_SCSI
+OBJS+=scsi-disk.o scsi-generic.o
+endif
 OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
 OBJS+=usb-serial.o usb-net.o
 OBJS+=sd.o ssi-sd.o
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index de7ecac..f517023 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -683,8 +683,10 @@ ifdef CONFIG_BLUEZ
 LIBS += $(CONFIG_BLUEZ_LIBS)
 endif
 
+ifdef CONFIG_SCSI
 # SCSI layer
 OBJS+= lsi53c895a.o esp.o
+endif
 
 # USB layer
 OBJS+= usb-ohci.o
diff --git a/qemu/configure b/qemu/configure
index 95d176b..afb4efc 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -175,6 +175,7 @@ nptl="yes"
 mixemu="no"
 bluez="yes"
 smb="yes"
+scsi="yes"
 kvm="yes"
 kvm_cap_pit="no"
 kvm_cap_device_assignment="no"
@@ -406,6 +407,8 @@ for opt do
   ;;
   --disable-smb) smb="no"
   ;;
+  --disable-scsi) scsi="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -559,6 +562,7 @@ echo "  --disable-gcrypt         disable libgcrypt usage"
 echo "  --disable-curses         disable curses output"
 echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-smb            disable smb user directories"
+echo "  --disable-scsi           disable scsi devices"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1289,6 +1293,7 @@ echo "AIO support       $aio"
 echo "QXL               $qxl"
 echo "Spice             $spice"
 echo "SMB directores    $smb"
+echo "SCSI devices      $scsi"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1578,6 +1583,10 @@ fi
 if test "$smb" = "yes" ; then
   echo "#define CONFIG_SMB 1" >> $config_h
 fi
+if test "$scsi" = "yes" ; then
+  echo "CONFIG_SCSI=yes" >> $config_mak
+  echo "#define CONFIG_SCSI 1" >> $config_h
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 692ddea..d901527 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -1167,6 +1167,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
         i440fx_init_memory_mappings(i440fx_state);
     }
 
+#ifdef CONFIG_SCSI
     if (pci_enabled) {
 	int max_bus;
         int bus, unit;
@@ -1184,6 +1185,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
 	    }
         }
     }
+#endif
 
     /* Add virtio block devices */
     if (pci_enabled) {
diff --git a/qemu/hw/pci-hotplug.c b/qemu/hw/pci-hotplug.c
index 31e92ab..d8a34c5 100644
--- a/qemu/hw/pci-hotplug.c
+++ b/qemu/hw/pci-hotplug.c
@@ -70,10 +70,12 @@ void drive_hot_add(const char *pci_addr, const char *opts)
     bus = drive_get_max_bus (type);
 
     switch (type) {
+#ifdef CONFIG_SCSI
     case IF_SCSI:
         success = 1;
         lsi_scsi_attach (dev, drives_table[drive_idx].bdrv,
                          drives_table[drive_idx].unit);
+#endif
         break;
     default:
         term_printf("Can't hot-add drive to type %d\n", type);
@@ -112,12 +114,14 @@ static PCIDevice *qemu_pci_hot_add_storage(PCIBus *pci_bus, const char *opts)
     }
 
     switch (type) {
+#ifdef CONFIG_SCSI
     case IF_SCSI:
         opaque = lsi_scsi_init (pci_bus, -1);
         if (opaque && drive_idx >= 0)
             lsi_scsi_attach (opaque, drives_table[drive_idx].bdrv,
                              drives_table[drive_idx].unit);
         break;
+#endif
     case IF_VIRTIO:
         opaque = virtio_blk_init (pci_bus, drives_table[drive_idx].bdrv);
         break;
diff --git a/qemu/hw/pci.h b/qemu/hw/pci.h
index 0ac2520..36bbe9b 100644
--- a/qemu/hw/pci.h
+++ b/qemu/hw/pci.h
@@ -187,10 +187,12 @@ void pci_info(void);
 PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint32_t id,
                         pci_map_irq_fn map_irq, const char *name);
 
+#ifdef CONFIG_SCSI
 /* lsi53c895a.c */
 #define LSI_MAX_DEVS 7
 void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id);
 void *lsi_scsi_init(PCIBus *bus, int devfn);
+#endif
 
 /* vmware_vga.c */
 void pci_vmsvga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
diff --git a/qemu/vl.c b/qemu/vl.c
index 6420267..3b465ba 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -2419,9 +2419,11 @@ int drive_init(struct drive_opt *arg, int snapshot,
         if (!strcmp(buf, "ide")) {
 	    type = IF_IDE;
             max_devs = MAX_IDE_DEVS;
+#ifdef CONFIG_SCSI
         } else if (!strcmp(buf, "scsi")) {
 	    type = IF_SCSI;
             max_devs = MAX_SCSI_DEVS;
+#endif
         } else if (!strcmp(buf, "floppy")) {
 	    type = IF_FLOPPY;
             max_devs = 0;
-- 
1.6.3.rc4.29.g8146