Add USB option and enable vga on spapr
PATCH v5 2/4 Add one new file vga-pci.h
In reply to [email protected]From: Li Zhang <[email protected]>
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 the platforms.
--- hw/cirrus_vga.c | 2 +- hw/pc.h | 4 ---- hw/vga-pci.c | 2 +- hw/vga-pci.h | 13 +++++++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.h
hw/cirrus_vga.c +1 -1
@@ -27,11 +27,11 @@* available at http://home.worldonline.dk/~finth/ */ #include "hw.h" -#include "pc.h" #include "pci.h" #include "console.h" #include "vga_int.h" #include "loader.h" +#include "vga-pci.h" /* * TODO:
hw/pc.h +0 -4
@@ -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) {
hw/vga-pci.c +1 -1
@@ -23,12 +23,12 @@*/ #include "hw.h" #include "console.h" -#include "pc.h" #include "pci.h" #include "vga_int.h" #include "pixel_ops.h" #include "qemu-timer.h" #include "loader.h" +#include "vga-pci.h" typedef struct PCIVGAState { PCIDevice dev;
hw/vga-pci.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef VGA_PCI_H +#define VGA_PCI_H + +#include "qemu-common.h" +#include "qdev.h" + +/* vga-pci.c */ +DeviceState *pci_vga_init (PCIBus *bus); + +/* cirrus_vga.c */ +DeviceState *pci_cirrus_vga_init (PCIBus *bus); + +#endif
Signature · 1 line
1.7.9.5
PATCH v5 4/4 spapr: Add support for -vga option
In reply to [email protected]From: Li Zhang <[email protected]>
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)
--- hw/spapr.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
hw/spapr.c +28 -1
@@ -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 0x00001111sPAPREnvironment *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,16 @@ 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 { +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 +730,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; + } + machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 );if (machine_opts) { add_usb =qemu_opt_get_bool (machine_opts,"usb" , true);
@@ -720,6 +743,10 @@ static void ppc_spapr_init(ram_addr_t ram_size,if (add_usb) {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 )) { fprintf(stderr, "qemu: pSeries SLOF firmware requires >= "
Signature · 1 line
1.7.9.5
PATCH v5 3/4 Cleanup pc.h on other platforms
In reply to [email protected]From: Li Zhang <[email protected]>
The declarations of pci_vga_init() and pci_cirrus_vga_init() are moved to vga-pci.h to be called by all the platforms. So it's necessary to cleanup pc.h on the platforms other than PC which include the file and add vga-pci.h on all the plaforms to call vga related functions.
This patch is to cleanup pc.h and add vga-pci.h.
--- hw/alpha_pci.c | 1 + hw/mips_malta.c | 1 + hw/pc.c | 1 + hw/ppc_newworld.c | 2 +- hw/ppc_oldworld.c | 2 +- hw/ppc_prep.c | 1 + hw/sun4u.c | 1 + 7 files changed, 7 insertions(+), 2 deletions(-)
hw/alpha_pci.c +1 -0
@@ -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. */
hw/mips_malta.c +1 -0
@@ -48,6 +48,7 @@#include "blockdev.h" #include "exec-memory.h" #include "sysbus.h" /* SysBusDevice */ +#include "vga-pci.h" //#define DEBUG_BOARD_INIT
hw/pc.c +1 -0
@@ -48,6 +48,7 @@#include "memory.h" #include "exec-memory.h" #include "arch_init.h" +#include "vga-pci.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS
hw/ppc_newworld.c +1 -1
@@ -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
hw/ppc_oldworld.c +1 -1
@@ -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
hw/ppc_prep.c +1 -0
@@ -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
hw/sun4u.c +1 -0
@@ -39,6 +39,7 @@#include "elf.h" #include "blockdev.h" #include "exec-memory.h" +#include "vga-pci.h" //#define DEBUG_IRQ //#define DEBUG_EBUS
Signature · 1 line
1.7.9.5
v5 cover Add USB option and enable vga on spapr
From: Li Zhang <[email protected]>
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.
Benjamin Herrenschmidt (1):
spapr: Add support for -vga option
Li Zhang (3):
Add usb option in machine options
Add one new file vga-pci.h
Cleanup pc.h on other platforms
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/spapr.c | 40 +++++++++++++++++++++++++++++++++++++++- hw/sun4u.c | 1 + hw/vga-pci.c | 2 +- hw/vga-pci.h | 13 +++++++++++++ qemu-config.c | 4 ++++ 13 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 hw/vga-pci.h
Signature · 1 line
1.7.9.5
PATCH v5 1/4 Add usb option in machine options
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.
--- hw/spapr.c | 11 +++++++++++ qemu-config.c | 4 ++++ 2 files changed, 15 insertions(+)
hw/spapr.c +11 -0
@@ -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 *machine_opts; +bool add_usb = true; spapr =g_malloc0 (sizeof (*spapr));QLIST_INIT (&spapr->phbs);
@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); } + machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +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 );
qemu-config.c +4 -0
@@ -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 */ } },
Signature · 1 line
1.7.9.5
Re: [Qemu-devel] [Qemu-ppc] [PATCH v5 2/4] Add one new file vga-pci.h
In reply to [email protected]Hi Alex,
Would you please help review these patches, if you have time? This patch should work with [3/4], which cleanup all the places where pci_vga_init() and pci_cirrus_vga_init() are used.
Thanks.
Quoted 95 lines · On Mon, Jul 2, 2012 at 1:25 PM, <[email protected]> wrote:
From: Li Zhang <[email protected]>
Functions
pci_vga_init()andpci_cirrus_vga_init()are declared inpc.h. That prevents other platforms (e.g. sPAPR) to use them.This patch is to create one new file
vga-pci.hand move the declarations tovga-pci.h, so that they can be shared by all the platforms.Signed-off-by Li Zhang <[email protected]>--- hw/cirrus_vga.c | 2 +- hw/pc.h | 4 ---- hw/vga-pci.c | 2 +- hw/vga-pci.h | 13 +++++++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.hhw/cirrus_vga.c +1
-1@@ -27,11 +27,11 @@* available at http://home.worldonline.dk/~finth/ */ #include "hw.h" -#include "pc.h" #include "pci.h" #include "console.h" #include "vga_int.h" #include "loader.h" +#include "vga-pci.h" /* * TODO: hw/pc.h +0
-4@@ -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) {hw/vga-pci.c +1
-1@@ -23,12 +23,12 @@*/ #include "hw.h" #include "console.h" -#include "pc.h" #include "pci.h" #include "vga_int.h" #include "pixel_ops.h" #include "qemu-timer.h" #include "loader.h" +#include "vga-pci.h" typedef struct PCIVGAState { PCIDevice dev;hw/vga-pci.h new file +13
-1@@ -0,0 +1,13 @@ +#ifndef VGA_PCI_H +#define VGA_PCI_H + +#include "qemu-common.h" +#include "qdev.h" + +/* vga-pci.c */ +DeviceState *pci_vga_init (PCIBus *bus); + +/* cirrus_vga.c */ +DeviceState *pci_cirrus_vga_init (PCIBus *bus); + +#endif --1.7.9.5
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to [email protected]Quoted 12 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
Quoted 7 lines
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>
Shouldn't you also convert -usb over to the new syntax, so that -usb basically is the same as -machine x,usb=on?
Alex
Quoted 21 lines
---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +2
-0@@ -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 *machine_opts; +bool add_usb = true; spapr =g_malloc0 (sizeof (*spapr));QLIST_INIT (&spapr->phbs);@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 10 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }
Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Alex
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 4/4] spapr: Add support for -vga option
In reply to [email protected]Quoted 26 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
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 <[email protected]>Signed-off-by Li Zhang <[email protected]>---
hw/spapr.c| 29 ++++++++++++++++++++++++++++-1 file changed, 28 insertions(+), 1 deletion(-)hw/spapr.c +2
-0@@ -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"
hw/spapr.c line 87
Quoted 4 lines
hw/spapr.c +1
-0@@ -82,6 +84,7 @@#define PHANDLE_XICP 0x00001111sPAPREnvironment *spapr; +bool spapr_has_graphics;
Globals are a big no-no :). Please move this into sPAPREnvironment.
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 265
Quoted 10 lines
hw/spapr.c +3
-0qemu_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)));
Are you sure we want to set these in -nographic or -vga none mode as well?
Quoted 16 lines
hw/spapr.c +3
-1_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,16 @@ static void spapr_cpu_reset(void *opaque)cpu_reset (CPU (cpu));
hw/spapr.c static void spapr_cpu_reset(void *opaque) · line 574
Quoted 10 lines
hw/spapr.c +8
-0} +static int spapr_vga_init (PCIBus *pci_bus) +{ +if (std_vga_enabled) { +pci_vga_init (pci_bus); + }else { +return 0 ; + } +return 1 ;
This still silently ignores unsupported -vga options, right? Please error out properly if the user passes in -vga cirrus or xql. We need to let him know that what he selected is not available.
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 736
Quoted 13 lines
hw/spapr.c +6
-0+} +/* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(ram_addr_t ram_size, const char *boot_device,@@ -712,6 +730,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; + }
How about
spapr_has_graphics = spapr_vga_init(...);
If that gets you above 80 characters, just shove the parameter to spapr_vga_init into a variable.
Alex
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 4/4] spapr: Add support for -vga option
Am 06.07.2012 15:50, schrieb Alexander Graf:
Quoted 14 lines · On 02.07.2012, at 07:25, [email protected] wrote:
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 736
Quoted 9 lines
hw/spapr.c +4
-0@@ -712,6 +730,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; + }How about
Quoted 3 lines
spapr_has_graphics=spapr_vga_init(...);If that gets you above 80 characters, just shove the parameter to
spapr_vga_initinto a variable.
Further, that expression could use
PCIHostState *phb = PCI_HOST_BRIDGE(QLIST_FIRST(&spapr->phbs)); spapr_vga_init(phb->bus)
once introduced through the pci_host series. :)
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafAm 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0
[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }
Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafAm 06.07.2012 18:03, schrieb Alexander Graf:
Quoted 69 lines · Andreas Färber
Quoted 50 lines
Am 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Quoted 6 lines
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
I was thinking of replacing
usb_enabledwithstatic inline int usb_enabled(bool default) { machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { return qemu_opt_get_bool(machine_opts, "usb", default); } return default; }
Quoted 1 line
Whereas -usb in
vl.cwould set machine.usb = on. Then all users ofusb_enabledwould automatically be converted to the new syntax and we could even use the same logic inspapr.c.
Oh sure, if we return bool and keep QemuOpts* locally it's perfect. :)
I understood you wanted to generalize the if (add_usb) {} that you replied under. ;)
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Andreas FärberQuoted 49 lines · Andreas Färber
Am 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Quoted 6 lines
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
I was thinking of replacing usb_enabled with
static inline int usb_enabled(bool default) {
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
if (machine_opts) {
return qemu_opt_get_bool(machine_opts, "usb", default);
}
return default;
}Whereas -usb in vl.c would set machine.usb = on. Then all users of usb_enabled would automatically be converted to the new syntax and we could even use the same logic in spapr.c.
Alex
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafQuoted 20 lines · Alexander Graf
Quoted 17 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>Shouldn't you also convert -usb over to the new syntax, so that -usb basically is the same as -machine x,usb=on?
Assumely, -usb and -machine x, usb=on shouldn't be used at the same time. When using -usb, and -machine x, usb=off, it's a little like to
disable the default USB of machine,
and use another specific USB with -usb option.
That's what my understanding. :)
Quoted 25 lines
Alex
Quoted 22 lines
---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +2
-0@@ -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 *machine_opts; +bool add_usb = true; spapr =g_malloc0 (sizeof (*spapr));QLIST_INIT (&spapr->phbs);@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }
Quoted 12 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
OK. I will do that. :)
Quoted 3 lines
Alex
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
Quoted 24 lines · Li Zhang
Quoted 23 lines · Alexander Graf
Quoted 19 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>
Quoted 8 lines
Quoted 2 lines
Shouldn't you also convert -usb over to the new syntax, so that -usb basically is the same as -machine x,usb=on?
Assumely, -usb and -machine x, usb=on shouldn't be used at the same time. When using -usb, and -machine x, usb=off, it's a little like to
disable the default USB of machine,
and use another specific USB with -usb option.That's what my understanding. :)
It's not about passing them in at the same time, but about having a single semantic instance where "Do we expose USB?" gets stored. That makes the code easier.
Also if you change things the way I suggested, every platform will be able to use -usb and -machine usb=x. So things become a lot more logical from the command line perspective as well, since a management app can always pass in -machine usb=x and have the same semantics, regardless of the machine we're running on.
Alex
Quoted 49 lines
Quoted 26 lines
Alex
Quoted 22 lines
---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +2
-0@@ -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 *machine_opts; +bool add_usb = true; spapr =g_malloc0 (sizeof (*spapr));QLIST_INIT (&spapr->phbs);@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 12 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
OK. I will do that. :)
Quoted 3 lines
Alex
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafQuoted 69 lines · Alexander Graf
Quoted 49 lines · Andreas Färber
Am 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Quoted 6 lines
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
I was thinking of replacing
usb_enabledwithstatic inline int usb_enabled(bool default) { machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { return qemu_opt_get_bool(machine_opts, "usb", default); } return default; }
Quoted 2 lines
Whereas -usb in
vl.cwould set machine.usb = on. Then all users ofusb_enabledwould automatically be converted to the new syntax and we could even use the same logic inspapr.c.
I see, you mean global varible usb_enabled is still used, and when -usb is passed to qemu command line,use_enabled will be assigned by the above function and set machine.usb=on.
So all the places where usb_enabled is used still can work correctly.
I think that's great, I will do that.
Thanks for your suggestions.
Quoted 3 lines
Alex
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafQuoted 35 lines · Alexander Graf
Quoted 31 lines · Li Zhang
Quoted 20 lines · Alexander Graf
Quoted 17 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Quoted 5 lines
Quoted 2 lines
Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>Shouldn't you also convert -usb over to the new syntax, so that -usb basically is the same as -machine x,usb=on?
Assumely, -usb and -machine x, usb=on shouldn't be used at the same time. When using -usb, and -machine x, usb=off, it's a little like to
disable the default USB of machine,
and use another specific USB with -usb option.
Quoted 6 lines
Quoted 1 line
That's what my understanding. :)
It's not about passing them in at the same time, but about having a single semantic instance where "Do we expose USB?" gets stored. That makes the code easier.
Also if you change things the way I suggested, every platform will be able to use -usb and -machine usb=x. So things become a lot more logical from the command line perspective as well, since a management app can always pass in -machine usb=x and have the same semantics, regardless of the machine we're running on.
Got it. I will change it.
Quoted 52 lines
Alex
Quoted 49 lines
Quoted 26 lines
Alex
Quoted 22 lines
---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +2
-0@@ -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 *machine_opts; +bool add_usb = true; spapr =g_malloc0 (sizeof (*spapr));QLIST_INIT (&spapr->phbs);@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 12 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
OK. I will do that. :)
Quoted 3 lines
Alex
--
Best Regards
-Li
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Li ZhangQuoted 70 lines · Li Zhang
Quoted 69 lines · Alexander Graf
Quoted 49 lines · Andreas Färber
Am 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Quoted 6 lines
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
I was thinking of replacing
usb_enabledwithstatic inline int usb_enabled(bool default) { machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { return qemu_opt_get_bool(machine_opts, "usb", default); } return default; }
Quoted 8 lines
Quoted 2 lines
Whereas -usb in
vl.cwould set machine.usb = on. Then all users ofusb_enabledwould automatically be converted to the new syntax and we could even use the same logic inspapr.c.I see, you mean global varible
usb_enabledis still used, and when -usb is passed to qemu command line,use_enabledwill be assigned by the above function and set machine.usb=on.So all the places where
usb_enabledis used still can work correctly.
I mean convert usb_enabled into a function that checks machine.usb :). The only global state should live in machine opts.
Alex
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 4/4] spapr: Add support for -vga option
In reply to Alexander GrafQuoted 37 lines · Alexander Graf
Quoted 26 lines · On 02.07.2012, at 07:25, [email protected] wrote:
From: Li Zhang <[email protected]>
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 <[email protected]>Signed-off-by Li Zhang <[email protected]>---
hw/spapr.c| 29 ++++++++++++++++++++++++++++-1 file changed, 28 insertions(+), 1 deletion(-)hw/spapr.c +2
-0@@ -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" hw/spapr.c line 87
Quoted 4 lines
hw/spapr.c +1
-0@@ -82,6 +84,7 @@#define PHANDLE_XICP 0x00001111sPAPREnvironment *spapr; +bool spapr_has_graphics;Globals are a big no-no :). Please move this into sPAPREnvironment.
Quoted 1 line
Quoted 11 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 265
Quoted 9 lines
qemu_irqspapr_allocate_irq(uint32_t hint,uint32_t*irq_num,
enumxics_irq_typetype)hw/spapr.c +3
-0@@ -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)));Are you sure we want to set these in -nographic or -vga none mode as well?
I am not sure about this.
Ben, would you please give more information about this?
Thanks.
Quoted 19 lines
Quoted 19 lines
hw/spapr.c +3
-1_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,16 @@ static void spapr_cpu_reset(void *opaque)cpu_reset (CPU (cpu)); }
Quoted 10 lines
hw/spapr.c static void spapr_cpu_reset(void *opaque) · line 574
Quoted 8 lines
hw/spapr.c +8
-0+static int spapr_vga_init (PCIBus *pci_bus) +{ +if (std_vga_enabled) { +pci_vga_init (pci_bus); + }else { +return 0 ; + } +return 1 ;This still silently ignores unsupported -vga options, right? Please error out properly if the user passes in -vga cirrus or xql. We need to let him know that what he selected is not available.
Yes, right. It seems that it's not good.
OK, I will do that.
Quoted 17 lines
Quoted 7 lines
hw/spapr.c +2
-0+} +/* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(ram_addr_t ram_size, const char *boot_device,hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 736
Quoted 7 lines
hw/spapr.c +4
-0@@ -712,6 +730,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; + }How about
Quoted 3 lines
spapr_has_graphics=spapr_vga_init(...);If that gets you above 80 characters, just shove the parameter to
spapr_vga_initinto a variable.
OK. I see.
Thanks.
Quoted 4 lines
Alex
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
In reply to Alexander GrafQuoted 77 lines · Alexander Graf
Quoted 73 lines · Li Zhang
Quoted 71 lines · Alexander Graf
Quoted 49 lines · Andreas Färber
Am 06.07.2012 15:43, schrieb Alexander Graf:
Quoted 31 lines · On 02.07.2012, at 07:25, [email protected] wrote:
Quoted 29 lines
From: Li Zhang <[email protected]>
pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB.
So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.Signed-off-by Li Zhang <[email protected]>Reviewed-by Andreas Färber <[email protected]>---
hw/spapr.c| 11 +++++++++++qemu-config.c| 4 ++++2 files changed, 15 insertions(+)hw/spapr.c +0
-0[...]
Quoted 4 lines
Quoted 4 lines
hw/spapr.c +0
-0@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,spapr_vscsi_create (spapr->vio_bus); }Quoted 11 lines
hw/spapr.c static void ppc_spapr_init(ram_addr_t ram_size, · line 723
Quoted 9 lines
hw/spapr.c +9
-0+ machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + add_usb =qemu_opt_get_bool (machine_opts,"usb" , true); + } + +if (add_usb) { +pci_create_simple (QLIST_FIRST (&spapr->phbs)->host_state.bus, +-1 ,"pci-ohci" ); + }Didn't I ask you to extract this out to generic code? I don't want to have a "usb" machine opt that is only available for -M pseries.
Quoted 6 lines
Isn't the mapping from "usb=on" to device-level actions machine-specific? We have ohci, uhci, ehci, xhci to choose from. And the bus to place it on is machine-specific, too.
So did you rather mean adding usb= awareness to more machines? If we generalize usb=on to usb=none/ohci/... plus some usbbus= we get -device.
I was thinking of replacing
usb_enabledwithstatic inline int usb_enabled(bool default) { machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); if (machine_opts) { return qemu_opt_get_bool(machine_opts, "usb", default); } return default; }Whereas -usb in
vl.cwould set machine.usb = on. Then all users ofusb_enabledwould automatically be converted to the new syntax and we could even use the same logic inspapr.c.
Quoted 8 lines
Quoted 5 lines
I see, you mean global varible
usb_enabledis still used, and when -usb is passed to qemu command line,use_enabledwill be assigned by the above function and set machine.usb=on.So all the places where
usb_enabledis used still can work correctly.I mean convert
usb_enabledinto a function that checks machine.usb :). The only global state should live in machine opts.
Oh, got it.
So usb_enabled should be cleared up in the places where it is used. :)
Quoted 3 lines
Alex
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc][PATCH v5 4/4] spapr: Add support for -vga option
In reply to Li ZhangQuoted 6 lines · Li Zhang
Quoted 1 line
Are you sure we want to set these in -nographic or -vga none mode as
well?
I am not sure about this.
Ben, would you please give more information about this?
Doesn't matter much. They are only useful when there is a vga adapter, they don't hurt if there isn't and it shouldn't depend on the presence of -vga since once can add an adapter with -device, so it becomes really tricky to figure out whether to expose them or not, so I made it unconditional.
Cheers,
Ben.