From patchwork Tue Sep 11 06:56:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 183026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6772C2C0089 for ; Tue, 11 Sep 2012 16:56:32 +1000 (EST) Received: from localhost ([::1]:54419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBKOc-0005RN-Fw for incoming@patchwork.ozlabs.org; Tue, 11 Sep 2012 02:56:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBKOO-0005Qy-45 for qemu-devel@nongnu.org; Tue, 11 Sep 2012 02:56:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBKOM-0007Fg-NJ for qemu-devel@nongnu.org; Tue, 11 Sep 2012 02:56:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBKOM-0007FV-Ee for qemu-devel@nongnu.org; Tue, 11 Sep 2012 02:56:14 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8B6uD2h011982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Sep 2012 02:56:13 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8B6uBdN004025; Tue, 11 Sep 2012 02:56:12 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Tue, 11 Sep 2012 09:56:09 +0300 Message-Id: <1347346570-2469-2-git-send-email-alevy@redhat.com> In-Reply-To: <1347346570-2469-1-git-send-email-alevy@redhat.com> References: <1347346570-2469-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH 2/3] hw/qxl: add support for QXL_IO_CAPABILITIES_SET 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 Guest set capabilities are written to the spice server via spice_qxl_guest_capabilities_set, provided the compiled against spice server is new enough to provide this symbol. QXL device revision will be raised in a later patch to advertise this support to the guest. Signed-off-by: Alon Levy --- configure | 7 +++++++ hw/qxl.c | 24 ++++++++++++++++++++++++ trace-events | 1 + 3 files changed, 32 insertions(+) diff --git a/configure b/configure index 30be784..d0e3eb1 100755 --- a/configure +++ b/configure @@ -2709,6 +2709,9 @@ EOF if $pkg_config --atleast-version=0.12.0 spice-protocol >/dev/null 2>&1; then spice_qxl_io_monitors_config_async="yes" fi + if $pkg_config --atleast-version=0.12.2 spice-protocol >/dev/null 2>&1; then + spice_qxl_io_client_monitors_config="yes" + fi else if test "$spice" = "yes" ; then feature_not_found "spice" @@ -3456,6 +3459,10 @@ if test "$spice_qxl_io_monitors_config_async" = "yes" ; then echo "CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC=y" >> $config_host_mak fi +if test "$spice_qxl_io_client_monitors_config" = "yes" ; then + echo "CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG=y" >> $config_host_mak +fi + if test "$smartcard" = "yes" ; then echo "CONFIG_SMARTCARD=y" >> $config_host_mak fi diff --git a/hw/qxl.c b/hw/qxl.c index 94eb3c8..583a2d9 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -32,6 +32,10 @@ #define QXL_IO_MONITORS_CONFIG_ASYNC (QXL_IO_FLUSH_RELEASE + 1) #endif +#ifndef CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG +#define QXL_IO_CAPABILITIES_SET (QXL_IO_FLUSH_RELEASE + 2) +#endif + /* * NOTE: SPICE_RING_PROD_ITEM accesses memory on the pci bar and as * such can be changed by the guest, so to avoid a guest trigerrable @@ -289,6 +293,21 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay) #endif } +static void qxl_spice_guest_capabilities_set(PCIQXLDevice *qxl) +{ +#if SPICE_SERVER_VERSION >= 0x000b05 && \ + defined(CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG) + uint8_t guest_capabilities[sizeof(qxl->ram->guest_capabilities)]; + + trace_qxl_io_capabilities_set(qxl->id, sizeof(qxl->ram->guest_capabilities), + qxl->ram->guest_capabilities); + memcpy(guest_capabilities, qxl->ram->guest_capabilities, + sizeof(guest_capabilities)); + spice_qxl_guest_capabilities_set(&qxl->ssd.qxl, sizeof(guest_capabilities), + guest_capabilities); +#endif +} + void qxl_spice_reset_image_cache(PCIQXLDevice *qxl) { trace_qxl_spice_reset_image_cache(qxl->id); @@ -576,6 +595,7 @@ static const char *io_port_to_string(uint32_t io_port) [QXL_IO_FLUSH_SURFACES_ASYNC] = "QXL_IO_FLUSH_SURFACES_ASYNC", [QXL_IO_FLUSH_RELEASE] = "QXL_IO_FLUSH_RELEASE", [QXL_IO_MONITORS_CONFIG_ASYNC] = "QXL_IO_MONITORS_CONFIG_ASYNC", + [QXL_IO_CAPABILITIES_SET] = "QXL_IO_CAPABILITIES_SET", }; if (io_port >= ARRAY_SIZE(io_port_to_string)) { @@ -1398,6 +1418,7 @@ static void ioport_write(void *opaque, target_phys_addr_t addr, case QXL_IO_LOG: case QXL_IO_MEMSLOT_ADD_ASYNC: case QXL_IO_CREATE_PRIMARY_ASYNC: + case QXL_IO_CAPABILITIES_SET: break; default: if (d->mode != QXL_MODE_VGA) { @@ -1580,6 +1601,9 @@ async_common: case QXL_IO_MONITORS_CONFIG_ASYNC: qxl_spice_monitors_config_async(d, 0); break; + case QXL_IO_CAPABILITIES_SET: + qxl_spice_guest_capabilities_set(d); + break; default: qxl_set_guest_bug(d, "%s: unexpected ioport=0x%x\n", __func__, io_port); } diff --git a/trace-events b/trace-events index 42dfb93..7a35f62 100644 --- a/trace-events +++ b/trace-events @@ -927,6 +927,7 @@ qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s" qxl_io_read_unexpected(int qid) "%d" qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char *desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)" qxl_io_write(int qid, const char *mode, uint64_t addr, uint64_t val, unsigned size, int async) "%d %s addr=%"PRIu64 " val=%"PRIu64" size=%u async=%d" +qxl_io_capabilities_set(int qid, int caps_size, uint8_t *caps) "%d %d %p" qxl_memslot_add_guest(int qid, uint32_t slot_id, uint64_t guest_start, uint64_t guest_end) "%d %u: guest phys 0x%"PRIx64 " - 0x%" PRIx64 qxl_post_load(int qid, const char *mode) "%d %s" qxl_pre_load(int qid) "%d"