Received: from eggs.gnu.org ([208.118.235.92]:58246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UY4x9-0002g6-9z for qemu-devel@nongnu.org; Thu, 02 May 2013 21:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UY4x0-0000CO-37 for qemu-devel@nongnu.org; Thu, 02 May 2013 21:38:27 -0400 From: David Gibson Date: Fri, 3 May 2013 11:38:10 +1000 Message-Id: <1367545092-19980-7-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1367545092-19980-1-git-send-email-david@gibson.dropbear.id.au> References: <1367545092-19980-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 6/8] pseries: savevm support for PAPR TCE tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de, quintela@redhat.com Cc: aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson 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/ppc/spapr_iommu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index e1fe941..ccc5839 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -122,6 +122,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; @@ -161,6 +181,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; } @@ -170,6 +192,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() || -- 1.7.10.4