From patchwork Thu May 9 06:02:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163673 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp548254ilr; Wed, 8 May 2019 23:12:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD8mAw/b+VEq+DrsQE4NUGnt/kKYXuPD3SitlAvZthts+J0IzQlLPmf8REbhKhZ4pz647u X-Received: by 2002:adf:b458:: with SMTP id v24mr1496111wrd.46.1557382357313; Wed, 08 May 2019 23:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557382357; cv=none; d=google.com; s=arc-20160816; b=jxJ7hstMIqXloMmtyEMYFMx+pGq9NXDn1nNZ6UCs0BydImIvFqECpNBYzVcbNQL168 Bs5ixtYRcDuXP55Okug83+rwwPZV1u+yEoAEkRbFEXsodd5X5Pg5003UM30EnVN07Xx2 cikYelhtFJQojDbKgQvYXCC6Kqk+fdKLnAgpE0vHWXO3e69wVejP95vba4Q0O7POBA63 N/0o2NNh30A2dqdnDnOCSE+FxqwUBlLxL6vB09m80B0dHaP0gGkroji4b2jZUciKxtk0 lJpfh5onLDwBGTvPicFisG94wruaUB1EM010tZAoZfhguQhOMCWzhRYCJvSiJWZX7PFr wwog== 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=KDWMmeXDxeYaDrbtpgauY6pAF7pSEhxca7JLZhrlUgE=; b=UF+ulfbyp76UJK+O/VfZFcOFihGxCga3TFv/EM0ClJ94KgZZYlR5GgFRY+4tIDbjad PS+n3N59E+BhRW4unzsNDeCGQwAH+6r34dmmxDKg97weus2K3hHA+wjrm6rnhShFoUe9 IV3d6o5Q7bxqqZ4HDipiazOkgYQN4cZsFeGlrYQtRZxXmSDjrBx17aVvsp+KKmooL3Hu bM44MS46QXJmGhpp3BOlGK3cmuYvdEmyJMsXcQ4Z8OvO/P58qxBCSxmq5+ptLS/efoup crqNGatyGFAkpf+6FI/05+uPYcrrYIAbANZp9RbFFPgCzQkxBJSf6xuz07E0wcvU8X9P mOzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="r/a7l2V6"; 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 v12si546552wrs.123.2019.05.08.23.12.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 May 2019 23:12:37 -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="r/a7l2V6"; 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]:48704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOcIG-0006pM-8P for patch@linaro.org; Thu, 09 May 2019 02:12:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOc8z-000600-H9 for qemu-devel@nongnu.org; Thu, 09 May 2019 02:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOc8x-00074x-VO for qemu-devel@nongnu.org; Thu, 09 May 2019 02:03:01 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:38534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOc8x-00073v-4F for qemu-devel@nongnu.org; Thu, 09 May 2019 02:02:59 -0400 Received: by mail-pg1-x541.google.com with SMTP id j26so630969pgl.5 for ; Wed, 08 May 2019 23:02:58 -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=KDWMmeXDxeYaDrbtpgauY6pAF7pSEhxca7JLZhrlUgE=; b=r/a7l2V68fV6NQ0oPdyGrUs0Miq1msJnGH2RSeoex3VTNdpUyuuV3GiwYwWtUKr5df yIwTT2rh4mat2NaFfHO6ZBNyPNDp95BOQe+cd2SvU3M72w02Dxd3a70Ln8yGHeSgaRXQ wStn/4YWNn3QHVNuHHKnglay0jBmwr3GbSgqZ7Hkg/f4rUiOFcKQwjQvGcZwnn6WszeM xGYGwAasB5aKSw3Yva8Wwkd1Tx1Lj8AxOCUSgBKC7J1bHvJk9o6qAjhqDE/IedhnjWR1 N2M3akcUBj1dsFlP6VZSkL5S7bZ8mLW/OjMWQXqXlIgDAMaFQoTCY7dQgreIcBfokzo7 AlwQ== 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=KDWMmeXDxeYaDrbtpgauY6pAF7pSEhxca7JLZhrlUgE=; b=L5YSm25K9MH4iba92XU92zUDDqhx1RuunZiu/AU+GTmryPhq2MWbd51pRRUQtZGuTi +xNquT4ojH8T2jrtijGPUxvFFM/XTqVPQUS7b6hD4skyM6otyAE947B+cgjgP8cvq2N5 4CHdUNn6LIuavuDG4Iy12bPnKVAk3Iwe8hWs4XJqEQqznUmJ9VEqS64FY7K9poALXGbP UsTgMd1nGSsJKmIRf0CK5NCv9IIjDzkOTU8xkBgXX+/xNHnWRxWCLBukc/ZxgF8+i41M ts2/ydGKGzq5i18vl7FEh2x1E5frNYJBSpnkiUXs1ODDyqXiPBSD2rAbe319TxrtW3J1 NRWg== X-Gm-Message-State: APjAAAVyiZlXkaNQjpSEiHdfK29xX1lWHZY/FiUKVgBKAAODLaeCPJe2 vAs/+6QkU6Q10bBUPf0aQrcOSP++ip8= X-Received: by 2002:a63:fc55:: with SMTP id r21mr3101581pgk.441.1557381776890; Wed, 08 May 2019 23:02:56 -0700 (PDT) Received: from localhost.localdomain (97-113-27-95.tukw.qwest.net. [97.113.27.95]) by smtp.gmail.com with ESMTPSA id n7sm1496109pff.45.2019.05.08.23.02.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 23:02:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 May 2019 23:02:26 -0700 Message-Id: <20190509060246.4031-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190509060246.4031-1-richard.henderson@linaro.org> References: <20190509060246.4031-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::541 Subject: [Qemu-devel] [PATCH v2 07/27] 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 Reviewed-by: Peter Maydell 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 diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index 9b1e6c2d58..d224d4426e 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -261,8 +261,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 282da19994..57c50c1578 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -231,9 +231,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