Various VGA / VNC fixes and cleanups to prep for multiheaded graphics
These patches grew from a very strange process, but nonetheless they exist now. All of the initial patches are robustness / bugfixes / cleanups. The final result is that we can use multiple Cirrus VGA adapters simultaneously.
Note the last patch is a complete hack. It is not meant to be designed this way, and is included for demonstration purposes only. You will also need to know how to hack your xorg.conf file to setup multihead properly, but it does work, at least under SDL, for me. You can switch using the standard qemu ctrl-alt-1 / ctrl-alt-2 to switch between both graphic consoles.
I would attach a screenshot to demonstrate this if I could, but the patch mail program, or my skills at manipulating it are not sufficient to do that.
Not that this is very useful, but it was possible, and a consequence of what I had been working on, so I felt compelled to release it.
The next step if anyone were to be interested in multiheaded machine simulation would be to create a console.h abstraction designed to support this; it would at least require a 'display_state_init' and 'run' callback, and would need differentiation to determine whether all displays should be multiplexed on one console; or whether there should be multiple consoles supporting all displays; or whether there should be a master console with access to all monitor targets and slave displays for secondary graphics consoles.
Multiple concurrent SDL displays would require a much deeper design, with a separate process for each display, given the current state of SDL does not support multiple windows. This may or may not be possible under Cocoa, which I have access to but have not fully investigated.
This might be more useful when applied to a VNC or other remote display target. Initial attempts to get multiple simultaneous VNC displays did not work, but there is no obvious technical obstacle to the progress.
Enjoy. I was going to include a screenshot of 4 simultaneous heads on a <unspecified name> distro with a giant image of a heavily modified and ridiculously finned Honda Civic, but sorry, I don't have the patience to recompile the X server again.
Cheers,
Zach
PATCH 1/14 Add a configure switch to enable / disable all user targets. I felt compelled to do it for symmetry, mostly it is useful to disable user targets when you don't want to build them.
--- configure | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
configure +8 -0
@@ -449,6 +449,12 @@ for opt do ;; --enable-system) softmmu="yes" ;; + --disable-user) + linux_user="no" ; + bsd_user="no" ; + darwin_user="no" + ;; + --enable-user) ;; --disable-linux-user) linux_user="no" ;; --enable-linux-user) linux_user="yes"
@@ -631,6 +637,8 @@ echo " --disable-kvm disable KVM acceleration support" echo " --disable-nptl disable usermode NPTL support" echo " --enable-system enable all system emulation targets" echo " --disable-system disable all system emulation targets" +echo " --enable-user enable supported user emulation targets" +echo " --disable-user disable all user emulation targets" echo " --enable-linux-user enable all linux usermode emulation targets" echo " --disable-linux-user disable all linux usermode emulation targets" echo " --enable-darwin-user enable all darwin usermode emulation targets"
Signature · 1 line
1.6.2.5
PATCH 2/14 Don't segfault when changing VNC password on an SDL display.
--- vnc.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
vnc.c +4 -0
@@ -2160,6 +2160,10 @@ int vnc_display_password(DisplayState *ds, const char *password) {VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; +if (!vs) { +return -1 ; + } +if (vs->password) {qemu_free (vs->password); vs->password =NULL ;
Signature · 1 line
1.6.2.5
PATCH 3/14 When using stdio monitor and VNC display, one can set or clear a VNC password; this should set or turn off VNC authentication as well.
--- vnc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
vnc.c +5 -0
@@ -2171,6 +2171,11 @@ int vnc_display_password(DisplayState *ds, const char *password)if (password && password[0 ]) {if (!(vs->password =qemu_strdup (password)))return -1 ; +if (vs->auth ==VNC_AUTH_NONE ) { + vs->auth =VNC_AUTH_VNC ; + } + }else { + vs->auth =VNC_AUTH_NONE ; }return 0 ;
Signature · 1 line
1.6.2.5
PATCH 4/14 Clean up VGA type selection; far too many variables being used to track one state leads to confusion if new variables are added.
--- sysemu.h | 15 +++++++++++---- vl.c | 18 ++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-)
sysemu.h +11 -4
@@ -103,10 +103,17 @@ typedef enum DisplayType } DisplayType;extern int bios_size; -extern int cirrus_vga_enabled; -extern int std_vga_enabled; -extern int vmsvga_enabled; -extern int xenfb_enabled; + +typedef enum { +VGA_NONE ,VGA_STD ,VGA_CIRRUS ,VGA_VMWARE ,VGA_XENFB +}VGAInterfaceType ; + +extern int vga_interface_type; +#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS) +#define std_vga_enabled (vga_interface_type == VGA_STD) +#define xenfb_enabled (vga_interface_type == VGA_XENFB) +#define vmsvga_enabled (vga_interface_type == VGA_VMWARE) +extern int graphic_width;extern int graphic_height;extern int graphic_depth;
vl.c +6 -12
@@ -213,10 +213,7 @@ int vm_running;static int autostart;static int rtc_utc =1 ;static int rtc_date_offset =-1 ;/* -1 means no change */ -int cirrus_vga_enabled =1 ; -int std_vga_enabled =0 ; -int vmsvga_enabled =0 ; -int xenfb_enabled =0 ; +int vga_interface_type =VGA_CIRRUS ;#ifdef TARGET_SPARC int graphic_width =1024 ;int graphic_height =768 ;
@@ -4737,18 +4734,15 @@ static void select_vgahw (const char *p) {const char *opts; - cirrus_vga_enabled =0 ; - std_vga_enabled =0 ; - vmsvga_enabled =0 ; - xenfb_enabled =0 ; + vga_interface_type =VGA_NONE ;if (strstart (p,"std" , &opts)) { - std_vga_enabled =1 ; + vga_interface_type =VGA_STD ; }else if (strstart (p,"cirrus" , &opts)) { - cirrus_vga_enabled =1 ; + vga_interface_type =VGA_CIRRUS ; }else if (strstart (p,"vmware" , &opts)) { - vmsvga_enabled =1 ; + vga_interface_type =VGA_VMWARE ; }else if (strstart (p,"xenfb" , &opts)) { - xenfb_enabled =1 ; + vga_interface_type =VGA_XENFB ; }else if (!strstart (p,"none" , &opts)) { invalid_vga:fprintf (stderr,"Unknown vga type: %s\n" , p);
Signature · 1 line
1.6.2.5
PATCH 5/14 Change cpu_phys mem callback to use [offset, size) bounds instead of [start, end).
--- cpu-all.h | 2 +- exec.c | 4 ++-- hw/cirrus_vga.c | 11 ++++++----- hw/framebuffer.c | 2 +- hw/vga.c | 12 ++++++------ hw/vga_int.h | 2 +- kvm-all.c | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-)
cpu-all.h +1 -1
@@ -907,7 +907,7 @@ int cpu_physical_memory_set_dirty_tracking(int enable);int cpu_physical_memory_get_dirty_tracking (void );int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr); +ram_addr_t size);void dump_exec_info (FILE *f,int (*cpu_fprintf)(FILE *f,const char *fmt, ...));
exec.c +2 -2
@@ -1921,12 +1921,12 @@ int cpu_physical_memory_get_dirty_tracking(void) }int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr) +ram_addr_t size) {int ret =0 ;if (kvm_enabled ()) - ret =kvm_physical_sync_dirty_bitmap (start_addr, end_addr); + ret =kvm_physical_sync_dirty_bitmap (start_addr, size);return ret; }
hw/cirrus_vga.c +6 -5
@@ -1220,7 +1220,7 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)* on the current location, otherwise we lose this pointer forever */ if (s->vga.lfb_vram_mapped) {target_phys_addr_t base_addr = isa_mem_base +0xa0000 + bank_index *0x8000 ; -cpu_physical_sync_dirty_bitmap (base_addr, base_addr +0x8000 ); +cpu_physical_sync_dirty_bitmap (base_addr,0x8000 ); } s->cirrus_bank_base[bank_index] = offset; s->cirrus_bank_limit[bank_index] = limit;
@@ -2588,8 +2588,9 @@ static void map_linear_vram(CirrusVGAState *s) {if (!s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) { s->vga.map_addr = s->vga.lfb_addr; - s->vga.map_end = s->vga.lfb_end; -cpu_register_physical_memory (s->vga.map_addr, s->vga.map_end - s->vga.map_addr, s->vga.vram_offset); + s->vga.map_size = s->vga.lfb_end - s->vga.lfb_addr; +cpu_register_physical_memory (s->vga.map_addr, s->vga.map_size, + s->vga.vram_offset); }if (!s->vga.map_addr)
@@ -2620,7 +2621,7 @@ static void map_linear_vram(CirrusVGAState *s)static void unmap_linear_vram (CirrusVGAState *s) {if (s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) - s->vga.map_addr = s->vga.map_end =0 ; + s->vga.map_addr = s->vga.map_size =0 ;cpu_register_physical_memory (isa_mem_base +0xa0000 ,0x20000 , s->vga.vga_io_memory);
@@ -3270,7 +3271,7 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int region_num,cpu_register_physical_memory (addr +0x1000000 ,0x400000 , s->cirrus_linear_bitblt_io_addr); - s->vga.map_addr = s->vga.map_end =0 ; + s->vga.map_addr = s->vga.map_size =0 ; s->vga.lfb_addr = addr &TARGET_PAGE_MASK ; s->vga.lfb_end = ((addr +VGA_RAM_SIZE ) +TARGET_PAGE_SIZE -1 ) &TARGET_PAGE_MASK ;/* account for overflow */
hw/framebuffer.c +1 -1
@@ -49,7 +49,7 @@ void framebuffer_update_display( *first_row =-1 ; src_len = src_width * rows; -cpu_physical_sync_dirty_bitmap (base, base + src_len); +cpu_physical_sync_dirty_bitmap (base, src_len); pd =cpu_get_physical_page_desc (base); pd2 =cpu_get_physical_page_desc (base + src_len -1 );/* We should reall check that this is a continuous ram region.
hw/vga.c +6 -6
@@ -1571,11 +1571,11 @@ void vga_invalidate_scanlines(VGAState *s, int y1, int y2)static void vga_sync_dirty_bitmap (VGAState *s) {if (s->map_addr) -cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_end); +cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_size);if (s->lfb_vram_mapped) { -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa0000 ,0xa8000 ); -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa8000 ,0xb0000 ); +cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa0000 ,0x8000 ); +cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa8000 ,0x8000 ); } }
@@ -1878,7 +1878,7 @@ void vga_reset(void *opaque) s->lfb_addr =0 ; s->lfb_end =0 ; s->map_addr =0 ; - s->map_end =0 ; + s->map_size =0 ; s->lfb_vram_mapped =0 ; s->bios_offset =0 ; s->bios_size =0 ;
@@ -2227,7 +2227,7 @@ typedef struct PCIVGAState {void vga_dirty_log_start (VGAState *s) {if (kvm_enabled () && s->map_addr) -kvm_log_start (s->map_addr, s->map_end - s->map_addr); +kvm_log_start (s->map_addr, s->map_size);if (kvm_enabled () && s->lfb_vram_mapped) {kvm_log_start (isa_mem_base +0xa0000 ,0x8000 );
@@ -2245,7 +2245,7 @@ static void vga_map(PCIDevice *pci_dev, int region_num, }else {cpu_register_physical_memory (addr, s->vram_size, s->vram_offset); s->map_addr = addr; - s->map_end = addr + s->vram_size; + s->map_size = s->vram_size;vga_dirty_log_start (s); } }
hw/vga_int.h +1 -1
@@ -105,7 +105,7 @@ typedef struct VGACommonState {uint32_t lfb_addr;uint32_t lfb_end;uint32_t map_addr; -uint32_t map_end; +uint32_t map_size;uint32_t lfb_vram_mapped;/* whether 0xa0000 is mapped as ram */ unsigned long bios_offset;unsigned int bios_size;
kvm-all.c +2 -2
@@ -294,11 +294,11 @@ int kvm_set_migration_log(int enable)* @end_addr: end of logged region. */ int kvm_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr) +ram_addr_t dirty_size) {KVMState *s = kvm_state;unsigned long size, allocated_size =0 ; -target_phys_addr_t phys_addr; +target_phys_addr_t phys_addr, end_addr = start_addr + dirty_size;ram_addr_t addr;KVMDirtyLog d;KVMSlot *mem;
Signature · 1 line
1.6.2.5
PATCH 6/14 Split VGA ioport init into a helper function.
--- hw/vga.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-)
hw/vga.c +14 -8
@@ -2301,14 +2301,8 @@ void vga_common_init(VGAState *s, int vga_ram_size)vga_reset (s); } -/* used by both ISA and PCI */ -void vga_init (VGAState *s) +static void vga_ioport_init (VGAState *s) { -int vga_io_memory; - -qemu_register_reset (vga_reset,0 , s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); -register_ioport_write (0x3c0 ,16 ,1 , vga_ioport_write, s);register_ioport_write (0x3b4 ,2 ,1 , vga_ioport_write, s);
@@ -2322,7 +2316,6 @@ void vga_init(VGAState *s)register_ioport_read (0x3d4 ,2 ,1 , vga_ioport_read, s);register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s);register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); - s->bank_offset =0 ;#ifdef CONFIG_BOCHS_VBE #if defined (TARGET_I386 )
@@ -2346,6 +2339,19 @@ void vga_init(VGAState *s)register_ioport_write (0x1d0 ,1 ,2 , vbe_ioport_write_data, s);#endif #endif /* CONFIG_BOCHS_VBE */ +} + +/* used by both ISA and PCI */ +void vga_init (VGAState *s) +{ +int vga_io_memory; + +qemu_register_reset (vga_reset,0 , s); +register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); + + s->bank_offset =0 ; + +vga_ioport_init (s); vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
Signature · 1 line
1.6.2.5
PATCH 7/14 Code motion; make mm VGA init function more like standard vga init function. Add missing vga_reset hook to vga_mm_init.
--- hw/vga.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
hw/vga.c +6 -3
@@ -2422,14 +2422,17 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, {int s_ioport_ctrl, vga_io_memory; +qemu_register_reset (vga_reset,0 , s); +register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); + + s->bank_offset =0 ; + s->it_shift = it_shift; s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s); - vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); + vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s);cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); - s->bank_offset =0 ;cpu_register_physical_memory (vram_base +0x000a0000 ,0x20000 , vga_io_memory);qemu_register_coalesced_mmio (vram_base +0x000a0000 ,0x20000 ); }
Signature · 1 line
1.6.2.5
PATCH 8/14 Make VGA vram offset passed into vga_mm_init absolute. Since this is a function of the platform, it makes sense to have it be explicitly known in the platform layer rather than hardcoded inside the vga code.
--- hw/mips_jazz.c | 2 +- hw/vga.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/mips_jazz.c +1 -1
@@ -200,7 +200,7 @@ void mips_jazz_init (ram_addr_t ram_size,g364fb_mm_init (0x40000000 ,0x60000000 ,0 , rc4030[3 ]);break ;case JAZZ_PICA61 : -isa_vga_mm_init (0x40000000 ,0x60000000 ,0 ); +isa_vga_mm_init (0x400a0000 ,0x60000000 ,0 );break ;default :break ;
hw/vga.c +2 -2
@@ -2433,8 +2433,8 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s);cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); -cpu_register_physical_memory (vram_base +0x000a0000 ,0x20000 , vga_io_memory); -qemu_register_coalesced_mmio (vram_base +0x000a0000 ,0x20000 ); +cpu_register_physical_memory (vram_base,0x20000 , vga_io_memory); +qemu_register_coalesced_mmio (vram_base,0x20000 ); }int isa_vga_init (void )
Signature · 1 line
1.6.2.5
PATCH 9/14 Further transformation: use common vga_init() which allows either I/O port or memory mapped based control.
--- hw/vga.c | 40 +++++++++++++--------------------------- hw/vga_int.h | 3 ++- hw/vmware_vga.c | 2 +- 3 files changed, 16 insertions(+), 29 deletions(-)
hw/vga.c +13 -27
@@ -2341,24 +2341,6 @@ static void vga_ioport_init(VGAState *s)#endif /* CONFIG_BOCHS_VBE */ } -/* used by both ISA and PCI */ -void vga_init (VGAState *s) -{ -int vga_io_memory; - -qemu_register_reset (vga_reset,0 , s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); - - s->bank_offset =0 ; - -vga_ioport_init (s); - - vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); -cpu_register_physical_memory (isa_mem_base +0x000a0000 ,0x20000 , - vga_io_memory); -qemu_register_coalesced_mmio (isa_mem_base +0x000a0000 ,0x20000 ); -} -/* Memory mapped interface */ static uint32_t vga_mm_readb (void *opaque,target_phys_addr_t addr) {
@@ -2417,8 +2399,8 @@ static CPUWriteMemoryFunc *vga_mm_write_ctrl[] = { &vga_mm_writel, }; -static void vga_mm_init (VGAState *s,target_phys_addr_t vram_base, -target_phys_addr_t ctrl_base,int it_shift) +void vga_init (VGAState *s,target_phys_addr_t vram_base, +target_phys_addr_t ctrl_base,int it_shift) {int s_ioport_ctrl, vga_io_memory;
@@ -2426,13 +2408,17 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base,register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); s->bank_offset =0 ; - s->it_shift = it_shift; - s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s); - vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); +/* Pass ctrl_base to setup memory mapped I/O control */ +if (ctrl_base) { + s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s); +cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); + }else { +vga_ioport_init (s); + } -cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); + vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s);cpu_register_physical_memory (vram_base,0x20000 , vga_io_memory);qemu_register_coalesced_mmio (vram_base,0x20000 ); }
@@ -2444,7 +2430,7 @@ int isa_vga_init(void) s =qemu_mallocz (sizeof (VGAState));vga_common_init (s,VGA_RAM_SIZE ); -vga_init (s); +vga_init (s, isa_mem_base +0xa0000 ,0 ,-1 ); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
@@ -2465,7 +2451,7 @@ int isa_vga_mm_init(target_phys_addr_t vram_base, s =qemu_mallocz (sizeof (VGAState));vga_common_init (s,VGA_RAM_SIZE ); -vga_mm_init (s, vram_base, ctrl_base, it_shift); +vga_init (s, vram_base, ctrl_base, it_shift); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
@@ -2504,7 +2490,7 @@ int pci_vga_init(PCIBus *bus, s = &d->vga_state;vga_common_init (s,VGA_RAM_SIZE ); -vga_init (s); +vga_init (s, isa_mem_base +0xa0000 ,0 ,-1 ); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
hw/vga_int.h +2 -1
@@ -190,7 +190,8 @@ static inline int c6_to_8(int v) }void vga_common_init (VGAState *s,int vga_ram_size); -void vga_init (VGAState *s); +void vga_init (VGAState *s,target_phys_addr_t vram_base, +target_phys_addr_t ctrl_base,int it_shift);void vga_reset (void *s);void vga_dirty_log_start (VGAState *s);
hw/vmware_vga.c +1 -1
@@ -1130,7 +1130,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)#ifdef EMBED_STDVGA vga_common_init ((VGAState *) s, vga_ram_size); -vga_init ((VGAState *) s); +vga_init ((VGAState *) s, isa_mem_base +0xa0000 ,0 ,-1 );#else s->vram_size = vga_ram_size; s->vram_offset =qemu_ram_alloc (vga_ram_size);
Signature · 1 line
1.6.2.5
PATCH 10/14 Stash VGA physical address and use it in KVM callbacks. Stash VGA physical pointer in cirrus vga as well.
--- hw/cirrus_vga.c | 18 ++++++++---------- hw/vga.c | 9 +++++---- hw/vga_int.h | 1 + 3 files changed, 14 insertions(+), 14 deletions(-)
hw/cirrus_vga.c +8 -10
@@ -1219,7 +1219,7 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)/* Thinking about changing bank base? First, drop the dirty bitmap information * on the current location, otherwise we lose this pointer forever */ if (s->vga.lfb_vram_mapped) { -target_phys_addr_t base_addr = isa_mem_base +0xa0000 + bank_index *0x8000 ; +target_phys_addr_t base_addr = s->vga.vram_phys + bank_index *0x8000 ;cpu_physical_sync_dirty_bitmap (base_addr,0x8000 ); } s->cirrus_bank_base[bank_index] = offset;
@@ -2603,16 +2603,15 @@ static void map_linear_vram(CirrusVGAState *s) && !((s->vga.gr[0x0B] & 0x14) == 0x14) && !(s->vga.gr[0x0B] & 0x02)) { -cpu_register_physical_memory (isa_mem_base +0xa0000 ,0x8000 , +cpu_register_physical_memory (s->vga.vram_phys,0x8000 , (s->vga.vram_offset + s->cirrus_bank_base[0 ]) |IO_MEM_RAM ); -cpu_register_physical_memory (isa_mem_base +0xa8000 ,0x8000 , +cpu_register_physical_memory (s->vga.vram_phys +0x8000 ,0x8000 , (s->vga.vram_offset + s->cirrus_bank_base[1 ]) |IO_MEM_RAM ); s->vga.lfb_vram_mapped =1 ; } else { -cpu_register_physical_memory (isa_mem_base +0xa0000 ,0x20000 , - s->vga.vga_io_memory); +cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); }vga_dirty_log_start (&s->vga);
@@ -2623,8 +2622,7 @@ static void unmap_linear_vram(CirrusVGAState *s)if (s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) s->vga.map_addr = s->vga.map_size =0 ; -cpu_register_physical_memory (isa_mem_base +0xa0000 ,0x20000 , - s->vga.vga_io_memory); +cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); }/* Compute the memory access functions */
@@ -3197,11 +3195,11 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s);register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); + s->vga.vram_phys = isa_mem_base +0xa0000 ; s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, cirrus_vga_mem_write, s); -cpu_register_physical_memory (isa_mem_base +0x000a0000 ,0x20000 , - s->vga.vga_io_memory); -qemu_register_coalesced_mmio (isa_mem_base +0x000a0000 ,0x20000 ); +cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); +qemu_register_coalesced_mmio (s->vga.vram_phys,0x20000 );/* I/O handler for LFB */ s->cirrus_linear_io_addr =
hw/vga.c +5 -4
@@ -1574,8 +1574,8 @@ static void vga_sync_dirty_bitmap(VGAState *s)cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_size);if (s->lfb_vram_mapped) { -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa0000 ,0x8000 ); -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa8000 ,0x8000 ); +cpu_physical_sync_dirty_bitmap (s->vram_phys,0x8000 ); +cpu_physical_sync_dirty_bitmap (s->vram_phys +0x8000 ,0x8000 ); } }
@@ -2230,8 +2230,8 @@ void vga_dirty_log_start(VGAState *s)kvm_log_start (s->map_addr, s->map_size);if (kvm_enabled () && s->lfb_vram_mapped) { -kvm_log_start (isa_mem_base +0xa0000 ,0x8000 ); -kvm_log_start (isa_mem_base +0xa8000 ,0x8000 ); +kvm_log_start (s->vram_phys,0x8000 ); +kvm_log_start (s->vram_phys +0x8000 ,0x8000 ); } }
@@ -2409,6 +2409,7 @@ void vga_init(VGAState *s, target_phys_addr_t vram_base, s->bank_offset =0 ; s->it_shift = it_shift; + s->vram_phys = vram_base;/* Pass ctrl_base to setup memory mapped I/O control */ if (ctrl_base) {
hw/vga_int.h +1 -0
@@ -102,6 +102,7 @@ typedef struct VGACommonState {uint8_t *vram_ptr;ram_addr_t vram_offset;unsigned int vram_size; +target_phys_addr_t vram_phys;uint32_t lfb_addr;uint32_t lfb_end;uint32_t map_addr;
Signature · 1 line
1.6.2.5
PATCH 11/14 Add some defined constants for VGA offsets.
--- hw/cirrus_vga.c | 14 +++++++------- hw/vga.c | 12 ++++++------ hw/vga_int.h | 4 ++++ hw/vmware_vga.c | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-)
hw/cirrus_vga.c +7 -7
@@ -2002,7 +2002,7 @@ static uint32_t cirrus_vga_mem_readb(void *opaque, target_phys_addr_t addr)return vga_mem_readb (s, addr); } - addr &=0x1ffff ; + addr &=VGA_VRAM_MASK ;if (addr <0x10000 ) {/* XXX handle bitblt */
@@ -2078,7 +2078,7 @@ static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr,return ; } - addr &=0x1ffff ; + addr &=VGA_VRAM_MASK ;if (addr <0x10000 ) {if (s->cirrus_srcptr != s->cirrus_srcptr_end) {
@@ -2611,7 +2611,7 @@ static void map_linear_vram(CirrusVGAState *s) s->vga.lfb_vram_mapped =1 ; }else { -cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); +cpu_register_physical_memory (s->vga.vram_phys,VGA_VRAM_SIZE , s->vga.vga_io_memory); }vga_dirty_log_start (&s->vga);
@@ -2622,7 +2622,7 @@ static void unmap_linear_vram(CirrusVGAState *s)if (s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) s->vga.map_addr = s->vga.map_size =0 ; -cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); +cpu_register_physical_memory (s->vga.vram_phys,VGA_VRAM_SIZE , s->vga.vga_io_memory); }/* Compute the memory access functions */
@@ -3195,11 +3195,11 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s);register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); - s->vga.vram_phys = isa_mem_base +0xa0000 ; + s->vga.vram_phys = isa_mem_base +VGA_ISA_ADDRESS ; s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, cirrus_vga_mem_write, s); -cpu_register_physical_memory (s->vga.vram_phys,0x20000 , s->vga.vga_io_memory); -qemu_register_coalesced_mmio (s->vga.vram_phys,0x20000 ); +cpu_register_physical_memory (s->vga.vram_phys,VGA_VRAM_SIZE , s->vga.vga_io_memory); +qemu_register_coalesced_mmio (s->vga.vram_phys,VGA_VRAM_SIZE );/* I/O handler for LFB */ s->cirrus_linear_io_addr =
hw/vga.c +6 -6
@@ -713,7 +713,7 @@ uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr)/* convert to VGA memory offset */ memory_map_mode = (s->gr[6 ] >>2 ) &3 ; - addr &=0x1ffff ; + addr &=VGA_VRAM_MASK ;switch (memory_map_mode) {case 0 :break ;
@@ -803,7 +803,7 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)#endif /* convert to VGA memory offset */ memory_map_mode = (s->gr[6 ] >>2 ) &3 ; - addr &=0x1ffff ; + addr &=VGA_VRAM_MASK ;switch (memory_map_mode) {case 0 :break ;
@@ -2420,8 +2420,8 @@ void vga_init(VGAState *s, target_phys_addr_t vram_base, } vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); -cpu_register_physical_memory (vram_base,0x20000 , vga_io_memory); -qemu_register_coalesced_mmio (vram_base,0x20000 ); +cpu_register_physical_memory (vram_base,VGA_VRAM_SIZE , vga_io_memory); +qemu_register_coalesced_mmio (vram_base,VGA_VRAM_SIZE ); }int isa_vga_init (void )
@@ -2431,7 +2431,7 @@ int isa_vga_init(void) s =qemu_mallocz (sizeof (VGAState));vga_common_init (s,VGA_RAM_SIZE ); -vga_init (s, isa_mem_base +0xa0000 ,0 ,-1 ); +vga_init (s, isa_mem_base +VGA_ISA_ADDRESS ,0 ,-1 ); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
@@ -2491,7 +2491,7 @@ int pci_vga_init(PCIBus *bus, s = &d->vga_state;vga_common_init (s,VGA_RAM_SIZE ); -vga_init (s, isa_mem_base +0xa0000 ,0 ,-1 ); +vga_init (s, isa_mem_base +VGA_ISA_ADDRESS ,0 ,-1 ); s->ds =graphic_console_init (s->update, s->invalidate, s->screen_dump, s->text_update, s);
hw/vga_int.h +4 -0
@@ -79,6 +79,10 @@#define CH_ATTR_SIZE (160 * 100)#define VGA_MAX_HEIGHT 2048 +#define VGA_ISA_ADDRESS 0xa0000 +#define VGA_VRAM_SIZE 0x20000 +#define VGA_VRAM_MASK 0x1ffff +struct vga_precise_retrace {int64_t ticks_per_char;int64_t total_chars;
hw/vmware_vga.c +1 -1
@@ -1130,7 +1130,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)#ifdef EMBED_STDVGA vga_common_init ((VGAState *) s, vga_ram_size); -vga_init ((VGAState *) s, isa_mem_base +0xa0000 ,0 ,-1 ); +vga_init ((VGAState *) s, isa_mem_base +VGA_ISA_ADDRESS ,0 ,-1 );#else s->vram_size = vga_ram_size; s->vram_offset =qemu_ram_alloc (vga_ram_size);
Signature · 1 line
1.6.2.5
PATCH 12/14 Add a PCI BAR for the VGA ROM which is mapped into cirrus_vga. This makes the cirrus device complete under some X servers which require the V_BIOS mapping.
--- hw/cirrus_vga.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
hw/cirrus_vga.c +8 -1
@@ -3288,6 +3288,12 @@ static void cirrus_pci_mmio_map(PCIDevice *d, int region_num, s->cirrus_mmio_io_addr); } +static void cirrus_pci_rom_map (PCIDevice *d,int region_num, +uint32_t addr,uint32_t size,int type) +{ +cpu_register_physical_memory (addr,0x10000 ,0xc0000 |IO_MEM_ROM ); +} +static void pci_cirrus_write_config (PCIDevice *d,uint32_t address,uint32_t val,int len) {
@@ -3341,5 +3347,6 @@ void pci_cirrus_vga_init(PCIBus *bus)pci_register_bar ((PCIDevice *)d,1 ,CIRRUS_PNPMMIO_SIZE ,PCI_ADDRESS_SPACE_MEM , cirrus_pci_mmio_map); } -/* XXX: ROM BIOS */ +pci_register_bar ((PCIDevice *)d,PCI_ROM_SLOT ,0x10000 , +PCI_ADDRESS_SPACE_MEM , cirrus_pci_rom_map); }
Signature · 1 line
1.6.2.5
PATCH 13/14 Allow cirrus VGA to be initialized multiple times; only the first init takes the ISA memory region and hardware I/O ports.
--- hw/cirrus_vga.c | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-)
hw/cirrus_vga.c +21 -16
@@ -3153,6 +3153,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) {int i;static int inited; +static int idx =0 ;if (!inited) { inited =1 ;
@@ -3181,25 +3182,28 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) s->bustype =CIRRUS_BUSTYPE_ISA ; } -register_ioport_write (0x3c0 ,16 ,1 , vga_ioport_write, s); +if (idx ==0 ) { +register_ioport_write (0x3c0 ,16 ,1 , vga_ioport_write, s); -register_ioport_write (0x3b4 ,2 ,1 , vga_ioport_write, s); -register_ioport_write (0x3d4 ,2 ,1 , vga_ioport_write, s); -register_ioport_write (0x3ba ,1 ,1 , vga_ioport_write, s); -register_ioport_write (0x3da ,1 ,1 , vga_ioport_write, s); +register_ioport_write (0x3b4 ,2 ,1 , vga_ioport_write, s); +register_ioport_write (0x3d4 ,2 ,1 , vga_ioport_write, s); +register_ioport_write (0x3ba ,1 ,1 , vga_ioport_write, s); +register_ioport_write (0x3da ,1 ,1 , vga_ioport_write, s); -register_ioport_read (0x3c0 ,16 ,1 , vga_ioport_read, s); +register_ioport_read (0x3c0 ,16 ,1 , vga_ioport_read, s); -register_ioport_read (0x3b4 ,2 ,1 , vga_ioport_read, s); -register_ioport_read (0x3d4 ,2 ,1 , vga_ioport_read, s); -register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s); -register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); +register_ioport_read (0x3b4 ,2 ,1 , vga_ioport_read, s); +register_ioport_read (0x3d4 ,2 ,1 , vga_ioport_read, s); +register_ioport_read (0x3ba ,1 ,1 , vga_ioport_read, s); +register_ioport_read (0x3da ,1 ,1 , vga_ioport_read, s); + s->vga.vram_phys = isa_mem_base +VGA_ISA_ADDRESS ; - s->vga.vram_phys = isa_mem_base +VGA_ISA_ADDRESS ; - s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, - cirrus_vga_mem_write, s); -cpu_register_physical_memory (s->vga.vram_phys,VGA_VRAM_SIZE , s->vga.vga_io_memory); -qemu_register_coalesced_mmio (s->vga.vram_phys,VGA_VRAM_SIZE ); + s->vga.vga_io_memory =cpu_register_io_memory (cirrus_vga_mem_read, + cirrus_vga_mem_write, s); +cpu_register_physical_memory (s->vga.vram_phys,VGA_VRAM_SIZE , + s->vga.vga_io_memory); +qemu_register_coalesced_mmio (s->vga.vram_phys,VGA_VRAM_SIZE ); + }/* I/O handler for LFB */ s->cirrus_linear_io_addr =
@@ -3229,7 +3233,8 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)qemu_register_reset (cirrus_reset,0 , s);cirrus_reset (s); -register_savevm ("cirrus_vga" ,0 ,2 , cirrus_vga_save, cirrus_vga_load, s); +register_savevm ("cirrus_vga" , idx,2 , cirrus_vga_save, cirrus_vga_load, s); + idx++; }/***************************************
Signature · 1 line
1.6.2.5
PATCH 14/14 Atrocious and horrendous patch to demonstrate multiple SDL displays. The multiple SDL displays can be seen on one console, using ctrl-alt-1/2 to switch between them.
I will not sign off this patch as it should not be committed! This is purely for demonstration. The proper way to do this is a more refined console interface, and a separation of the notion of display creation and 'running' of the display window interface.
--- hw/pc.c | 1 + vl.c | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
hw/pc.c +1 -0
@@ -1018,6 +1018,7 @@ static void pc_init1(ram_addr_t ram_size,if (cirrus_vga_enabled) {if (pci_enabled) {pci_cirrus_vga_init (pci_bus); +pci_cirrus_vga_init (pci_bus); }else {isa_cirrus_vga_init (); }
vl.c +3 -0
@@ -6103,6 +6103,7 @@ int main(int argc, char **argv, char **envp)#if defined(CONFIG_SDL )case DT_SDL :sdl_display_init (ds, full_screen, no_frame); +sdl_display_init (ds->next, full_screen, no_frame);break ;#elif defined(CONFIG_COCOA )case DT_SDL :
@@ -6111,8 +6112,10 @@ int main(int argc, char **argv, char **envp)#endif case DT_VNC :vnc_display_init (ds); +vnc_display_init (ds->next);if (vnc_display_open (ds, vnc_display) <0 )exit (1 ); +if (vnc_display_open (ds->next, vnc_display) <0 )if (show_vnc_port) {printf ("VNC server running on `%s'\n" ,vnc_display_local_addr (ds));
Signature · 1 line
1.6.2.5
[Qemu-devel] Re: [PATCH 07/14] Code motion; make mm VGA init function more like standard vga init function. Add missing vga_reset hook to vga_mm_init.
In reply to Zachary AmsdenQuoted 10 lines · Zachary Amsden
Signed-off-by Zachary Amsden <[email protected]>--- hw/vga.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)hw/vga.c +0
-0
hw/vga.c static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, · line 2425
Quoted 4 lines
hw/vga.c +1
-0@@ -2422,14 +2422,17 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, {int s_ioport_ctrl, vga_io_memory; +qemu_register_reset (vga_reset,0 , s);
vga users like cirrus or vmware invoke reset too. You probably want to drop those calls now. And did you check that vga_reset is still always invoked before any vga user reset callback?
Quoted 6 lines
hw/vga.c +4
-0+register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); + + s->bank_offset =0 ; + s->it_shift = it_shift; s_ioport_ctrl =cpu_register_io_memory (vga_mm_read_ctrl, vga_mm_write_ctrl, s);
hw/vga.c static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base, · line 2438
Quoted 10 lines
hw/vga.c +1
-3- vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s); -register_savevm ("vga" ,0 ,2 , vga_save, vga_load, s); + vga_io_memory =cpu_register_io_memory (vga_mem_read, vga_mem_write, s);cpu_register_physical_memory (ctrl_base,0x100000 , s_ioport_ctrl); - s->bank_offset =0 ;cpu_register_physical_memory (vram_base +0x000a0000 ,0x20000 , vga_io_memory);qemu_register_coalesced_mmio (vram_base +0x000a0000 ,0x20000 ); }
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
[Qemu-devel] Re: [PATCH 05/14] Change cpu_phys mem callback to use [offset, size) bounds instead of [start, end).
In reply to Zachary AmsdenQuoted 163 lines · Zachary Amsden
Signed-off-by Zachary Amsden <[email protected]>--- cpu-all.h | 2 +- exec.c | 4 ++-- hw/cirrus_vga.c | 11 ++++++----- hw/framebuffer.c | 2 +- hw/vga.c | 12 ++++++------ hw/vga_int.h | 2 +- kvm-all.c | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-)cpu-all.h +1
-1@@ -907,7 +907,7 @@ int cpu_physical_memory_set_dirty_tracking(int enable);int cpu_physical_memory_get_dirty_tracking (void );int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr); +ram_addr_t size);void dump_exec_info (FILE *f,int (*cpu_fprintf)(FILE *f,const char *fmt, ...));exec.c +2
-2@@ -1921,12 +1921,12 @@ int cpu_physical_memory_get_dirty_tracking(void) }int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr) +ram_addr_t size) {int ret =0 ;if (kvm_enabled ()) - ret =kvm_physical_sync_dirty_bitmap (start_addr, end_addr); + ret =kvm_physical_sync_dirty_bitmap (start_addr, size);return ret; }hw/cirrus_vga.c +6
-5@@ -1220,7 +1220,7 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)* on the current location, otherwise we lose this pointer forever */ if (s->vga.lfb_vram_mapped) {target_phys_addr_t base_addr = isa_mem_base +0xa0000 + bank_index *0x8000 ; -cpu_physical_sync_dirty_bitmap (base_addr, base_addr +0x8000 ); +cpu_physical_sync_dirty_bitmap (base_addr,0x8000 ); } s->cirrus_bank_base[bank_index] = offset; s->cirrus_bank_limit[bank_index] = limit;@@ -2588,8 +2588,9 @@ static void map_linear_vram(CirrusVGAState *s) {if (!s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) { s->vga.map_addr = s->vga.lfb_addr; - s->vga.map_end = s->vga.lfb_end; -cpu_register_physical_memory (s->vga.map_addr, s->vga.map_end - s->vga.map_addr, s->vga.vram_offset); + s->vga.map_size = s->vga.lfb_end - s->vga.lfb_addr; +cpu_register_physical_memory (s->vga.map_addr, s->vga.map_size, + s->vga.vram_offset); }if (!s->vga.map_addr)@@ -2620,7 +2621,7 @@ static void map_linear_vram(CirrusVGAState *s)static void unmap_linear_vram (CirrusVGAState *s) {if (s->vga.map_addr && s->vga.lfb_addr && s->vga.lfb_end) - s->vga.map_addr = s->vga.map_end =0 ; + s->vga.map_addr = s->vga.map_size =0 ;cpu_register_physical_memory (isa_mem_base +0xa0000 ,0x20000 , s->vga.vga_io_memory);@@ -3270,7 +3271,7 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int region_num,cpu_register_physical_memory (addr +0x1000000 ,0x400000 , s->cirrus_linear_bitblt_io_addr); - s->vga.map_addr = s->vga.map_end =0 ; + s->vga.map_addr = s->vga.map_size =0 ; s->vga.lfb_addr = addr &TARGET_PAGE_MASK ; s->vga.lfb_end = ((addr +VGA_RAM_SIZE ) +TARGET_PAGE_SIZE -1 ) &TARGET_PAGE_MASK ;/* account for overflow */ hw/framebuffer.c +1
-1@@ -49,7 +49,7 @@ void framebuffer_update_display( *first_row =-1 ; src_len = src_width * rows; -cpu_physical_sync_dirty_bitmap (base, base + src_len); +cpu_physical_sync_dirty_bitmap (base, src_len); pd =cpu_get_physical_page_desc (base); pd2 =cpu_get_physical_page_desc (base + src_len -1 );/* We should reall check that this is a continuous ram region. hw/vga.c +6
-6@@ -1571,11 +1571,11 @@ void vga_invalidate_scanlines(VGAState *s, int y1, int y2)static void vga_sync_dirty_bitmap (VGAState *s) {if (s->map_addr) -cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_end); +cpu_physical_sync_dirty_bitmap (s->map_addr, s->map_size);if (s->lfb_vram_mapped) { -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa0000 ,0xa8000 ); -cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa8000 ,0xb0000 ); +cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa0000 ,0x8000 ); +cpu_physical_sync_dirty_bitmap (isa_mem_base +0xa8000 ,0x8000 ); } }@@ -1878,7 +1878,7 @@ void vga_reset(void *opaque) s->lfb_addr =0 ; s->lfb_end =0 ; s->map_addr =0 ; - s->map_end =0 ; + s->map_size =0 ; s->lfb_vram_mapped =0 ; s->bios_offset =0 ; s->bios_size =0 ;@@ -2227,7 +2227,7 @@ typedef struct PCIVGAState {void vga_dirty_log_start (VGAState *s) {if (kvm_enabled () && s->map_addr) -kvm_log_start (s->map_addr, s->map_end - s->map_addr); +kvm_log_start (s->map_addr, s->map_size);if (kvm_enabled () && s->lfb_vram_mapped) {kvm_log_start (isa_mem_base +0xa0000 ,0x8000 );@@ -2245,7 +2245,7 @@ static void vga_map(PCIDevice *pci_dev, int region_num, }else {cpu_register_physical_memory (addr, s->vram_size, s->vram_offset); s->map_addr = addr; - s->map_end = addr + s->vram_size; + s->map_size = s->vram_size;vga_dirty_log_start (s); } }hw/vga_int.h +1
-1@@ -105,7 +105,7 @@ typedef struct VGACommonState {uint32_t lfb_addr;uint32_t lfb_end;uint32_t map_addr; -uint32_t map_end; +uint32_t map_size;uint32_t lfb_vram_mapped;/* whether 0xa0000 is mapped as ram */ unsigned long bios_offset;unsigned int bios_size;kvm-all.c +0
-0
kvm-all.c int kvm_set_migration_log(int enable) · line 301
Quoted 10 lines
kvm-all.c +2
-2@@ -294,11 +294,11 @@ int kvm_set_migration_log(int enable)* @end_addr: end of logged region. */ int kvm_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr) +ram_addr_t dirty_size) {KVMState *s = kvm_state;unsigned long size, allocated_size =0 ; -target_phys_addr_t phys_addr; +target_phys_addr_t phys_addr, end_addr = start_addr + dirty_size;
I personally prefer adding a separate line for this. But that's a matter of taste I guess.
kvm-all.c int kvm_set_migration_log(int enable) · line 304
Quoted 3 lines
kvm-all.c +0
-0ram_addr_t addr;KVMDirtyLog d;KVMSlot *mem;
Otherwise, no concerns.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH 05/14] Change cpu_phys mem callback to use [offset, size) bounds instead of [start, end).
In reply to Zachary AmsdenQuoted 29 lines · Zachary Amsden
Signed-off-by Zachary Amsden <[email protected]>--- cpu-all.h | 2 +- exec.c | 4 ++-- hw/cirrus_vga.c | 11 ++++++----- hw/framebuffer.c | 2 +- hw/vga.c | 12 ++++++------ hw/vga_int.h | 2 +- kvm-all.c | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-)cpu-all.h +1
-1@@ -907,7 +907,7 @@ int cpu_physical_memory_set_dirty_tracking(int enable);int cpu_physical_memory_get_dirty_tracking (void );int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr); +ram_addr_t size);void dump_exec_info (FILE *f,int (*cpu_fprintf)(FILE *f,const char *fmt, ...));exec.c +0
-0
exec.c int cpu_physical_memory_get_dirty_tracking(void) · line 1925
Quoted 6 lines
exec.c +1
-1@@ -1921,12 +1921,12 @@ int cpu_physical_memory_get_dirty_tracking(void) }int cpu_physical_sync_dirty_bitmap (target_phys_addr_t start_addr, -target_phys_addr_t end_addr) +ram_addr_t size)
This breaks the build for i386-softmmu as ram_addr_t is a uint32_t there. In vl.c, there's
static int ram_save_live(QEMUFile *f, int stage, void *opaque) {
ram_addr_t addr;
uint64_t bytes_transferred_last;
double bwidth = 0;
uint64_t expected_time = 0;
if (cpu_physical_sync_dirty_bitmap(0, TARGET_PHYS_ADDR_MAX) != 0) {And you get a large integer truncation error.
Regards,
Anthony Liguori
Quoted 24 lines · Zachary Amsden
These patches grew from a very strange process, but nonetheless they exist now. All of the initial patches are robustness / bugfixes / cleanups. The final result is that we can use multiple Cirrus VGA adapters simultaneously.
Note the last patch is a complete hack. It is not meant to be designed this way, and is included for demonstration purposes only. You will also need to know how to hack your xorg.conf file to setup multihead properly, but it does work, at least under SDL, for me. You can switch using the standard qemu ctrl-alt-1 / ctrl-alt-2 to switch between both graphic consoles.
I would attach a screenshot to demonstrate this if I could, but the patch mail program, or my skills at manipulating it are not sufficient to do that.
Not that this is very useful, but it was possible, and a consequence of what I had been working on, so I felt compelled to release it.
The next step if anyone were to be interested in multiheaded machine simulation would be to create a
console.habstraction designed to support this; it would at least require a 'display_state_init' and 'run' callback, and would need differentiation to determine whether all displays should be multiplexed on one console; or whether there should be multiple consoles supporting all displays; or whether there should be a master console with access to all monitor targets and slave displays for secondary graphics consoles.
Quoted 8 lines
Multiple concurrent SDL displays would require a much deeper design, with a separate process for each display, given the current state of SDL does not support multiple windows. This may or may not be possible under Cocoa, which I have access to but have not fully investigated.
This might be more useful when applied to a VNC or other remote display target. Initial attempts to get multiple simultaneous VNC displays did not work, but there is no obvious technical obstacle to the progress.
For VNC, there is an documented extension which allows for intelligent client side handling of multiple displays. Essentially the server VNC framebuffer represents the combined real estate of all displays (this lets dumb VNC clients work), and the "ExtendedDesktopSize" extension allows intelligent clients to query what regions within the framebuffer correspond to each display. So it would be useful to implement this in QEMU if we're to allow multiple VGA adapters.
http://tigervnc.sourceforge.net/cgi-bin/rfbproto#extendeddesktopsize-pseudo-encoding
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 7 lines · Daniel P. Berrange
For VNC, there is an documented extension which allows for intelligent client side handling of multiple displays. Essentially the server VNC framebuffer represents the combined real estate of all displays (this lets dumb VNC clients work), and the "ExtendedDesktopSize" extension allows intelligent clients to query what regions within the framebuffer correspond to each display. So it would be useful to implement this in QEMU if we're to allow multiple VGA adapters.
This is true, but in this context, is it useful? If one wants multiple displays, one can easily double the height or width of the virtual display and run nested servers inside of them.
I think, perhaps, the more useful thing is to allow multiple remote clients to connect to individual displays... which this patchset has not quite achieved, but proved at least plausible.
Zach
Quoted 9 lines · Zachary Amsden
Quoted 7 lines · Daniel P. Berrange
For VNC, there is an documented extension which allows for intelligent client side handling of multiple displays. Essentially the server VNC framebuffer represents the combined real estate of all displays (this lets dumb VNC clients work), and the "ExtendedDesktopSize" extension allows intelligent clients to query what regions within the framebuffer correspond to each display. So it would be useful to implement this in QEMU if we're to allow multiple VGA adapters.
Quoted 3 lines
This is true, but in this context, is it useful? If one wants multiple displays, one can easily double the height or width of the virtual display and run nested servers inside of them.
If you just want twice as screen real estate on a desktop system then yes, you can increase the resolution. However in many cases we actually want multiple independent displays.
Paul