From patchwork Fri Nov 24 04:23:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10073511 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 6C81E60383 for ; Fri, 24 Nov 2017 04:24:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BF5A2A235 for ; Fri, 24 Nov 2017 04:24:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F0472A346; Fri, 24 Nov 2017 04:24:43 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 F08222A235 for ; Fri, 24 Nov 2017 04:24:42 +0000 (UTC) Received: from localhost ([::1]:47193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI5Xd-0002RC-Qm for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 Nov 2017 23:24:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI5Wf-0002Pg-7h for qemu-devel@nongnu.org; Thu, 23 Nov 2017 23:23:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eI5We-0005W4-B6 for qemu-devel@nongnu.org; Thu, 23 Nov 2017 23:23:41 -0500 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:38533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eI5Wc-0005U4-BR; Thu, 23 Nov 2017 23:23:38 -0500 Received: by mail-pl0-x241.google.com with SMTP id s10so3741531plj.5; Thu, 23 Nov 2017 20:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eJ84sSP2qWTkfMjT64yvlDis7nQK9Yz9PIPQxV3MYu4=; b=uMuab5fVlYD1+rRn/vA82htEcAH+WSqMZn8wXf0zzyNbsjarK1fti3H1yNDF6ePLYd ML1sueUCqt5PzQYWvSApLMhjUs03BdyVhsGYkNUC5pu1FSwu6wUXR/lGhOie3ic+KulD cW+fB+ZikbjTMNR6KcbT2aY6MdMI/P4UgSvIROvpYYSPc6NSBb7kbkNId9gjoDhSqjEa dmY2bQVnZZK+GSl2JAgq68docCkNCpwcPg0r4o1RAyBIcTxeTOHBArJ7KJTx66OlQRGG iIuAVPZGPLhOS+NKeheDsw0uDl6cPndUwA0e+HojjV7S2EfUqk8aZeVz8cXD7LCsQ50o E90A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eJ84sSP2qWTkfMjT64yvlDis7nQK9Yz9PIPQxV3MYu4=; b=PMe/z//XsERtqOixTF4LY2rsYW0ltwQwsZ9Xge62jatTgMxicH85nmxNr6sGMhDte6 1CeIEXEVOO+HBVbPG06OvaX5W774ry3RO7qf9xY7okld2Ssm5ZoPKHVSg2sAE+kitrml GD7ilASzJspIHKN7dmpkheHN/AyA8FhWA80f9w5uCJgJBye1UrX4z/+85r8DOjKRvpfH azh5xxovRLpe7/LG7uV0sMfkXpTXF5+xPOFMcAyf3KdgxcaTd1SzugoHcGjrlOuLUsVv MxvbTSu9VtsPU49IrqenqdIjfCfmoMASVme4FQTW8Zf/vU1dN9e3axmZsgj+yGE5lPYj 4TXw== X-Gm-Message-State: AJaThX6mdM1gvVpEal/CvYEvKmS70KgOIoHKIf49gGz5DG4kN9xQmPg5 3sW38dMELrazv+RJODHqIljYd1he X-Google-Smtp-Source: AGs4zMbixTWq8GY6E5usmPlgLbWFOO7IUUL/XN74g5EeIOvAdKh/9iFwVI25ek7eJ2nb9L4eSRUX9A== X-Received: by 10.84.133.15 with SMTP id 15mr26907393plf.367.1511497417284; Thu, 23 Nov 2017 20:23:37 -0800 (PST) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id f70sm40214287pfc.84.2017.11.23.20.23.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 20:23:36 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Fri, 24 Nov 2017 15:23:24 +1100 Message-Id: <20171124042325.28012-2-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171124042325.28012-1-sjitindarsingh@gmail.com> References: <20171124042325.28012-1-sjitindarsingh@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [QEMU-PPC] [PATCH 1/2] target/ppc: Move setting of patb_entry on hash table init 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: groug@kaod.org, qemu-devel@nongnu.org, sjitindarsingh@gmail.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 The patb_entry is used to store the location of the process table in guest memory. The msb is also used to indicate the mmu mode of the guest, that is patb_entry & 1 << 63 ? radix_mode : hash_mode. Currently we set this to zero in spapr_setup_hpt_and_vrma() since if this function gets called then we know we're hash. However some code paths, such as setting up the hpt on incoming migration of a hash guest, call spapr_reallocate_hpt() directly bypassing this higher level function. Since we assume radix if the host is capable this results in the msb in patb_entry being left set so in spapr_post_load() we call kvmppc_configure_v3_mmu() and tell the host we're radix which as expected means addresses cannot be translated once we actually run the cpu. To fix this move the zeroing of patb_entry into spapr_reallocate_hpt(). Signed-off-by: Suraj Jitindar Singh Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6841bd294b..e7af47bab0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1373,6 +1373,8 @@ void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift, DIRTY_HPTE(HPTE(spapr->htab, i)); } } + /* We're setting up a hash table, so that means we're not radix */ + spapr->patb_entry = 0; } void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr) @@ -1392,8 +1394,6 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr) spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)), spapr->htab_shift); } - /* We're setting up a hash table, so that means we're not radix */ - spapr->patb_entry = 0; } static void find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)