Skip to contentSkip to conversation

Be able to compile out not needed options

RFC PATCH In review [email protected] 6 participants 31 messages Jun 23, 2009 – Jun 29, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Be able to compile out not needed options

From: Juan Quintela <[email protected]>

Hi

this series of patches:
a- move object files only used by one target to that target Makefile.target b- add flags to disable parts: --disable-{bluez,usb,vwmare,virtio,scsi}
defaults is leave it enabled. You need to add the --disable-* flag to get any change
c- disable the use of --smb <dir>

What is the intent: we want to be able to not compile-in things that we are not interested in (they are experimental/not needed for our target/...).

Is this the right approach? Should I do something different?

For the next series, I am also interested on enable/disabling bits of a subsysem:
being able to support usb-hid but not usb-{host,net,msnd}. I already have patches to disable that, just waiting to hear what is the preffered way to get that functionality.

Known problems:
- qemu-*.hx files don't run over cpp and then we are not able to remove from the help page the options that we don't support.
- drive_hot_add without scsi support do nothing.

Any comments?

Later, Juan.

Juan Quintela (15):
Only compile-in selected audio drivers
Make --disable-bluez to really remove bluetooth support rename usb variable to usb host
protect with CONFIG_BRLAPI
Make --disable-usb to really remove usb support
Add --disable-smb to remove smb directories support
add option to remove scsi support
add option to disable wmware devices
ssi bus is only used on the arm platform
move i2c devices only used in arm devices to arm target
sd flash is only used in arm devices
move m48t59 and ecc driver to ppc and sparc, that are the targets
that use it
nand and ecc are only used on arm and cris argets
enable isa_mmio only in the platforms that use it: ppc, arm, mips and
sparc
add option to disable virtio drivers

 Makefile          |   23 ++++++++++-----
 Makefile.hw       |    8 ++--
 Makefile.target   |   40 ++++++++++++++++++++------
 configure         |   81 +++++++++++++++++++++++++++++++++++++++++++---------
 hw/baum.h         |    2 +
 hw/nseries.c      |    2 +
 hw/pc.c           |    8 +++++
 hw/pci-hotplug.c  |    9 +++++-
 hw/pci.h          |    2 +
 hw/pckbd.c        |    4 +-
 hw/ppc_newworld.c |    2 +
 hw/ppc_oldworld.c |    3 +-
 hw/ppc_prep.c     |    2 +
 hw/pxa2xx.c       |    4 ++
 hw/realview.c     |    2 +
 hw/usb.h          |    3 ++
 hw/versatilepb.c  |    2 +
 monitor.c         |    2 +
 net.c             |    2 +
 qemu-monitor.hx   |    4 ++
 qemu-options.hx   |    4 ++-
 sysemu.h          |    4 ++
 vl.c              |   30 +++++++++++++++----
 23 files changed, 197 insertions(+), 46 deletions(-)
#1 lore raw

PATCH 1/15 Only compile-in selected audio drivers

From: Juan Quintela <[email protected]>

---
 Makefile.target |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Makefile.target +10 -1
index a0f24fa..60326fe 100644
@@ -523,7 +523,16 @@ ifdef CONFIG_OSS
 LIBS += $(CONFIG_OSS_LIB)
 endif
 
-SOUND_HW = sb16.o es1370.o ac97.o
+SOUND_HW =
+ifdef CONFIG_SB16
+SOUND_HW += sb16.o
+endif
+ifdef CONFIG_ES1370
+SOUND_HW += es1370.o
+endif
+ifdef CONFIG_AC97
+SOUND_HW += ac97.o
+endif
 ifdef CONFIG_ADLIB
 SOUND_HW += fmopl.o adlib.o
 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
Signature · 1 line
1.6.2.2
#2 lore raw

Re: [Qemu-devel] [PATCH 01/15] Only compile-in selected audio drivers

Quoted 21 lines · On Tue, 23 Jun 2009, [email protected] wrote:

From: Juan Quintela <[email protected]>

---
 Makefile.target |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Makefile.target +3 -1
index a0f24fa..60326fe 100644
@@ -523,7 +523,16 @@ ifdef CONFIG_OSS
 LIBS += $(CONFIG_OSS_LIB)
 endif
 
-SOUND_HW = sb16.o es1370.o ac97.o
+SOUND_HW =
+ifdef CONFIG_SB16
+SOUND_HW += sb16.o

Makefile.target ifdef CONFIG_OSS · line 538

Quoted 10 lines
Makefile.target +7 -0
+endif
+ifdef CONFIG_ES1370
+SOUND_HW += es1370.o
+endif
+ifdef CONFIG_AC97
+SOUND_HW += ac97.o
+endif
 ifdef CONFIG_ADLIB
 SOUND_HW += fmopl.o adlib.o
 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0

Fine by me, while you are at it pcspk can also be made conditional.

Signature · 1 line
mailto:[email protected]
#3 lore raw

PATCH 2/15 Make --disable-bluez to really remove bluetooth support

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile  |    2 ++
 configure |    1 +
 vl.c      |   12 ++++++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
Makefile +2 -0
index a06c9bf..588523c 100644
@@ -105,8 +105,10 @@ OBJS+=scsi-generic.o
 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
+ifdef CONFIG_BLUEZ
 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
 OBJS+=bt-hci-csr.o
+endif
 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
 OBJS+=msmouse.o ps2.o
configure +1 -0
index 5f11464..92a1466 100755
@@ -1448,6 +1448,7 @@ echo "Install blobs     $blobs"
 echo -e "KVM support       $kvm"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
+echo "bluetooth support $bluez"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
vl.c +10 -2
index 60a00e1..914c907 100644
@@ -1867,6 +1867,7 @@ int check_params(char *buf, int buf_size,
     return 0;
 }
 
+#ifdef CONFIG_BLUEZ
 /***********************************************************/
 /* Bluetooth support */
 static int nb_hcis;
@@ -2057,6 +2058,7 @@ static int bt_parse(const char *opt)
     fprintf(stderr, "qemu: bad bluetooth parameter '%s'\n", opt);
     return 1;
 }
+#endif /* CONFIG_BLUEZ */
 
 /***********************************************************/
 /* QEMU Block devices */
@@ -2716,10 +2718,14 @@ static int usb_device_add(const char *devname, int is_hotplug)
             return -1;
         nd_table[nic].model = "usb";
         dev = usb_net_init(&nd_table[nic]);
-    } else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
+    } else
+#ifdef CONFIG_BLUEZ
+    if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
         dev = usb_bt_init(devname[2] ? hci_init(p) :
                         bt_new_hci(qemu_find_bt_vlan(0)));
-    } else {
+    } else
+#endif
+    {
         return -1;
     }
     if (!dev)
@@ -5872,10 +5878,12 @@ int main(int argc, char **argv, char **envp)
 
     net_client_check();
 
+#ifdef CONFIG_BLUEZ
     /* init the bluetooth world */
     for (i = 0; i < nb_bt_opts; i++)
         if (bt_parse(bt_opts[i]))
             exit(1);
+#endif
 
     /* init the memory */
     if (ram_size == 0)
Signature · 1 line
1.6.2.2
#4 lore raw

PATCH 3/15 rename usb variable to usb host

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
index 92a1466..73c3550 100755
@@ -328,7 +328,7 @@ audio_drv_list="oss"
 audio_possible_drivers="oss alsa sdl esd pa"
 linux="yes"
 linux_user="yes"
