From patchwork Tue Nov 14 04:37:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 837678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="gyIK0Kn4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ybZWz2RW7z9s7F for ; Tue, 14 Nov 2017 15:38:39 +1100 (AEDT) Received: from localhost ([::1]:57562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eESzd-0006Lm-BQ for incoming@patchwork.ozlabs.org; Mon, 13 Nov 2017 23:38:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eESz2-0006Lc-RR for qemu-devel@nongnu.org; Mon, 13 Nov 2017 23:38:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eESz1-0002r6-L4 for qemu-devel@nongnu.org; Mon, 13 Nov 2017 23:38:00 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:50623) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eESz0-0002jK-Ra; Mon, 13 Nov 2017 23:37:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3ybZW23mvdz9s7h; Tue, 14 Nov 2017 15:37:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1510634270; bh=odMFDAnN18TfRMqPkMVBRCtrU8YMTxTHAJ863J1za9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyIK0Kn4a+CrWheubPLn+jSNEShoqnbhfTlI6Tg2wji8kWSJs8kEOMyqbfzT8BLB5 a7uV4uieZKwL1paZWk7fHhcXWw7hk5PW0VTDgGwqsZdzH64YGERVD6WHALRJZ3U/yE QyoBobzP4DvTtTAZoxekynxm5q3gsc3x7/HU6pbw= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 14 Nov 2017 15:37:46 +1100 Message-Id: <20171114043747.4810-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171114043747.4810-1-david@gibson.dropbear.id.au> References: <20171114043747.4810-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 1/2] target/ppc: correct htab shift for hash on radix 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: lvivier@redhat.com, thuth@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, groug@kaod.org, agraf@suse.de, qemu-ppc@nongnu.org, Sam Bobroff , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Sam Bobroff KVM HV will soon support running a guest in hash mode on a POWER9 host running in radix mode (see [1]), however the guest currently fails to boot. This is because the "htab_shift" value (the size of the MMU's hash table) is added to the device tree before KVM has had a chance to change it. If the host is in hash mode, KVM does not need to change it and so the problem is not seen, but when the host is in radix mode a change is required and we see a problem. To fix this, move the call spapr_setup_hpt_and_vrma() (where htab_shift could be changed) up a little so that it's called before spapr_h_cas_compose_response() (where htab_shift is added to the device tree). Signed-off-by: Sam Bobroff [1] See http://www.spinics.net/lists/kvm-ppc/msg13057.html Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0d59d1534d..be22a6b289 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1636,6 +1636,12 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, spapr->cas_legacy_guest_workaround = !spapr_ovec_test(ov1_guest, OV1_PPC_3_00); if (!spapr->cas_reboot) { + /* If ppc_spapr_reset() did not set up a HPT but one is necessary + * (because the guest isn't going to use radix) then set it up here. */ + if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) { + /* legacy hash or new hash: */ + spapr_setup_hpt_and_vrma(spapr); + } spapr->cas_reboot = (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) != 0); @@ -1644,13 +1650,6 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu, if (spapr->cas_reboot) { qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - } else { - /* If ppc_spapr_reset() did not set up a HPT but one is necessary - * (because the guest isn't going to use radix) then set it up here. */ - if ((spapr->patb_entry & PATBE1_GR) && !guest_radix) { - /* legacy hash or new hash: */ - spapr_setup_hpt_and_vrma(spapr); - } } return H_SUCCESS;