From patchwork Mon Jun 20 11:11:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 101095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 596A8B6FD9 for ; Mon, 20 Jun 2011 21:33:04 +1000 (EST) Received: from localhost ([::1]:54098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYciy-0007TG-6S for incoming@patchwork.ozlabs.org; Mon, 20 Jun 2011 07:33:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcOe-000385-Nw for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:12:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYcOd-0003xJ-5m for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:12:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcOc-0003x7-RR for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:11:59 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5KBBwrR018415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Jun 2011 07:11:58 -0400 Received: from bow.redhat.com (vpn-10-78.rdu.redhat.com [10.11.10.78]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5KBBq7p006888; Mon, 20 Jun 2011 07:11:56 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 20 Jun 2011 13:11:52 +0200 Message-Id: <1308568312-5463-3-git-send-email-alevy@redhat.com> In-Reply-To: <1308568312-5463-1-git-send-email-alevy@redhat.com> References: <1308568312-5463-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: yhalperi@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH 2/2] qxl: add QXL_IO_UPDATE_MEM for guest S3&S4 support 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 Add QXL_IO_UPDATE_MEM. Used to reduce vmexits from the guest when it resets the spice server state before going to sleep. The implementation requires an updated spice-server (0.8.2) with the new worker function update_mem. Cc: Yonit Halperin --- hw/qxl.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index ca5c8b3..4945d95 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1016,6 +1016,32 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_DESTROY_ALL_SURFACES: d->ssd.worker->destroy_surfaces(d->ssd.worker); break; + case QXL_IO_UPDATE_MEM: + dprint(d, 1, "QXL_IO_UPDATE_MEM (%d) entry (%s, s#=%d, res#=%d)\n", + val, qxl_mode_to_string(d->mode), d->guest_surfaces.count, + d->num_free_res); + switch (val) { + case (QXL_UPDATE_MEM_RENDER_ALL): + d->ssd.worker->update_mem(d->ssd.worker); + break; + case (QXL_UPDATE_MEM_FLUSH): { + QXLReleaseRing *ring = &d->ram->release_ring; + if (ring->prod - ring->cons + 1 == ring->num_items) { + // TODO - "return" a value to the guest and let it loop? + fprintf(stderr, + "ERROR: no flush, full release ring [p%d,%dc]\n", + ring->prod, ring->cons); + } + qxl_push_free_res(d, 1 /* flush */); + dprint(d, 1, "QXL_IO_UPDATE_MEM exit (%s, s#=%d, res#=%d,%p)\n", + qxl_mode_to_string(d->mode), d->guest_surfaces.count, + d->num_free_res, d->last_release); + break; + } + default: + fprintf(stderr, "ERROR: unexpected value to QXL_IO_UPDATE_MEM\n"); + } + break; default: fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port); abort();