-usb="linux"
+usb_host="linux"
 kvm="yes"
 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
@@ -340,7 +340,7 @@ esac
 if [ "$bsd" = "yes" ] ; then
   if [ "$darwin" != "yes" ] ; then
     make="gmake"
-    usb="bsd"
+    usb_host="bsd"
   fi
   bsd_user="yes"
 fi
@@ -1803,7 +1803,7 @@ fi
 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
 
 # USB host support
-case "$usb" in
+case "$usb_host" in
 linux)
   echo "HOST_USB=linux" >> $config_mak
 ;;
Signature · 1 line
1.6.2.2
#5 lore raw

PATCH 4/15 protect with CONFIG_BRLAPI

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 hw/baum.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/baum.h +2 -0
index ac34b30..3bad998 100644
@@ -22,8 +22,10 @@
  * THE SOFTWARE.
  */
 
+#ifdef CONFIG_BRLAPI
 /* usb device */
 USBDevice *usb_baum_init(void);
 
 /* char device */
 CharDriverState *chr_baum_init(void);
+#endif
Signature · 1 line
1.6.2.2
#6 lore raw

PATCH 5/15 Make --disable-usb to really remove usb support

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile          |    7 ++++++-
 Makefile.target   |    7 ++++++-
 configure         |   34 ++++++++++++++++++++++------------
 hw/nseries.c      |    2 ++
 hw/pc.c           |    2 ++
 hw/ppc_newworld.c |    2 ++
 hw/ppc_oldworld.c |    3 ++-
 hw/ppc_prep.c     |    2 ++
 hw/pxa2xx.c       |    4 ++++
 hw/realview.c     |    2 ++
 hw/usb.h          |    3 +++
 hw/versatilepb.c  |    2 ++
 monitor.c         |    2 ++
 qemu-monitor.hx   |    4 ++++
 qemu-options.hx   |    2 ++
 sysemu.h          |    4 ++++
 vl.c              |   14 +++++++++++---
 17 files changed, 78 insertions(+), 18 deletions(-)
Makefile +6 -1
index 588523c..c4b41c4 100644
@@ -102,11 +102,16 @@ OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
 OBJS+=scsi-disk.o cdrom.o
 OBJS+=scsi-generic.o
+ifdef CONFIG_USB
 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
+endif
 OBJS+=sd.o ssi-sd.o
 ifdef CONFIG_BLUEZ
-OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o usb-bt.o
+OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
+ifdef CONFIG_USB
+OBJS+=usb-bt.o
+endif
 OBJS+=bt-hci-csr.o
 endif
 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
Makefile.target +6 -1
index 60326fe..878294d 100644
@@ -565,8 +565,10 @@ ifeq ($(CONFIG_XEN), yes)
   LIBS += $(XEN_LIBS)
 endif
 
+ifdef CONFIG_USB
 # USB layer
 OBJS+= usb-ohci.o
+endif
 
 # PCI network cards
 OBJS += eepro100.o
@@ -583,7 +585,10 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o
 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
-OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
+ifdef CONFIG_USB
+OBJS+= usb-uhci.o
+endif
+OBJS+= vmmouse.o vmport.o vmware_vga.o hpet.o
 OBJS += device-hotplug.o pci-hotplug.o smbios.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
configure +22 -12
index 73c3550..f859065 100755
@@ -191,6 +191,7 @@ nptl="yes"
 mixemu="no"
 bluez="yes"
 kvm="no"
+usb="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -436,6 +437,8 @@ for opt do
   ;;
   --disable-bluez) bluez="no"
   ;;
+  --disable-usb) usb="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -627,6 +630,7 @@ echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
 echo "  --disable-curses         disable curses output"
 echo "  --disable-curl           disable curl connectivity"
 echo "  --disable-bluez          disable bluez stack connectivity"
+echo "  --disable-usb            disable usb stack connectivity"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1449,6 +1453,7 @@ echo -e "KVM support       $kvm"
 echo "fdt support       $fdt"
 echo "preadv support    $preadv"
 echo "bluetooth support $bluez"
+echo "usb support       $usb"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1802,18 +1807,23 @@ fi
 
 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
 
-# USB host support
-case "$usb_host" in
-linux)
-  echo "HOST_USB=linux" >> $config_mak
-;;
-bsd)
-  echo "HOST_USB=bsd" >> $config_mak
-;;
-*)
-  echo "HOST_USB=stub" >> $config_mak
-;;
-esac
+if test "$usb" = "yes" ; then
+  echo "CONFIG_USB=yes" >> $config_mak
+  echo "#define CONFIG_USB 1" >> $config_h
+
+  # USB host support
+  case "$usb_host" in
+  linux)
+    echo "HOST_USB=linux" >> $config_mak
+  ;;
+  bsd)
+    echo "HOST_USB=bsd" >> $config_mak
+  ;;
+  *)
+    echo "HOST_USB=stub" >> $config_mak
+  ;;
+  esac
+fi
 
 # Determine what linker flags to use to force archive inclusion
 check_linker_flags()
hw/nseries.c +2 -0
index b412aa0..55648e1 100644
@@ -1314,8 +1314,10 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device,
     n8x0_dss_setup(s);
     n8x0_cbus_setup(s);
     n8x0_uart_setup(s);
+#ifdef CONFIG_USB
     if (usb_enabled)
         n8x0_usb_setup(s);
+#endif
 
     /* Setup initial (reset) machine state */
 
hw/pc.c +2 -0
index 86e5cfe..7e2ff41 100644
@@ -1119,9 +1119,11 @@ static void pc_init1(ram_addr_t ram_size,
 
     cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
 
+#ifdef CONFIG_USB
     if (pci_enabled && usb_enabled) {
         usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
     }
+#endif
 
     if (pci_enabled && acpi_enabled) {
         uint8_t *eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
hw/ppc_newworld.c +2 -0
index a1057b4..ae70842 100644
@@ -331,9 +331,11 @@ static void ppc_core99_init (ram_addr_t ram_size,
                dbdma_mem_index, cuda_mem_index, NULL, 0, NULL,
                escc_mem_index);
 
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
 
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;
hw/ppc_oldworld.c +2 -1
index 686e81f..6b94111 100644
@@ -365,10 +365,11 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
                dbdma_mem_index, cuda_mem_index, nvr, 2, ide_mem_index,
                escc_mem_index);
 
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
-
+#endif
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;
 
hw/ppc_prep.c +2 -0
index b6f19a5..cd1cc12 100644
@@ -738,9 +738,11 @@ static void ppc_prep_init (ram_addr_t ram_size,
     cpu_register_physical_memory(0xFEFF0000, 0x1000, PPC_io_memory);
 #endif
 
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
 
     m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59);
     if (m48t59 == NULL)
hw/pxa2xx.c +4 -0
index f2e98ff..26da459 100644
@@ -2121,9 +2121,11 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision)
         s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
     }
 
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]);
     }
+#endif
 
     s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);
     s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);
@@ -2233,9 +2235,11 @@ PXA2xxState *pxa255_init(unsigned int sdram_size)
         s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
     }
 
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]);
     }
+#endif
 
     s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);
     s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);
