From patchwork Thu Feb 23 02:09:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9587653 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 0F64760578 for ; Thu, 23 Feb 2017 02:10:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F317128684 for ; Thu, 23 Feb 2017 02:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7FFF286A3; Thu, 23 Feb 2017 02:10:38 +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_SIGNED, 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 8636228684 for ; Thu, 23 Feb 2017 02:10:38 +0000 (UTC) Received: from localhost ([::1]:55983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgird-0004iT-HJ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Feb 2017 21:10:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgiqo-0004Pb-DL for qemu-devel@nongnu.org; Wed, 22 Feb 2017 21:09:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgiql-0007Ze-8v for qemu-devel@nongnu.org; Wed, 22 Feb 2017 21:09:46 -0500 Received: from ozlabs.org ([103.22.144.67]:36523) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgiqk-0007Ye-Sc; Wed, 22 Feb 2017 21:09:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vTHjv6zW6z9s7k; Thu, 23 Feb 2017 13:09:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1487815779; bh=6yeicWUBn+wM4CPTtqy3GTxZOhheEFpQWslG+n5oCcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c63Ixde27WWL/IpH2rwPZXMr72e1Be75LfDh28q3bbyq0zmgabLIT7dMw4RSdZKTD dLZGaHoqPYHDoy7Xx15SXF3itYFUmuHvSuj+cWUeMaPizEb9aVsoQmZg0vwfC7TPrl s35tVzOGX8WiT5KNQCaPRQ9ZuquIZOTwlmxZT3AQ= From: David Gibson To: qemu-ppc@nongnu.org, aik@ozlabs.ru, sjitindarsingh@gmail.com Date: Thu, 23 Feb 2017 13:09:32 +1100 Message-Id: <20170223020936.29220-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170223020936.29220-1-david@gibson.dropbear.id.au> References: <20170223020936.29220-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PATCH 2/6] target/ppc: Merge cpu_ppc_set_vhyp() with cpu_ppc_set_papr() 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, agraf@suse.de, thuth@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, paulus@samba.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP cpu_ppc_set_papr() sets up various aspects of CPU state for use with PAPR paravirtualized guests. However, it doesn't set the virtual hypervisor, so callers must also call cpu_ppc_set_vhyp() so that PAPR hypercalls are handled properly. This is a bit silly, so fold setting the virtual hypervisor into cpu_ppc_set_papr(). Signed-off-by: David Gibson Reviewed-by: Suraj Jitindar Singh --- hw/ppc/spapr_cpu_core.c | 3 +-- target/ppc/cpu.h | 3 +-- target/ppc/translate_init.c | 10 +++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 55cd045..76563c4 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -57,8 +57,7 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ); /* Enable PAPR mode in TCG or KVM */ - cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr)); - cpu_ppc_set_papr(cpu); + cpu_ppc_set_papr(cpu, PPC_VIRTUAL_HYPERVISOR(spapr)); if (cpu->max_compat) { Error *local_err = NULL; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 425e79d..f99bcae 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1300,8 +1300,7 @@ void store_booke_tcr (CPUPPCState *env, target_ulong val); void store_booke_tsr (CPUPPCState *env, target_ulong val); void ppc_tlb_invalidate_all (CPUPPCState *env); void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr); -void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp); -void cpu_ppc_set_papr(PowerPCCPU *cpu); +void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp); #endif #endif diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index be35cbd..a1405e9 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8835,18 +8835,14 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) } #if !defined(CONFIG_USER_ONLY) - -void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp) -{ - cpu->vhyp = vhyp; -} - -void cpu_ppc_set_papr(PowerPCCPU *cpu) +void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp) { CPUPPCState *env = &cpu->env; ppc_spr_t *lpcr = &env->spr_cb[SPR_LPCR]; ppc_spr_t *amor = &env->spr_cb[SPR_AMOR]; + cpu->vhyp = vhyp; + /* PAPR always has exception vectors in RAM not ROM. To ensure this, * MSR[IP] should never be set. *