* [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR @ 2012-08-07 2:41 Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang ` (3 more replies) 0 siblings, 4 replies; 38+ messages in thread From: Li Zhang @ 2012-08-07 2:41 UTC (permalink / raw) To: qemu-devel, qemu-ppc; +Cc: aliguori, agraf, Li Zhang, afaerber, david v1 -> v2: * Convert USB option from char to bool. v2 -> v3: * Remove global USB option * Get USB option with qemu_opt_get_bool(). * Send vga patch for sPAPR which requires USB enabled. v3 -> v4: * Fix some English grammar and coding style faults * Replace usb_on with add_usb to be more functional. * Remove vga init functions' declearations from pc.h, and add one new file vga-pci.h for the declearations. * Cleanup pc.h on some platforms and add vga-pci.h * Remove graphic devices which are not supported on sPAPR platform. They will be added back when they are supported. v4 -> v5: * Correct several English words * Add header file "qemu-comman.h" in vga-pci.h, which defines PCIBus and DeviceState types. Move #endif to the end of the vga-pci.h and remove the trailing white line. v5 -> v6: * Remove global usb_enabled variable * Set USB option in machine option * Cleanup USB option on all platforms * Report error when vga model is not std v6 -> v7: * merge 1/5 and 2/5 together to avoid breaking build * merge 3/5 and 4/5 together to avoid breaking build Benjamin Herrenschmidt (1): spapr: Add support for -vga option Li Zhang (2): Add USB option in machine options Add one new file vga-pci.h and cleanup on all platforms hw/alpha_pci.c | 1 + hw/cirrus_vga.c | 2 +- hw/mips_malta.c | 1 + hw/nseries.c | 9 +++++++++ hw/pc.c | 1 + hw/pc.h | 4 ---- hw/pc_piix.c | 6 ++++++ hw/ppc_newworld.c | 12 ++++++++++-- hw/ppc_oldworld.c | 10 +++++++++- hw/ppc_prep.c | 8 ++++++++ hw/pxa2xx.c | 15 +++++++++++++++ hw/realview.c | 8 ++++++++ hw/spapr.c | 43 ++++++++++++++++++++++++++++++++++++++++++- hw/sun4u.c | 1 + hw/versatilepb.c | 8 ++++++++ hw/vga-pci.c | 2 +- hw/vga-pci.h | 12 ++++++++++++ qemu-config.c | 4 ++++ sysemu.h | 1 - vl.c | 29 +++++++++++++++++++++++------ 20 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 hw/vga-pci.h -- 1.7.7.6 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options 2012-08-07 2:41 [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang @ 2012-08-07 2:41 ` Li Zhang 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger ` (3 more replies) 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms Li Zhang ` (2 subsequent siblings) 3 siblings, 4 replies; 38+ messages in thread From: Li Zhang @ 2012-08-07 2:41 UTC (permalink / raw) To: qemu-devel, qemu-ppc; +Cc: aliguori, agraf, Li Zhang, afaerber, david When -usb option is used, global varible usb_enabled is set. And all the plafrom will create one USB controller according to this variable. In fact, global varibles make code hard to read. So this patch is to remove global variable usb_enabled and add USB option in machine options. All the plaforms will get USB option value from machine options. USB option of machine options will be set either by: * -usb * -machine type=pseries,usb=on Both these ways can work now. They both set USB option in machine options. In the future, the first way will be removed. Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> --- hw/nseries.c | 9 +++++++++ hw/pc_piix.c | 6 ++++++ hw/ppc_newworld.c | 10 +++++++++- hw/ppc_oldworld.c | 8 ++++++++ hw/ppc_prep.c | 7 +++++++ hw/pxa2xx.c | 15 +++++++++++++++ hw/realview.c | 8 ++++++++ hw/spapr.c | 12 ++++++++++++ hw/versatilepb.c | 8 ++++++++ qemu-config.c | 4 ++++ sysemu.h | 1 - vl.c | 29 +++++++++++++++++++++++------ 12 files changed, 109 insertions(+), 8 deletions(-) diff --git a/hw/nseries.c b/hw/nseries.c index 4df2670..8e385b7 100644 --- a/hw/nseries.c +++ b/hw/nseries.c @@ -1282,6 +1282,9 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device, int sdram_size = binfo->ram_size; DisplayState *ds; + QemuOpts *mach_opts; + bool usb_enabled = false; + s->mpu = omap2420_mpu_init(sysmem, sdram_size, cpu_model); /* Setup peripherals @@ -1322,6 +1325,12 @@ 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); + + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); + } + if (usb_enabled) n8x0_usb_setup(s); diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 0c0096f..0bf25d0 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -148,6 +148,8 @@ static void pc_init1(MemoryRegion *system_memory, MemoryRegion *pci_memory; MemoryRegion *rom_memory; void *fw_cfg = NULL; + QemuOpts *mach_opts; + bool usb_enabled = false; pc_cpus_init(cpu_model); @@ -267,6 +269,10 @@ static void pc_init1(MemoryRegion *system_memory, pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, floppy, idebus[0], idebus[1], rtc_state); + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); + } if (pci_enabled && usb_enabled) { pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); } diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 4e2a6e6..1a324eb 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -159,6 +159,9 @@ static void ppc_core99_init (ram_addr_t ram_size, linux_boot = (kernel_filename != NULL); + QemuOpts *mach_opts; + bool usb_enabled = false; + /* init CPUs */ if (cpu_model == NULL) #ifdef TARGET_PPC64 @@ -350,7 +353,7 @@ static void ppc_core99_init (ram_addr_t ram_size, /* cuda also initialize ADB */ if (machine_arch == ARCH_MAC99_U3) { - usb_enabled = 1; + usb_enabled = true; } cuda_init(&cuda_mem, pic[0x19]); @@ -360,6 +363,11 @@ static void ppc_core99_init (ram_addr_t ram_size, macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem, dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar); + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); + } + if (usb_enabled) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index f2c6908..da05705 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -101,6 +101,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, linux_boot = (kernel_filename != NULL); + QemuOpts *mach_opts; + bool usb_enabled = true; + /* init CPUs */ if (cpu_model == NULL) cpu_model = "G3"; @@ -286,6 +289,11 @@ static void ppc_heathrow_init (ram_addr_t ram_size, macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem, dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar); + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); + } + if (usb_enabled) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index be2b268..dc294ae 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -484,6 +484,9 @@ static void ppc_prep_init (ram_addr_t ram_size, linux_boot = (kernel_filename != NULL); + QemuOpts *mach_opts; + bool usb_enabled = true; + /* init CPUs */ if (cpu_model == NULL) cpu_model = "602"; @@ -661,6 +664,10 @@ static void ppc_prep_init (ram_addr_t ram_size, memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); #endif + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); + } if (usb_enabled) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index d5f1420..ed87797 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -2007,6 +2007,9 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, PXA2xxState *s; int i; DriveInfo *dinfo; + QemuOpts *mach_opts; + bool usb_enabled = false; + s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { @@ -2108,6 +2111,11 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); + } + if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); @@ -2144,6 +2152,8 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) PXA2xxState *s; int i; DriveInfo *dinfo; + QemuOpts *mach_opts; + bool usb_enabled = false; s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); @@ -2239,6 +2249,11 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); + } + if (usb_enabled) { sysbus_create_simple("sysbus-ohci", 0x4c000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); diff --git a/hw/realview.c b/hw/realview.c index 19db4d0..543d5dc 100644 --- a/hw/realview.c +++ b/hw/realview.c @@ -73,6 +73,8 @@ static void realview_init(ram_addr_t ram_size, uint32_t proc_id = 0; uint32_t sys_id; ram_addr_t low_ram_size; + QemuOpts *mach_opts; + bool usb_enabled = true; switch (board_type) { case BOARD_EB: @@ -227,6 +229,12 @@ static void realview_init(ram_addr_t ram_size, sysbus_connect_irq(busdev, 2, pic[50]); sysbus_connect_irq(busdev, 3, pic[51]); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci"); + + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); + } + if (usb_enabled) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/hw/spapr.c b/hw/spapr.c index 81c9343..4dc5e59 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, long load_limit, rtas_limit, fw_size; long pteg_shift = 17; char *filename; + QemuOpts *mach_opts; + bool usb_enabled = true; spapr = g_malloc0(sizeof(*spapr)); QLIST_INIT(&spapr->phbs); @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, spapr_vscsi_create(spapr->vio_bus); } + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); + } + + if (usb_enabled) { + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, + -1, "pci-ohci"); + } + if (rma_size < (MIN_RMA_SLOF << 20)) { fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " "%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF); diff --git a/hw/versatilepb.c b/hw/versatilepb.c index 4fd5d9b..4b2f70d 100644 --- a/hw/versatilepb.c +++ b/hw/versatilepb.c @@ -188,6 +188,8 @@ static void versatile_init(ram_addr_t ram_size, int n; int done_smc = 0; DriveInfo *dinfo; + QemuOpts *mach_opts; + bool usb_enabled = false; if (!cpu_model) { cpu_model = "arm926"; @@ -247,6 +249,12 @@ static void versatile_init(ram_addr_t ram_size, pci_nic_init_nofail(nd, "rtl8139", NULL); } } + + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); + } + if (usb_enabled) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/qemu-config.c b/qemu-config.c index 5c3296b..b86ee36 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = { .name = "dt_compatible", .type = QEMU_OPT_STRING, .help = "Overrides the \"compatible\" property of the dt root node", + },{ + .name = "usb", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable/disable usb", }, { /* End of list */ } }, diff --git a/sysemu.h b/sysemu.h index 4669348..7fbf8f4 100644 --- a/sysemu.h +++ b/sysemu.h @@ -118,7 +118,6 @@ extern const char *keyboard_layout; extern int win2k_install_hack; extern int alt_grab; extern int ctrl_grab; -extern int usb_enabled; extern int smp_cpus; extern int max_cpus; extern int cursor_hide; diff --git a/vl.c b/vl.c index e71cb30..77e8962 100644 --- a/vl.c +++ b/vl.c @@ -198,7 +198,6 @@ CharDriverState *serial_hds[MAX_SERIAL_PORTS]; CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; int win2k_install_hack = 0; -int usb_enabled = 0; int singlestep = 0; int smp_cpus = 1; int max_cpus = 0; @@ -1043,13 +1042,24 @@ static void smp_parse(const char *optarg) /***********************************************************/ /* USB devices */ +static inline bool usb_enabled(bool default_usb) +{ + QemuOpts *mach_opts; + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (mach_opts) { + return qemu_opt_get_bool(mach_opts, "usb", default_usb); + } + return default_usb; +} + static int usb_device_add(const char *devname) { const char *p; USBDevice *dev = NULL; - if (!usb_enabled) + if (!usb_enabled(false)) { return -1; + } /* drivers with .usbdevice_name entry in USBDeviceInfo */ dev = usbdevice_create(devname); @@ -1085,8 +1095,9 @@ static int usb_device_del(const char *devname) if (strstart(devname, "host:", &p)) return usb_host_device_close(p); - if (!usb_enabled) + if (!usb_enabled(false)) { return -1; + } p = strchr(devname, '.'); if (!p) @@ -2977,10 +2988,16 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_usb: - usb_enabled = 1; + machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (machine_opts) { + qemu_opt_set_bool(machine_opts, "usb", true); + } break; case QEMU_OPTION_usbdevice: - usb_enabled = 1; + machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (machine_opts) { + qemu_opt_set_bool(machine_opts, "usb", true); + } add_device_config(DEV_USB, optarg); break; case QEMU_OPTION_device: @@ -3526,7 +3543,7 @@ int main(int argc, char **argv, char **envp) current_machine = machine; /* init USB devices */ - if (usb_enabled) { + if (usb_enabled(false)) { if (foreach_device_config(DEV_USB, usb_parse) < 0) exit(1); } -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [RFC] usb and s390 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang @ 2012-08-07 12:19 ` Christian Borntraeger 2012-08-07 12:50 ` Li Zhang 2012-08-07 14:20 ` Eric Blake 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger ` (2 subsequent siblings) 3 siblings, 2 replies; 38+ messages in thread From: Christian Borntraeger @ 2012-08-07 12:19 UTC (permalink / raw) To: Li Zhang Cc: aliguori, agraf, Li Zhang, qemu-devel, Christian Borntraeger, Jens Freimann, qemu-ppc, Eugene Dvurechenski, afaerber, david 2nd attempt, with mailing lists on cc.... This patch reminded us of another thing that we have been working on. Here is a patch that sits in my patch queue and disables usb for s390 We have not pushed that patch yet, since several libvirt versions will always specify -usb, which will then break. So are there any opinions about handling the usb option for platforms that actually dont support it? Christian - Eugene Dvurechenski (1): USB code fenced for s390 configure | 66 +++++++++++++++++++++++++++++++++++++++++------------ hmp-commands.hx | 6 +++++ hw/Makefile.objs | 5 ++- monitor.c | 4 +++ qemu-options.hx | 4 +++ sysemu.h | 2 + vl.c | 8 +++++- 7 files changed, 76 insertions(+), 19 deletions(-) ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC] usb and s390 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger @ 2012-08-07 12:50 ` Li Zhang 2012-08-07 14:20 ` Eric Blake 1 sibling, 0 replies; 38+ messages in thread From: Li Zhang @ 2012-08-07 12:50 UTC (permalink / raw) To: Christian Borntraeger Cc: qemu-ppc, aliguori, agraf, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, afaerber, david On 2012年08月07日 20:19, Christian Borntraeger wrote: > 2nd attempt, with mailing lists on cc.... > This patch reminded us of another thing that we have been working on. > Here is a patch that sits in my patch queue and disables usb for s390 > We have not pushed that patch yet, since several libvirt versions will always > specify -usb, which will then break. > > So are there any opinions about handling the usb option for platforms that > actually dont support it? My patches removed the usb_enabled global variable. So platforms can't use the global variable any more. Platforms created usb controller according to usb_enabled global variable before. Now we add USB option to machine options. For the platfrom, usb_enabled is got from machine option as the following: QemuOpts *mach_opts; bool usb_enabled = false; (If the platform needs to default value as true, it should be set as true ) mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (mach_opts) { usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); } > > Christian > > - > Eugene Dvurechenski (1): > USB code fenced for s390 > > configure | 66 +++++++++++++++++++++++++++++++++++++++++------------ > hmp-commands.hx | 6 +++++ > hw/Makefile.objs | 5 ++- > monitor.c | 4 +++ > qemu-options.hx | 4 +++ > sysemu.h | 2 + > vl.c | 8 +++++- > 7 files changed, 76 insertions(+), 19 deletions(-) > -- Li Zhang IBM China Linux Technology Centre ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC] usb and s390 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger 2012-08-07 12:50 ` Li Zhang @ 2012-08-07 14:20 ` Eric Blake 1 sibling, 0 replies; 38+ messages in thread From: Eric Blake @ 2012-08-07 14:20 UTC (permalink / raw) To: Christian Borntraeger Cc: aliguori, agraf, Li Zhang, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, qemu-ppc, afaerber, david [-- Attachment #1: Type: text/plain, Size: 1423 bytes --] On 08/07/2012 06:19 AM, Christian Borntraeger wrote: > 2nd attempt, with mailing lists on cc.... > This patch reminded us of another thing that we have been working on. > Here is a patch that sits in my patch queue and disables usb for s390 > We have not pushed that patch yet, since several libvirt versions will always > specify -usb, which will then break. You are correct that older libvirt always specified -usb; but with the upcoming libvirt 0.10.0, we have fixed things to now allow the user to request starting without -usb. > > So are there any opinions about handling the usb option for platforms that > actually dont support it? Libvirt should probably learn which platforms don't support it and automatically omit the -usb without user intervention on those platforms, but at least we have the fallback to explicitly avoid the -usb now. Knowing which platforms support usb might be easier if there were some QMP query-* command that could be used to learn whether a particular machine type supports it. That is, since this series is adding the new syntax '-machine type=pseries,usb=off', libvirt should be able to query '-machine type=pseries,?' to see what options the given machine has, and preferably through a QMP interface rather than through the command line. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 620 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger @ 2012-08-07 12:19 ` Christian Borntraeger 2012-08-07 12:26 ` Peter Maydell ` (2 more replies) 2012-08-14 10:39 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Alexander Graf 2012-08-14 10:46 ` Alexander Graf 3 siblings, 3 replies; 38+ messages in thread From: Christian Borntraeger @ 2012-08-07 12:19 UTC (permalink / raw) To: Li Zhang Cc: aliguori, agraf, Li Zhang, qemu-devel, Christian Borntraeger, Jens Freimann, qemu-ppc, Eugene Dvurechenski, afaerber, david From: Eugene Dvurechenski <jno@linux.vnet.ibm.com> on s390 there is no usb support and the -usb option doesnt do anything. This patch fences all usb code for s390. Signed-off-by: Eugene Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- configure | 66 +++++++++++++++++++++++++++++++++++++++++------------ hmp-commands.hx | 6 +++++ hw/Makefile.objs | 5 ++- monitor.c | 4 +++ qemu-options.hx | 4 +++ sysemu.h | 2 + vl.c | 8 +++++- 7 files changed, 76 insertions(+), 19 deletions(-) diff --git a/configure b/configure index 280726c..405b201 100755 --- a/configure +++ b/configure @@ -486,7 +486,10 @@ Haiku) audio_possible_drivers="oss alsa sdl esd pa" linux="yes" linux_user="yes" - usb="linux" + case "$cpu" in + s390*) usb='none';; + *) usb="linux";; + esac kvm="yes" vhost_net="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then @@ -2647,6 +2650,11 @@ EOF fi # check for libcacard for smartcard support +if test "$usb" = 'none'; then + smartcard='no' # USB support required + smartcard_nss='no' + smartcard_cflags="" +fi if test "$smartcard" != "no" ; then smartcard="yes" smartcard_cflags="" @@ -2686,7 +2694,12 @@ if test "$smartcard" = "no" ; then fi # check for usbredirparser for usb network redirection support -if test "$usb_redir" != "no" ; then +if test "$usb" = 'no'; then + if test "$usb_redir" = "yes"; then + feature_not_found "usb-redir" + fi + usb_redir='no' +elif test "$usb_redir" != "no" ; then if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then usb_redir="yes" usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) @@ -3102,6 +3115,7 @@ echo "OpenGL support $opengl" echo "libiscsi support $libiscsi" echo "build guest agent $guest_agent" echo "coroutine backend $coroutine_backend" +echo "USB support $usb" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -3377,18 +3391,20 @@ if test "$spice" = "yes" ; then echo "CONFIG_SPICE=y" >> $config_host_mak fi -if test "$smartcard" = "yes" ; then - echo "CONFIG_SMARTCARD=y" >> $config_host_mak -fi +if test "$usb" != 'none'; then + if test "$smartcard" = "yes" ; then + echo "CONFIG_SMARTCARD=y" >> $config_host_mak + fi -if test "$smartcard_nss" = "yes" ; then - echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak - echo "libcacard_libs=$libcacard_libs" >> $config_host_mak - echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak -fi + if test "$smartcard_nss" = "yes" ; then + echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak + echo "libcacard_libs=$libcacard_libs" >> $config_host_mak + echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak + fi -if test "$usb_redir" = "yes" ; then - echo "CONFIG_USB_REDIR=y" >> $config_host_mak + if test "$usb_redir" = "yes" ; then + echo "CONFIG_USB_REDIR=y" >> $config_host_mak + fi fi if test "$opengl" = "yes" ; then @@ -3602,6 +3618,7 @@ target_int_alignment=4 target_long_alignment=4 target_llong_alignment=8 target_libs_softmmu= +target_has_usb="yes" TARGET_ARCH="$target_arch2" TARGET_BASE_ARCH="" @@ -3733,6 +3750,7 @@ case "$target_arch2" in target_nptl="yes" target_phys_bits=64 target_long_alignment=8 + target_has_usb="no" ;; unicore32) target_phys_bits=32 @@ -3858,9 +3876,19 @@ if test "$target_bsd_user" = "yes" ; then echo "CONFIG_BSD_USER=y" >> $config_target_mak fi +cflags='' +if test "$usb" = 'none' ; then + echo "TARGET_HAS_USB=0" + echo "CONFIG_HAS_USB=n" + cflags="-UTARGET_HAS_USB" +else + echo "TARGET_HAS_USB=1" + echo "CONFIG_HAS_USB=y" + cflags="-DTARGET_HAS_USB=1" +fi >> $config_target_mak + # generate QEMU_CFLAGS/LDFLAGS for targets -cflags="" includes="" ldflags="" @@ -3961,6 +3989,9 @@ if test "$tcg_interpreter" = "yes" ; then fi case "$ARCH" in +s390*) # it has no USB at all + cflags="$cflags -UTARGET_HAS_USB" +;; alpha) # Ensure there's only a single GP cflags="-msmall-data $cflags" @@ -4025,10 +4056,15 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" DIRS="$DIRS roms/seabios roms/vgabios" DIRS="$DIRS qapi-generated" -DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" +if test "$usb" != 'none'; then + DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" +fi FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" -FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" +FILES="$FILES tests/tcg/lm32/Makefile" +if test "$usb" != 'none'; then + FILES="$FILES libcacard/Makefile" +fi FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" FILES="$FILES pc-bios/spapr-rtas/Makefile" FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" diff --git a/hmp-commands.hx b/hmp-commands.hx index eea8b32..c989123 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -568,6 +568,7 @@ STEXI Compute the checksum of a memory region. ETEXI +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) { .name = "usb_add", .args_type = "devname:s", @@ -575,6 +576,7 @@ ETEXI .help = "add USB device (e.g. 'host:bus.addr' or 'host:vendor_id:product_id')", .mhandler.cmd = do_usb_add, }, +#endif STEXI @item usb_add @var{devname} @@ -584,6 +586,7 @@ Add the USB device @var{devname}. For details of available devices see @ref{usb_devices} ETEXI +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) { .name = "usb_del", .args_type = "devname:s", @@ -591,6 +594,7 @@ ETEXI .help = "remove USB device 'bus.addr'", .mhandler.cmd = do_usb_del, }, +#endif STEXI @item usb_del @var{devname} @@ -601,6 +605,7 @@ hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor command @code{info usb} to see the devices you can remove. ETEXI +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) { .name = "device_add", .args_type = "device:O", @@ -609,6 +614,7 @@ ETEXI .user_print = monitor_user_noop, .mhandler.cmd_new = do_device_add, }, +#endif STEXI @item device_add @var{config} diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 8327e55..e6811f2 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -1,4 +1,5 @@ -hw-obj-y = usb/ ide/ +hw-obj-y = ide/ +hw-obj-$(CONFIG_HAS_USB) += usb/ hw-obj-y += loader.o hw-obj-$(CONFIG_VIRTIO) += virtio-console.o hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o @@ -121,7 +122,7 @@ hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) hw-obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/ -common-obj-y += usb/ +common-obj-$(CONFIG_HAS_USB) += usb/ common-obj-y += irq.o common-obj-$(CONFIG_PTIMER) += ptimer.o common-obj-$(CONFIG_MAX7310) += max7310.o diff --git a/monitor.c b/monitor.c index 49dccfe..554cc48 100644 --- a/monitor.c +++ b/monitor.c @@ -24,7 +24,9 @@ #include <dirent.h> #include "hw/hw.h" #include "hw/qdev.h" +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) #include "hw/usb.h" +#endif #include "hw/pcmcia.h" #include "hw/pc.h" #include "hw/pci.h" @@ -2543,6 +2545,7 @@ static mon_cmd_t info_cmds[] = { .help = "show NUMA information", .mhandler.info = do_info_numa, }, +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) { .name = "usb", .args_type = "", @@ -2557,6 +2560,7 @@ static mon_cmd_t info_cmds[] = { .help = "show host USB devices", .mhandler.info = usb_host_info, }, +#endif { .name = "profile", .args_type = "", diff --git a/qemu-options.hx b/qemu-options.hx index 5e7d0dc..9b2b4a3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -491,9 +491,11 @@ STEXI @end table ETEXI +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) DEF("usb", 0, QEMU_OPTION_usb, "-usb enable the USB driver (will be the default soon)\n", QEMU_ARCH_ALL) +#endif STEXI USB options: @table @option @@ -503,9 +505,11 @@ USB options: Enable the USB driver (will be the default soon) ETEXI +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice, "-usbdevice name add the host or guest USB device 'name'\n", QEMU_ARCH_ALL) +#endif STEXI @item -usbdevice @var{devname} diff --git a/sysemu.h b/sysemu.h index 4669348..c1d73c7 100644 --- a/sysemu.h +++ b/sysemu.h @@ -177,9 +177,11 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) void do_usb_add(Monitor *mon, const QDict *qdict); void do_usb_del(Monitor *mon, const QDict *qdict); void usb_info(Monitor *mon); +#endif void rtc_change_mon_event(struct tm *tm); diff --git a/vl.c b/vl.c index e71cb30..389ce95 100644 --- a/vl.c +++ b/vl.c @@ -1042,7 +1042,7 @@ static void smp_parse(const char *optarg) /***********************************************************/ /* USB devices */ - +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) static int usb_device_add(const char *devname) { const char *p; @@ -1122,7 +1122,7 @@ void do_usb_del(Monitor *mon, const QDict *qdict) error_report("could not delete USB device '%s'", devname); } } - +#endif /***********************************************************/ /* PCMCIA/Cardbus */ @@ -2976,6 +2976,7 @@ int main(int argc, char **argv, char **envp) machine = machine_parse(optarg); } break; +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) case QEMU_OPTION_usb: usb_enabled = 1; break; @@ -2983,6 +2984,7 @@ int main(int argc, char **argv, char **envp) usb_enabled = 1; add_device_config(DEV_USB, optarg); break; +#endif case QEMU_OPTION_device: if (!qemu_opts_parse(qemu_find_opts("device"), optarg, 1)) { exit(1); @@ -3525,11 +3527,13 @@ int main(int argc, char **argv, char **envp) current_machine = machine; +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) /* init USB devices */ if (usb_enabled) { if (foreach_device_config(DEV_USB, usb_parse) < 0) exit(1); } +#endif /* init generic devices */ if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0) -- 1.7.0.1 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger @ 2012-08-07 12:26 ` Peter Maydell 2012-08-07 20:22 ` Blue Swirl 2012-08-07 12:57 ` Andreas Färber 2012-08-07 12:59 ` Li Zhang 2 siblings, 1 reply; 38+ messages in thread From: Peter Maydell @ 2012-08-07 12:26 UTC (permalink / raw) To: Christian Borntraeger Cc: aliguori, agraf, Li Zhang, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, qemu-ppc, afaerber, david On 7 August 2012 13:19, Christian Borntraeger <borntraeger@de.ibm.com> wrote: > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > /* init USB devices */ > if (usb_enabled) { > if (foreach_device_config(DEV_USB, usb_parse) < 0) > exit(1); > } > +#endif Whether there is USB or not is a property of the machine model, not the target CPU architecture, so a TARGET_HAS_USB define is definitely the wrong approach. -- PMM ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 12:26 ` Peter Maydell @ 2012-08-07 20:22 ` Blue Swirl 2012-08-08 6:29 ` Christian Borntraeger 0 siblings, 1 reply; 38+ messages in thread From: Blue Swirl @ 2012-08-07 20:22 UTC (permalink / raw) To: Peter Maydell Cc: qemu-ppc, aliguori, agraf, Li Zhang, qemu-devel, Christian Borntraeger, Jens Freimann, Li Zhang, Eugene Dvurechenski, afaerber, david On Tue, Aug 7, 2012 at 12:26 PM, Peter Maydell <peter.maydell@linaro.org> wrote: > On 7 August 2012 13:19, Christian Borntraeger <borntraeger@de.ibm.com> wrote: >> +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) >> /* init USB devices */ >> if (usb_enabled) { >> if (foreach_device_config(DEV_USB, usb_parse) < 0) >> exit(1); >> } >> +#endif > > Whether there is USB or not is a property of the machine model, > not the target CPU architecture, so a TARGET_HAS_USB define > is definitely the wrong approach. Yes. I'd add CONFIG_USB=y to files in default-configs/ except for s390*, Sparc32 and user emulators. Unless it's enough for USB to have a dependency on PCI? > > -- PMM > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 20:22 ` Blue Swirl @ 2012-08-08 6:29 ` Christian Borntraeger 0 siblings, 0 replies; 38+ messages in thread From: Christian Borntraeger @ 2012-08-08 6:29 UTC (permalink / raw) To: Blue Swirl Cc: Peter Maydell, aliguori, qemu-ppc, agraf, Li Zhang, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, afaerber, david On 07/08/12 22:22, Blue Swirl wrote: > On Tue, Aug 7, 2012 at 12:26 PM, Peter Maydell <peter.maydell@linaro.org> wrote: >> On 7 August 2012 13:19, Christian Borntraeger <borntraeger@de.ibm.com> wrote: >>> +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) >>> /* init USB devices */ >>> if (usb_enabled) { >>> if (foreach_device_config(DEV_USB, usb_parse) < 0) >>> exit(1); >>> } >>> +#endif >> >> Whether there is USB or not is a property of the machine model, >> not the target CPU architecture, so a TARGET_HAS_USB define >> is definitely the wrong approach. > > Yes. I'd add CONFIG_USB=y to files in default-configs/ except for > s390*, Sparc32 and user emulators. Unless it's enough for USB to have > a dependency on PCI? Yes, that seems to be the right place - thanks. A dependency on pci would also do for us. On the other hand, if there are really plans to add a virtio-usb then we should not disable usb support at all - especially since disabling it does cause some trouble with libvirt and the current state does not cause problems (we assumed that libvirt will detect usb capability like it does for other parameters, but it doesnt). In other words this patch was mostly cosmetics. So lets just drop this patch, go ahead with Li's patch set and later on we can see if we should do anything regarding s390. Christian ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger 2012-08-07 12:26 ` Peter Maydell @ 2012-08-07 12:57 ` Andreas Färber 2012-08-07 12:59 ` Li Zhang 2 siblings, 0 replies; 38+ messages in thread From: Andreas Färber @ 2012-08-07 12:57 UTC (permalink / raw) To: Christian Borntraeger Cc: qemu-ppc, aliguori, Peter Maydell, agraf, Li Zhang, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, david Am 07.08.2012 14:19, schrieb Christian Borntraeger: > From: Eugene Dvurechenski <jno@linux.vnet.ibm.com> > > on s390 there is no usb support and the -usb option doesnt > do anything. > This patch fences all usb code for s390. > > Signed-off-by: Eugene Dvurechenski <jno@linux.vnet.ibm.com> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > configure | 66 +++++++++++++++++++++++++++++++++++++++++------------ > hmp-commands.hx | 6 +++++ > hw/Makefile.objs | 5 ++- > monitor.c | 4 +++ > qemu-options.hx | 4 +++ > sysemu.h | 2 + > vl.c | 8 +++++- > 7 files changed, 76 insertions(+), 19 deletions(-) This patch seems to be mixing two things: 1) Disabling USB host support. If System z mainframes don't have USB support, it doesn't make much sense to enable USB host passthrough. 2) Disabling USB support for guest machines. Wasn't there a recent virtio-usb RFC? In that case it would very well be possible to connect virtual USB devices (including smartcard) to the virtio s390 machine. Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger 2012-08-07 12:26 ` Peter Maydell 2012-08-07 12:57 ` Andreas Färber @ 2012-08-07 12:59 ` Li Zhang 2 siblings, 0 replies; 38+ messages in thread From: Li Zhang @ 2012-08-07 12:59 UTC (permalink / raw) To: Christian Borntraeger Cc: qemu-ppc, aliguori, agraf, qemu-devel, Jens Freimann, Li Zhang, Eugene Dvurechenski, afaerber, david On 2012年08月07日 20:19, Christian Borntraeger wrote: > From: Eugene Dvurechenski <jno@linux.vnet.ibm.com> > > on s390 there is no usb support and the -usb option doesnt > do anything. > This patch fences all usb code for s390. > > Signed-off-by: Eugene Dvurechenski <jno@linux.vnet.ibm.com> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > configure | 66 +++++++++++++++++++++++++++++++++++++++++------------ > hmp-commands.hx | 6 +++++ > hw/Makefile.objs | 5 ++- > monitor.c | 4 +++ > qemu-options.hx | 4 +++ > sysemu.h | 2 + > vl.c | 8 +++++- > 7 files changed, 76 insertions(+), 19 deletions(-) > > diff --git a/configure b/configure > index 280726c..405b201 100755 > --- a/configure > +++ b/configure > @@ -486,7 +486,10 @@ Haiku) > audio_possible_drivers="oss alsa sdl esd pa" > linux="yes" > linux_user="yes" > - usb="linux" > + case "$cpu" in > + s390*) usb='none';; > + *) usb="linux";; > + esac > kvm="yes" > vhost_net="yes" > if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then > @@ -2647,6 +2650,11 @@ EOF > fi > > # check for libcacard for smartcard support > +if test "$usb" = 'none'; then > + smartcard='no' # USB support required > + smartcard_nss='no' > + smartcard_cflags="" > +fi > if test "$smartcard" != "no" ; then > smartcard="yes" > smartcard_cflags="" > @@ -2686,7 +2694,12 @@ if test "$smartcard" = "no" ; then > fi > > # check for usbredirparser for usb network redirection support > -if test "$usb_redir" != "no" ; then > +if test "$usb" = 'no'; then > + if test "$usb_redir" = "yes"; then > + feature_not_found "usb-redir" > + fi > + usb_redir='no' > +elif test "$usb_redir" != "no" ; then > if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then > usb_redir="yes" > usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) > @@ -3102,6 +3115,7 @@ echo "OpenGL support $opengl" > echo "libiscsi support $libiscsi" > echo "build guest agent $guest_agent" > echo "coroutine backend $coroutine_backend" > +echo "USB support $usb" > > if test "$sdl_too_old" = "yes"; then > echo "-> Your SDL version is too old - please upgrade to have SDL support" > @@ -3377,18 +3391,20 @@ if test "$spice" = "yes" ; then > echo "CONFIG_SPICE=y" >> $config_host_mak > fi > > -if test "$smartcard" = "yes" ; then > - echo "CONFIG_SMARTCARD=y" >> $config_host_mak > -fi > +if test "$usb" != 'none'; then > + if test "$smartcard" = "yes" ; then > + echo "CONFIG_SMARTCARD=y" >> $config_host_mak > + fi > > -if test "$smartcard_nss" = "yes" ; then > - echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak > - echo "libcacard_libs=$libcacard_libs" >> $config_host_mak > - echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak > -fi > + if test "$smartcard_nss" = "yes" ; then > + echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak > + echo "libcacard_libs=$libcacard_libs" >> $config_host_mak > + echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak > + fi > > -if test "$usb_redir" = "yes" ; then > - echo "CONFIG_USB_REDIR=y" >> $config_host_mak > + if test "$usb_redir" = "yes" ; then > + echo "CONFIG_USB_REDIR=y" >> $config_host_mak > + fi > fi > > if test "$opengl" = "yes" ; then > @@ -3602,6 +3618,7 @@ target_int_alignment=4 > target_long_alignment=4 > target_llong_alignment=8 > target_libs_softmmu= > +target_has_usb="yes" > > TARGET_ARCH="$target_arch2" > TARGET_BASE_ARCH="" > @@ -3733,6 +3750,7 @@ case "$target_arch2" in > target_nptl="yes" > target_phys_bits=64 > target_long_alignment=8 > + target_has_usb="no" > ;; > unicore32) > target_phys_bits=32 > @@ -3858,9 +3876,19 @@ if test "$target_bsd_user" = "yes" ; then > echo "CONFIG_BSD_USER=y" >> $config_target_mak > fi > > +cflags='' > +if test "$usb" = 'none' ; then > + echo "TARGET_HAS_USB=0" > + echo "CONFIG_HAS_USB=n" > + cflags="-UTARGET_HAS_USB" > +else > + echo "TARGET_HAS_USB=1" > + echo "CONFIG_HAS_USB=y" > + cflags="-DTARGET_HAS_USB=1" > +fi >> $config_target_mak > + > # generate QEMU_CFLAGS/LDFLAGS for targets > > -cflags="" > includes="" > ldflags="" > > @@ -3961,6 +3989,9 @@ if test "$tcg_interpreter" = "yes" ; then > fi > > case "$ARCH" in > +s390*) # it has no USB at all > + cflags="$cflags -UTARGET_HAS_USB" > +;; > alpha) > # Ensure there's only a single GP > cflags="-msmall-data $cflags" > @@ -4025,10 +4056,15 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" > DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" > DIRS="$DIRS roms/seabios roms/vgabios" > DIRS="$DIRS qapi-generated" > -DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" > +if test "$usb" != 'none'; then > + DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" > +fi > FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" > FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" > -FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" > +FILES="$FILES tests/tcg/lm32/Makefile" > +if test "$usb" != 'none'; then > + FILES="$FILES libcacard/Makefile" > +fi > FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" > FILES="$FILES pc-bios/spapr-rtas/Makefile" > FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" > diff --git a/hmp-commands.hx b/hmp-commands.hx > index eea8b32..c989123 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -568,6 +568,7 @@ STEXI > Compute the checksum of a memory region. > ETEXI > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > { > .name = "usb_add", > .args_type = "devname:s", > @@ -575,6 +576,7 @@ ETEXI > .help = "add USB device (e.g. 'host:bus.addr' or 'host:vendor_id:product_id')", > .mhandler.cmd = do_usb_add, > }, > +#endif > > STEXI > @item usb_add @var{devname} > @@ -584,6 +586,7 @@ Add the USB device @var{devname}. For details of available devices see > @ref{usb_devices} > ETEXI > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > { > .name = "usb_del", > .args_type = "devname:s", > @@ -591,6 +594,7 @@ ETEXI > .help = "remove USB device 'bus.addr'", > .mhandler.cmd = do_usb_del, > }, > +#endif > > STEXI > @item usb_del @var{devname} > @@ -601,6 +605,7 @@ hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor > command @code{info usb} to see the devices you can remove. > ETEXI > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > { > .name = "device_add", > .args_type = "device:O", > @@ -609,6 +614,7 @@ ETEXI > .user_print = monitor_user_noop, > .mhandler.cmd_new = do_device_add, > }, > +#endif > > STEXI > @item device_add @var{config} > diff --git a/hw/Makefile.objs b/hw/Makefile.objs > index 8327e55..e6811f2 100644 > --- a/hw/Makefile.objs > +++ b/hw/Makefile.objs > @@ -1,4 +1,5 @@ > -hw-obj-y = usb/ ide/ > +hw-obj-y = ide/ > +hw-obj-$(CONFIG_HAS_USB) += usb/ > hw-obj-y += loader.o > hw-obj-$(CONFIG_VIRTIO) += virtio-console.o > hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o > @@ -121,7 +122,7 @@ hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) > > hw-obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/ > > -common-obj-y += usb/ > +common-obj-$(CONFIG_HAS_USB) += usb/ > common-obj-y += irq.o > common-obj-$(CONFIG_PTIMER) += ptimer.o > common-obj-$(CONFIG_MAX7310) += max7310.o > diff --git a/monitor.c b/monitor.c > index 49dccfe..554cc48 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -24,7 +24,9 @@ > #include <dirent.h> > #include "hw/hw.h" > #include "hw/qdev.h" > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > #include "hw/usb.h" > +#endif > #include "hw/pcmcia.h" > #include "hw/pc.h" > #include "hw/pci.h" > @@ -2543,6 +2545,7 @@ static mon_cmd_t info_cmds[] = { > .help = "show NUMA information", > .mhandler.info = do_info_numa, > }, > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > { > .name = "usb", > .args_type = "", > @@ -2557,6 +2560,7 @@ static mon_cmd_t info_cmds[] = { > .help = "show host USB devices", > .mhandler.info = usb_host_info, > }, > +#endif > { > .name = "profile", > .args_type = "", > diff --git a/qemu-options.hx b/qemu-options.hx > index 5e7d0dc..9b2b4a3 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -491,9 +491,11 @@ STEXI > @end table > ETEXI > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > DEF("usb", 0, QEMU_OPTION_usb, > "-usb enable the USB driver (will be the default soon)\n", > QEMU_ARCH_ALL) > +#endif > STEXI > USB options: > @table @option > @@ -503,9 +505,11 @@ USB options: > Enable the USB driver (will be the default soon) > ETEXI > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice, > "-usbdevice name add the host or guest USB device 'name'\n", > QEMU_ARCH_ALL) > +#endif > STEXI > > @item -usbdevice @var{devname} > diff --git a/sysemu.h b/sysemu.h > index 4669348..c1d73c7 100644 > --- a/sysemu.h > +++ b/sysemu.h > @@ -177,9 +177,11 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; > > extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > void do_usb_add(Monitor *mon, const QDict *qdict); > void do_usb_del(Monitor *mon, const QDict *qdict); > void usb_info(Monitor *mon); > +#endif > > void rtc_change_mon_event(struct tm *tm); > > diff --git a/vl.c b/vl.c > index e71cb30..389ce95 100644 > --- a/vl.c > +++ b/vl.c > @@ -1042,7 +1042,7 @@ static void smp_parse(const char *optarg) > > /***********************************************************/ > /* USB devices */ > - > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > static int usb_device_add(const char *devname) > { > const char *p; > @@ -1122,7 +1122,7 @@ void do_usb_del(Monitor *mon, const QDict *qdict) > error_report("could not delete USB device '%s'", devname); > } > } > - > +#endif > /***********************************************************/ > /* PCMCIA/Cardbus */ > > @@ -2976,6 +2976,7 @@ int main(int argc, char **argv, char **envp) > machine = machine_parse(optarg); > } > break; > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > case QEMU_OPTION_usb: > usb_enabled = 1; This line will be replaced by the following in my patch: machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { qemu_opt_set_bool(machine_opts, "usb", true); } BTW, does s390 use the same vl.c as other platforms? It seems that the code is not as the code I have seen in qemu. :) > break; > @@ -2983,6 +2984,7 @@ int main(int argc, char **argv, char **envp) > usb_enabled = 1; This is the same as I mention above. > add_device_config(DEV_USB, optarg); > break; > +#endif > case QEMU_OPTION_device: > if (!qemu_opts_parse(qemu_find_opts("device"), optarg, 1)) { > exit(1); > @@ -3525,11 +3527,13 @@ int main(int argc, char **argv, char **envp) > > current_machine = machine; > > +#if defined(TARGET_HAS_USB) && (TARGET_HAS_USB == 1) > /* init USB devices */ > if (usb_enabled) { usb_enabled is removed and it is replaced with usb_enabled() function. You can see my patch. > if (foreach_device_config(DEV_USB, usb_parse) < 0) > exit(1); > } > +#endif > > /* init generic devices */ > if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0) -- Li Zhang IBM China Linux Technology Centre ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger @ 2012-08-14 10:39 ` Alexander Graf 2012-08-14 14:59 ` Li Zhang 2012-08-14 10:46 ` Alexander Graf 3 siblings, 1 reply; 38+ messages in thread From: Alexander Graf @ 2012-08-14 10:39 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On 08/07/2012 04:41 AM, Li Zhang wrote: > When -usb option is used, global varible usb_enabled is set. > And all the plafrom will create one USB controller according > to this variable. In fact, global varibles make code hard > to read. > > So this patch is to remove global variable usb_enabled and > add USB option in machine options. All the plaforms will get > USB option value from machine options. > > USB option of machine options will be set either by: > * -usb > * -machine type=pseries,usb=on > > Both these ways can work now. They both set USB option in > machine options. In the future, the first way will be removed. > > Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> > --- > hw/nseries.c | 9 +++++++++ > hw/pc_piix.c | 6 ++++++ > hw/ppc_newworld.c | 10 +++++++++- > hw/ppc_oldworld.c | 8 ++++++++ > hw/ppc_prep.c | 7 +++++++ > hw/pxa2xx.c | 15 +++++++++++++++ > hw/realview.c | 8 ++++++++ > hw/spapr.c | 12 ++++++++++++ > hw/versatilepb.c | 8 ++++++++ > qemu-config.c | 4 ++++ > sysemu.h | 1 - > vl.c | 29 +++++++++++++++++++++++------ > 12 files changed, 109 insertions(+), 8 deletions(-) > > diff --git a/hw/nseries.c b/hw/nseries.c > index 4df2670..8e385b7 100644 > --- a/hw/nseries.c > +++ b/hw/nseries.c > @@ -1282,6 +1282,9 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device, > int sdram_size = binfo->ram_size; > DisplayState *ds; > > + QemuOpts *mach_opts; > + bool usb_enabled = false; > + > s->mpu = omap2420_mpu_init(sysmem, sdram_size, cpu_model); > > /* Setup peripherals > @@ -1322,6 +1325,12 @@ 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); > + > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); > + } > + > if (usb_enabled) > n8x0_usb_setup(s); > > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 0c0096f..0bf25d0 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -148,6 +148,8 @@ static void pc_init1(MemoryRegion *system_memory, > MemoryRegion *pci_memory; > MemoryRegion *rom_memory; > void *fw_cfg = NULL; > + QemuOpts *mach_opts; > + bool usb_enabled = false; > > pc_cpus_init(cpu_model); > > @@ -267,6 +269,10 @@ static void pc_init1(MemoryRegion *system_memory, > pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, > floppy, idebus[0], idebus[1], rtc_state); > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); > + } > if (pci_enabled && usb_enabled) { > pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); > } > diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c > index 4e2a6e6..1a324eb 100644 > --- a/hw/ppc_newworld.c > +++ b/hw/ppc_newworld.c > @@ -159,6 +159,9 @@ static void ppc_core99_init (ram_addr_t ram_size, > > linux_boot = (kernel_filename != NULL); > > + QemuOpts *mach_opts; > + bool usb_enabled = false; > + > /* init CPUs */ > if (cpu_model == NULL) > #ifdef TARGET_PPC64 > @@ -350,7 +353,7 @@ static void ppc_core99_init (ram_addr_t ram_size, > > /* cuda also initialize ADB */ > if (machine_arch == ARCH_MAC99_U3) { > - usb_enabled = 1; > + usb_enabled = true; > } > cuda_init(&cuda_mem, pic[0x19]); > > @@ -360,6 +363,11 @@ static void ppc_core99_init (ram_addr_t ram_size, > macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem, > dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar); > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > if (usb_enabled) { > pci_create_simple(pci_bus, -1, "pci-ohci"); > } > diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c > index f2c6908..da05705 100644 > --- a/hw/ppc_oldworld.c > +++ b/hw/ppc_oldworld.c > @@ -101,6 +101,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, > > linux_boot = (kernel_filename != NULL); > > + QemuOpts *mach_opts; > + bool usb_enabled = true; > + > /* init CPUs */ > if (cpu_model == NULL) > cpu_model = "G3"; > @@ -286,6 +289,11 @@ static void ppc_heathrow_init (ram_addr_t ram_size, > macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem, > dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar); > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > if (usb_enabled) { > pci_create_simple(pci_bus, -1, "pci-ohci"); > } > diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c > index be2b268..dc294ae 100644 > --- a/hw/ppc_prep.c > +++ b/hw/ppc_prep.c > @@ -484,6 +484,9 @@ static void ppc_prep_init (ram_addr_t ram_size, > > linux_boot = (kernel_filename != NULL); > > + QemuOpts *mach_opts; > + bool usb_enabled = true; > + > /* init CPUs */ > if (cpu_model == NULL) > cpu_model = "602"; > @@ -661,6 +664,10 @@ static void ppc_prep_init (ram_addr_t ram_size, > memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); > #endif > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > if (usb_enabled) { > pci_create_simple(pci_bus, -1, "pci-ohci"); > } > diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c > index d5f1420..ed87797 100644 > --- a/hw/pxa2xx.c > +++ b/hw/pxa2xx.c > @@ -2007,6 +2007,9 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, > PXA2xxState *s; > int i; > DriveInfo *dinfo; > + QemuOpts *mach_opts; > + bool usb_enabled = false; > + > s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); > > if (revision && strncmp(revision, "pxa27", 5)) { > @@ -2108,6 +2111,11 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, > s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); > } > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); > + } > + > if (usb_enabled) { > sysbus_create_simple("sysbus-ohci", 0x4c000000, > qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); > @@ -2144,6 +2152,8 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) > PXA2xxState *s; > int i; > DriveInfo *dinfo; > + QemuOpts *mach_opts; > + bool usb_enabled = false; > > s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); > > @@ -2239,6 +2249,11 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) > s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); > } > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); > + } > + > if (usb_enabled) { > sysbus_create_simple("sysbus-ohci", 0x4c000000, > qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); > diff --git a/hw/realview.c b/hw/realview.c > index 19db4d0..543d5dc 100644 > --- a/hw/realview.c > +++ b/hw/realview.c > @@ -73,6 +73,8 @@ static void realview_init(ram_addr_t ram_size, > uint32_t proc_id = 0; > uint32_t sys_id; > ram_addr_t low_ram_size; > + QemuOpts *mach_opts; > + bool usb_enabled = true; > > switch (board_type) { > case BOARD_EB: > @@ -227,6 +229,12 @@ static void realview_init(ram_addr_t ram_size, > sysbus_connect_irq(busdev, 2, pic[50]); > sysbus_connect_irq(busdev, 3, pic[51]); > pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci"); > + > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > if (usb_enabled) { > pci_create_simple(pci_bus, -1, "pci-ohci"); > } > diff --git a/hw/spapr.c b/hw/spapr.c > index 81c9343..4dc5e59 100644 > --- a/hw/spapr.c > +++ b/hw/spapr.c > @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, > long load_limit, rtas_limit, fw_size; > long pteg_shift = 17; > char *filename; > + QemuOpts *mach_opts; > + bool usb_enabled = true; > > spapr = g_malloc0(sizeof(*spapr)); > QLIST_INIT(&spapr->phbs); > @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, > spapr_vscsi_create(spapr->vio_bus); > } > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > + if (usb_enabled) { > + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, > + -1, "pci-ohci"); > + } > + > if (rma_size < (MIN_RMA_SLOF << 20)) { > fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " > "%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF); > diff --git a/hw/versatilepb.c b/hw/versatilepb.c > index 4fd5d9b..4b2f70d 100644 > --- a/hw/versatilepb.c > +++ b/hw/versatilepb.c > @@ -188,6 +188,8 @@ static void versatile_init(ram_addr_t ram_size, > int n; > int done_smc = 0; > DriveInfo *dinfo; > + QemuOpts *mach_opts; > + bool usb_enabled = false; > > if (!cpu_model) { > cpu_model = "arm926"; > @@ -247,6 +249,12 @@ static void versatile_init(ram_addr_t ram_size, > pci_nic_init_nofail(nd, "rtl8139", NULL); > } > } > + > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); > + } > + > if (usb_enabled) { > pci_create_simple(pci_bus, -1, "pci-ohci"); > } > diff --git a/qemu-config.c b/qemu-config.c > index 5c3296b..b86ee36 100644 > --- a/qemu-config.c > +++ b/qemu-config.c > @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = { > .name = "dt_compatible", > .type = QEMU_OPT_STRING, > .help = "Overrides the \"compatible\" property of the dt root node", > + },{ > + .name = "usb", > + .type = QEMU_OPT_BOOL, > + .help = "Set on/off to enable/disable usb", > }, > { /* End of list */ } > }, > diff --git a/sysemu.h b/sysemu.h > index 4669348..7fbf8f4 100644 > --- a/sysemu.h > +++ b/sysemu.h > @@ -118,7 +118,6 @@ extern const char *keyboard_layout; > extern int win2k_install_hack; > extern int alt_grab; > extern int ctrl_grab; > -extern int usb_enabled; > extern int smp_cpus; > extern int max_cpus; > extern int cursor_hide; > diff --git a/vl.c b/vl.c > index e71cb30..77e8962 100644 > --- a/vl.c > +++ b/vl.c > @@ -198,7 +198,6 @@ CharDriverState *serial_hds[MAX_SERIAL_PORTS]; > CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; > CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; > int win2k_install_hack = 0; > -int usb_enabled = 0; > int singlestep = 0; > int smp_cpus = 1; > int max_cpus = 0; > @@ -1043,13 +1042,24 @@ static void smp_parse(const char *optarg) > /***********************************************************/ > /* USB devices */ > > +static inline bool usb_enabled(bool default_usb) > +{ > + QemuOpts *mach_opts; > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + return qemu_opt_get_bool(mach_opts, "usb", default_usb); > + } > + return default_usb; > +} If you move this function to sysemu.h and simply do a global s/usb_enabled/usb_enabled(false)/ the patch will be a lot smaller and we will have a lot less duplicated code. Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options 2012-08-14 10:39 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Alexander Graf @ 2012-08-14 14:59 ` Li Zhang 0 siblings, 0 replies; 38+ messages in thread From: Li Zhang @ 2012-08-14 14:59 UTC (permalink / raw) To: Alexander Graf; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On Tue, Aug 14, 2012 at 6:39 PM, Alexander Graf <agraf@suse.de> wrote: > On 08/07/2012 04:41 AM, Li Zhang wrote: >> >> When -usb option is used, global varible usb_enabled is set. >> And all the plafrom will create one USB controller according >> to this variable. In fact, global varibles make code hard >> to read. >> >> So this patch is to remove global variable usb_enabled and >> add USB option in machine options. All the plaforms will get >> USB option value from machine options. >> >> USB option of machine options will be set either by: >> * -usb >> * -machine type=pseries,usb=on >> >> Both these ways can work now. They both set USB option in >> machine options. In the future, the first way will be removed. >> >> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> >> --- >> hw/nseries.c | 9 +++++++++ >> hw/pc_piix.c | 6 ++++++ >> hw/ppc_newworld.c | 10 +++++++++- >> hw/ppc_oldworld.c | 8 ++++++++ >> hw/ppc_prep.c | 7 +++++++ >> hw/pxa2xx.c | 15 +++++++++++++++ >> hw/realview.c | 8 ++++++++ >> hw/spapr.c | 12 ++++++++++++ >> hw/versatilepb.c | 8 ++++++++ >> qemu-config.c | 4 ++++ >> sysemu.h | 1 - >> vl.c | 29 +++++++++++++++++++++++------ >> 12 files changed, 109 insertions(+), 8 deletions(-) >> >> diff --git a/hw/nseries.c b/hw/nseries.c >> index 4df2670..8e385b7 100644 >> --- a/hw/nseries.c >> +++ b/hw/nseries.c >> @@ -1282,6 +1282,9 @@ static void n8x0_init(ram_addr_t ram_size, const >> char *boot_device, >> int sdram_size = binfo->ram_size; >> DisplayState *ds; >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> + >> s->mpu = omap2420_mpu_init(sysmem, sdram_size, cpu_model); >> /* Setup peripherals >> @@ -1322,6 +1325,12 @@ 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); >> + >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); >> + } >> + >> if (usb_enabled) >> n8x0_usb_setup(s); >> diff --git a/hw/pc_piix.c b/hw/pc_piix.c >> index 0c0096f..0bf25d0 100644 >> --- a/hw/pc_piix.c >> +++ b/hw/pc_piix.c >> @@ -148,6 +148,8 @@ static void pc_init1(MemoryRegion *system_memory, >> MemoryRegion *pci_memory; >> MemoryRegion *rom_memory; >> void *fw_cfg = NULL; >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> pc_cpus_init(cpu_model); >> @@ -267,6 +269,10 @@ static void pc_init1(MemoryRegion *system_memory, >> pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, >> floppy, idebus[0], idebus[1], rtc_state); >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); >> + } >> if (pci_enabled && usb_enabled) { >> pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); >> } >> diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c >> index 4e2a6e6..1a324eb 100644 >> --- a/hw/ppc_newworld.c >> +++ b/hw/ppc_newworld.c >> @@ -159,6 +159,9 @@ static void ppc_core99_init (ram_addr_t ram_size, >> linux_boot = (kernel_filename != NULL); >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> + >> /* init CPUs */ >> if (cpu_model == NULL) >> #ifdef TARGET_PPC64 >> @@ -350,7 +353,7 @@ static void ppc_core99_init (ram_addr_t ram_size, >> /* cuda also initialize ADB */ >> if (machine_arch == ARCH_MAC99_U3) { >> - usb_enabled = 1; >> + usb_enabled = true; >> } >> cuda_init(&cuda_mem, pic[0x19]); >> @@ -360,6 +363,11 @@ static void ppc_core99_init (ram_addr_t ram_size, >> macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem, >> dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar); >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> + >> if (usb_enabled) { >> pci_create_simple(pci_bus, -1, "pci-ohci"); >> } >> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c >> index f2c6908..da05705 100644 >> --- a/hw/ppc_oldworld.c >> +++ b/hw/ppc_oldworld.c >> @@ -101,6 +101,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, >> linux_boot = (kernel_filename != NULL); >> + QemuOpts *mach_opts; >> + bool usb_enabled = true; >> + >> /* init CPUs */ >> if (cpu_model == NULL) >> cpu_model = "G3"; >> @@ -286,6 +289,11 @@ static void ppc_heathrow_init (ram_addr_t ram_size, >> macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem, >> dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar); >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> + >> if (usb_enabled) { >> pci_create_simple(pci_bus, -1, "pci-ohci"); >> } >> diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c >> index be2b268..dc294ae 100644 >> --- a/hw/ppc_prep.c >> +++ b/hw/ppc_prep.c >> @@ -484,6 +484,9 @@ static void ppc_prep_init (ram_addr_t ram_size, >> linux_boot = (kernel_filename != NULL); >> + QemuOpts *mach_opts; >> + bool usb_enabled = true; >> + >> /* init CPUs */ >> if (cpu_model == NULL) >> cpu_model = "602"; >> @@ -661,6 +664,10 @@ static void ppc_prep_init (ram_addr_t ram_size, >> memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); >> #endif >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> if (usb_enabled) { >> pci_create_simple(pci_bus, -1, "pci-ohci"); >> } >> diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c >> index d5f1420..ed87797 100644 >> --- a/hw/pxa2xx.c >> +++ b/hw/pxa2xx.c >> @@ -2007,6 +2007,9 @@ PXA2xxState *pxa270_init(MemoryRegion >> *address_space, >> PXA2xxState *s; >> int i; >> DriveInfo *dinfo; >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> + >> s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); >> if (revision && strncmp(revision, "pxa27", 5)) { >> @@ -2108,6 +2111,11 @@ PXA2xxState *pxa270_init(MemoryRegion >> *address_space, >> s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); >> } >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); >> + } >> + >> if (usb_enabled) { >> sysbus_create_simple("sysbus-ohci", 0x4c000000, >> qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); >> @@ -2144,6 +2152,8 @@ PXA2xxState *pxa255_init(MemoryRegion >> *address_space, unsigned int sdram_size) >> PXA2xxState *s; >> int i; >> DriveInfo *dinfo; >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); >> @@ -2239,6 +2249,11 @@ PXA2xxState *pxa255_init(MemoryRegion >> *address_space, unsigned int sdram_size) >> s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); >> } >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); >> + } >> + >> if (usb_enabled) { >> sysbus_create_simple("sysbus-ohci", 0x4c000000, >> qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); >> diff --git a/hw/realview.c b/hw/realview.c >> index 19db4d0..543d5dc 100644 >> --- a/hw/realview.c >> +++ b/hw/realview.c >> @@ -73,6 +73,8 @@ static void realview_init(ram_addr_t ram_size, >> uint32_t proc_id = 0; >> uint32_t sys_id; >> ram_addr_t low_ram_size; >> + QemuOpts *mach_opts; >> + bool usb_enabled = true; >> switch (board_type) { >> case BOARD_EB: >> @@ -227,6 +229,12 @@ static void realview_init(ram_addr_t ram_size, >> sysbus_connect_irq(busdev, 2, pic[50]); >> sysbus_connect_irq(busdev, 3, pic[51]); >> pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci"); >> + >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> + >> if (usb_enabled) { >> pci_create_simple(pci_bus, -1, "pci-ohci"); >> } >> diff --git a/hw/spapr.c b/hw/spapr.c >> index 81c9343..4dc5e59 100644 >> --- a/hw/spapr.c >> +++ b/hw/spapr.c >> @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, >> long load_limit, rtas_limit, fw_size; >> long pteg_shift = 17; >> char *filename; >> + QemuOpts *mach_opts; >> + bool usb_enabled = true; >> spapr = g_malloc0(sizeof(*spapr)); >> QLIST_INIT(&spapr->phbs); >> @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, >> spapr_vscsi_create(spapr->vio_bus); >> } >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> + >> + if (usb_enabled) { >> + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, >> + -1, "pci-ohci"); >> + } >> + >> if (rma_size < (MIN_RMA_SLOF << 20)) { >> fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " >> "%ldM guest RMA (Real Mode Area memory)\n", >> MIN_RMA_SLOF); >> diff --git a/hw/versatilepb.c b/hw/versatilepb.c >> index 4fd5d9b..4b2f70d 100644 >> --- a/hw/versatilepb.c >> +++ b/hw/versatilepb.c >> @@ -188,6 +188,8 @@ static void versatile_init(ram_addr_t ram_size, >> int n; >> int done_smc = 0; >> DriveInfo *dinfo; >> + QemuOpts *mach_opts; >> + bool usb_enabled = false; >> if (!cpu_model) { >> cpu_model = "arm926"; >> @@ -247,6 +249,12 @@ static void versatile_init(ram_addr_t ram_size, >> pci_nic_init_nofail(nd, "rtl8139", NULL); >> } >> } >> + >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", false); >> + } >> + >> if (usb_enabled) { >> pci_create_simple(pci_bus, -1, "pci-ohci"); >> } >> diff --git a/qemu-config.c b/qemu-config.c >> index 5c3296b..b86ee36 100644 >> --- a/qemu-config.c >> +++ b/qemu-config.c >> @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = { >> .name = "dt_compatible", >> .type = QEMU_OPT_STRING, >> .help = "Overrides the \"compatible\" property of the dt >> root node", >> + },{ >> + .name = "usb", >> + .type = QEMU_OPT_BOOL, >> + .help = "Set on/off to enable/disable usb", >> }, >> { /* End of list */ } >> }, >> diff --git a/sysemu.h b/sysemu.h >> index 4669348..7fbf8f4 100644 >> --- a/sysemu.h >> +++ b/sysemu.h >> @@ -118,7 +118,6 @@ extern const char *keyboard_layout; >> extern int win2k_install_hack; >> extern int alt_grab; >> extern int ctrl_grab; >> -extern int usb_enabled; >> extern int smp_cpus; >> extern int max_cpus; >> extern int cursor_hide; >> diff --git a/vl.c b/vl.c >> index e71cb30..77e8962 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -198,7 +198,6 @@ CharDriverState *serial_hds[MAX_SERIAL_PORTS]; >> CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; >> CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; >> int win2k_install_hack = 0; >> -int usb_enabled = 0; >> int singlestep = 0; >> int smp_cpus = 1; >> int max_cpus = 0; >> @@ -1043,13 +1042,24 @@ static void smp_parse(const char *optarg) >> /***********************************************************/ >> /* USB devices */ >> +static inline bool usb_enabled(bool default_usb) >> +{ >> + QemuOpts *mach_opts; >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + return qemu_opt_get_bool(mach_opts, "usb", default_usb); >> + } >> + return default_usb; >> +} > > > If you move this function to sysemu.h and simply do a global > s/usb_enabled/usb_enabled(false)/ the patch will be a lot smaller and we > will have a lot less duplicated code. > OK, will do that. :) > > Alex > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang ` (2 preceding siblings ...) 2012-08-14 10:39 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Alexander Graf @ 2012-08-14 10:46 ` Alexander Graf 2012-08-14 15:01 ` Li Zhang 3 siblings, 1 reply; 38+ messages in thread From: Alexander Graf @ 2012-08-14 10:46 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On 08/07/2012 04:41 AM, Li Zhang wrote: > When -usb option is used, global varible usb_enabled is set. > And all the plafrom will create one USB controller according > to this variable. In fact, global varibles make code hard > to read. > > So this patch is to remove global variable usb_enabled and > add USB option in machine options. All the plaforms will get > USB option value from machine options. > > USB option of machine options will be set either by: > * -usb > * -machine type=pseries,usb=on > > Both these ways can work now. They both set USB option in > machine options. In the future, the first way will be removed. > > Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> > --- > hw/nseries.c | 9 +++++++++ > hw/pc_piix.c | 6 ++++++ > hw/ppc_newworld.c | 10 +++++++++- > hw/ppc_oldworld.c | 8 ++++++++ > hw/ppc_prep.c | 7 +++++++ > hw/pxa2xx.c | 15 +++++++++++++++ > hw/realview.c | 8 ++++++++ > hw/spapr.c | 12 ++++++++++++ > hw/versatilepb.c | 8 ++++++++ > qemu-config.c | 4 ++++ > sysemu.h | 1 - > vl.c | 29 +++++++++++++++++++++++------ > 12 files changed, 109 insertions(+), 8 deletions(-) > [...] > diff --git a/hw/spapr.c b/hw/spapr.c > index 81c9343..4dc5e59 100644 > --- a/hw/spapr.c > +++ b/hw/spapr.c > @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, > long load_limit, rtas_limit, fw_size; > long pteg_shift = 17; > char *filename; > + QemuOpts *mach_opts; > + bool usb_enabled = true; > > spapr = g_malloc0(sizeof(*spapr)); > QLIST_INIT(&spapr->phbs); > @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, > spapr_vscsi_create(spapr->vio_bus); > } > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > + if (usb_enabled) { > + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, > + -1, "pci-ohci"); > + } > + This needs to go into a separate patch. This patch is about moving the global usb_enabled variable towards a machine opt. It shouldn't modify any code outside of that scope, least of all add usb_enabled support for a new platform! Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options 2012-08-14 10:46 ` Alexander Graf @ 2012-08-14 15:01 ` Li Zhang 2012-08-14 23:10 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-14 15:01 UTC (permalink / raw) To: Alexander Graf; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On Tue, Aug 14, 2012 at 6:46 PM, Alexander Graf <agraf@suse.de> wrote: > On 08/07/2012 04:41 AM, Li Zhang wrote: >> >> When -usb option is used, global varible usb_enabled is set. >> And all the plafrom will create one USB controller according >> to this variable. In fact, global varibles make code hard >> to read. >> >> So this patch is to remove global variable usb_enabled and >> add USB option in machine options. All the plaforms will get >> USB option value from machine options. >> >> USB option of machine options will be set either by: >> * -usb >> * -machine type=pseries,usb=on >> >> Both these ways can work now. They both set USB option in >> machine options. In the future, the first way will be removed. >> >> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> >> --- >> hw/nseries.c | 9 +++++++++ >> hw/pc_piix.c | 6 ++++++ >> hw/ppc_newworld.c | 10 +++++++++- >> hw/ppc_oldworld.c | 8 ++++++++ >> hw/ppc_prep.c | 7 +++++++ >> hw/pxa2xx.c | 15 +++++++++++++++ >> hw/realview.c | 8 ++++++++ >> hw/spapr.c | 12 ++++++++++++ >> hw/versatilepb.c | 8 ++++++++ >> qemu-config.c | 4 ++++ >> sysemu.h | 1 - >> vl.c | 29 +++++++++++++++++++++++------ >> 12 files changed, 109 insertions(+), 8 deletions(-) >> > > [...] > > >> diff --git a/hw/spapr.c b/hw/spapr.c >> index 81c9343..4dc5e59 100644 >> --- a/hw/spapr.c >> +++ b/hw/spapr.c >> @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, >> long load_limit, rtas_limit, fw_size; >> long pteg_shift = 17; >> char *filename; >> + QemuOpts *mach_opts; >> + bool usb_enabled = true; >> spapr = g_malloc0(sizeof(*spapr)); >> QLIST_INIT(&spapr->phbs); >> @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, >> spapr_vscsi_create(spapr->vio_bus); >> } >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >> + if (mach_opts) { >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >> + } >> + >> + if (usb_enabled) { >> + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, >> + -1, "pci-ohci"); >> + } >> + > > > This needs to go into a separate patch. This patch is about moving the > global usb_enabled variable towards a machine opt. It shouldn't modify any > code outside of that scope, least of all add usb_enabled support for a new > platform! > I see. I will redo this patch. Send out it later. :) Thanks for your comments. > > Alex > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-14 15:01 ` Li Zhang @ 2012-08-14 23:10 ` David Gibson 2012-08-14 23:41 ` Alexander Graf 2012-08-15 0:09 ` Benjamin Herrenschmidt 0 siblings, 2 replies; 38+ messages in thread From: David Gibson @ 2012-08-14 23:10 UTC (permalink / raw) To: Li Zhang Cc: aliguori, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, afaerber On Tue, Aug 14, 2012 at 11:01:19PM +0800, Li Zhang wrote: > On Tue, Aug 14, 2012 at 6:46 PM, Alexander Graf <agraf@suse.de> wrote: > > On 08/07/2012 04:41 AM, Li Zhang wrote: > >> > >> When -usb option is used, global varible usb_enabled is set. > >> And all the plafrom will create one USB controller according > >> to this variable. In fact, global varibles make code hard > >> to read. > >> > >> So this patch is to remove global variable usb_enabled and > >> add USB option in machine options. All the plaforms will get > >> USB option value from machine options. > >> > >> USB option of machine options will be set either by: > >> * -usb > >> * -machine type=pseries,usb=on > >> > >> Both these ways can work now. They both set USB option in > >> machine options. In the future, the first way will be removed. > >> > >> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> > >> --- > >> hw/nseries.c | 9 +++++++++ > >> hw/pc_piix.c | 6 ++++++ > >> hw/ppc_newworld.c | 10 +++++++++- > >> hw/ppc_oldworld.c | 8 ++++++++ > >> hw/ppc_prep.c | 7 +++++++ > >> hw/pxa2xx.c | 15 +++++++++++++++ > >> hw/realview.c | 8 ++++++++ > >> hw/spapr.c | 12 ++++++++++++ > >> hw/versatilepb.c | 8 ++++++++ > >> qemu-config.c | 4 ++++ > >> sysemu.h | 1 - > >> vl.c | 29 +++++++++++++++++++++++------ > >> 12 files changed, 109 insertions(+), 8 deletions(-) > >> > > > > [...] > > > > > >> diff --git a/hw/spapr.c b/hw/spapr.c > >> index 81c9343..4dc5e59 100644 > >> --- a/hw/spapr.c > >> +++ b/hw/spapr.c > >> @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, > >> long load_limit, rtas_limit, fw_size; > >> long pteg_shift = 17; > >> char *filename; > >> + QemuOpts *mach_opts; > >> + bool usb_enabled = true; > >> spapr = g_malloc0(sizeof(*spapr)); > >> QLIST_INIT(&spapr->phbs); > >> @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, > >> spapr_vscsi_create(spapr->vio_bus); > >> } > >> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > >> + if (mach_opts) { > >> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > >> + } > >> + > >> + if (usb_enabled) { > >> + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, > >> + -1, "pci-ohci"); > >> + } > >> + > > > > > > This needs to go into a separate patch. This patch is about moving the > > global usb_enabled variable towards a machine opt. It shouldn't modify any > > code outside of that scope, least of all add usb_enabled support for a new > > platform! > > > I see. I will redo this patch. Send out it later. :) > Thanks for your comments. When you do that, please also change the default to make spapr _not_ have usb. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-14 23:10 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson @ 2012-08-14 23:41 ` Alexander Graf 2012-08-15 0:09 ` Benjamin Herrenschmidt 1 sibling, 0 replies; 38+ messages in thread From: Alexander Graf @ 2012-08-14 23:41 UTC (permalink / raw) To: David Gibson; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, Li Zhang, afaerber On 15.08.2012, at 01:10, David Gibson wrote: > On Tue, Aug 14, 2012 at 11:01:19PM +0800, Li Zhang wrote: >> On Tue, Aug 14, 2012 at 6:46 PM, Alexander Graf <agraf@suse.de> wrote: >>> On 08/07/2012 04:41 AM, Li Zhang wrote: >>>> >>>> When -usb option is used, global varible usb_enabled is set. >>>> And all the plafrom will create one USB controller according >>>> to this variable. In fact, global varibles make code hard >>>> to read. >>>> >>>> So this patch is to remove global variable usb_enabled and >>>> add USB option in machine options. All the plaforms will get >>>> USB option value from machine options. >>>> >>>> USB option of machine options will be set either by: >>>> * -usb >>>> * -machine type=pseries,usb=on >>>> >>>> Both these ways can work now. They both set USB option in >>>> machine options. In the future, the first way will be removed. >>>> >>>> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> >>>> --- >>>> hw/nseries.c | 9 +++++++++ >>>> hw/pc_piix.c | 6 ++++++ >>>> hw/ppc_newworld.c | 10 +++++++++- >>>> hw/ppc_oldworld.c | 8 ++++++++ >>>> hw/ppc_prep.c | 7 +++++++ >>>> hw/pxa2xx.c | 15 +++++++++++++++ >>>> hw/realview.c | 8 ++++++++ >>>> hw/spapr.c | 12 ++++++++++++ >>>> hw/versatilepb.c | 8 ++++++++ >>>> qemu-config.c | 4 ++++ >>>> sysemu.h | 1 - >>>> vl.c | 29 +++++++++++++++++++++++------ >>>> 12 files changed, 109 insertions(+), 8 deletions(-) >>>> >>> >>> [...] >>> >>> >>>> diff --git a/hw/spapr.c b/hw/spapr.c >>>> index 81c9343..4dc5e59 100644 >>>> --- a/hw/spapr.c >>>> +++ b/hw/spapr.c >>>> @@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, >>>> long load_limit, rtas_limit, fw_size; >>>> long pteg_shift = 17; >>>> char *filename; >>>> + QemuOpts *mach_opts; >>>> + bool usb_enabled = true; >>>> spapr = g_malloc0(sizeof(*spapr)); >>>> QLIST_INIT(&spapr->phbs); >>>> @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, >>>> spapr_vscsi_create(spapr->vio_bus); >>>> } >>>> + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); >>>> + if (mach_opts) { >>>> + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); >>>> + } >>>> + >>>> + if (usb_enabled) { >>>> + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, >>>> + -1, "pci-ohci"); >>>> + } >>>> + >>> >>> >>> This needs to go into a separate patch. This patch is about moving the >>> global usb_enabled variable towards a machine opt. It shouldn't modify any >>> code outside of that scope, least of all add usb_enabled support for a new >>> platform! >>> >> I see. I will redo this patch. Send out it later. :) >> Thanks for your comments. > > When you do that, please also change the default to make spapr _not_ > have usb. I thought the idea was to default to usb=on when -vga is used? Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-14 23:10 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson 2012-08-14 23:41 ` Alexander Graf @ 2012-08-15 0:09 ` Benjamin Herrenschmidt 2012-08-15 1:24 ` Li Zhang 1 sibling, 1 reply; 38+ messages in thread From: Benjamin Herrenschmidt @ 2012-08-15 0:09 UTC (permalink / raw) To: David Gibson; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, Li Zhang, afaerber On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: > > I see. I will redo this patch. Send out it later. :) > > Thanks for your comments. > > When you do that, please also change the default to make spapr _not_ > have usb. FYI, I originally asked for USB as default ... however it looks like at this stage the price (performance) is too high so either make it default to OFF, or make it default to ON if and only if VGA is also enabled. Cheers, Ben. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 0:09 ` Benjamin Herrenschmidt @ 2012-08-15 1:24 ` Li Zhang 2012-08-15 1:47 ` David Gibson 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-15 1:24 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: aliguori, qemu-devel, Li Zhang, David Gibson, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: >> > I see. I will redo this patch. Send out it later. :) >> > Thanks for your comments. >> >> When you do that, please also change the default to make spapr _not_ >> have usb. > > FYI, I originally asked for USB as default ... however it looks like at > this stage the price (performance) is too high so either make it default > to OFF, or make it default to ON if and only if VGA is also enabled. > Got it, I change the default as false, and when VGA is enabled, set USB option as true. > Cheers, > Ben. > > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 1:24 ` Li Zhang @ 2012-08-15 1:47 ` David Gibson 2012-08-15 2:50 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: David Gibson @ 2012-08-15 1:47 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: > On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt > <benh@kernel.crashing.org> wrote: > > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: > >> > I see. I will redo this patch. Send out it later. :) > >> > Thanks for your comments. > >> > >> When you do that, please also change the default to make spapr _not_ > >> have usb. > > > > FYI, I originally asked for USB as default ... however it looks like at > > this stage the price (performance) is too high so either make it default > > to OFF, or make it default to ON if and only if VGA is also enabled. > > > Got it, I change the default as false, and when VGA is enabled, set > USB option as true. Not quite, actually. The default should depend on VGA, but the explicit usb= option should always override that. Having VGA without USB would be unusual, but it should be possible if you specify it explicitly. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 1:47 ` David Gibson @ 2012-08-15 2:50 ` Li Zhang 2012-08-15 2:57 ` David Gibson 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-15 2:50 UTC (permalink / raw) To: Li Zhang, Benjamin Herrenschmidt, aliguori, Li Zhang, qemu-devel, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 9:47 AM, David Gibson <dwg@au1.ibm.com> wrote: > On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: >> On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt >> <benh@kernel.crashing.org> wrote: >> > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: >> >> > I see. I will redo this patch. Send out it later. :) >> >> > Thanks for your comments. >> >> >> >> When you do that, please also change the default to make spapr _not_ >> >> have usb. >> > >> > FYI, I originally asked for USB as default ... however it looks like at >> > this stage the price (performance) is too high so either make it default >> > to OFF, or make it default to ON if and only if VGA is also enabled. >> > >> Got it, I change the default as false, and when VGA is enabled, set >> USB option as true. > > Not quite, actually. The default should depend on VGA, but the > explicit usb= option should always override that. Having VGA without > USB would be unusual, but it should be possible if you specify it > explicitly. > Right, explicit usb= option will override the value. I think we can set the usb option value when no usb option is specified. For example, we use -machine type=pseries without usb= option. I am considering as the following: if (vga_enabled) { set_usb_option(true) } if (usb_enabled(false)) { //If vga is enabled and "-machine type=pseries" is specified, it will get true. pci_create_simple(ohci) } > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 2:50 ` Li Zhang @ 2012-08-15 2:57 ` David Gibson 2012-08-15 5:44 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: David Gibson @ 2012-08-15 2:57 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 10:50:04AM +0800, Li Zhang wrote: > On Wed, Aug 15, 2012 at 9:47 AM, David Gibson <dwg@au1.ibm.com> wrote: > > On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: > >> On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt > >> <benh@kernel.crashing.org> wrote: > >> > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: > >> >> > I see. I will redo this patch. Send out it later. :) > >> >> > Thanks for your comments. > >> >> > >> >> When you do that, please also change the default to make spapr _not_ > >> >> have usb. > >> > > >> > FYI, I originally asked for USB as default ... however it looks like at > >> > this stage the price (performance) is too high so either make it default > >> > to OFF, or make it default to ON if and only if VGA is also enabled. > >> > > >> Got it, I change the default as false, and when VGA is enabled, set > >> USB option as true. > > > > Not quite, actually. The default should depend on VGA, but the > > explicit usb= option should always override that. Having VGA without > > USB would be unusual, but it should be possible if you specify it > > explicitly. > > > Right, explicit usb= option will override the value. > I think we can set the usb option value when no usb option is specified. > For example, we use -machine type=pseries without usb= option. > > I am considering as the following: > > if (vga_enabled) { > set_usb_option(true) > } No, this will override the option given on the command line. > if (usb_enabled(false)) { //If vga is enabled and "-machine > type=pseries" is specified, it will get true. > pci_create_simple(ohci) > } It's much easier than this, you just want if (usb_enabled(vga_enabled)) -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 2:57 ` David Gibson @ 2012-08-15 5:44 ` Li Zhang 2012-08-15 11:13 ` David Gibson 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-15 5:44 UTC (permalink / raw) To: Li Zhang, Benjamin Herrenschmidt, aliguori, Li Zhang, qemu-devel, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 10:57 AM, David Gibson <dwg@au1.ibm.com> wrote: > On Wed, Aug 15, 2012 at 10:50:04AM +0800, Li Zhang wrote: >> On Wed, Aug 15, 2012 at 9:47 AM, David Gibson <dwg@au1.ibm.com> wrote: >> > On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: >> >> On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt >> >> <benh@kernel.crashing.org> wrote: >> >> > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: >> >> >> > I see. I will redo this patch. Send out it later. :) >> >> >> > Thanks for your comments. >> >> >> >> >> >> When you do that, please also change the default to make spapr _not_ >> >> >> have usb. >> >> > >> >> > FYI, I originally asked for USB as default ... however it looks like at >> >> > this stage the price (performance) is too high so either make it default >> >> > to OFF, or make it default to ON if and only if VGA is also enabled. >> >> > >> >> Got it, I change the default as false, and when VGA is enabled, set >> >> USB option as true. >> > >> > Not quite, actually. The default should depend on VGA, but the >> > explicit usb= option should always override that. Having VGA without >> > USB would be unusual, but it should be possible if you specify it >> > explicitly. >> > >> Right, explicit usb= option will override the value. >> I think we can set the usb option value when no usb option is specified. >> For example, we use -machine type=pseries without usb= option. >> >> I am considering as the following: >> >> if (vga_enabled) { >> set_usb_option(true) >> } > > No, this will override the option given on the command line. Oh, I didn't realize that. > >> if (usb_enabled(false)) { //If vga is enabled and "-machine >> type=pseries" is specified, it will get true. >> pci_create_simple(ohci) >> } > > It's much easier than this, you just want > if (usb_enabled(vga_enabled)) This is better than mine. :) It seems that this patch needs to work with VGA patch together. :) I need to modify as that. :) > > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 5:44 ` Li Zhang @ 2012-08-15 11:13 ` David Gibson 2012-08-15 14:17 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: David Gibson @ 2012-08-15 11:13 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 01:44:28PM +0800, Li Zhang wrote: > On Wed, Aug 15, 2012 at 10:57 AM, David Gibson <dwg@au1.ibm.com> wrote: > > On Wed, Aug 15, 2012 at 10:50:04AM +0800, Li Zhang wrote: > >> On Wed, Aug 15, 2012 at 9:47 AM, David Gibson <dwg@au1.ibm.com> wrote: > >> > On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: > >> >> On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt > >> >> <benh@kernel.crashing.org> wrote: > >> >> > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: > >> >> >> > I see. I will redo this patch. Send out it later. :) > >> >> >> > Thanks for your comments. > >> >> >> > >> >> >> When you do that, please also change the default to make spapr _not_ > >> >> >> have usb. > >> >> > > >> >> > FYI, I originally asked for USB as default ... however it looks like at > >> >> > this stage the price (performance) is too high so either make it default > >> >> > to OFF, or make it default to ON if and only if VGA is also enabled. > >> >> > > >> >> Got it, I change the default as false, and when VGA is enabled, set > >> >> USB option as true. > >> > > >> > Not quite, actually. The default should depend on VGA, but the > >> > explicit usb= option should always override that. Having VGA without > >> > USB would be unusual, but it should be possible if you specify it > >> > explicitly. > >> > > >> Right, explicit usb= option will override the value. > >> I think we can set the usb option value when no usb option is specified. > >> For example, we use -machine type=pseries without usb= option. > >> > >> I am considering as the following: > >> > >> if (vga_enabled) { > >> set_usb_option(true) > >> } > > > > No, this will override the option given on the command line. > Oh, I didn't realize that. > > > >> if (usb_enabled(false)) { //If vga is enabled and "-machine > >> type=pseries" is specified, it will get true. > >> pci_create_simple(ohci) > >> } > > > > It's much easier than this, you just want > > if (usb_enabled(vga_enabled)) > This is better than mine. :) > It seems that this patch needs to work with VGA patch together. :) > I need to modify as that. :) Not necessarily. In the initial usb pach you can just make the default 'false', then just change that one line in the VGA patch. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 1/3] Add USB option in machine options 2012-08-15 11:13 ` David Gibson @ 2012-08-15 14:17 ` Li Zhang 0 siblings, 0 replies; 38+ messages in thread From: Li Zhang @ 2012-08-15 14:17 UTC (permalink / raw) To: Li Zhang, Benjamin Herrenschmidt, aliguori, Li Zhang, qemu-devel, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 7:13 PM, David Gibson <dwg@au1.ibm.com> wrote: > On Wed, Aug 15, 2012 at 01:44:28PM +0800, Li Zhang wrote: >> On Wed, Aug 15, 2012 at 10:57 AM, David Gibson <dwg@au1.ibm.com> wrote: >> > On Wed, Aug 15, 2012 at 10:50:04AM +0800, Li Zhang wrote: >> >> On Wed, Aug 15, 2012 at 9:47 AM, David Gibson <dwg@au1.ibm.com> wrote: >> >> > On Wed, Aug 15, 2012 at 09:24:34AM +0800, Li Zhang wrote: >> >> >> On Wed, Aug 15, 2012 at 8:09 AM, Benjamin Herrenschmidt >> >> >> <benh@kernel.crashing.org> wrote: >> >> >> > On Wed, 2012-08-15 at 09:10 +1000, David Gibson wrote: >> >> >> >> > I see. I will redo this patch. Send out it later. :) >> >> >> >> > Thanks for your comments. >> >> >> >> >> >> >> >> When you do that, please also change the default to make spapr _not_ >> >> >> >> have usb. >> >> >> > >> >> >> > FYI, I originally asked for USB as default ... however it looks like at >> >> >> > this stage the price (performance) is too high so either make it default >> >> >> > to OFF, or make it default to ON if and only if VGA is also enabled. >> >> >> > >> >> >> Got it, I change the default as false, and when VGA is enabled, set >> >> >> USB option as true. >> >> > >> >> > Not quite, actually. The default should depend on VGA, but the >> >> > explicit usb= option should always override that. Having VGA without >> >> > USB would be unusual, but it should be possible if you specify it >> >> > explicitly. >> >> > >> >> Right, explicit usb= option will override the value. >> >> I think we can set the usb option value when no usb option is specified. >> >> For example, we use -machine type=pseries without usb= option. >> >> >> >> I am considering as the following: >> >> >> >> if (vga_enabled) { >> >> set_usb_option(true) >> >> } >> > >> > No, this will override the option given on the command line. >> Oh, I didn't realize that. >> > >> >> if (usb_enabled(false)) { //If vga is enabled and "-machine >> >> type=pseries" is specified, it will get true. >> >> pci_create_simple(ohci) >> >> } >> > >> > It's much easier than this, you just want >> > if (usb_enabled(vga_enabled)) >> This is better than mine. :) >> It seems that this patch needs to work with VGA patch together. :) >> I need to modify as that. :) > > Not necessarily. In the initial usb pach you can just make the > default 'false', then just change that one line in the VGA patch. Got it. Thanks David. :) > > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms 2012-08-07 2:41 [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang @ 2012-08-07 2:41 ` Li Zhang 2012-08-14 11:04 ` Alexander Graf 2012-08-07 2:42 ` [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option Li Zhang 2012-08-07 15:05 ` [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 3 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-07 2:41 UTC (permalink / raw) To: qemu-devel, qemu-ppc; +Cc: aliguori, agraf, Li Zhang, afaerber, david Functions pci_vga_init() and pci_cirrus_vga_init() are declared in pc.h. That prevents other platforms (e.g. sPAPR) to use them. This patch is to create one new file vga-pci.h and move the declarations to vga-pci.h, so that they can be shared by all platforms. This patch also cleans up on all platforms. Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> --- hw/alpha_pci.c | 1 + hw/cirrus_vga.c | 2 +- hw/mips_malta.c | 1 + hw/pc.c | 1 + hw/pc.h | 4 ---- hw/ppc_newworld.c | 2 +- hw/ppc_oldworld.c | 2 +- hw/ppc_prep.c | 1 + hw/sun4u.c | 1 + hw/vga-pci.c | 2 +- hw/vga-pci.h | 12 ++++++++++++ 11 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 hw/vga-pci.h diff --git a/hw/alpha_pci.c b/hw/alpha_pci.c index 6735577..ea546f8 100644 --- a/hw/alpha_pci.c +++ b/hw/alpha_pci.c @@ -11,6 +11,7 @@ #include "qemu-log.h" #include "sysemu.h" #include "vmware_vga.h" +#include "vga-pci.h" /* PCI IO reads/writes, to byte-word addressable memory. */ diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 623dd68..e8dcc6b 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -27,8 +27,8 @@ * available at http://home.worldonline.dk/~finth/ */ #include "hw.h" -#include "pc.h" #include "pci.h" +#include "vga-pci.h" #include "console.h" #include "vga_int.h" #include "loader.h" diff --git a/hw/mips_malta.c b/hw/mips_malta.c index 351c88e..ad23f26 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -48,6 +48,7 @@ #include "blockdev.h" #include "exec-memory.h" #include "sysbus.h" /* SysBusDevice */ +#include "vga-pci.h" //#define DEBUG_BOARD_INIT diff --git a/hw/pc.c b/hw/pc.c index 81c391c..c3a1c6e 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -50,6 +50,7 @@ #include "exec-memory.h" #include "arch_init.h" #include "bitmap.h" +#include "vga-pci.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS diff --git a/hw/pc.h b/hw/pc.h index 31ccb6f..e4db071 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -189,14 +189,10 @@ static inline DeviceState *isa_vga_init(ISABus *bus) return &dev->qdev; } -DeviceState *pci_vga_init(PCIBus *bus); int isa_vga_mm_init(target_phys_addr_t vram_base, target_phys_addr_t ctrl_base, int it_shift, MemoryRegion *address_space); -/* cirrus_vga.c */ -DeviceState *pci_cirrus_vga_init(PCIBus *bus); - /* ne2000.c */ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) { diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 1a324eb..c9226db 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -52,7 +52,6 @@ #include "adb.h" #include "mac_dbdma.h" #include "nvram.h" -#include "pc.h" #include "pci.h" #include "net.h" #include "sysemu.h" @@ -68,6 +67,7 @@ #include "hw/usb.h" #include "blockdev.h" #include "exec-memory.h" +#include "vga-pci.h" #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index da05705..73d71a8 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -29,7 +29,6 @@ #include "adb.h" #include "mac_dbdma.h" #include "nvram.h" -#include "pc.h" #include "sysemu.h" #include "net.h" #include "isa.h" @@ -44,6 +43,7 @@ #include "kvm_ppc.h" #include "blockdev.h" #include "exec-memory.h" +#include "vga-pci.h" #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index dc294ae..ecdf633 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -39,6 +39,7 @@ #include "blockdev.h" #include "arch_init.h" #include "exec-memory.h" +#include "vga-pci.h" //#define HARD_DEBUG_PPC_IO //#define DEBUG_PPC_IO diff --git a/hw/sun4u.c b/hw/sun4u.c index 137a7c6..07cd042 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -39,6 +39,7 @@ #include "elf.h" #include "blockdev.h" #include "exec-memory.h" +#include "vga-pci.h" //#define DEBUG_IRQ //#define DEBUG_EBUS diff --git a/hw/vga-pci.c b/hw/vga-pci.c index 37dc019..9abbada 100644 --- a/hw/vga-pci.c +++ b/hw/vga-pci.c @@ -23,8 +23,8 @@ */ #include "hw.h" #include "console.h" -#include "pc.h" #include "pci.h" +#include "vga-pci.h" #include "vga_int.h" #include "pixel_ops.h" #include "qemu-timer.h" diff --git a/hw/vga-pci.h b/hw/vga-pci.h new file mode 100644 index 0000000..49abf13 --- /dev/null +++ b/hw/vga-pci.h @@ -0,0 +1,12 @@ +#ifndef VGA_PCI_H +#define VGA_PCI_H + +#include "qemu-common.h" + +/* vga-pci.c */ +DeviceState *pci_vga_init(PCIBus *bus); + +/* cirrus_vga.c */ +DeviceState *pci_cirrus_vga_init(PCIBus *bus); + +#endif -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms Li Zhang @ 2012-08-14 11:04 ` Alexander Graf 0 siblings, 0 replies; 38+ messages in thread From: Alexander Graf @ 2012-08-14 11:04 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On 08/07/2012 04:41 AM, Li Zhang wrote: > Functions pci_vga_init() and pci_cirrus_vga_init() are declared > in pc.h. That prevents other platforms (e.g. sPAPR) to use them. > > This patch is to create one new file vga-pci.h and move the > declarations to vga-pci.h, so that they can be shared by > all platforms. This patch also cleans up on all platforms. > > Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> Thanks, applied to ppc-next. Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-07 2:41 [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms Li Zhang @ 2012-08-07 2:42 ` Li Zhang 2012-08-14 11:04 ` Alexander Graf 2012-08-07 15:05 ` [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 3 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-07 2:42 UTC (permalink / raw) To: qemu-devel, qemu-ppc; +Cc: aliguori, agraf, Li Zhang, afaerber, david Also instanciate the USB keyboard and mouse when that option is used (you can still use -device to create individual devices without all the defaults) Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> --- hw/spapr.c | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/hw/spapr.c b/hw/spapr.c index 4dc5e59..e8eb947 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -45,6 +45,8 @@ #include "kvm.h" #include "kvm_ppc.h" #include "pci.h" +#include "vga-pci.h" +#include "usb.h" #include "exec-memory.h" @@ -82,6 +84,7 @@ #define PHANDLE_XICP 0x00001111 sPAPREnvironment *spapr; +bool spapr_has_graphics; qemu_irq spapr_allocate_irq(uint32_t hint, uint32_t *irq_num, enum xics_irq_type type) @@ -257,6 +260,9 @@ static void *spapr_create_fdt_skel(const char *cpu_model, _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop)))); } _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); + _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width))); + _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height))); + _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth))); _FDT((fdt_end_node(fdt))); @@ -503,7 +509,9 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, } } - spapr_populate_chosen_stdout(fdt, spapr->vio_bus); + if (!spapr_has_graphics) { + spapr_populate_chosen_stdout(fdt, spapr->vio_bus); + } _FDT((fdt_pack(fdt))); @@ -556,6 +564,18 @@ static void spapr_cpu_reset(void *opaque) cpu_reset(CPU(cpu)); } +static int spapr_vga_init(PCIBus *pci_bus) +{ + if (std_vga_enabled) { + pci_vga_init(pci_bus); + } else { + fprintf(stderr, "This vga model is not supported," + "currently it only supports -vga std\n"); + return 0; + } + return 1; +} + /* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(ram_addr_t ram_size, const char *boot_device, @@ -712,6 +732,11 @@ static void ppc_spapr_init(ram_addr_t ram_size, spapr_vscsi_create(spapr->vio_bus); } + /* Graphics */ + if (spapr_vga_init(QLIST_FIRST(&spapr->phbs)->host_state.bus)) { + spapr_has_graphics = true; + } + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (mach_opts) { usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); @@ -720,6 +745,10 @@ static void ppc_spapr_init(ram_addr_t ram_size, if (usb_enabled) { pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, -1, "pci-ohci"); + if (spapr_has_graphics) { + usbdevice_create("keyboard"); + usbdevice_create("mouse"); + } } if (rma_size < (MIN_RMA_SLOF << 20)) { -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-07 2:42 ` [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option Li Zhang @ 2012-08-14 11:04 ` Alexander Graf 2012-08-14 12:04 ` Benjamin Herrenschmidt 2012-08-14 15:07 ` [Qemu-devel] [Qemu-ppc][PATCH " Li Zhang 0 siblings, 2 replies; 38+ messages in thread From: Alexander Graf @ 2012-08-14 11:04 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On 08/07/2012 04:42 AM, Li Zhang wrote: > Also instanciate the USB keyboard and mouse when that option is used > (you can still use -device to create individual devices without all > the defaults) > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> > --- > hw/spapr.c | 31 ++++++++++++++++++++++++++++++- > 1 files changed, 30 insertions(+), 1 deletions(-) Thanks, applied to ppc-next without the USB bits. I also get the following warning now: $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append root=/dev/null This vga model is not supported,currently it only supports -vga std [...] Fixing with a follow-up patch. Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 11:04 ` Alexander Graf @ 2012-08-14 12:04 ` Benjamin Herrenschmidt 2012-08-14 12:13 ` David Gibson 2012-08-14 15:07 ` [Qemu-devel] [Qemu-ppc][PATCH " Li Zhang 1 sibling, 1 reply; 38+ messages in thread From: Benjamin Herrenschmidt @ 2012-08-14 12:04 UTC (permalink / raw) To: Alexander Graf Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, Li Zhang, afaerber, david On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: > Thanks, applied to ppc-next without the USB bits. I also get the > following warning now: > > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append > root=/dev/null > This vga model is not supported,currently it only supports -vga std > [...] > > Fixing with a follow-up patch. Right, nowadays qemu defaults to cirrus regardless of the arch which is annoying. In fact it even creates a vga card with -nographic, you have to do -vga none to avoid it which is even more annoying for us :-) That's an area where we want less stupid global magic in vl.c and more fine tunes arch control. Cheers, Ben ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 12:04 ` Benjamin Herrenschmidt @ 2012-08-14 12:13 ` David Gibson 2012-08-14 15:13 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: David Gibson @ 2012-08-14 12:13 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: aliguori, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, Li Zhang, afaerber On Tue, Aug 14, 2012 at 10:04:03PM +1000, Benjamin Herrenschmidt wrote: > On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: > > Thanks, applied to ppc-next without the USB bits. I also get the > > following warning now: > > > > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel > > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append > > root=/dev/null > > This vga model is not supported,currently it only supports -vga std > > [...] > > > > Fixing with a follow-up patch. > > Right, nowadays qemu defaults to cirrus regardless of the arch which is > annoying. In fact it even creates a vga card with -nographic, you have > to do -vga none to avoid it which is even more annoying for us :-) No, that's not the problem, or at least it's not the only problem. It actually rejected -vga none. I fixed that in the version in my tree, but I hadn't sent that out to Alex yet. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 12:13 ` David Gibson @ 2012-08-14 15:13 ` Li Zhang 2012-08-14 17:19 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-14 15:13 UTC (permalink / raw) To: Benjamin Herrenschmidt, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, aliguori, afaerber, Li Zhang On Tue, Aug 14, 2012 at 8:13 PM, David Gibson <dwg@au1.ibm.com> wrote: > On Tue, Aug 14, 2012 at 10:04:03PM +1000, Benjamin Herrenschmidt wrote: >> On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: >> > Thanks, applied to ppc-next without the USB bits. I also get the >> > following warning now: >> > >> > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel >> > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append >> > root=/dev/null >> > This vga model is not supported,currently it only supports -vga std >> > [...] >> > >> > Fixing with a follow-up patch. >> >> Right, nowadays qemu defaults to cirrus regardless of the arch which is >> annoying. In fact it even creates a vga card with -nographic, you have >> to do -vga none to avoid it which is even more annoying for us :-) > > No, that's not the problem, or at least it's not the only problem. It > actually rejected -vga none. I fixed that in the version in my tree, > but I hadn't sent that out to Alex yet. OK, I see. I will redo USB patches. Let me pull the version from the internal tree and resend it with USB patches. > > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson > > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 15:13 ` Li Zhang @ 2012-08-14 17:19 ` Li Zhang 2012-08-14 17:52 ` Li Zhang 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-14 17:19 UTC (permalink / raw) To: Benjamin Herrenschmidt, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, aliguori, afaerber, Li Zhang On Tue, Aug 14, 2012 at 11:13 PM, Li Zhang <zhlcindy@gmail.com> wrote: > On Tue, Aug 14, 2012 at 8:13 PM, David Gibson <dwg@au1.ibm.com> wrote: >> On Tue, Aug 14, 2012 at 10:04:03PM +1000, Benjamin Herrenschmidt wrote: >>> On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: >>> > Thanks, applied to ppc-next without the USB bits. I also get the >>> > following warning now: >>> > >>> > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel >>> > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append >>> > root=/dev/null >>> > This vga model is not supported,currently it only supports -vga std >>> > [...] >>> > >>> > Fixing with a follow-up patch. >>> >>> Right, nowadays qemu defaults to cirrus regardless of the arch which is >>> annoying. In fact it even creates a vga card with -nographic, you have >>> to do -vga none to avoid it which is even more annoying for us :-) >> >> No, that's not the problem, or at least it's not the only problem. It >> actually rejected -vga none. I fixed that in the version in my tree, >> but I hadn't sent that out to Alex yet. > OK, I see. > I will redo USB patches. > Let me pull the version from the internal tree and resend it with USB patches. > David, I didn't find your latest version. I think I have to send out tomorrow morning. It seems that VPN server is down again. :( >> >> -- >> David Gibson | I'll have my music baroque, and my code >> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ >> | _way_ _around_! >> http://www.ozlabs.org/~dgibson >> >> > > > > -- > > Best Regards > -Li -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 17:19 ` Li Zhang @ 2012-08-14 17:52 ` Li Zhang 2012-08-14 23:11 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson 0 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-14 17:52 UTC (permalink / raw) To: Benjamin Herrenschmidt, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, aliguori, afaerber, Li Zhang On Wed, Aug 15, 2012 at 1:19 AM, Li Zhang <zhlcindy@gmail.com> wrote: > On Tue, Aug 14, 2012 at 11:13 PM, Li Zhang <zhlcindy@gmail.com> wrote: >> On Tue, Aug 14, 2012 at 8:13 PM, David Gibson <dwg@au1.ibm.com> wrote: >>> On Tue, Aug 14, 2012 at 10:04:03PM +1000, Benjamin Herrenschmidt wrote: >>>> On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: >>>> > Thanks, applied to ppc-next without the USB bits. I also get the >>>> > following warning now: >>>> > >>>> > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel >>>> > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append >>>> > root=/dev/null >>>> > This vga model is not supported,currently it only supports -vga std >>>> > [...] >>>> > >>>> > Fixing with a follow-up patch. >>>> >>>> Right, nowadays qemu defaults to cirrus regardless of the arch which is >>>> annoying. In fact it even creates a vga card with -nographic, you have >>>> to do -vga none to avoid it which is even more annoying for us :-) >>> >>> No, that's not the problem, or at least it's not the only problem. It >>> actually rejected -vga none. I fixed that in the version in my tree, >>> but I hadn't sent that out to Alex yet. >> OK, I see. >> I will redo USB patches. >> Let me pull the version from the internal tree and resend it with USB patches. >> > David, I didn't find your latest version. > I think I have to send out tomorrow morning. > It seems that VPN server is down again. :( > VPN can work now. I have sent out USB part. David, would you please send out the latest version of VGA part. Thanks. :) >>> >>> -- >>> David Gibson | I'll have my music baroque, and my code >>> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ >>> | _way_ _around_! >>> http://www.ozlabs.org/~dgibson >>> >>> >> >> >> >> -- >> >> Best Regards >> -Li > > > > -- > > Best Regards > -Li -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 17:52 ` Li Zhang @ 2012-08-14 23:11 ` David Gibson 0 siblings, 0 replies; 38+ messages in thread From: David Gibson @ 2012-08-14 23:11 UTC (permalink / raw) To: Li Zhang Cc: aliguori, Alexander Graf, Li Zhang, qemu-devel, qemu-ppc, afaerber On Wed, Aug 15, 2012 at 01:52:55AM +0800, Li Zhang wrote: > On Wed, Aug 15, 2012 at 1:19 AM, Li Zhang <zhlcindy@gmail.com> wrote: > > On Tue, Aug 14, 2012 at 11:13 PM, Li Zhang <zhlcindy@gmail.com> wrote: > >> On Tue, Aug 14, 2012 at 8:13 PM, David Gibson <dwg@au1.ibm.com> wrote: > >>> On Tue, Aug 14, 2012 at 10:04:03PM +1000, Benjamin Herrenschmidt wrote: > >>>> On Tue, 2012-08-14 at 13:04 +0200, Alexander Graf wrote: > >>>> > Thanks, applied to ppc-next without the USB bits. I also get the > >>>> > following warning now: > >>>> > > >>>> > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel > >>>> > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append > >>>> > root=/dev/null > >>>> > This vga model is not supported,currently it only supports -vga std > >>>> > [...] > >>>> > > >>>> > Fixing with a follow-up patch. > >>>> > >>>> Right, nowadays qemu defaults to cirrus regardless of the arch which is > >>>> annoying. In fact it even creates a vga card with -nographic, you have > >>>> to do -vga none to avoid it which is even more annoying for us :-) > >>> > >>> No, that's not the problem, or at least it's not the only problem. It > >>> actually rejected -vga none. I fixed that in the version in my tree, > >>> but I hadn't sent that out to Alex yet. > >> OK, I see. > >> I will redo USB patches. > >> Let me pull the version from the internal tree and resend it with USB patches. > >> > > David, I didn't find your latest version. > > I think I have to send out tomorrow morning. > > It seems that VPN server is down again. :( > > > VPN can work now. I have sent out USB part. > David, would you please send out the latest version of VGA part. There's no need, Alex already pulled your patch and put an equivalent fix in. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option 2012-08-14 11:04 ` Alexander Graf 2012-08-14 12:04 ` Benjamin Herrenschmidt @ 2012-08-14 15:07 ` Li Zhang 1 sibling, 0 replies; 38+ messages in thread From: Li Zhang @ 2012-08-14 15:07 UTC (permalink / raw) To: Alexander Graf; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On Tue, Aug 14, 2012 at 7:04 PM, Alexander Graf <agraf@suse.de> wrote: > On 08/07/2012 04:42 AM, Li Zhang wrote: >> >> Also instanciate the USB keyboard and mouse when that option is used >> (you can still use -device to create individual devices without all >> the defaults) >> >> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> >> Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> >> --- >> hw/spapr.c | 31 ++++++++++++++++++++++++++++++- >> 1 files changed, 30 insertions(+), 1 deletions(-) > > > Thanks, applied to ppc-next without the USB bits. I also get the following > warning now: > > $ ./ppc64-softmmu/qemu-system-ppc64 -nographic -M pseries -kernel > /boot/vmlinux -initrd /boot/initrd -enable-kvm -m 1G -append root=/dev/null > This vga model is not supported,currently it only supports -vga std > [...] > > Fixing with a follow-up patch. > Oh, got it. It's annoying. > > Alex > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR 2012-08-07 2:41 [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang ` (2 preceding siblings ...) 2012-08-07 2:42 ` [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option Li Zhang @ 2012-08-07 15:05 ` Li Zhang 2012-08-14 11:04 ` Alexander Graf 3 siblings, 1 reply; 38+ messages in thread From: Li Zhang @ 2012-08-07 15:05 UTC (permalink / raw) To: qemu-devel, qemu-ppc; +Cc: aliguori, agraf, Li Zhang, afaerber, david Hi Alex and Andreas, Would you please help review the new version patches? We hope the patches can be merged into 1.2. 1.2 will be freezed soon. Thanks a lot. On Tue, Aug 7, 2012 at 10:41 AM, Li Zhang <zhlcindy@gmail.com> wrote: > v1 -> v2: > * Convert USB option from char to bool. > > v2 -> v3: > * Remove global USB option > * Get USB option with qemu_opt_get_bool(). > * Send vga patch for sPAPR which requires USB enabled. > > v3 -> v4: > * Fix some English grammar and coding style faults > * Replace usb_on with add_usb to be more functional. > * Remove vga init functions' declearations from pc.h, > and add one new file vga-pci.h for the declearations. > * Cleanup pc.h on some platforms and add vga-pci.h > * Remove graphic devices which are not supported on sPAPR platform. > They will be added back when they are supported. > > v4 -> v5: > * Correct several English words > * Add header file "qemu-comman.h" in vga-pci.h, which defines PCIBus > and DeviceState types. > Move #endif to the end of the vga-pci.h and remove the trailing > white line. > > v5 -> v6: > * Remove global usb_enabled variable > * Set USB option in machine option > * Cleanup USB option on all platforms > * Report error when vga model is not std > > v6 -> v7: > * merge 1/5 and 2/5 together to avoid breaking build > * merge 3/5 and 4/5 together to avoid breaking build > > Benjamin Herrenschmidt (1): > spapr: Add support for -vga option > > Li Zhang (2): > Add USB option in machine options > Add one new file vga-pci.h and cleanup on all platforms > > hw/alpha_pci.c | 1 + > hw/cirrus_vga.c | 2 +- > hw/mips_malta.c | 1 + > hw/nseries.c | 9 +++++++++ > hw/pc.c | 1 + > hw/pc.h | 4 ---- > hw/pc_piix.c | 6 ++++++ > hw/ppc_newworld.c | 12 ++++++++++-- > hw/ppc_oldworld.c | 10 +++++++++- > hw/ppc_prep.c | 8 ++++++++ > hw/pxa2xx.c | 15 +++++++++++++++ > hw/realview.c | 8 ++++++++ > hw/spapr.c | 43 ++++++++++++++++++++++++++++++++++++++++++- > hw/sun4u.c | 1 + > hw/versatilepb.c | 8 ++++++++ > hw/vga-pci.c | 2 +- > hw/vga-pci.h | 12 ++++++++++++ > qemu-config.c | 4 ++++ > sysemu.h | 1 - > vl.c | 29 +++++++++++++++++++++++------ > 20 files changed, 160 insertions(+), 17 deletions(-) > create mode 100644 hw/vga-pci.h > > -- > 1.7.7.6 > -- Best Regards -Li ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR 2012-08-07 15:05 ` [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang @ 2012-08-14 11:04 ` Alexander Graf 0 siblings, 0 replies; 38+ messages in thread From: Alexander Graf @ 2012-08-14 11:04 UTC (permalink / raw) To: Li Zhang; +Cc: aliguori, qemu-devel, Li Zhang, qemu-ppc, afaerber, david On 08/07/2012 05:05 PM, Li Zhang wrote: > Hi Alex and Andreas, > > Would you please help review the new version patches? > We hope the patches can be merged into 1.2. > 1.2 will be freezed soon. Most of it should be unintrusive enough for 1.2. Please just make sure to rework the USB patches quickly. Alex ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2012-08-15 14:17 UTC | newest] Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-08-07 2:41 [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Li Zhang 2012-08-07 12:19 ` [Qemu-devel] [RFC] usb and s390 Christian Borntraeger 2012-08-07 12:50 ` Li Zhang 2012-08-07 14:20 ` Eric Blake 2012-08-07 12:19 ` [Qemu-devel] [RFC/PATCH 1/1] USB code fenced for s390 Christian Borntraeger 2012-08-07 12:26 ` Peter Maydell 2012-08-07 20:22 ` Blue Swirl 2012-08-08 6:29 ` Christian Borntraeger 2012-08-07 12:57 ` Andreas Färber 2012-08-07 12:59 ` Li Zhang 2012-08-14 10:39 ` [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options Alexander Graf 2012-08-14 14:59 ` Li Zhang 2012-08-14 10:46 ` Alexander Graf 2012-08-14 15:01 ` Li Zhang 2012-08-14 23:10 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson 2012-08-14 23:41 ` Alexander Graf 2012-08-15 0:09 ` Benjamin Herrenschmidt 2012-08-15 1:24 ` Li Zhang 2012-08-15 1:47 ` David Gibson 2012-08-15 2:50 ` Li Zhang 2012-08-15 2:57 ` David Gibson 2012-08-15 5:44 ` Li Zhang 2012-08-15 11:13 ` David Gibson 2012-08-15 14:17 ` Li Zhang 2012-08-07 2:41 ` [Qemu-devel] [Qemu-ppc][PATCH v7 2/3] Add one new file vga-pci.h and cleanup on all platforms Li Zhang 2012-08-14 11:04 ` Alexander Graf 2012-08-07 2:42 ` [Qemu-devel] [Qemu-ppc][PATCH v7 3/3] spapr: Add support for -vga option Li Zhang 2012-08-14 11:04 ` Alexander Graf 2012-08-14 12:04 ` Benjamin Herrenschmidt 2012-08-14 12:13 ` David Gibson 2012-08-14 15:13 ` Li Zhang 2012-08-14 17:19 ` Li Zhang 2012-08-14 17:52 ` Li Zhang 2012-08-14 23:11 ` [Qemu-devel] [Qemu-ppc] [PATCH " David Gibson 2012-08-14 15:07 ` [Qemu-devel] [Qemu-ppc][PATCH " Li Zhang 2012-08-07 15:05 ` [Qemu-devel] [Qemu-ppc][PATCH v7 0/3] Add USB enablement and VGA enablement on sPAPR Li Zhang 2012-08-14 11:04 ` Alexander Graf
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.