hw/realview.c +2 -0
index 8e176b9..fd78875 100644
@@ -110,9 +110,11 @@ static void realview_init(ram_addr_t ram_size,
     dev = sysbus_create_varargs("realview_pci", 0x60000000,
                                 pic[48], pic[49], pic[50], pic[51], NULL);
     pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
         pci_create_simple(pci_bus, -1, "lsi53c895a");
hw/usb.h +3 -0
index e9d4bc2..9ab3d0e 100644
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 
+
+#ifdef CONFIG_USB
 #include "block.h"
 
 #define USB_TOKEN_SETUP 0x2d
@@ -297,3 +299,4 @@ MUSBState *musb_init(qemu_irq *irqs);
 uint32_t musb_core_intr_get(MUSBState *s);
 void musb_core_intr_clear(MUSBState *s, uint32_t mask);
 void musb_set_size(MUSBState *s, int epnum, int size, int is_tx);
+#endif
hw/versatilepb.c +2 -0
index 3371121..ff6b279 100644
@@ -215,9 +215,11 @@ static void versatile_init(ram_addr_t ram_size,
             pci_nic_init(nd, "rtl8139", NULL);
         }
     }
+#ifdef CONFIG_USB
     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
     }
+#endif
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
         pci_create_simple(pci_bus, -1, "lsi53c895a");
monitor.c +2 -0
index 6b45f6c..bf88dd1 100644
@@ -1706,10 +1706,12 @@ static const mon_cmd_t info_cmds[] = {
       "", "show KVM information", },
     { "numa", "", do_info_numa,
       "", "show NUMA information", },
+#ifdef CONFIG_USB
     { "usb", "", usb_info,
       "", "show guest USB devices", },
     { "usbhost", "", usb_host_info,
       "", "show host USB devices", },
+#endif
     { "profile", "", do_info_profile,
       "", "show profiling information", },
     { "capture", "", do_info_capture,
qemu-monitor.hx +4 -0
index fa48527..46dce9b 100644
@@ -347,8 +347,10 @@ STEXI
 Compute the checksum of a memory region.
 ETEXI
 
+#ifdef CONFIG_USB
     { "usb_add", "s", do_usb_add,
       "device", "add USB device (e.g. 'host:bus.addr' or 'host:vendor_id:product_id')" },
+#endif
 STEXI
 @item usb_add @var{devname}
 
@@ -356,8 +358,10 @@ Add the USB device @var{devname}.  For details of available devices see
 @ref{usb_devices}
 ETEXI
 
+#ifdef CONFIG_USB
     { "usb_del", "s", do_usb_del,
       "device", "remove USB device 'bus.addr'" },
+#endif
 STEXI
 @item usb_del @var{devname}
 
qemu-options.hx +2 -0
index 503da33..c765869 100644
@@ -312,6 +312,7 @@ STEXI
 @end table
 ETEXI
 
+#ifdef CONFIG_USB
 DEF("usb", 0, QEMU_OPTION_usb,
     "-usb            enable the USB driver (will be the default soon)\n")
 STEXI
@@ -324,6 +325,7 @@ ETEXI
 
 DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
     "-usbdevice name add the host or guest USB device 'name'\n")
+#endif
 STEXI
 
 @item -usbdevice @var{devname}
sysemu.h +4 -0
index d77de09..a6ede0c 100644
@@ -115,7 +115,9 @@ extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
 extern int alt_grab;
+#ifdef CONFIG_USB
 extern int usb_enabled;
+#endif
 extern int no_virtio_balloon;
 extern int smp_cpus;
 extern int cursor_hide;
@@ -267,9 +269,11 @@ struct soundhw {
 extern struct soundhw soundhw[];
 #endif
 
+#ifdef CONFIG_USB
 void do_usb_add(Monitor *mon, const char *devname);
 void do_usb_del(Monitor *mon, const char *devname);
 void usb_info(Monitor *mon);
+#endif
 
 int get_param_value(char *buf, int buf_size,
                     const char *tag, const char *str);
vl.c +11 -3
index 914c907..e1ead85 100644
@@ -238,7 +238,9 @@ CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
 int win2k_install_hack = 0;
 int rtc_td_hack = 0;
 #endif
+#ifdef CONFIG_USB
 int usb_enabled = 0;
+#endif
 int singlestep = 0;
 int smp_cpus = 1;
 const char *vnc_display;
@@ -2619,6 +2621,7 @@ static void numa_add(const char *optarg)
     return;
 }
 
+#ifdef CONFIG_USB
 /***********************************************************/
 /* USB devices */
 
@@ -2828,6 +2831,7 @@ void usb_info(Monitor *mon)
                        0, dev->addr, speed_str, dev->devname);
     }
 }
+#endif
 
 /***********************************************************/
 /* PCMCIA/Cardbus */
@@ -4989,8 +4993,10 @@ int main(int argc, char **argv, char **envp)
     const char *loadvm = NULL;
     QEMUMachine *machine;
     const char *cpu_model;
+#ifdef CONFIG_USB
     const char *usb_devices[MAX_USB_CMDLINE];
-    int usb_devices_index;
+    int usb_devices_index = 0;
+#endif
 #ifndef _WIN32
     int fds[2];
 #endif
@@ -5070,8 +5076,6 @@ int main(int argc, char **argv, char **envp)
         node_cpumask[i] = 0;
     }
 
-    usb_devices_index = 0;
-
     nb_net_clients = 0;
     nb_bt_opts = 0;
     nb_drives = 0;
@@ -5561,6 +5565,7 @@ int main(int argc, char **argv, char **envp)
 #endif
                 break;
 #endif
+#ifdef CONFIG_USB
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
@@ -5573,6 +5578,7 @@ int main(int argc, char **argv, char **envp)
                 usb_devices[usb_devices_index] = optarg;
                 usb_devices_index++;
                 break;
+#endif
             case QEMU_OPTION_smp:
                 smp_cpus = atoi(optarg);
                 if (smp_cpus < 1) {
@@ -6080,6 +6086,7 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
+#ifdef CONFIG_USB
     /* init USB devices */
     if (usb_enabled) {
         for(i = 0; i < usb_devices_index; i++) {
@@ -6089,6 +6096,7 @@ int main(int argc, char **argv, char **envp)
             }
         }
     }
+#endif
 
     if (!display_state)
         dumb_display_init();
Signature · 1 line
1.6.2.2
#7 lore raw

[Qemu-devel] Re: [PATCH 05/15] Make --disable-usb to really remove usb support

Quoted 24 lines · [email protected] wrote:

From: Juan Quintela <[email protected]>

---
 Makefile          |    7 ++++++-
 Makefile.target   |    7 ++++++-
 configure         |   34 ++++++++++++++++++++++------------
 hw/nseries.c      |    2 ++
 hw/pc.c           |    2 ++
 hw/ppc_newworld.c |    2 ++
 hw/ppc_oldworld.c |    3 ++-
 hw/ppc_prep.c     |    2 ++
 hw/pxa2xx.c       |    4 ++++
 hw/realview.c     |    2 ++
 hw/usb.h          |    3 +++
 hw/versatilepb.c  |    2 ++
 monitor.c         |    2 ++
 qemu-monitor.hx   |    4 ++++
 qemu-options.hx   |    2 ++
 sysemu.h          |    4 ++++
 vl.c              |   14 +++++++++++---
 17 files changed, 78 insertions(+), 18 deletions(-)

