From patchwork Thu May 9 22:26:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163781 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp1581251ilr; Thu, 9 May 2019 15:44:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL0JEwor6cjx1txUjYtxlI2i5WFiRVbs1Q+50y16u23FtZWcSoYrb4zPe2gxCNxQm9KSS/ X-Received: by 2002:a7b:c301:: with SMTP id k1mr4468949wmj.37.1557441894435; Thu, 09 May 2019 15:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557441894; cv=none; d=google.com; s=arc-20160816; b=is8T/ymF8FbefDR+9EVNvm6KWv8+4bz70nrYHgAX+EUSdsMSq9nJBgVehti4c5psZ+ y4OkyRKbRGbAlrpv4Dz4NOFuFkdM2D7cEa1P/14zjnjAbAIbzo8WV1FThAVBYkaE0iRa 0p2zKHiU6VAkMOS7Pp8p+zvOk3GFSNpXCHeg3b65WOHYKZJdJbmCI2jwaznM4Y1ST3ZO 8ubssWSvFwIN6nud/QRMGntb6FkfUkDE5eF96KoQXtD7yvOZi01S7Zl+oXueLUsaNtRs rRP4toG8F2ocCCbhdf0MmUHrJLArpLE5RG+15o0MwWXTziSa7au7mLoDpVHwQHGJ0MBy uANQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=mO9SG/KDn6Z2XkdZi0vVeuMkQ/HJNb3IP/UJIvyk/cdBCibhzrwUWFsFxHxXKTaQgT t3WaHE0YUdnlgv6MMGOE2rzjn5v0ClDGWJ75ey9LPtJUHSo0Jc3BnKPrGUFz2Rq+1eW8 qLevQMcs/GYwK/PQ1/TUUEzpYd4zkfqyb9Tj1rwKwe+Hv4TKdNgogdiUKs18w5E7VjS7 U9IjsGQbPwgsybontH5INptnzjF+bQp+0H1K+S/fPDuqwdr3+3mX9XOrZqRsYFkizI4C ho9LyinxVW0GaOJPpw8xamo46CrnHdKXHDWR/Nv81mqru1pgaNlyvs+XVq46aJGoRNVi skmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cF+grQo6; 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=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 g62si2412133wmf.93.2019.05.09.15.44.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 09 May 2019 15:44:54 -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=fail header.i=@linaro.org header.s=google header.b=cF+grQo6; 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=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:33697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOrmX-0006hK-CE for patch@linaro.org; Thu, 09 May 2019 18:44:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOrVL-0007xJ-R2 for qemu-devel@nongnu.org; Thu, 09 May 2019 18:27:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOrVK-0005cB-4Y for qemu-devel@nongnu.org; Thu, 09 May 2019 18:27:07 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:46894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOrVJ-0005bE-UJ for qemu-devel@nongnu.org; Thu, 09 May 2019 18:27:06 -0400 Received: by mail-pg1-x542.google.com with SMTP id t187so1908435pgb.13 for ; Thu, 09 May 2019 15:27:05 -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; bh=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=cF+grQo68Bk3UiRIPZiIGyy8MYaUpqaiNh9SDWNHZv6q/2IcdRSQLapaQl3GMeRPL+ 5oiL1cEsHlBSjudZVvZtG2Fu6utCOK2+Jl3dRx9DoXgHY35WT4Lb13JopQH4TYf1yep4 nmlypSkZ8Ga5hYM0yWxEWZcy7LaovC6X8Qe3lNy/HJwRIOaFfx/Z4f104otmVjH1RRgg Rzs3Iz4nStxa9Y/ifkA5wrn4bqYd4EY/0vdBl+e1lO5OQ5tjcvipi+WjdhJQL48TYwVR nKzxcqsTxKxzRORdlCqhFjmL+aXG5e3jRbrs0uR8Cb5RH3MoUVKyM9kgS/mRgBWulBPJ GaBQ== 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; bh=LTrRBAzo3ZXhs7/OIQshe/0vUKzYgpD3ylIgF8SzGa8=; b=H7EcC/NH64S/SWVjqnHiRxul8pWC/0++zjvy3ymliPNiVmfmiTJvECqftkaWXWg5Bx zzq5FIZLfEyx+Qv0WcFS23xVoBXZtx8jpRo3YzYKR152bIrxxgkDEj5LEAWJDrj9PVd9 a/df+r9chLCs7Ou2K9sgwppmtpsvrvLP6WYrP3GzQe4i9u0eRkVZzcQ0smE2w42xr5Wp 4Q+u/7NTszXJHZ2G19iu7hlbBCANy51V5Xba04Xd0M6lHYihpKhVs/fSCOgfF1EHTsme 1BhkIJx11cCZvOJ4FmYuYVfkmJIyI06IWKQBK8dUIDtUFrgrxGPj1yqef8vRcdyrnjb/ Yojw== X-Gm-Message-State: APjAAAXC1yf8mNxCAf6oD45TkLYfuNhyF5nb6PXvtfIS/FVASVcwh9Fe me8cKM71Rwtp62n+XtEW4ui2ZXgKCgU= X-Received: by 2002:a65:48ca:: with SMTP id o10mr9091642pgs.136.1557440824221; Thu, 09 May 2019 15:27:04 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id m2sm4490521pfi.24.2019.05.09.15.27.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 15:27:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 9 May 2019 15:26:27 -0700 Message-Id: <20190509222631.14271-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190509222631.14271-1-richard.henderson@linaro.org> References: <20190509222631.14271-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v3 23/27] target/unicore32: Convert to CPUClass::tlb_fill 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: Guan Xuetao Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove the user-only functions, as we no longer have a user-only config. Cc: Guan Xuetao Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/unicore32/cpu.h | 5 +++-- target/unicore32/cpu.c | 5 +---- target/unicore32/helper.c | 23 ----------------------- target/unicore32/op_helper.c | 14 -------------- target/unicore32/softmmu.c | 19 +++++++++++++++---- 5 files changed, 19 insertions(+), 47 deletions(-) -- 2.17.1 diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h index 24abe5e5c0..f052ee08bf 100644 --- a/target/unicore32/cpu.h +++ b/target/unicore32/cpu.h @@ -178,8 +178,9 @@ static inline void cpu_get_tb_cpu_state(CPUUniCore32State *env, target_ulong *pc } } -int uc32_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw, - int mmu_idx); +bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); void uc32_translate_init(void); void switch_mode(CPUUniCore32State *, int); diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index 2b49d1ca40..3f57c508a0 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -138,11 +138,8 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data) cc->cpu_exec_interrupt = uc32_cpu_exec_interrupt; cc->dump_state = uc32_cpu_dump_state; cc->set_pc = uc32_cpu_set_pc; -#ifdef CONFIG_USER_ONLY - cc->handle_mmu_fault = uc32_cpu_handle_mmu_fault; -#else + cc->tlb_fill = uc32_cpu_tlb_fill; cc->get_phys_page_debug = uc32_cpu_get_phys_page_debug; -#endif cc->tcg_initialize = uc32_translate_init; dc->vmsd = &vmstate_uc32_cpu; } diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c index a5ff2ddb74..0d4914b48d 100644 --- a/target/unicore32/helper.c +++ b/target/unicore32/helper.c @@ -215,29 +215,6 @@ void helper_cp1_putc(target_ulong x) } #endif -#ifdef CONFIG_USER_ONLY -void switch_mode(CPUUniCore32State *env, int mode) -{ - UniCore32CPU *cpu = uc32_env_get_cpu(env); - - if (mode != ASR_MODE_USER) { - cpu_abort(CPU(cpu), "Tried to switch out of user mode\n"); - } -} - -void uc32_cpu_do_interrupt(CPUState *cs) -{ - cpu_abort(cs, "NO interrupt in user mode\n"); -} - -int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, - int access_type, int mmu_idx) -{ - cpu_abort(cs, "NO mmu fault in user mode\n"); - return 1; -} -#endif - bool uc32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { if (interrupt_request & CPU_INTERRUPT_HARD) { diff --git a/target/unicore32/op_helper.c b/target/unicore32/op_helper.c index e0a15882d3..797ba60dc9 100644 --- a/target/unicore32/op_helper.c +++ b/target/unicore32/op_helper.c @@ -242,17 +242,3 @@ uint32_t HELPER(ror_cc)(CPUUniCore32State *env, uint32_t x, uint32_t i) return ((uint32_t)x >> shift) | (x << (32 - shift)); } } - -#ifndef CONFIG_USER_ONLY -void tlb_fill(CPUState *cs, target_ulong addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - int ret; - - ret = uc32_cpu_handle_mmu_fault(cs, addr, size, access_type, mmu_idx); - if (unlikely(ret)) { - /* now we have a real cpu fault */ - cpu_loop_exit_restore(cs, retaddr); - } -} -#endif diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index 00c7e0d028..13678df4d7 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -215,8 +215,9 @@ do_fault: return code; } -int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, - int access_type, int mmu_idx) +bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) { UniCore32CPU *cpu = UNICORE32_CPU(cs); CPUUniCore32State *env = &cpu->env; @@ -257,7 +258,11 @@ int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, phys_addr &= TARGET_PAGE_MASK; address &= TARGET_PAGE_MASK; tlb_set_page(cs, address, phys_addr, prot, mmu_idx, page_size); - return 0; + return true; + } + + if (probe) { + return false; } env->cp0.c3_faultstatus = ret; @@ -267,7 +272,13 @@ int uc32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, } else { cs->exception_index = UC32_EXCP_DTRAP; } - return ret; + cpu_loop_exit_restore(cs, retaddr); +} + +void tlb_fill(CPUState *cs, target_ulong addr, int size, + MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) +{ + uc32_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr); } hwaddr uc32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)