From patchwork Tue Jan 22 12:20:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10776259 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 2B2971399 for ; Tue, 22 Jan 2019 20:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1676D2B7D4 for ; Tue, 22 Jan 2019 20:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06BDC2B879; Tue, 22 Jan 2019 20:56:44 +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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,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 801C62B7D4 for ; Tue, 22 Jan 2019 20:56:43 +0000 (UTC) Received: from localhost ([127.0.0.1]:49621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm36A-00031l-6a for patchwork-qemu-devel@patchwork.kernel.org; Tue, 22 Jan 2019 15:56:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm1r4-0002el-Tm for qemu-devel@nongnu.org; Tue, 22 Jan 2019 14:37:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm1r2-0004B9-97 for qemu-devel@nongnu.org; Tue, 22 Jan 2019 14:37:02 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:35196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gm1qx-00043p-6Y for qemu-devel@nongnu.org; Tue, 22 Jan 2019 14:36:57 -0500 Received: by mail-pl1-x630.google.com with SMTP id p8so11974376plo.2 for ; Tue, 22 Jan 2019 11:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7AMoONMkuWyVTCRjWs5bYL2pa5Dg6sAqJ865V0R8X/k=; b=sh8wG4XHKJCljlVFliKeMMUv9bcuDUPRee/Olvv+abnaZZDsceY1Pm3FH7ONa0GSdc PX2F8AGz9vajL0lmSdx6t3PyTfPtNQuGSCDOVYOfQk36CI432JPRL2ZP3KrwtzqLueln 0jkGBGJCeOFnR1vk9X1NInkXjh5APmeCvN/xnhXQBbfVL+oTHLz1itMSFcHw3DG+ip2g pPqrUEcnbA71yDv8c9mmag2XEC6rcYV/E7SvJIY58Zc4pshaCgwP4hMq2Eo64JOPbLOx Ob9ZcUIxM4LaLjRuGy64XrsiZk1J6ft2KIoBgntb43PbOQuAqhNIwT6GyYDRUkAZs/Uy PC6w== 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=7AMoONMkuWyVTCRjWs5bYL2pa5Dg6sAqJ865V0R8X/k=; b=AzAVdryueNrMmRwNBmc3Zwr8RHYm5vuH8RXeRBYsf6PIEtQ03ifLDCcQBu16IDU0hR iz7ub86BDaFufuC9T2ghgoWlWYKnw94zRaHj0RwzGbwdkZFx1p9i4cihjRbbSK7D5bjt 0Kmfyj3lCvZE0seDdqVtUgtXdAUUlSJxl9nq8icOEiU3AxnFfd+gQMtCD5NOi6sUGkBE JPowmYMUm5WQEG+VVBHqo8A8eDjdpIO/Q9IzTOUOYzQFstnBoTMbOUuKFP5T6522nLuD 3SXjAqLNxBObdEBL6A8lka5HhmLWZKro1GcAmCAK83iVIV++yDwYZX1qRxAxD2pcwQwl 6T9g== X-Gm-Message-State: AJcUukeYJmVsckhoWMJoDJvxFK+HjguJj8nwpkuDXRZJptQ371zJ6zuo uHfG7Jurm3sGzRH89L0I8ExMoDZQbyo= X-Google-Smtp-Source: ALg8bN52TdLJKAHtWDdxkAPUPmJCYnhlBM7B2FX+ZC0wyKnaLC7dFHAd+P3n7cA6DElfZNqFGIIvQw== X-Received: by 2002:a17:902:1101:: with SMTP id d1mr33753942pla.136.1548159713154; Tue, 22 Jan 2019 04:21:53 -0800 (PST) Received: from localhost ([149.199.62.129]) by smtp.gmail.com with ESMTPSA id k15sm23790907pfb.147.2019.01.22.04.21.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Jan 2019 04:21:52 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2019 04:20:46 -0800 Message-Id: <20190122122048.10845-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190122122048.10845-1-edgar.iglesias@gmail.com> References: <20190122122048.10845-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::630 Subject: [Qemu-devel] [PULL v1 1/3] target/microblaze: Switch to transaction_failed hook 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell Switch the microblaze target from the old unassigned_access hook to the transaction_failed hook. The notable difference is that rather than it being called for all physical memory accesses which fail (including those made by DMA devices or by the gdbstub), it is only called for those made by the CPU via its MMU. For microblaze this makes no difference because none of the target CPU code needs to make loads or stores by physical address. Signed-off-by: Peter Maydell [EI: Add space in qemu_log()] Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 2 +- target/microblaze/cpu.h | 7 ++++--- target/microblaze/op_helper.c | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 9b546a2c18..49876b19b3 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -297,7 +297,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = mb_cpu_handle_mmu_fault; #else - cc->do_unassigned_access = mb_cpu_unassigned_access; + cc->do_transaction_failed = mb_cpu_transaction_failed; cc->get_phys_page_debug = mb_cpu_get_phys_page_debug; #endif dc->vmsd = &vmstate_mb_cpu; diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 3c4e0ba80a..03ca91007d 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -388,9 +388,10 @@ static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, } #if !defined(CONFIG_USER_ONLY) -void mb_cpu_unassigned_access(CPUState *cpu, hwaddr addr, - bool is_write, bool is_exec, int is_asi, - unsigned size); +void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, + unsigned size, MMUAccessType access_type, + int mmu_idx, MemTxAttrs attrs, + MemTxResult response, uintptr_t retaddr); #endif #endif diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 7cdbbcccae..e23dcfdc20 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -486,26 +486,28 @@ void helper_mmu_write(CPUMBState *env, uint32_t ext, uint32_t rn, uint32_t v) mmu_write(env, ext, rn, v); } -void mb_cpu_unassigned_access(CPUState *cs, hwaddr addr, - bool is_write, bool is_exec, int is_asi, - unsigned size) +void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, + unsigned size, MMUAccessType access_type, + int mmu_idx, MemTxAttrs attrs, + MemTxResult response, uintptr_t retaddr) { MicroBlazeCPU *cpu; CPUMBState *env; - - qemu_log_mask(CPU_LOG_INT, "Unassigned " TARGET_FMT_plx " wr=%d exe=%d\n", - addr, is_write ? 1 : 0, is_exec ? 1 : 0); - if (cs == NULL) { - return; - } + 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->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_EAR] = addr; - if (is_exec) { + if (access_type == MMU_INST_FETCH) { if ((env->pvr.regs[2] & PVR2_IOPB_BUS_EXC_MASK)) { env->sregs[SR_ESR] = ESR_EC_INSN_BUS; helper_raise_exception(env, EXCP_HW_EXCP);