...

hw/nseries.c static void n8x0_init(ram_addr_t ram_size, const char *boot_device, · line 1320

Quoted 12 lines
hw/nseries.c +2 -0
index b412aa0..55648e1 100644
@@ -1314,8 +1314,10 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device,
     n8x0_dss_setup(s);
     n8x0_cbus_setup(s);
     n8x0_uart_setup(s);
+#ifdef CONFIG_USB
     if (usb_enabled)
         n8x0_usb_setup(s);
+#endif

I think there are some good patterns available to avoid this #ifdef all over the place. Check how kvm_enabled works, e.g.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#8 lore raw

PATCH 6/15 Add --disable-smb to remove smb directories support

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure       |    9 +++++++++
 net.c           |    2 ++
 qemu-options.hx |    2 +-
 vl.c            |    2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)
configure +9 -0
index f859065..93823cb 100755
@@ -192,6 +192,7 @@ mixemu="no"
 bluez="yes"
 kvm="no"
 usb="yes"
+smb="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -439,6 +440,8 @@ for opt do
   ;;
   --disable-usb) usb="no"
   ;;
+  --disable-smb) smb="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -631,6 +634,7 @@ echo "  --disable-curses         disable curses output"
 echo "  --disable-curl           disable curl connectivity"
 echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-usb            disable usb stack connectivity"
+echo "  --disable-smb            disable smb directories support"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -663,6 +667,7 @@ if test "$mingw32" = "yes" ; then
     oss="no"
     linux_user="no"
     bsd_user="no"
+    smb="no"
     OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
 fi
 
@@ -1454,6 +1459,7 @@ echo "fdt support       $fdt"
 echo "preadv support    $preadv"
 echo "bluetooth support $bluez"
 echo "usb support       $usb"
+echo "smb directories   $smb"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1776,6 +1782,9 @@ fi
 if test "$xen" = "yes" ; then
   echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
 fi
+if test "$smb" = "yes" ; then
+  echo "#define CONFIG_SMB 1" >> $config_h
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
net.c +2 -0
index 55f70f2..8142f5e 100644
@@ -996,6 +996,7 @@ static void slirp_smb(const char *exported_dir)
     slirp_add_exec(0, smb_cmdline, 4, 139);
 }
 
+#ifdef CONFIG_SMB
 /* automatic user mode samba server configuration */
 void net_slirp_smb(const char *exported_dir)
 {
@@ -1008,6 +1009,7 @@ void net_slirp_smb(const char *exported_dir)
         slirp_smb(exported_dir);
     }
 }
+#endif
 
 #endif /* !defined(_WIN32) */
 
qemu-options.hx +1 -1
index c765869..0a0f327 100644
@@ -937,7 +937,7 @@ qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
 @end example
 ETEXI
 
-#ifndef _WIN32
+#ifdef CONFIG_SMB
 DEF("smb", HAS_ARG, QEMU_OPTION_smb, \
            "-smb dir        allow SMB access to files in 'dir' [-net user]\n")
 #endif
vl.c +1 -1
index e1ead85..830ffa3 100644
@@ -5314,7 +5314,7 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_bootp:
                 bootp_filename = optarg;
                 break;
-#ifndef _WIN32
+#ifdef CONFIG_SMB
             case QEMU_OPTION_smb:
 		net_slirp_smb(optarg);
                 break;
Signature · 1 line
1.6.2.2
#9 lore raw

[Qemu-devel] Re: [PATCH 06/15] Add --disable-smb to remove smb directories support

Quoted 104 lines · [email protected] wrote:

From: Juan Quintela <[email protected]>

---
 configure       |    9 +++++++++
 net.c           |    2 ++
 qemu-options.hx |    2 +-
 vl.c            |    2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)
configure +9 -0
index f859065..93823cb 100755
@@ -192,6 +192,7 @@ mixemu="no"
 bluez="yes"
 kvm="no"
 usb="yes"
+smb="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -439,6 +440,8 @@ for opt do
   ;;
   --disable-usb) usb="no"
   ;;
+  --disable-smb) smb="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -631,6 +634,7 @@ echo "  --disable-curses         disable curses output"
 echo "  --disable-curl           disable curl connectivity"
 echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-usb            disable usb stack connectivity"
+echo "  --disable-smb            disable smb directories support"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -663,6 +667,7 @@ if test "$mingw32" = "yes" ; then
     oss="no"
     linux_user="no"
     bsd_user="no"
+    smb="no"
     OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
 fi
 
@@ -1454,6 +1459,7 @@ echo "fdt support       $fdt"
 echo "preadv support    $preadv"
 echo "bluetooth support $bluez"
 echo "usb support       $usb"
+echo "smb directories   $smb"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1776,6 +1782,9 @@ fi
 if test "$xen" = "yes" ; then
   echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
 fi
+if test "$smb" = "yes" ; then
+  echo "#define CONFIG_SMB 1" >> $config_h
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
net.c +2 -0
index 55f70f2..8142f5e 100644
@@ -996,6 +996,7 @@ static void slirp_smb(const char *exported_dir)
     slirp_add_exec(0, smb_cmdline, 4, 139);
 }
 
+#ifdef CONFIG_SMB
 /* automatic user mode samba server configuration */
 void net_slirp_smb(const char *exported_dir)
 {
@@ -1008,6 +1009,7 @@ void net_slirp_smb(const char *exported_dir)
         slirp_smb(exported_dir);
     }
 }
+#endif
 
 #endif /* !defined(_WIN32) */
 
qemu-options.hx +1 -1
index c765869..0a0f327 100644
@@ -937,7 +937,7 @@ qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
 @end example
 ETEXI
 
-#ifndef _WIN32
+#ifdef CONFIG_SMB
 DEF("smb", HAS_ARG, QEMU_OPTION_smb, \
            "-smb dir        allow SMB access to files in 'dir' [-net user]\n")
 #endif
vl.c +0 -0
index e1ead85..830ffa3 100644

vl.c int main(int argc, char **argv, char **envp) · line 5320

Quoted 8 lines
vl.c +1 -1
@@ -5314,7 +5314,7 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_bootp:
                 bootp_filename = optarg;
                 break;
-#ifndef _WIN32
+#ifdef CONFIG_SMB
             case QEMU_OPTION_smb:
 		net_slirp_smb(optarg);
                 break;

This patch collides with pending rework of the slirp stack. I hope to role them out the next days (some tests and one feature is missing ATM). I would appreciate if we can synchronize before merging -- if we really want it...

I think the patch does not reflect the dependency of CONFIG_SMB on CONFIG_SLIRP. Moreover, I bet it's not covering all bits. Given the small amount of code it avoids, I would say: keep this feature under the hood of CONFIG_SLIRP. It's not worth the complication (it will become much more complicated with my fully configurable slirp stack, see earlier postings).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#10 lore raw

PATCH 7/15 add option to remove scsi support

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile         |    6 ++++--
 Makefile.hw      |    3 ++-
 configure        |    9 +++++++++
 hw/pc.c          |    2 ++
 hw/pci-hotplug.c |    9 ++++++++-
 hw/pci.h         |    2 ++
 vl.c             |    2 ++
 7 files changed, 29 insertions(+), 4 deletions(-)
