From patchwork Tue Jul 7 12:23:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 492162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1CC151402BD for ; Tue, 7 Jul 2015 22:26:15 +1000 (AEST) Received: from localhost ([::1]:57122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCRwz-0004Rt-9f for incoming@patchwork.ozlabs.org; Tue, 07 Jul 2015 08:26:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCRur-0001FD-Oi for qemu-devel@nongnu.org; Tue, 07 Jul 2015 08:24:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCRuo-0006uo-25 for qemu-devel@nongnu.org; Tue, 07 Jul 2015 08:24:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCRun-0006uO-TC for qemu-devel@nongnu.org; Tue, 07 Jul 2015 08:23:57 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 2D632AED5A for ; Tue, 7 Jul 2015 12:23:57 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t67CNulX028757; Tue, 7 Jul 2015 08:23:56 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 89EE781912; Tue, 7 Jul 2015 14:23:55 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 7 Jul 2015 14:23:52 +0200 Message-Id: <1436271834-11007-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1436271834-11007-1-git-send-email-kraxel@redhat.com> References: <1436271834-11007-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , "Michael S. Tsirkin" Subject: [Qemu-devel] [PULL 1/3] virtio-gpu: update console device property. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Update the device link of the QemuConsole, so it points to the virtio-gpu-pci or virtio-vga device instead of virtio-gpu-device. This is needed because we want to find the device by id, for example for input routing, and the id specified on the command line is attached to the pci proxy, not the virtio device. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-pci.c | 8 ++++++++ hw/display/virtio-vga.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c index f0f25c7..d3e9aad 100644 --- a/hw/display/virtio-gpu-pci.c +++ b/hw/display/virtio-gpu-pci.c @@ -25,13 +25,21 @@ static Property virtio_gpu_pci_properties[] = { static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOGPUPCI *vgpu = VIRTIO_GPU_PCI(vpci_dev); + VirtIOGPU *g = &vgpu->vdev; DeviceState *vdev = DEVICE(&vgpu->vdev); + int i; qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); /* force virtio-1.0 */ vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN; vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY; object_property_set_bool(OBJECT(vdev), true, "realized", errp); + + for (i = 0; i < g->conf.max_outputs; i++) { + object_property_set_link(OBJECT(g->scanout[i].con), + OBJECT(vpci_dev), + "device", errp); + } } static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data) diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 94f9d0e..1b09a04 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -79,6 +79,7 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VirtIOGPU *g = &vvga->vdev; VGACommonState *vga = &vvga->vga; uint32_t offset; + int i; /* init vga compat bits */ vga->vram_size_mb = 8; @@ -120,6 +121,12 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) vga->con = g->scanout[0].con; graphic_console_set_hwops(vga->con, &virtio_vga_ops, vvga); + + for (i = 0; i < g->conf.max_outputs; i++) { + object_property_set_link(OBJECT(g->scanout[i].con), + OBJECT(vpci_dev), + "device", errp); + } } static void virtio_vga_reset(DeviceState *dev)