From patchwork Mon Oct 15 00:24:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 191440 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 861742C0097 for ; Mon, 15 Oct 2012 11:24:07 +1100 (EST) Received: from localhost ([::1]:59727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNYTV-0001ix-Id for incoming@patchwork.ozlabs.org; Sun, 14 Oct 2012 20:24:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNYTB-0001hI-Iu for qemu-devel@nongnu.org; Sun, 14 Oct 2012 20:23:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNYTA-0001xA-0c for qemu-devel@nongnu.org; Sun, 14 Oct 2012 20:23:45 -0400 Received: from ozlabs.org ([203.10.76.45]:53308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNYT9-0001ul-IT; Sun, 14 Oct 2012 20:23:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3F28C2C00AC; Mon, 15 Oct 2012 11:23:38 +1100 (EST) From: David Gibson To: agraf@suse.de, quintela@redhat.com Date: Mon, 15 Oct 2012 10:24:40 +1000 Message-Id: <1350260682-21428-14-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350260682-21428-1-git-send-email-david@gibson.dropbear.id.au> References: <1350260682-21428-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 13/15] pseries: savevm support for PAPR TCE tables 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 This patch adds the necessary VMStateDescription information to save the state of PAPR TCE tables (that is, the PAPR specified IOMMU). Signed-off-by: David Gibson --- hw/spapr_iommu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c index 38034c0..29e76eb 100644 --- a/hw/spapr_iommu.c +++ b/hw/spapr_iommu.c @@ -115,6 +115,26 @@ static int spapr_tce_translate(DMAContext *dma, return 0; } +static const VMStateDescription vmstate_spapr_tce_table = { + .name = "spapr_iommu", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + /* Sanity check */ + VMSTATE_UINT32_EQUAL(liobn, sPAPRTCETable), + VMSTATE_UINT32_EQUAL(window_size, sPAPRTCETable), + + /* IOMMU state */ + VMSTATE_BOOL(bypass, sPAPRTCETable), + VMSTATE_VBUFFER_DIVIDE(table, sPAPRTCETable, 0, NULL, 0, window_size, + SPAPR_TCE_PAGE_SIZE / sizeof(sPAPRTCE)), + + VMSTATE_END_OF_LIST() + }, +}; + + DMAContext *spapr_tce_new_dma_context(uint32_t liobn, size_t window_size) { sPAPRTCETable *tcet; @@ -148,6 +168,8 @@ DMAContext *spapr_tce_new_dma_context(uint32_t liobn, size_t window_size) QLIST_INSERT_HEAD(&spapr_tce_tables, tcet, list); + vmstate_register(NULL, tcet->liobn, &vmstate_spapr_tce_table, tcet); + return &tcet->dma; } @@ -157,6 +179,8 @@ void spapr_tce_free(DMAContext *dma) if (dma) { sPAPRTCETable *tcet = DO_UPCAST(sPAPRTCETable, dma, dma); + vmstate_unregister(NULL, &vmstate_spapr_tce_table, tcet); + QLIST_REMOVE(tcet, list); if (!kvm_enabled() ||