From patchwork Tue Nov 2 11:07:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516665 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4430352iml; Tue, 2 Nov 2021 04:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSvYpJY7lDYuryhawT1PUjkyjHqexQXgMmcGFi4rBX9g5qc4rot6TyiN2/lPAoxqm37asl X-Received: by 2002:aca:6256:: with SMTP id w83mr4534676oib.19.1635853677293; Tue, 02 Nov 2021 04:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635853677; cv=none; d=google.com; s=arc-20160816; b=P3bNKSSkPKMjd49PpTrelJzcIzZ6i7IHxf0gXzmZIJKPPEpy1RCVIvqcCgVH43kNB6 98VjqRf8GjJn+nWLF0L+vbtsla8MchquRZwqt5kSJm1M9A0S/fc+KfcP2bBc/2IOSu9H 5EGZkRivOma2Rlh3ZE7pdXLdzocY3TqyTfrChVJoKDnvmKpJsLZDJYc8W5bNBgt5SUse raxS10WJgnCeJnxgVk0G93N1uYzMhADtcUODgV9OUziIhikDmlweHmmMjf86/mwMmz6I e6lF41j8PV5KwCyD5ruNm5KTS9LrTg5evPEDAwCZwM6NcaBDyuUP6yLybgBkSlyogmTN eV5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=54O7y5F6cil48JbVjJeuP4tBSWG4MHFPBxntrZflWpI=; b=PG4dgXI4rQzSgmHQ2GXvMiZVZ9VF0mwiBE3Lgbn4AuPENz6n1oa/F/WDtpmmA2qHsf /AYJ9HtvS3LX//CoUw2KE3BRQufsPFXFFW2NnsHJqyTF3ArKWSnXhbU1b8TcotyvGzM4 ZIeGT4dNndhdcVe9+OckdymCkg3jUCNdtb/dYmZ6AawkMljLDLFsHi4B10gQSNsCqkrw dp583aJcgiCXBfqmr/pGb/pTWw9ZWIqnbrKlLv9KCGiAQbxG9vjeRmCGZV+9U5ojJohU EaJ9BhI9/Qlx4dLf5HS7T7FUBkaf+t62u0POtWp7mDt2F0zJYjzerPXN84Tpe9pw8qeo JDrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UV1GmcKa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a10si4059387oil.167.2021.11.02.04.47.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 04:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UV1GmcKa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhsGi-0002iS-N1 for patch@linaro.org; Tue, 02 Nov 2021 07:47:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhrhA-0001Ov-RH for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:11:12 -0400 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]:34342) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhrh9-0001y7-6R for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:11:12 -0400 Received: by mail-qk1-x72d.google.com with SMTP id bq14so7755137qkb.1 for ; Tue, 02 Nov 2021 04:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=54O7y5F6cil48JbVjJeuP4tBSWG4MHFPBxntrZflWpI=; b=UV1GmcKaWi7JsNo+xvsGQ3x42SkuHFt3TcH5c6MUvKIPtpGwpPELiaiEqsA3h/I+XK M779cpi6fDos5n9VSe13JQXff/YwkQrxD38j8YgPzAqBgPifyoEn/Twc0UfMtBoS2Off 3n32oUdiEypbw6sle7Bo+m1Cwdn6P8KsIftcFwRXeFiU9n+TM1WxDEN4p8k/2n1XqShD xGKmtL3ECFxfcFXDhSzNvaxQP37mzJTq55G0PPZvZfXNJf+aI84xlUfkZRniesOug/qC l5HudRzbxjyAN8YJLxW5Py3lAdUw98U3waDa9eGkm2yCmGYDDci2mUDPw1USfC4/rZCA ljxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=54O7y5F6cil48JbVjJeuP4tBSWG4MHFPBxntrZflWpI=; b=6J9OOGEMIwLtCwlRID+heCiBHtDtruvAUv7Ixfc4/h5UnHHVlNEDEHrhH3ChHjW0wd ml8cNEBwb/YQJMuNGP2i1d8xUkAR1LE5qKwnlEuGPO20t4nRP6bZHCSGw/n0oIh/jTzn Vs0hsWAs8xgmXPYhRBKGzGqcSa/4vTe6EiCyJ3MmF9FLf2AFF/6/fn/Xh5z2tHQE0UA2 7g1L2HzzXmoLh1GaUn87/ITUxncgXkmmxlwv3k0Uf2usBIMqZHbbbSNy6meOyfv11/iq oLLSuLeor3b71IzCgPWc4ZcudH9DXO89eWwBfJPCPta4vAThtcty6Ue/uBRwkejg6tah v6Bw== X-Gm-Message-State: AOAM533L/CHV+2rjORGOAp24ATFQQ3qq+gMeQxM1YIkhV60Dqa7b+gKq 3Yjx3HArW/GZb8GJcKXXyGHECDgdwKM+HA== X-Received: by 2002:a05:620a:d96:: with SMTP id q22mr28577214qkl.219.1635851470234; Tue, 02 Nov 2021 04:11:10 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id bm25sm12730854qkb.4.2021.11.02.04.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 04:11:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 48/60] target/ppc: Move SPR_DSISR setting to powerpc_excp Date: Tue, 2 Nov 2021 07:07:28 -0400 Message-Id: <20211102110740.215699-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102110740.215699-1-richard.henderson@linaro.org> References: <20211102110740.215699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72d; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" By doing this while sending the exception, we will have already done the unwinding, which makes the ppc_cpu_do_unaligned_access code a bit cleaner. Update the comment about the expected instruction format. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/ppc/excp_helper.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b7d1767920..88a8de4b80 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -454,13 +454,15 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) break; } case POWERPC_EXCP_ALIGN: /* Alignment exception */ - /* Get rS/rD and rA from faulting opcode */ /* - * Note: the opcode fields will not be set properly for a - * direct store load/store, but nobody cares as nobody - * actually uses direct store segments. + * Get rS/rD and rA from faulting opcode. + * Note: We will only invoke ALIGN for atomic operations, + * so all instructions are X-form. */ - env->spr[SPR_DSISR] |= (env->error_code & 0x03FF0000) >> 16; + { + uint32_t insn = cpu_ldl_code(env, env->nip); + env->spr[SPR_DSISR] |= (insn & 0x03FF0000) >> 16; + } break; case POWERPC_EXCP_PROGRAM: /* Program exception */ switch (env->error_code & ~0xF) { @@ -1462,14 +1464,9 @@ void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, int mmu_idx, uintptr_t retaddr) { CPUPPCState *env = cs->env_ptr; - uint32_t insn; - - /* Restore state and reload the insn we executed, for filling in DSISR. */ - cpu_restore_state(cs, retaddr, true); - insn = cpu_ldl_code(env, env->nip); cs->exception_index = POWERPC_EXCP_ALIGN; - env->error_code = insn & 0x03FF0000; - cpu_loop_exit(cs); + env->error_code = 0; + cpu_loop_exit_restore(cs, retaddr); } #endif