Makefile +4 -2
index c4b41c4..3fd0ef5 100644
@@ -100,8 +100,10 @@ OBJS+=irq.o ptimer.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 eeprom93xx.o tsc2005.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
 ifdef CONFIG_USB
 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
Makefile.hw +2 -1
index 6accb3b..57a0ed6 100644
@@ -23,8 +23,9 @@ OBJS+= nand.o ecc.o
 
 OBJS+= m48t59.o escc.o
 
-# SCSI layer
+ifdef CONFIG_SCSI
 OBJS+= lsi53c895a.o esp.o
+endif
 
 OBJS+= dma-helpers.o sysbus.o
 
configure +9 -0
index 93823cb..4a1fb45 100755
@@ -193,6 +193,7 @@ bluez="yes"
 kvm="no"
 usb="yes"
 smb="yes"
+scsi="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -442,6 +443,8 @@ for opt do
   ;;
   --disable-smb) smb="no"
   ;;
+  --disable-scsi) scsi="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -635,6 +638,7 @@ echo "  --disable-curl           disable curl connectivity"
 echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-usb            disable usb stack connectivity"
 echo "  --disable-smb            disable smb directories support"
+echo "  --disable-scsi           disable scsi support"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1460,6 +1464,7 @@ echo "preadv support    $preadv"
 echo "bluetooth support $bluez"
 echo "usb support       $usb"
 echo "smb directories   $smb"
+echo "scsi support      $scsi"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1785,6 +1790,10 @@ fi
 if test "$smb" = "yes" ; then
   echo "#define CONFIG_SMB 1" >> $config_h
 fi
+if test "$scsi" = "yes" ; then
+  echo "#define CONFIG_SCSI 1" >> $config_h
+  echo "CONFIG_SCSI=yes" >> $config_mak
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
hw/pc.c +2 -0
index 7e2ff41..ee0e07f 100644
@@ -1144,6 +1144,7 @@ static void pc_init1(ram_addr_t ram_size,
         i440fx_init_memory_mappings(i440fx_state);
     }
 
+#ifdef CONFIG_SCSI
     if (pci_enabled) {
 	int max_bus;
         int bus;
@@ -1153,6 +1154,7 @@ static void pc_init1(ram_addr_t ram_size,
             pci_create_simple(pci_bus, -1, "lsi53c895a");
         }
     }
+#endif
 
     /* Add virtio block devices */
     if (pci_enabled) {
hw/pci-hotplug.c +8 -1
index 952e27a..677f494 100644
@@ -78,11 +78,13 @@ void drive_hot_add(Monitor *mon, 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->qdev, drives_table[drive_idx].bdrv,
                         drives_table[drive_idx].unit);
         break;
+#endif
     default:
         monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
     }
@@ -103,9 +105,12 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
     char buf[128];
 
     if (get_param_value(buf, sizeof(buf), "if", opts)) {
+#ifdef CONFIG_SCSI
         if (!strcmp(buf, "scsi"))
             type = IF_SCSI;
-        else if (!strcmp(buf, "virtio")) {
+        else
+#endif
+        if (!strcmp(buf, "virtio")) {
             type = IF_VIRTIO;
         } else {
             monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf);
@@ -130,9 +135,11 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
     }
 
     switch (type) {
+#ifdef CONFIG_SCSI
     case IF_SCSI:
         dev = pci_create("lsi53c895a", devaddr);
         break;
+#endif
     case IF_VIRTIO:
         dev = pci_create("virtio-blk-pci", devaddr);
         break;
hw/pci.h +2 -0
index c8625de..317dc70 100644
@@ -222,9 +222,11 @@ void pci_qdev_register(const char *name, int size, pci_qdev_initfn init);
 PCIDevice *pci_create(const char *name, const char *devaddr);
 PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
 
+#ifdef CONFIG_SCSI
 /* lsi53c895a.c */
 #define LSI_MAX_DEVS 7
 void lsi_scsi_attach(DeviceState *host, BlockDriverState *bd, int id);
+#endif
 
 /* vmware_vga.c */
 void pci_vmsvga_init(PCIBus *bus);
vl.c +2 -0
index 830ffa3..b3cd8d9 100644
@@ -2271,9 +2271,11 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque)
         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;
Signature · 1 line
1.6.2.2
#11 lore raw

PATCH 8/15 add option to disable wmware devices

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.target |    6 ++++--
 configure       |   15 +++++++++++++++
 hw/pc.c         |    4 ++++
 hw/pckbd.c      |    4 ++--
 4 files changed, 25 insertions(+), 4 deletions(-)
Makefile.target +4 -2
index 878294d..55575a1 100644
@@ -588,8 +588,10 @@ OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
 ifdef CONFIG_USB
 OBJS+= usb-uhci.o
 endif
-OBJS+= vmmouse.o vmport.o vmware_vga.o hpet.o
-OBJS += device-hotplug.o pci-hotplug.o smbios.o
+ifdef CONFIG_VMWARE
+OBJS+= vmmouse.o vmport.o vmware_vga.o
+endif
+OBJS+= device-hotplug.o pci-hotplug.o smbios.o hpet.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
configure +15 -0
index 4a1fb45..5554934 100755
@@ -194,6 +194,7 @@ kvm="no"
 usb="yes"
 smb="yes"
 scsi="yes"
+vmware="no"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -340,6 +341,12 @@ fi
 ;;
 esac
 
+case $cpu in
+i386|x86_64)
+vmware="yes"
+;;
+esac
+
 if [ "$bsd" = "yes" ] ; then
   if [ "$darwin" != "yes" ] ; then
     make="gmake"
@@ -445,6 +452,8 @@ for opt do
   ;;
   --disable-scsi) scsi="no"
   ;;
+  --disable-vmware) vmware="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -639,6 +648,7 @@ echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-usb            disable usb stack connectivity"
 echo "  --disable-smb            disable smb directories support"
 echo "  --disable-scsi           disable scsi support"
+echo "  --disable-vmware         disable vmware devices"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1465,6 +1475,7 @@ echo "bluetooth support $bluez"
 echo "usb support       $usb"
 echo "smb directories   $smb"
 echo "scsi support      $scsi"
+echo "vwmare devices    $vmware"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1794,6 +1805,10 @@ if test "$scsi" = "yes" ; then
   echo "#define CONFIG_SCSI 1" >> $config_h
   echo "CONFIG_SCSI=yes" >> $config_mak
 fi
+if test "$vmware" = "yes" ; then
+  echo "#define CONFIG_VMWARE 1" >> $config_h
+  echo "CONFIG_VMWARE=yes" >> $config_mak
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
hw/pc.c +4 -0
index ee0e07f..91d7a45 100644
@@ -885,7 +885,9 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }
 
+#ifdef CONFIG_VMWARE
     vmport_init();
+#endif
 
     /* allocate RAM */
     ram_addr = qemu_ram_alloc(0xa0000);
@@ -1021,11 +1023,13 @@ static void pc_init1(ram_addr_t ram_size,
         } else {
             isa_cirrus_vga_init();
         }
