From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOAQF-00085h-C1 for qemu-devel@nongnu.org; Sat, 17 Jan 2009 07:37:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOAQD-00084L-L5 for qemu-devel@nongnu.org; Sat, 17 Jan 2009 07:37:06 -0500 Received: from [199.232.76.173] (port=41590 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOAQD-00083u-Bu for qemu-devel@nongnu.org; Sat, 17 Jan 2009 07:37:05 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:55406) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOAQC-0004mL-L1 for qemu-devel@nongnu.org; Sat, 17 Jan 2009 07:37:05 -0500 Message-ID: <4971D0EC.2060805@web.de> Date: Sat, 17 Jan 2009 13:37:00 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <4971CB6F.3000604@web.de> In-Reply-To: <4971CB6F.3000604@web.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig66DA04B298B988D7C0E79EEC" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: kvm: system reset does not work / slow cirrus-vga Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig66DA04B298B988D7C0E79EEC Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Jan Kiszka wrote: > Another issue: cirrus_vga seems to run without mmio coalescing support.= > Graphic modes are horribly slow. In contrast, -vga std gives reasonable= > performance. Maybe I will play with the diff of the kvm tree later, but= > that one currently has its own cirrus-reset problems... OK, this can be fixed by porting the kvm changes over, but I cannot asses if they are all valid or needed upstream. Avi? Jan ------> diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index ef939ae..04295a0 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -850,11 +850,17 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGA= State * s) =20 static void cirrus_bitblt_reset(CirrusVGAState * s) { + int need_update; + s->gr[0x31] &=3D ~(CIRRUS_BLT_START | CIRRUS_BLT_BUSY | CIRRUS_BLT_FIFOUSED); + need_update =3D s->cirrus_srcptr !=3D &s->cirrus_bltbuf[0] + || s->cirrus_srcptr_end !=3D &s->cirrus_bltbuf[0]; s->cirrus_srcptr =3D &s->cirrus_bltbuf[0]; s->cirrus_srcptr_end =3D &s->cirrus_bltbuf[0]; s->cirrus_srccounter =3D 0; + if (!need_update) + return; cirrus_update_memory_access(s); } =20 @@ -1381,6 +1387,8 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned r= eg_index, int reg_value) printf("cirrus: handled outport sr_index %02x, sr_value %02x\n", reg_index, reg_value); #endif + if (reg_index =3D=3D 0x07) + cirrus_update_memory_access(s); break; case 0x17: // Configuration Readback and Extended Control s->sr[reg_index] =3D (s->sr[reg_index] & 0x38) | (reg_value & 0xc7); @@ -2620,12 +2628,12 @@ static CPUWriteMemoryFunc *cirrus_linear_bitblt_w= rite[3] =3D { =20 static void map_linear_vram(CirrusVGAState *s) { + vga_dirty_log_start((VGAState *)s); =20 if (!s->map_addr && s->lfb_addr && s->lfb_end) { s->map_addr =3D s->lfb_addr; s->map_end =3D s->lfb_end; cpu_register_physical_memory(s->map_addr, s->map_end - s->map_ad= dr, s->vram_offset); - vga_dirty_log_start((VGAState *)s); } =20 if (!s->map_addr) @@ -2633,6 +2641,10 @@ static void map_linear_vram(CirrusVGAState *s) =20 s->lfb_vram_mapped =3D 0; =20 + cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x8000, + (s->vram_offset + s->cirrus_bank_base[0]= ) | IO_MEM_UNASSIGNED); + cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000, + (s->vram_offset + s->cirrus_bank_base[1]= ) | IO_MEM_UNASSIGNED); if (!(s->cirrus_srcptr !=3D s->cirrus_srcptr_end) && !((s->sr[0x07] & 0x01) =3D=3D 0) && !((s->gr[0x0B] & 0x14) =3D=3D 0x14) @@ -2644,24 +2656,24 @@ static void map_linear_vram(CirrusVGAState *s) (s->vram_offset + s->cirrus_bank_bas= e[1]) | IO_MEM_RAM); =20 s->lfb_vram_mapped =3D 1; - vga_dirty_log_start((VGAState *)s); } else { cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x8000, s->= vga_io_memory); cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000, s->= vga_io_memory); } =20 + vga_dirty_log_start((VGAState *)s); } =20 static void unmap_linear_vram(CirrusVGAState *s) { - if (s->map_addr && s->lfb_addr && s->lfb_end) { - vga_dirty_log_stop((VGAState *)s); + vga_dirty_log_stop((VGAState *)s); + if (s->map_addr && s->lfb_addr && s->lfb_end) s->map_addr =3D s->map_end =3D 0; - } =20 cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x20000, s->vga_io_memory); + vga_dirty_log_start((VGAState *)s); } =20 /* Compute the memory access functions */ @@ -3316,6 +3328,7 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int re= gion_num, { CirrusVGAState *s =3D &((PCICirrusVGAState *)d)->cirrus_vga; =20 + vga_dirty_log_stop((VGAState *)s); /* XXX: add byte swapping apertures */ cpu_register_physical_memory(addr, s->vram_size, s->cirrus_linear_io_addr); @@ -3328,6 +3341,7 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int re= gion_num, /* account for overflow */ if (s->lfb_end < addr + VGA_RAM_SIZE) s->lfb_end =3D addr + VGA_RAM_SIZE; + vga_dirty_log_start((VGAState *)s); } =20 static void cirrus_pci_mmio_map(PCIDevice *d, int region_num, @@ -3339,6 +3353,20 @@ static void cirrus_pci_mmio_map(PCIDevice *d, int = region_num, s->cirrus_mmio_io_addr); } =20 +static void pci_cirrus_write_config(PCIDevice *d, + uint32_t address, uint32_t val, int = len) +{ + PCICirrusVGAState *pvs =3D container_of(d, PCICirrusVGAState, dev); + CirrusVGAState *s =3D &pvs->cirrus_vga; + + vga_dirty_log_stop((VGAState *)s); + pci_default_write_config(d, address, val, len); + if (s->map_addr && pvs->dev.io_regions[0].addr =3D=3D -1) + s->map_addr =3D 0; + cirrus_update_memory_access(s); + vga_dirty_log_start((VGAState *)s); +} + void pci_cirrus_vga_init(PCIBus *bus, uint8_t *vga_ram_base, ram_addr_t vga_ram_offset, int vga_ram_size) { @@ -3352,7 +3380,7 @@ void pci_cirrus_vga_init(PCIBus *bus, uint8_t *vga_= ram_base, /* setup PCI configuration registers */ d =3D (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA", sizeof(PCICirrusVGAStat= e), - -1, NULL, NULL); + -1, NULL, pci_cirrus_wr= ite_config); pci_conf =3D d->dev.config; pci_conf[0x00] =3D (uint8_t) (PCI_VENDOR_CIRRUS & 0xff); pci_conf[0x01] =3D (uint8_t) (PCI_VENDOR_CIRRUS >> 8); --------------enig66DA04B298B988D7C0E79EEC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAklx0PAACgkQniDOoMHTA+lybwCfWPUSYYAMIrjLakq3A+IvZ27U KMUAn2Uwi5LGo+Qqn1q/Be2IeLXu5/QW =bnuX -----END PGP SIGNATURE----- --------------enig66DA04B298B988D7C0E79EEC--