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: 156322 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp8035400jaa; Tue, 22 Jan 2019 12:55:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN46t9dwEzTXfeSq9fwVV8x89DTkc+upo0i90XeP1X/ygH8w4Vgrxm2jgjG2UeOwe6mdmMoe X-Received: by 2002:a1c:2c44:: with SMTP id s65mr75522wms.80.1548190546906; Tue, 22 Jan 2019 12:55:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548190546; cv=none; d=google.com; s=arc-20160816; b=PBf4fWFaP+XgNdc2Jh1ObWYmF3bsqTuszHZa5xF77cXqK2xM7DR6euX/EzaEUw/ctX 44ApXv2+Frle793lyPYNXjGNZZlrFn8Vl4ADlZjMdHz6Q7NlPVX6D2xnwt8AJJcv5bDF 64cDOPLYGfyxq9FMp9CbEobQDT6Rfbu7IDubW2gvAb+nbL/MDy9SAYy7fyN6ohu2JwvB XyGBlDTa+NvzF6joJTm1NlbTjA+Xf6h3sNIFCwAm+tuKyWmcAukwb3fH9sm4LpLiqvd6 +Xcp7DK/DNpzvRD+/9/WpnCCw0bR5Y9m8B5wA/VO9vcsQvFAnlzrFZppWYSRf/RIdCDK 2xuQ== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=7AMoONMkuWyVTCRjWs5bYL2pa5Dg6sAqJ865V0R8X/k=; b=0DGuqLg4UEX+nWoKfmgADU/PV0aWd8e17O2x4vhxR0SON47URKYhZvU8TJGauihSPu dXd9HApjdYBYJWWeu3Nya/nQZk5QnnJ6perI+HN6YGNQlVpKJVsNEnML9snyg0CZumPs CYgWq2tPa5qATO2W9zXJFrTiRFl+TYbtnFpY0sYbMWbQwEKxlr+qAoko+ET4lnDdbK+A XNB/urD7UCEgcwFQhUPmUQWb8AcUj+KLjvamamANJKbayd/8Ecc9GLQCcykEYkWFyC+K 9yi7YpNpwdREktkLE9cRNFVC/aglXyNUcGI55ydCJ+Qp3UdS5vfj04KxbNGk5J9JNOiX jZFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sh8wG4XH; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p2si37913673wrm.14.2019.01.22.12.55.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 22 Jan 2019 12:55:46 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=sh8wG4XH; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([127.0.0.1]:49588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm35F-0001pC-NV for patch@linaro.org; Tue, 22 Jan 2019 15:55:45 -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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.19.1 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);