+#ifdef CONFIG_VMWARE
     } else if (vmsvga_enabled) {
         if (pci_enabled)
             pci_vmsvga_init(pci_bus);
         else
             fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+#endif
     } else if (std_vga_enabled) {
         if (pci_enabled) {
             pci_vga_init(pci_bus, 0, 0);
hw/pckbd.c +2 -2
index 092d1ba..14f5f61 100644
@@ -378,7 +378,7 @@ void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base)
 
     s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
     s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
-#ifdef TARGET_I386
+#if defined(TARGET_i386) && defined(CONFIG_VMWARE)
     vmmouse_init(s->mouse);
 #endif
     qemu_register_reset(kbd_reset, 0, s);
@@ -435,7 +435,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
 
     s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
     s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
-#ifdef TARGET_I386
+#if defined(TARGET_I386) && defined(CONFIG_VMWARE)
     vmmouse_init(s->mouse);
 #endif
     qemu_register_reset(kbd_reset, 0, s);
Signature · 1 line
1.6.2.2
#12 lore raw

PATCH 9/15 ssi bus is only used on the arm platform

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile        |    8 ++++----
 Makefile.target |    1 +
 2 files changed, 5 insertions(+), 4 deletions(-)
Makefile +4 -4
index 3fd0ef5..27043f3 100644
@@ -97,8 +97,8 @@ OBJS=$(BLOCK_OBJS)
 OBJS+=readline.o console.o
 
 OBJS+=irq.o ptimer.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+=i2c.o smbus.o smbus_eeprom.o max7310.o wm8750.o
+OBJS+=ssd0303.o stellaris_input.o twl92230.o
 OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
 OBJS+=cdrom.o
 ifdef CONFIG_SCSI
@@ -108,7 +108,7 @@ ifdef CONFIG_USB
 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
 endif
-OBJS+=sd.o ssi-sd.o
+OBJS+=sd.o
 ifdef CONFIG_BLUEZ
 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
 ifdef CONFIG_USB
@@ -119,7 +119,7 @@ endif
 OBJS+=buffered_file.o migration.o migration-tcp.o net.o qemu-sockets.o
 OBJS+=qemu-char.o aio.o net-checksum.o savevm.o cache-utils.o
 OBJS+=msmouse.o ps2.o
-OBJS+=qdev.o ssi.o
+OBJS+=qdev.o
 
 ifdef CONFIG_BRLAPI
 OBJS+= baum.o
Makefile.target +1 -0
index 55575a1..007e53e 100644
@@ -692,6 +692,7 @@ OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 OBJS+= syborg_virtio.o
+OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
Signature · 1 line
1.6.2.2
#13 lore raw

PATCH 10/15 move i2c devices only used in arm devices to arm target

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile        |    5 ++---
 Makefile.target |    3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)
Makefile +2 -3
index 27043f3..b942ae3 100644
@@ -97,9 +97,8 @@ OBJS=$(BLOCK_OBJS)
 OBJS+=readline.o console.o
 
 OBJS+=irq.o ptimer.o
-OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o wm8750.o
-OBJS+=ssd0303.o stellaris_input.o twl92230.o
-OBJS+=tmp105.o lm832x.o eeprom93xx.o tsc2005.o
+OBJS+=i2c.o smbus.o smbus_eeprom.o
+OBJS+=eeprom93xx.o
 OBJS+=cdrom.o
 ifdef CONFIG_SCSI
 OBJS+=scsi-disk.o scsi-generic.o
Makefile.target +2 -1
index 007e53e..35ac91e 100644
@@ -692,7 +692,8 @@ OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 OBJS+= syborg_virtio.o
-OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o
+OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o max7310.o wm8750.o
+OBJS+= ssd0303.o stellaris_input.o twl92230.o tmp105.o lm832x.o tsc2005.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
Signature · 1 line
1.6.2.2
#15 lore raw

PATCH 11/15 sd flash is only used in arm devices

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile        |    1 -
 Makefile.target |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)
Makefile +0 -1
index b942ae3..110de1e 100644
@@ -107,7 +107,6 @@ ifdef CONFIG_USB
 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
 endif
-OBJS+=sd.o
 ifdef CONFIG_BLUEZ
 OBJS+=bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
 ifdef CONFIG_USB
Makefile.target +1 -0
index 35ac91e..b6cd106 100644
@@ -694,6 +694,7 @@ OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 OBJS+= syborg_virtio.o
 OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o max7310.o wm8750.o
 OBJS+= ssd0303.o stellaris_input.o twl92230.o tmp105.o lm832x.o tsc2005.o
+OBJS+= sd.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
Signature · 1 line
1.6.2.2
#16 lore raw

Re: [Qemu-devel] [PATCH 11/15] sd flash is only used in arm devices

Quoted 1 line · On 6/23/09, [email protected] <[email protected]> wrote:

From: Juan Quintela <[email protected]>

While $SUBJECT may be true, the patch still goes to wrong direction. The long term goal is to have a single binary for all systems. This means that devices should get more generic and not be tied to some systems.

#17 lore raw

[Qemu-devel] Re: [PATCH 11/15] sd flash is only used in arm devices

Quoted 7 lines · Blue Swirl
Quoted 1 line · On 6/23/09, [email protected] <[email protected]> wrote:

From: Juan Quintela <[email protected]>

While $SUBJECT may be true, the patch still goes to wrong direction. The long term goal is to have a single binary for all systems. This means that devices should get more generic and not be tied to some systems.

What do you prefer then, a config option that get only enabled for each arch when it is needed?

Something like ARCH_HAS_SD=0|1

and then have the sd.o file in a single place on the Makefile.

What we are searching here is to be able to compile-out functionality that we are not interested in. This RFC was related about how people preffer it implemented.

Thanks for de review, Juan.

#18 lore raw

[Qemu-devel] Re: [PATCH 11/15] sd flash is only used in arm devices

Quoted 10 lines · Juan Quintela
Quoted 7 lines · Blue Swirl
Quoted 1 line · On 6/23/09, [email protected] <[email protected]> wrote:

From: Juan Quintela <[email protected]>

While $SUBJECT may be true, the patch still goes to wrong direction. The long term goal is to have a single binary for all systems. This means that devices should get more generic and not be tied to some systems.

Quoted 6 lines

What do you prefer then, a config option that get only enabled for each
arch when it is needed?

 Something like ARCH_HAS_SD=0|1

and then have the sd.o file in a single place on the Makefile.

Or CONFIG_SD, defined only if needed.

Quoted 3 lines

What we are searching here is to be able to compile-out functionality that we are not interested in. This RFC was related about how people preffer it implemented.

Sounds like we'd get faster builds when building only a few targets, nice.

#19 lore raw

Re: [Qemu-devel] [PATCH 11/15] sd flash is only used in arm devices

In reply to Blue Swirl
Quoted 10 lines · Blue Swirl
Quoted 2 lines · On 6/23/09, [email protected] <[email protected]> wrote:

From: Juan Quintela <[email protected]>

While $SUBJECT may be true, the patch still goes to wrong direction. The long term goal is to have a single binary for all systems. This means that devices should get more generic and not be tied to some systems.

While I agree with you, I think we want the device models to be treated as modules. This would allow someone to easily create a small version of QEMU that just emulated the things they were interested in.

But the overriding goal should be to do this while eliminating #ifdefs and ifdefs so I think this series needs to take a different approach.

Regards,

Anthony Liguori

#20 lore raw

PATCH 12/15 move m48t59 and ecc driver to ppc and sparc, that are the targets that use it

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.hw     |    2 --
 Makefile.target |    5 +++--
 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.hw +0 -2
