Add USB enablement and VGA enablement on sPAPR
v6 cover Add USB enablement and VGA enablement on sPAPR
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
Benjamin Herrenschmidt (1):
spapr: Add support for -vga option
Li Zhang (4):
Add USB option in machine options
Get USB option by machine options on all platforms 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/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
Signature · 1 line
1.7.7.6
PATCH v6 1/5 Add USB option in machine options
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 by 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.
--- qemu-config.c | 4 ++++ sysemu.h | 1 - vl.c | 29 +++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-)
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 */ } },
sysemu.h +0 -1
@@ -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;
vl.c +23 -6
@@ -196,7 +196,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 ;
@@ -1044,13 +1043,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);
@@ -1086,8 +1096,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)
@@ -2978,10 +2989,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 ); }
Signature · 1 line
1.7.7.6
PATCH v6 2/5 Get USB option by machine options on all platforms
In reply to Li ZhangAll the plaftorms use usb_enabled global variable to check USB option. Now that, usb_enabled has been removed and the value of USB option should
be got from machine options.
This patch is to clean up usb_enable on all platforms and get USB option by machine options.
Actually, in vl.c, the default USB option is false. For specific machine,
the default USB option can be changed to true.
Take pseries for an example, pseries needs USB enabled when the machine is initialized. USB option will be enabled when passing the command line by one of the following three ways:
* -M pseries
* -machine type=pseries
* -machine type=pseries,usb=on
If USB option needs to be disabled, it should use the following options:
* -machine type=pseries,usb=off
For some plaforms, USB option is disabled as the default. If it needs to enable USB, it should pass the command line as the following:
* -machine type=pseries,usb=on
--- 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 ++++++++ 9 files changed, 82 insertions(+), 1 deletions(-)
hw/nseries.c +9 -0
@@ -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);
hw/pc_piix.c +6 -0
@@ -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" ); }
hw/ppc_newworld.c +9 -1
@@ -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" ); }
hw/ppc_oldworld.c +8 -0
@@ -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" ); }
hw/ppc_prep.c +7 -0
@@ -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" ); }
hw/pxa2xx.c +15 -0
@@ -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 ));
hw/realview.c +8 -0
@@ -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" ); }
hw/spapr.c +12 -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 *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 );
hw/versatilepb.c +8 -0
@@ -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" ); }
Signature · 1 line
1.7.7.6
PATCH v6 3/5 Add one new file vga-pci.h
In reply to Li ZhangFunctions 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 | 12 ++++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.h
hw/cirrus_vga.c +1 -1
@@ -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"
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,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"
hw/vga-pci.h new file +12 -0
@@ -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
Signature · 1 line
1.7.7.6
Re: [Qemu-devel] [Qemu-ppc] [PATCH v6 3/5] Add one new file vga-pci.h
Quoted 36 lines · Li Zhang
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 | 12 ++++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.hhw/cirrus_vga.c +1
-1@@ -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" hw/pc.h +0
-0@@ -189,14 +189,10 @@ static inline DeviceState *isa_vga_init(ISABus *bus)return &dev->qdev;
hw/pc.h static inline DeviceState *isa_vga_init(ISABus *bus) · line 199
Quoted 10 lines
hw/pc.h +0
-4} -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); -
This would break build, hurting future bisections. Please merge with 4/5.
Quoted 39 lines
hw/pc.h +0
-0/* ne2000.c */ static inline bool isa_ne2000_init (ISABus *bus,int base,int irq,NICInfo *nd) {hw/vga-pci.c +1
-1@@ -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" hw/vga-pci.h new file +12
-1@@ -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
Re: [Qemu-devel] [Qemu-ppc] [PATCH v6 3/5] Add one new file vga-pci.h
Quoted 44 lines · Blue Swirl
Quoted 43 lines · Li Zhang
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 | 12 ++++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.hhw/cirrus_vga.c +1
-1@@ -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" hw/pc.h +0
-1@@ -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);
Quoted 5 lines
hw/pc.h static inline DeviceState *isa_vga_init(ISABus *bus) · line 199
Quoted 3 lines
hw/pc.h +0
-3-/* cirrus_vga.c */ -DeviceState *pci_cirrus_vga_init (PCIBus *bus); -This would break build, hurting future bisections. Please merge with 4/5.
Oh, got it, thanks. I will do that later.
It seems that 1/5 and 2/5 also should be merged together. -:)
Quoted 40 lines
Quoted 40 lines
hw/pc.h +0
-0/* ne2000.c */ static inline bool isa_ne2000_init (ISABus *bus,int base,int irq,NICInfo *nd) {hw/vga-pci.c +1
-1@@ -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" hw/vga-pci.h new file +12
-1@@ -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
Signature · 2 lines
Best Regards -Li
Re: [Qemu-devel] [Qemu-ppc] [PATCH v6 3/5] Add one new file vga-pci.h
Quoted 45 lines · Li Zhang
Quoted 44 lines · Blue Swirl
Quoted 43 lines · Li Zhang
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 | 12 ++++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 hw/vga-pci.hhw/cirrus_vga.c +1
-1@@ -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" hw/pc.h +0
-1@@ -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);
Quoted 7 lines
Quoted 5 lines
hw/pc.h static inline DeviceState *isa_vga_init(ISABus *bus) · line 199
Quoted 3 lines
hw/pc.h +0
-3-/* cirrus_vga.c */ -DeviceState *pci_cirrus_vga_init (PCIBus *bus); -This would break build, hurting future bisections. Please merge with 4/5.
Oh, got it, thanks. I will do that later.
It seems that 1/5 and 2/5 also should be merged together. -:)
Because of global usb_enabled removal, yes.
Quoted 46 lines
Quoted 33 lines
Quoted 33 lines
hw/pc.h +0
-0/* ne2000.c */ static inline bool isa_ne2000_init (ISABus *bus,int base,int irq,NICInfo *nd) {hw/vga-pci.c +1
-1@@ -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" hw/vga-pci.h new file +8
-0@@ -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); +Quoted 8 lines
Quoted 8 lines
hw/vga-pci.h new file +4
-1+/* cirrus_vga.c */ +DeviceState *pci_cirrus_vga_init (PCIBus *bus); + +#endif --1.7.7.6
--
Best Regards
-Li
PATCH v6 4/5 Cleanup pc.h on other platforms
In reply to Li ZhangThe 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
@@ -49,6 +49,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.7.6
PATCH v6 5/5 spapr: Add support for -vga option
In reply to Li ZhangAlso 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 | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-)
hw/spapr.c +30 -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,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 )) {
Signature · 1 line
1.7.7.6