From patchwork Thu Jun 27 06:45:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 255000 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 25DDA2C0099 for ; Thu, 27 Jun 2013 17:24:30 +1000 (EST) Received: from localhost ([::1]:42736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us60x-0004aH-8E for incoming@patchwork.ozlabs.org; Thu, 27 Jun 2013 02:49:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us5z5-0001xx-9z for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Us5z2-0007BI-NS for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:47:11 -0400 Received: from mail-ie0-f171.google.com ([209.85.223.171]:45042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us5z2-0007Au-Hx for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:47:08 -0400 Received: by mail-ie0-f171.google.com with SMTP id qd12so836792ieb.30 for ; Wed, 26 Jun 2013 23:47:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=j5X1j+WthRkN1uGEjZTBtSVudReKgTYUbJz0J5sNltA=; b=MnF65durMT1YcOIeoqFRvcG/0tsnx7DDVGz5gszWCwMgBxoX5SrOBMDQ8+JfP4vsbr RXQSgLPVCmIvNQ//zhlh/SQ3brhXnQVFKLMBC7WEBUrRFAcZk717DileUNteoWBCxZMS mmYHN173FaXwEuFL5psCQR+I8sNCiq5X6iALOI1JOGOxZfNJ4P3aO1a3S7AsiQ0OL3KU jhirMq3nRLFeSNk35hEJNKEdUXhEU6lEUppanWmMZYUKh+YbY2uusnfPp1n731r3zlFa 8lhwQAHc5B9ik10bsEjlxQNDc+J75UPnvOenM7a6eEYHBUcuslKSaYLqm8GMihI3kPoG Wnyg== X-Received: by 10.50.107.65 with SMTP id ha1mr4968603igb.50.1372315627848; Wed, 26 Jun 2013 23:47:07 -0700 (PDT) Received: from ka1.ozlabs.ibm.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPSA id x10sm11847910igl.3.2013.06.26.23.47.03 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Jun 2013 23:47:06 -0700 (PDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2013 16:45:51 +1000 Message-Id: <1372315560-5478-9-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1372315560-5478-1-git-send-email-aik@ozlabs.ru> References: <1372315560-5478-1-git-send-email-aik@ozlabs.ru> X-Gm-Message-State: ALoCoQkZm53M++wpYBe1gUZpwTgUFGC46Gmy4M6cWVyPWwSddyFdHGDPENHR00AqvC8EhAW3PB33 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.223.171 Cc: Anthony Liguori , aik@ozlabs.ru, Alexander Graf , qemu-ppc@nongnu.org, Paolo Bonzini , Paul Mackerras , David Gibson Subject: [Qemu-devel] [PATCH 08/17] 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 From: 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 Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_iommu.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 91bc8e4..ba1f7b6 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -112,6 +112,25 @@ static IOMMUTLBEntry spapr_tce_translate_iommu(MemoryRegion *iommu, hwaddr addr) }; } +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() + }, +}; + static MemoryRegionIOMMUOps spapr_iommu_ops = { .translate = spapr_tce_translate_iommu, }; @@ -156,6 +175,8 @@ sPAPRTCETable *spapr_tce_new_table(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; } @@ -163,6 +184,10 @@ void spapr_tce_free(sPAPRTCETable *tcet) { QLIST_REMOVE(tcet, list); + vmstate_unregister(NULL, &vmstate_spapr_tce_table, tcet); + + QLIST_REMOVE(tcet, list); + if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->window_size) != 0)) {