index 57a0ed6..63d16cf 100644
@@ -21,8 +21,6 @@ OBJS+= fw_cfg.o
 OBJS+= watchdog.o
 OBJS+= nand.o ecc.o
 
-OBJS+= m48t59.o escc.o
-
 ifdef CONFIG_SCSI
 OBJS+= lsi53c895a.o esp.o
 endif
Makefile.target +3 -2
index b6cd106..c803c8a 100644
@@ -597,7 +597,7 @@ endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 # shared objects
-OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
+OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o m48t59.o escc.o
 # PREP target
 OBJS+= pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
 OBJS+= prep_pci.o ppc_prep.o
@@ -667,8 +667,9 @@ OBJS+= cirrus_vga.o parallel.o
 else
 OBJS+= sun4m.o tcx.o iommu.o slavio_intctl.o
 OBJS+= slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
-OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o
+OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o escc.o
 endif
+OBJS+= m48t59.o
 endif
 ifeq ($(TARGET_BASE_ARCH), arm)
 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
Signature · 1 line
1.6.2.2
#22 lore raw

PATCH 13/15 nand and ecc are only used on arm and cris argets

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.hw     |    1 -
 Makefile.target |    4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
Makefile.hw +0 -1
index 63d16cf..6075fd3 100644
@@ -19,7 +19,6 @@ OBJS=
 OBJS+= virtio.o virtio-pci.o
 OBJS+= fw_cfg.o
 OBJS+= watchdog.o
-OBJS+= nand.o ecc.o
 
 ifdef CONFIG_SCSI
 OBJS+= lsi53c895a.o esp.o
Makefile.target +2 -2
index c803c8a..cb2b650 100644
@@ -657,7 +657,7 @@ OBJS+= etraxfs_eth.o
 OBJS+= etraxfs_timer.o
 OBJS+= etraxfs_ser.o
 
-OBJS+= pflash_cfi02.o
+OBJS+= pflash_cfi02.o nand.o
 endif
 ifeq ($(TARGET_BASE_ARCH), sparc)
 ifeq ($(TARGET_ARCH), sparc64)
@@ -695,7 +695,7 @@ OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 OBJS+= syborg_virtio.o
 OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o max7310.o wm8750.o
 OBJS+= ssd0303.o stellaris_input.o twl92230.o tmp105.o lm832x.o tsc2005.o
-OBJS+= sd.o
+OBJS+= sd.o nand.o ecc.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
Signature · 1 line
1.6.2.2
#24 lore raw

PATCH 14/15 enable isa_mmio only in the platforms that use it: ppc, arm, mips and sparc

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.target |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
Makefile.target +6 -6
index cb2b650..7240f81 100644
@@ -494,8 +494,8 @@ endif #CONFIG_BSD_USER
 # System emulator target
 ifndef CONFIG_USER_ONLY
 
-OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
-     gdbstub.o gdbstub-xml.o
+OBJS=vl.o osdep.o monitor.o pci.o loader.o machine.o  gdbstub.o gdbstub-xml.o
+
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
 OBJS+=virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
@@ -597,7 +597,7 @@ endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 # shared objects
-OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o m48t59.o escc.o
+OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o m48t59.o escc.o isa_mmio.o
 # PREP target
 OBJS+= pckbd.o serial.o i8259.o i8254.o fdc.o mc146818rtc.o
 OBJS+= prep_pci.o ppc_prep.o
@@ -627,7 +627,7 @@ OBJS+= g364fb.o jazz_led.o dp8393x.o
 OBJS+= ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
 OBJS+= mipsnet.o
-OBJS+= pflash_cfi01.o
+OBJS+= pflash_cfi01.o isa_mmio.o
 OBJS+= vmware_vga.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
@@ -669,7 +669,7 @@ OBJS+= sun4m.o tcx.o iommu.o slavio_intctl.o
 OBJS+= slavio_timer.o slavio_misc.o fdc.o sparc32_dma.o
 OBJS+= cs4231.o eccmemctl.o sbi.o sun4c_intctl.o escc.o
 endif
-OBJS+= m48t59.o
+OBJS+= m48t59.o isa_mmio.o
 endif
 ifeq ($(TARGET_BASE_ARCH), arm)
 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
@@ -695,7 +695,7 @@ OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 OBJS+= syborg_virtio.o
 OBJS+= ssi.o ssi-sd.o max111x.o ssd0323.o ads7846.o max7310.o wm8750.o
 OBJS+= ssd0303.o stellaris_input.o twl92230.o tmp105.o lm832x.o tsc2005.o
-OBJS+= sd.o nand.o ecc.o
+OBJS+= sd.o nand.o ecc.o isa_mmio.o
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
Signature · 1 line
1.6.2.2
#26 lore raw

PATCH 15/15 add option to disable virtio drivers

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.hw     |    2 ++
 Makefile.target |    2 ++
 configure       |    9 +++++++++
 3 files changed, 13 insertions(+), 0 deletions(-)
Makefile.hw +2 -0
index 6075fd3..3302555 100644
@@ -16,7 +16,9 @@ CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 OBJS=
+ifdef CONFIG_VIRTIO
 OBJS+= virtio.o virtio-pci.o
+endif
 OBJS+= fw_cfg.o
 OBJS+= watchdog.o
 
Makefile.target +2 -0
index 7240f81..1ba81df 100644
@@ -498,7 +498,9 @@ OBJS=vl.o osdep.o monitor.o pci.o loader.o machine.o  gdbstub.o gdbstub-xml.o
 
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
+ifdef CONFIG_VIRTIO
 OBJS+=virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
+endif
 ifdef CONFIG_KVM
 OBJS+=kvm.o kvm-all.o
 endif
configure +9 -0
index 5554934..8a6660d 100755
@@ -195,6 +195,7 @@ usb="yes"
 smb="yes"
 scsi="yes"
 vmware="no"
+virtio="yes"
 kerneldir=""
 aix="no"
 blobs="yes"
@@ -454,6 +455,8 @@ for opt do
   ;;
   --disable-vmware) vmware="no"
   ;;
+  --disable-virtio) virtio="no"
+  ;;
   --disable-kvm) kvm="no"
   ;;
   --enable-profiler) profiler="yes"
@@ -649,6 +652,7 @@ echo "  --disable-usb            disable usb stack connectivity"
 echo "  --disable-smb            disable smb directories support"
 echo "  --disable-scsi           disable scsi support"
 echo "  --disable-vmware         disable vmware devices"
+echo "  --disable-virtio         disable virtio devices"
 echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
@@ -1476,6 +1480,7 @@ echo "usb support       $usb"
 echo "smb directories   $smb"
 echo "scsi support      $scsi"
 echo "vwmare devices    $vmware"
+echo "virtio devices    $virtio"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1809,6 +1814,10 @@ if test "$vmware" = "yes" ; then
   echo "#define CONFIG_VMWARE 1" >> $config_h
   echo "CONFIG_VMWARE=yes" >> $config_mak
 fi
+if test "$virtio" = "yes" ; then
+  echo "#define CONFIG_VIRTIO 1" >> $config_h
+  echo "CONFIG_VIRTIO=yes" >> $config_mak
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
Signature · 1 line
1.6.2.2
#27 lore raw
In reply to [email protected]
Quoted 20 lines · [email protected] wrote:

