From patchwork Fri Aug 28 14:19:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248565 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1142905ilg; Fri, 28 Aug 2020 07:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSucnGIN5I+HCkpKa4cF0LMexbca72Z2HLA2smJkmUBNutwr+sLgMSS7sFsj2i/orGm+1d X-Received: by 2002:a25:5555:: with SMTP id j82mr3114240ybb.125.1598625854956; Fri, 28 Aug 2020 07:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598625854; cv=none; d=google.com; s=arc-20160816; b=w+VSQmNnOlWz+YLZ/N1wlM1OPFj9pLnN7UBHZu0CUws50660etcWczRfCPU3W1zUvv JWT8YhHRwIrArYU0iOOx8g7B1oZTNCwz2oilIZtH19td2t/gZZ8nsHh1cVpro2IkzdK9 2SNXGfxdNDOuGnBojfcmwOD1AapHYoaMVY5Abn1JZrzZhoeOjvl676LaDGMT2knaBrIj VC09Ehr54tlyQWxAlBRqLYflGXX5JW+fQ/7sgwHfT6SG77/JaaCHFSv6B2GyYdAaiybm PQfHU7KorrYCbLt21qBQ8VKL0J7lTab8QshU3D8AxRgNya/bMdLDWBhVi0ln2lFq/wgI H35w== 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=3LLfQYgaXzGwswhNrhZmalAI0pGPTZAeATntMFf9mBA=; b=JbCwM4FyNiuYCGDtuCCf+GI6YgwVMhjfEiefrRyDVwlyClVkStHikptj+a66XhPO+a gE5cEUoxVEJaKvONeGXE7mufBQ+WiXJn5Dyi7RaYtoClD07mYLmuo7vQL3GsT2VnL42k kMTnCvm600YLq+xtUK56dLcHxevdus0YR8DZ97CfNL5VNrwyneia5umAcE4GSmm9E90R C9pVVkuVGTpFl9nBVjJQ+PtclRKYXV7F3AhQ9X5By5EZ/lJmfb5qCQ9fLBHPmIW74bfr IO54S8C8aU1xmArKHpKbhkP8nLIXBb51oxNY7mUOO0Dx50GVAvjMY53c691ynSZFRwQM S/sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p8ZolXJM; 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 w192si1195289ybg.487.2020.08.28.07.44.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 07:44:14 -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=p8ZolXJM; 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]:54770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfby-0006Ya-E6 for patch@linaro.org; Fri, 28 Aug 2020 10:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfFG-0001kw-Lz for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:46 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:43802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBfFE-0005M0-G5 for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:46 -0400 Received: by mail-pg1-x530.google.com with SMTP id d19so517472pgl.10 for ; Fri, 28 Aug 2020 07:20:43 -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=3LLfQYgaXzGwswhNrhZmalAI0pGPTZAeATntMFf9mBA=; b=p8ZolXJMtqbWdxp2TgJ/MnsPREszLC/33VQrSwh/b8ogsPMlQ8KcP5tzn9J8AbN0dQ yxYJKhALzwWMqQ1MMXPrCpq9fGc0lkgoOmAezD/Oqd2OV0Y5lqn41yo59kr0gYtNCSYE RwsSZRwTTC4I+RQckRdhdxkrXLYmDK307bVykHhddYdxE1hTT34lw3bkLVsFF8TixdFP vIol+jvuMURUOvRX1W5z5M++mL5B40xj7t2HvI2yylFrziA9dB4V56FHOV3lFqbWAGYI UChJYzlQP/111ERmIebkgxtp9Yv2rlEIvUFYG8bnypLhLlhwOMTZeMNBeu7fmtl7LNZ6 Kt8A== 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:mime-version:content-transfer-encoding; bh=3LLfQYgaXzGwswhNrhZmalAI0pGPTZAeATntMFf9mBA=; b=ptCRVC8lUCoFuQk6LWtM8o/dAhTruLoXQOVyiTkhcNOlA9z2HqAxM7jH12FOU7z0XZ odpcCnsLRt8gmQqtBdyhh81MGlCVPU4l5UaU9dmk0khoRASxeY4sNeU9vRY/vk7NmSpd 6E1VbgiwJr0eXmT1COtg1AX/y7pDqhtUkvsoKi5jJoiezz0ZlEjgTKNYMVz3CdnXuhAu QX4dbXF3WvlQNKd12pYcA8txTZVWVWO7Sw3d+vV8uH7ip9pZ1WW10zC8Mw0x4CloKqqG zC9oswAv8wPYpzZiPlBq5e13gQiZLMtEGPPOg05XpXQWnLY8jqyJOEtdxy0dqraN7rmc kXVA== X-Gm-Message-State: AOAM5314ldZZ3VbqL3AnvTMk9ncJ/NTEvZLndngs+HtggtmdsBeoQ+eu GP8m02rBh4yqoErIGWgUZoVbo5/ZsV2WKg== X-Received: by 2002:a65:64d9:: with SMTP id t25mr1496544pgv.70.1598624442623; Fri, 28 Aug 2020 07:20:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id j3sm1403080pjw.23.2020.08.28.07.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:20:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 56/76] target/microblaze: Fix no-op mb_cpu_transaction_failed Date: Fri, 28 Aug 2020 07:19:09 -0700 Message-Id: <20200828141929.77854-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200828141929.77854-1-richard.henderson@linaro.org> References: <20200828141929.77854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do not call cpu_restore_state when no exception will be delivered. This can lead to inconsistent cpu state. Reported-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/op_helper.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index a99c467364..e6dcc79243 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -419,32 +419,33 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr) { - MicroBlazeCPU *cpu; - CPUMBState *env; + MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); + CPUMBState *env = &cpu->env; + qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx " physaddr 0x" TARGET_FMT_plx " size %d access type %s\n", addr, physaddr, size, access_type == MMU_INST_FETCH ? "INST_FETCH" : (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE")); - cpu = MICROBLAZE_CPU(cs); - env = &cpu->env; - cpu_restore_state(cs, retaddr, true); if (!(env->msr & MSR_EE)) { return; } - env->ear = addr; if (access_type == MMU_INST_FETCH) { - if ((env->pvr.regs[2] & PVR2_IOPB_BUS_EXC_MASK)) { - env->esr = ESR_EC_INSN_BUS; - helper_raise_exception(env, EXCP_HW_EXCP); + if (!cpu->cfg.iopb_bus_exception) { + return; } + env->esr = ESR_EC_INSN_BUS; } else { - if ((env->pvr.regs[2] & PVR2_DOPB_BUS_EXC_MASK)) { - env->esr = ESR_EC_DATA_BUS; - helper_raise_exception(env, EXCP_HW_EXCP); + if (!cpu->cfg.dopb_bus_exception) { + return; } + env->esr = ESR_EC_DATA_BUS; } + + env->ear = addr; + cs->exception_index = EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, retaddr); } #endif