From patchwork Wed May 17 03:49:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 9729959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 87CDA60363 for ; Wed, 17 May 2017 03:55:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 790212862D for ; Wed, 17 May 2017 03:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DE1128632; Wed, 17 May 2017 03:55:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1AD5E2862D for ; Wed, 17 May 2017 03:55:00 +0000 (UTC) Received: from localhost ([::1]:45338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAq39-00076R-Ar for patchwork-qemu-devel@patchwork.kernel.org; Tue, 16 May 2017 23:54:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dApz4-0004LQ-Rv for qemu-devel@nongnu.org; Tue, 16 May 2017 23:50:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dApz0-0000vo-5y for qemu-devel@nongnu.org; Tue, 16 May 2017 23:50:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35173 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dApz0-0000vN-1N for qemu-devel@nongnu.org; Tue, 16 May 2017 23:50:42 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4H3hjmm172608 for ; Tue, 16 May 2017 23:50:41 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0b-001b2d01.pphosted.com with ESMTP id 2agemcrpsj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 16 May 2017 23:50:40 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 May 2017 13:50:38 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 17 May 2017 13:50:35 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4H3oRr91376532; Wed, 17 May 2017 13:50:35 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v4H3o2IS030594; Wed, 17 May 2017 13:50:03 +1000 Received: from bharata.in.ibm.com ([9.124.35.166]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v4H3noZI029911; Wed, 17 May 2017 13:50:01 +1000 From: Bharata B Rao To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 09:19:22 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494992962-6929-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1494992962-6929-1-git-send-email-bharata@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17051703-0004-0000-0000-00000202F5D9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051703-0005-0000-0000-000009F868CB Message-Id: <1494992962-6929-7-git-send-email-bharata@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-17_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705170029 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [RFC PATCH v1 6/6] spapr: Fix migration of Radix guests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: rnsastry@linux.vnet.ibm.com, qemu-ppc@nongnu.org, Bharata B Rao , sam.bobroff@au1.ibm.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fix migration of radix guests by ensuring that we issue KVM_PPC_CONFIGURE_V3_MMU for radix case post migration. Reported-by: Nageswara R Sastry Signed-off-by: Bharata B Rao --- hw/ppc/spapr.c | 15 +++++++++++++++ hw/ppc/spapr_hcall.c | 1 + include/hw/ppc/spapr.h | 1 + 3 files changed, 17 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 05abfc1..dd1d687 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1443,6 +1443,20 @@ static int spapr_post_load(void *opaque, int version_id) err = spapr_rtc_import_offset(&spapr->rtc, spapr->rtc_offset); } + if (spapr->patb_entry) { + if (kvmppc_has_cap_mmu_radix() && kvm_enabled()) { + err = kvmppc_configure_v3_mmu(POWERPC_CPU(first_cpu), + spapr->patb_flags & + SPAPR_PROC_TABLE_RADIX, + spapr->patb_flags & + SPAPR_PROC_TABLE_GTSE, + spapr->patb_entry); + } else { + error_report("Radix guest is unsupported by the host"); + return -EINVAL; + } + } + return err; } @@ -1527,6 +1541,7 @@ static const VMStateDescription vmstate_spapr_patb_entry = { .needed = spapr_patb_entry_needed, .fields = (VMStateField[]) { VMSTATE_UINT64(patb_entry, sPAPRMachineState), + VMSTATE_UINT64(patb_flags, sPAPRMachineState), VMSTATE_END_OF_LIST() }, }; diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 768aa57..b002fae 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -986,6 +986,7 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, spapr_check_setup_free_hpt(spapr, spapr->patb_entry, cproc); spapr->patb_entry = cproc; /* Save new process table */ + spapr->patb_flags = flags; /* Save the flags */ /* Update the UPRT and GTSE bits in the LPCR for all cpus */ CPU_FOREACH(cs) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5b39a26..c25a32e 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -75,6 +75,7 @@ struct sPAPRMachineState { void *htab; uint32_t htab_shift; uint64_t patb_entry; /* Process tbl registed in H_REGISTER_PROCESS_TABLE */ + uint64_t patb_flags; hwaddr rma_size; int vrma_adjust; ssize_t rtas_size;