From: Juan Quintela <[email protected]>

Hi

this series of patches:
a- move object files only used by one target to that target Makefile.target b- add flags to disable parts: --disable-{bluez,usb,vwmare,virtio,scsi}
defaults is leave it enabled. You need to add the --disable-* flag to get any change
c- disable the use of --smb <dir>

What is the intent: we want to be able to not compile-in things that we are not interested in (they are experimental/not needed for our target/...).

Is this the right approach? Should I do something different?

For the next series, I am also interested on enable/disabling bits of a subsysem:
being able to support usb-hid but not usb-{host,net,msnd}. I already have patches to disable that, just waiting to hear what is the preffered way to get that functionality.

Quoted 7 lines

Known problems:
- qemu-*.hx files don't run over cpp and then we are not able to remove from the help page the options that we don't support.
- drive_hot_add without scsi support do nothing.

Any comments?

To me, there are a few fundamental requirements for this:

1) This be configurable via a .config file instead of via ./configure options.
2) This involve no additional #ifdefs in the code
3) In the Makefiles, instead of having ifdef conditionals, we do:
objs-$(CONFIG_FOO) += foo.o

The block/ drivers are the model here. If you drop individual files from the build, it Just Works.

Regards,

Anthony Liguori

#28 lore raw
Quoted 26 lines · Anthony Liguori
Quoted 25 lines · [email protected] wrote:

From: Juan Quintela <[email protected]>

Hi

this series of patches:
a- move object files only used by one target to that target Makefile.target b- add flags to disable parts: --disable-{bluez,usb,vwmare,virtio,scsi}
defaults is leave it enabled. You need to add the --disable-* flag to get any change
c- disable the use of --smb <dir>

What is the intent: we want to be able to not compile-in things that we are not interested in (they are experimental/not needed for our target/...).

Is this the right approach? Should I do something different?

For the next series, I am also interested on enable/disabling bits of a subsysem:
being able to support usb-hid but not usb-{host,net,msnd}. I already have patches to disable that, just waiting to hear what is the preffered way to get that functionality.

Known problems:
- qemu-*.hx files don't run over cpp and then we are not able to remove from the help page the options that we don't support.
- drive_hot_add without scsi support do nothing.

Quoted 7 lines
Quoted 2 lines

Any comments?

To me, there are a few fundamental requirements for this:

1) This be configurable via a .config file instead of via ./configure options.

We have config-hosts.mak.
If we don't want to do it with ./configure, with what/how do you want it to happen.

Do we agree in having:

qemu/.config
qemu/.config.mak
target-*/.config
target-*/.config.mak

And remove Makefile.target (i.e. split it in the target directories).

The problem that I saw otherwise with current approach is that it is difficult to have a module linked for one target and not for another. (No adding yet more ifdefs tricks is not a solution IMHO).

Quoted 1 line

2) This involve no additional #ifdefs in the code

That is doable, if we agree that putting stub declarations in .h files is ok. I was following the "current style".

Quoted 2 lines

3) In the Makefiles, instead of having ifdef conditionals, we do:

   objs-$(CONFIG_FOO) += foo.o

No problem with that for me if people agree in merging this solution.

Quoted 2 lines

The block/ drivers are the model here. If you drop individual files from the build, it Just Works.

But block/ drivers are _easy_ in this regard, you only have to register a struct, and they become available. USB/SCSI/... touch code in the middle of pc.c and the other platforms "machine" files.

On the other hand, block implementation is not flexible enough for us yet (TM). We would like to be able to complie all block drivers for qemu-img and only some of them for qemu :)

Will redo the patches with this (and the other people suggestions).

Thank for the input, Juan.

Quoted 3 lines

Regards,

Anthony Liguori

#29 lore raw
Quoted 32 lines · Juan Quintela
Quoted 30 lines · Anthony Liguori
Quoted 28 lines · [email protected] wrote:

From: Juan Quintela <[email protected]>

Hi

this series of patches:
a- move object files only used by one target to that target Makefile.target b- add flags to disable parts: --disable-{bluez,usb,vwmare,virtio,scsi}
defaults is leave it enabled. You need to add the --disable-* flag to get any change
c- disable the use of --smb <dir>

What is the intent: we want to be able to not compile-in things that we are not interested in (they are experimental/not needed for our target/...).

Is this the right approach? Should I do something different?

For the next series, I am also interested on enable/disabling bits of a subsysem:
being able to support usb-hid but not usb-{host,net,msnd}. I already have patches to disable that, just waiting to hear what is the preffered way to get that functionality.

Known problems:
- qemu-*.hx files don't run over cpp and then we are not able to remove from the help page the options that we don't support.
- drive_hot_add without scsi support do nothing.

Any comments?

Quoted 8 lines
Quoted 5 lines

To me, there are a few fundamental requirements for this:

1) This be configurable via a .config file instead of via ./configure options.

We have config-hosts.mak.

config-host.mak is generated. We need something that isn't generated.

Quoted 10 lines

If we don't want to do it with ./configure, with what/how do you want it to happen.

Do we agree in having:

qemu/.config
qemu/.config.mak
target-*/.config
target-*/.config.mak

I don't think we need all of these. I don't think we need separate .mak and .h files. The later can be generated from the former.

Quoted 4 lines

The problem that I saw otherwise with current approach is that it is difficult to have a module linked for one target and not for another. (No adding yet more ifdefs tricks is not a solution IMHO).

I suspect we will need to restructure Makefile.target to get this working. I'd suggest focusing on host configuration to start with to avoid this problem.

Quoted 6 lines
Quoted 2 lines

2) This involve no additional #ifdefs in the code

That is doable, if we agree that putting stub declarations in .h files is ok. I was following the "current style".

You usually shouldn't need stubs either. Take for instance, the changes you make for --disable-bluez.

First, you'll want to move all the stuff in vl.c that's bluez specific to a separate file.

For usb_device_add, you would need to add a registration API that allows registering an emulated usb device. In your new file, in a module load function, you would register bt and the bt: protocol as emulated usb devices.

Getting the actual bt options is a bit trickier. I think we have to deal with #ifdefs on that one. We can at least make the bt_parse() calls part of an option parsing callback or something.

Quoted 8 lines
Quoted 3 lines

The block/ drivers are the model here. If you drop individual files from the build, it Just Works.

But block/ drivers are _easy_ in this regard, you only have to register a struct, and they become available. USB/SCSI/... touch code in the middle of pc.c and the other platforms "machine" files.

Yes, that's precisely what we want to fix :-) block is easy because a lot of work was put into making it well isolated from everything else. It's the new model for how the rest of QEMU should look :-)

Quoted 4 lines

On the other hand, block implementation is not flexible enough for us yet (TM). We would like to be able to complie all block drivers for qemu-img and only some of them for qemu :)

That's an interesting idea.

Quoted 4 lines

Will redo the patches with this (and the other people suggestions).

Thank for the input, Juan.

Thanks for taking up this effort!

Regards,

Anthony Liguori

#30 lore raw
Quoted 2 lines · Anthony Liguori

For usb_device_add, you would need to add a registration API that allows registering an emulated usb device.

man qdev ;)

And usb is relatively easy as devices are added via -usbdevice and there is almost no windup in the hw/${machine}.c files.

cheers,
Gerd