From patchwork Wed Apr 3 03:43:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 161657 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2514843jan; Tue, 2 Apr 2019 20:51:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqys88m/QzyvhWTZDB7+yeu7YqPuLCxG2nWE17CKKuPP+nnf/5oRtcuElwMNN4EF7LF84KCg X-Received: by 2002:a81:234b:: with SMTP id j72mr60794101ywj.279.1554263472726; Tue, 02 Apr 2019 20:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554263472; cv=none; d=google.com; s=arc-20160816; b=WheS8jPirw+lJvptEUED3yiBlApZfLTBPcSv0EmCOuoMngO60U4NGlLg8SOT3YZcQZ Y3TNNGl3cI83c08FGmzWN1ZOMW97hTavIgwESiM8YHDWqPghRvqqOsx5wJ/8jZ51qkxT ljoUYJ4ZJek2RVmfB6CVtj+Z/QjRl30GpvUmAXx6UWzrKoYyaPbD8Qysz/V5+0WV2Y0m XO8NVwl65EoBRShiJmAbzZzQ40CtChGN5WlaEl8P+t0qeCjT03s6m9QFoZqqAk9GSHsj wu3cFVaOXhLCa9+9G5A/VGz8I0iSSiM3sz5HvApqCEDXuJc6dM01oUkkcXKRJoUq2ICq Xaxg== 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=lVkBfrW6VirLiLfiWJMR0NKgqluxD319D02OYmRqkHk=; b=hXGG6Lb8N7XupO7mimOK4npQEAfXZ7rvL2dwGYIiY+R/8AxbC1KkeRUrNN55PsIzfZ wm4iD6xiMwanYOHo1gDTJR6CBqCkL+RF+RWeibzAltn+UUsbNNu551QFg9+zopVE6FpR 8F2ZZHdmm0chhEjiGj/5UgOyCR/AWRXZMd+de63HhRrCZR4I/+87Z8dgNm/ilXH1VUkk //KAnGM6ysEVJ+wu6YopNUMHRhP8/P92kW7TjChWG1ZDkrS/c+fkoGm2hBdi6boxuatj 4VGn/OffASXlAAdZAVOfCCOdfp5UgxwnSNHcAU+Xn4aSm6mdUT1Ojvw4uvzozcM9OzHU sSbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iCFXyCbS; 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 j11si8822467ybp.27.2019.04.02.20.51.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 Apr 2019 20:51:12 -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=iCFXyCbS; 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]:52816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBWvg-0008WI-7t for patch@linaro.org; Tue, 02 Apr 2019 23:51:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBWp2-0002mr-AN for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBWp1-0008FF-7i for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:20 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:40014) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBWp0-0008DM-Uq for qemu-devel@nongnu.org; Tue, 02 Apr 2019 23:44:19 -0400 Received: by mail-pl1-x642.google.com with SMTP id b3so4337150plr.7 for ; Tue, 02 Apr 2019 20:44:18 -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=lVkBfrW6VirLiLfiWJMR0NKgqluxD319D02OYmRqkHk=; b=iCFXyCbS1vbtRw+2CberFCqQN292mqQlg+9c56VNasnRgL2D0Ud+/Ocq18M4KSn3qY lg31cRrKIWSlxppKaKLclAE5QhQ8YV4MQgMdvF+kd2OBDIoibKLYrtIKjR99wBR6CMGg 7POC8kJX09bBfOLWL4rnyTTYP2an9FN9pRsvxjj3Dlqv25148F//gd7Y8inv+wZLXgax rxKoxEhsmZ+YGLxXr9fXwSiCZdj+4N6gwruAeutb911HX35/w4+lLDG1mbw8XDohT9tl qalTgOyfmwxv0KKRXnM4UNeReLg6+NLH4e3Ts+JvD6w8FhoEjEIUuJwWyKg6ErCCySPV vl6g== 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=lVkBfrW6VirLiLfiWJMR0NKgqluxD319D02OYmRqkHk=; b=ph6DgE7uh3zyPMYOtV1S/734m/zIDu2tur36nPjMaOtqnS2ZgLXa1whyG0UAsRAIez uANIYP4N+2g54n0CGcgqNv2622gLXs+iqUbQOt1mY0Q2fS86A1C2lrlvZVKXNt/HAir7 64ytuqtpvjaeVn1yRGnaCynx2AMfq/oHkT+t8HaklULm8KscNR4LmGlx1IoHH6joX/Ds A9Ocsx3bsMgrH9R0YWgJsVkpMMeMOGcEg9vhYKxameOf6TaFi5i1cJT3JGnaoboBqkqm 4vTjWMGLUi45XEOjTQ6XaQf5ukyRQq7cxCfXtqgTv1v548eACdPlP7jOs2I5g/6vJeQc lU4Q== X-Gm-Message-State: APjAAAVSWdhjpW0tFkVZNyRhlNsKNLPuFtKoSQv0w7sd7FiRqWha1w8m ObwDOjZyJKZMOFHtyN3vHzjtJi4rh+mByA== X-Received: by 2002:a17:902:a5ca:: with SMTP id t10mr26491437plq.234.1554263057638; Tue, 02 Apr 2019 20:44:17 -0700 (PDT) Received: from cloudburst.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id z6sm26753214pgo.31.2019.04.02.20.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Apr 2019 20:44:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 10:43:40 +0700 Message-Id: <20190403034358.21999-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190403034358.21999-1-richard.henderson@linaro.org> References: <20190403034358.21999-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::642 Subject: [Qemu-devel] [PATCH 08/26] target/lm32: 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: Michael Walle Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cc: Michael Walle Signed-off-by: Richard Henderson --- target/lm32/cpu.h | 5 +++-- target/lm32/cpu.c | 5 ++--- target/lm32/helper.c | 12 +++++++++--- target/lm32/op_helper.c | 16 ---------------- 4 files changed, 14 insertions(+), 24 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index 66157eefe9..7cc279bcd0 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -262,8 +262,9 @@ bool lm32_cpu_do_semihosting(CPUState *cs); #define cpu_list lm32_cpu_list #define cpu_signal_handler cpu_lm32_signal_handler -int lm32_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw, - int mmu_idx); +bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); #include "exec/cpu-all.h" diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index b7499cb627..6d2a176c87 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -235,9 +235,8 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data) cc->set_pc = lm32_cpu_set_pc; cc->gdb_read_register = lm32_cpu_gdb_read_register; cc->gdb_write_register = lm32_cpu_gdb_write_register; -#ifdef CONFIG_USER_ONLY - cc->handle_mmu_fault = lm32_cpu_handle_mmu_fault; -#else + cc->tlb_fill = lm32_cpu_tlb_fill; +#ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = lm32_cpu_get_phys_page_debug; cc->vmsd = &vmstate_lm32_cpu; #endif diff --git a/target/lm32/helper.c b/target/lm32/helper.c index a039a993ff..1db9a5562e 100644 --- a/target/lm32/helper.c +++ b/target/lm32/helper.c @@ -25,8 +25,9 @@ #include "exec/semihost.h" #include "exec/log.h" -int lm32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, - int mmu_idx) +bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) { LM32CPU *cpu = LM32_CPU(cs); CPULM32State *env = &cpu->env; @@ -40,8 +41,13 @@ int lm32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, } else { tlb_set_page(cs, address, address, prot, mmu_idx, TARGET_PAGE_SIZE); } + return true; +} - return 0; +void tlb_fill(CPUState *cs, target_ulong addr, int size, + MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) +{ + lm32_cpu_tlb_fill(cs, addr, size, access_type, mmu_idx, false, retaddr); } hwaddr lm32_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c index 234d55e056..be12b11b02 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -143,21 +143,5 @@ uint32_t HELPER(rcsr_jrx)(CPULM32State *env) { return lm32_juart_get_jrx(env->juart_state); } - -/* Try to fill the TLB and return an exception if error. If retaddr is - * NULL, it means that the function was called in C code (i.e. not - * from generated code or from helper.c) - */ -void tlb_fill(CPUState *cs, target_ulong addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - int ret; - - ret = lm32_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