qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] spice: add qxl device
Date: Tue, 16 Nov 2010 19:43:06 +0200	[thread overview]
Message-ID: <20101116174306.GC4077@redhat.com> (raw)
In-Reply-To: <1288704898-30234-1-git-send-email-kraxel@redhat.com>

On Tue, Nov 02, 2010 at 02:34:58PM +0100, Gerd Hoffmann wrote:
> +        if (ram_size < 32 * 1024 * 1024)
> +            ram_size = 32 * 1024 * 1024;
> +        vga_common_init(vga, ram_size);
> +        vga_init(vga);
> +        register_ioport_write(0x3c0, 16, 1, qxl_vga_ioport_write, vga);
> +        register_ioport_write(0x3b4,  2, 1, qxl_vga_ioport_write, vga);
> +        register_ioport_write(0x3d4,  2, 1, qxl_vga_ioport_write, vga);
> +        register_ioport_write(0x3ba,  1, 1, qxl_vga_ioport_write, vga);
> +        register_ioport_write(0x3da,  1, 1, qxl_vga_ioport_write, vga);
> +
> +        vga->ds = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,
> +                                       qxl_hw_screen_dump, qxl_hw_text_update, qxl);
> +        qxl->ssd.ds = vga->ds;
> +        qxl->ssd.bufsize = (16 * 1024 * 1024);
> +        qxl->ssd.buf = qemu_malloc(qxl->ssd.bufsize);
> +
> +        qxl0 = qxl;

What happens when this device is then removed?

> +        register_displaychangelistener(vga->ds, &display_listener);
> +
> +        if (qxl->pci.romfile == NULL) {
> +            if (pci_device_id == 0x01ff) {
> +                qxl->pci.romfile = qemu_strdup("vgabios-qxldev.bin");
> +            } else {
> +                qxl->pci.romfile = qemu_strdup("vgabios-qxl.bin");
> +            }
> +        }
> +        pci_config_set_class(config, PCI_CLASS_DISPLAY_VGA);
> +    } else {
> +        if (ram_size < 16 * 1024 * 1024)
> +            ram_size = 16 * 1024 * 1024;
> +        qxl->vga.vram_size = ram_size;
> +        qxl->vga.vram_offset = qemu_ram_alloc(&qxl->pci.qdev, "qxl.vgavram",
> +                                              qxl->vga.vram_size);
> +        qxl->vga.vram_ptr = qemu_get_ram_ptr(qxl->vga.vram_offset);
> +
> +        pci_config_set_class(config, PCI_CLASS_DISPLAY_OTHER);

So 1st device has device id different from the rest?
Why?

> +    }
> +
> +    pci_config_set_vendor_id(config, REDHAT_PCI_VENDOR_ID);
> +    pci_config_set_device_id(config, pci_device_id);
> +    pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev);
> +    pci_set_byte(&config[PCI_INTERRUPT_PIN], 1);
> +
> +    qxl->rom_size = qxl_rom_size();
> +    qxl->rom_offset = qemu_ram_alloc(&qxl->pci.qdev, "qxl.vrom", qxl->rom_size);
> +    init_qxl_rom(qxl);
> +    init_qxl_ram(qxl);
> +
> +    if (qxl->vram_size < 16 * 1024 * 1024) {
> +        qxl->vram_size = 16 * 1024 * 1024;
> +    }
> +    if (qxl->revision == 1) {
> +        qxl->vram_size = 4096;
> +    }
> +    qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
> +    qxl->vram_offset = qemu_ram_alloc(&qxl->pci.qdev, "qxl.vram", qxl->vram_size);
> +
> +    io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
> +    if (qxl->revision == 1) {
> +        io_size = 8;
> +    }
> +
> +    pci_register_bar(&qxl->pci, QXL_IO_RANGE_INDEX,
> +                     io_size, PCI_BASE_ADDRESS_SPACE_IO, qxl_map);
> +
> +    pci_register_bar(&qxl->pci, QXL_ROM_RANGE_INDEX,
> +                     qxl->rom_size, PCI_BASE_ADDRESS_SPACE_MEMORY,
> +                     qxl_map);
> +
> +    pci_register_bar(&qxl->pci, QXL_RAM_RANGE_INDEX,
> +                     qxl->vga.vram_size, PCI_BASE_ADDRESS_SPACE_MEMORY,
> +                     qxl_map);
> +
> +    pci_register_bar(&qxl->pci, QXL_VRAM_RANGE_INDEX, qxl->vram_size,
> +                     PCI_BASE_ADDRESS_SPACE_MEMORY, qxl_map);
> +
> +    qxl->ssd.qxl.base.sif = &qxl_interface.base;
> +    qxl->ssd.qxl.id = qxl->id;
> +    qemu_spice_add_interface(&qxl->ssd.qxl.base);
> +    qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
> +
> +    init_pipe_signaling(qxl);
> +    qxl_reset_state(qxl);
> +
> +    device_id++;

what happens when this wraps around?
Since it's an int probably undefined behaviour ...

  parent reply	other threads:[~2010-11-16 18:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 13:34 [Qemu-devel] [PATCH] spice: add qxl device Gerd Hoffmann
2010-11-16 14:24 ` Anthony Liguori
2010-11-17 13:14   ` Gerd Hoffmann
2010-11-16 17:43 ` Michael S. Tsirkin [this message]
2010-11-17 13:28   ` [Qemu-devel] " Gerd Hoffmann
2010-11-17 13:58     ` Michael S. Tsirkin
2010-11-17 15:20       ` Gerd Hoffmann
2010-11-17 16:42         ` Michael S. Tsirkin
2010-11-17 17:02           ` Gerd Hoffmann
2010-11-17 18:00             ` Michael S. Tsirkin
2010-11-18  8:09               ` Gleb Natapov
2010-11-18  8:22                 ` Gerd Hoffmann
2010-11-18  9:08                   ` Michael S. Tsirkin
2010-11-18 10:46                     ` Gerd Hoffmann
2010-11-18  9:03                 ` Michael S. Tsirkin
2010-11-18  9:11                   ` Gleb Natapov
2010-11-18  9:30                     ` Michael S. Tsirkin
2010-11-18  9:57                       ` Gleb Natapov
2010-11-18 11:33                         ` Michael S. Tsirkin
2010-11-18 11:55                           ` Gleb Natapov
2010-11-18 12:03                             ` Michael S. Tsirkin
2010-11-18 12:27                               ` Gleb Natapov
2010-11-18 14:04                                 ` Michael S. Tsirkin
2010-11-18 14:57                                   ` Gleb Natapov
2010-11-18 15:25                                     ` Michael S. Tsirkin
2010-11-18 15:42                                       ` Gleb Natapov
2010-11-18 16:04                                         ` Michael S. Tsirkin
2010-11-18 16:10                                           ` Gleb Natapov
2010-11-18 16:14                                             ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101116174306.GC4077@redhat.com \
    --to=mst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).