From patchwork Sun Mar 10 08:26:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10846127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E5FC139A for ; Sun, 10 Mar 2019 08:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E966F28D79 for ; Sun, 10 Mar 2019 08:29:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6B0228D82; Sun, 10 Mar 2019 08:29:41 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75FDC28D79 for ; Sun, 10 Mar 2019 08:29:41 +0000 (UTC) Received: from localhost ([127.0.0.1]:41688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2tq0-0002v9-Ku for patchwork-qemu-devel@patchwork.kernel.org; Sun, 10 Mar 2019 04:29:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2tns-0000hR-MV for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:27:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2tnr-00018V-25 for qemu-devel@nongnu.org; Sun, 10 Mar 2019 04:27:28 -0400 Received: from ozlabs.org ([203.11.71.1]:35211) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2tno-00014n-TR; Sun, 10 Mar 2019 04:27:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44HDql0BShz9sN1; Sun, 10 Mar 2019 19:27:14 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552206435; bh=VMO/Zhzw4HeuR3K80BXH37ri6fuDg8EhFGofHgHXSJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3TC0NUV3+GNx6BDc/nfbQt3jPGgLA1r8Z/7Axbhpud+HSxnQcHfzSRWnYLzjxk1b bQ+vQ0+nR+9e8yXvC3JounvlTMTLkggBGps8MMQUhN1dghmFG6mEnuBVb2KBhtjatu 6KnduoUX/c4j7wVxu+IaXwqrG1wHOfIYm1yRDis4= From: David Gibson To: peter.maydell@linaro.org Date: Sun, 10 Mar 2019 19:26:16 +1100 Message-Id: <20190310082703.1245-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310082703.1245-1-david@gibson.dropbear.id.au> References: <20190310082703.1245-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 13/60] target/ppc: Move exception vector offset computation into a function 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, Fabiano Rosas , Alexey Kardashevskiy , groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.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 From: Fabiano Rosas Signed-off-by: Fabiano Rosas Reviewed-by: Alexey Kardashevskiy Message-Id: <20190228225759.21328-2-farosas@linux.ibm.com> Signed-off-by: David Gibson --- target/ppc/excp_helper.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 39bedbb11d..beafcf1ebd 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -107,6 +107,24 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp, return POWERPC_EXCP_RESET; } +static uint64_t ppc_excp_vector_offset(CPUState *cs, int ail) +{ + uint64_t offset = 0; + + switch (ail) { + case AIL_0001_8000: + offset = 0x18000; + break; + case AIL_C000_0000_0000_4000: + offset = 0xc000000000004000ull; + break; + default: + cpu_abort(cs, "Invalid AIL combination %d\n", ail); + break; + } + + return offset; +} /* Note that this function should be greatly optimized * when called with a constant excp, from ppc_hw_interrupt @@ -708,17 +726,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) /* Handle AIL */ if (ail) { new_msr |= (1 << MSR_IR) | (1 << MSR_DR); - switch(ail) { - case AIL_0001_8000: - vector |= 0x18000; - break; - case AIL_C000_0000_0000_4000: - vector |= 0xc000000000004000ull; - break; - default: - cpu_abort(cs, "Invalid AIL combination %d\n", ail); - break; - } + vector |= ppc_excp_vector_offset(cs, ail); } #if defined(TARGET_PPC64)