From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wiioz-0008FW-K9 for qemu-devel@nongnu.org; Fri, 09 May 2014 07:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wiiou-0005ur-P9 for qemu-devel@nongnu.org; Fri, 09 May 2014 07:18:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wiiou-0005uc-GK for qemu-devel@nongnu.org; Fri, 09 May 2014 07:18:28 -0400 Date: Fri, 9 May 2014 12:18:08 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140509111807.GA22335@work-vm> References: <1399630869-920-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399630869-920-1-git-send-email-arei.gonglei@huawei.com> Subject: Re: [Qemu-devel] [PATCH] cirrus_vga: adding sanity check for vram size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: weidong.huang@huawei.com, mst@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com, afaerber@suse.de * arei.gonglei@huawei.com (arei.gonglei@huawei.com) wrote: > From: Gonglei > > when configure a invalid vram size for cirrus card, such as less > 2 MB, which will crash qemu. Follow the real hardware, the cirrus > card has 4 MB video memory. Also for backward compatibility, accept > 8 MB and 16 MB vram size. virt-manager/libvirt seems to default to 9 MByte of Vram for cirrus, so this would break a lot of setups. Looking at datasheets on the web seems to say the chips actually went down to 1 MB or less. I think before doing this change, it would be good to understand where the weird 9MB in libvirt/virt-manager came from, and what the limits of the emulator/drivers are. Also, is there something broken at the moment - why make the change? Dave > Signed-off-by: Gonglei > --- > For isa cirrus vga device, its' init function has been droped at > commit db895a1e6a97e919f9b86d60c969377357b05066. I have no idea how adding > check on isa_cirrus_vga device. Any ideas? Thanks. > > hw/display/cirrus_vga.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c > index d1afc76..5fec068 100644 > --- a/hw/display/cirrus_vga.c > +++ b/hw/display/cirrus_vga.c > @@ -2959,6 +2959,13 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) > PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); > int16_t device_id = pc->device_id; > > + /* follow real hardware, cirrus card emulated has 4 MB video memory. > + Also accept 8 MB/16 MB for backward compatibility. */ > + if (s->vga.vram_size_mb != 4 || s->vga.vram_size_mb != 8 || > + s->vga.vram_size_mb != 16) { > + error_report("Invalid cirrus_vga ram size '%u'\n", s->vga.vram_size_mb); > + return -1; > + } > /* setup VGA */ > vga_common_init(&s->vga, OBJECT(dev), true); > cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev), > -- > 1.7.12.4 > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK