From patchwork Thu May 9 06:02:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163664 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp544489ilr; Wed, 8 May 2019 23:08:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6WlKLx6b0kB6Tqed4jhDu8MVCY5PEBuKw40re5Mm8403aIoRTarACDcjin/GQemgwy1KI X-Received: by 2002:a1c:20c9:: with SMTP id g192mr1339275wmg.76.1557382120419; Wed, 08 May 2019 23:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557382120; cv=none; d=google.com; s=arc-20160816; b=haygTqQkHP9EXnzSPaIBdZ7ACpMcV01N9GKWyZNMlHNI3CGmgS4kIPl70qCi1YqxUp ide8ktPKQkXmY/4HVdlz3klDIPxH8ENq+wkO0f37elilr2vqnLp59+Q7+ehfBDjoBoi1 S4qnaQg0wc324l1W3NM19g0jwsRpK6OMwlBbL+oh6KEJKC+PYj76L6n1XYRXc5yf1cp1 ArSQwIpjhIoapxb72lCvt1UDO0opsb4VWM7g1zt8WMlERqOlBmQ/CMy43YRG4Xx6+3aU t/hVWLeJfaQ/gDrIOO+tw3SzAR/MQ062t3HYKOWfm87KiGzj+nv5nt/pya7OQVGdOgj2 34PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=TSwkpgZErrPWEpCcQjciKuQLRrZVGq9UoCjibXCz1FGAikuZ2dnN81TxK8pzzvBKzI bzWi3SNH/qWPmLsKN7Yt/K6eNrYzQAWIkLMAAg9C7mwXmFRFfTkQVzhwQQ4ol8TGvQRc /mv+GfFfw7GmQQfoD3GHN0WSp2jPLp6jcHjBqOl9mTUOZxfg+FCg7XjxJtByrPKFZxsr w959CqlDLr/chqA5TeWKrLPlXeKr5HC6ZPnGUwCsPAH+1xPX4XDhJH/oAMfKy+Gm8Qcd 94R5ULBEVsibTxZr49Q+8WYBNj0PZrOIP5Q68lyf21FBKrc1Fpo9pfg83Th0uEQJEq2N 690Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Rb51GKEk; 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 s135si807895wme.92.2019.05.08.23.08.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 May 2019 23:08:40 -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=Rb51GKEk; 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]:48639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOcER-00030y-88 for patch@linaro.org; Thu, 09 May 2019 02:08:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOc8w-0005yv-GB for qemu-devel@nongnu.org; Thu, 09 May 2019 02:03:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOc8t-00072s-Sj for qemu-devel@nongnu.org; Thu, 09 May 2019 02:02:58 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:41593) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOc8t-00072d-N3 for qemu-devel@nongnu.org; Thu, 09 May 2019 02:02:55 -0400 Received: by mail-pf1-x443.google.com with SMTP id l132so714818pfc.8 for ; Wed, 08 May 2019 23:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=Rb51GKEkncGqGkbD0+hvkPavsJzccUSgbc9MBU86m7rUcT2RRJe0qvbRHy8/Imjdsa 2DkXSAzUL2Iog5PG9JNk0oQdRmzNBbDJ/aEqmPlFE/0S+LyIzs/DBSxjGysTAWWFQ9F6 DXrnB9qiuJWKw16zXIbE1EhnNrsAd7PmVByCf15lYL0pO32rIt34clbmYjOwr55A5IZJ vh3vRbK/yqwJ902DzW+l1n9QyqrXTbl0/pha/HIFzrEleIAhuKsMPv/KU1gePXGUT5v4 Q5N+8HCn/JibJJMKyjIm9H6EUdP4dEvANDCtKaBz4LumAC+zVkOWZPkgvyXjifz6YDGg rZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=MqZX61+/+b39h5n7NvOxmDDY7r+g4fRsaf4oocMCjHyOzhy2zDJyi1yy0DOIuqqgCL YOWlLIKuqwGNrsxt856N+Tebq+7AAeHcyNcsjV3HqUNP6nDTCb7h4dIXPNfwqRFKroAM gjyFwwuQRixmOEhiCCKqLvfvsG+3Rdp3oNcRwFDqRG5knmuwVxd8K0OuUdvhNvgyQY27 ZwBcTPLVoRVo4Sy6YJiWoDDZyhlzVhk/8ZM551szABnhqPz0GjrrkKSoHMofYbVBrZ+B 13rFT4OQEiuDrN9Zxb3H/KyJxfWG4qmksgkbUlQtvjghd+6BGVvBl7Mn2OVZBNPoBxde 2aQQ== X-Gm-Message-State: APjAAAUO5l9xWwyiaXRcJ0db0jHYl54YjpR0KVi3vYBGmyjPF2C7No2+ xwGEHAw4TITO0CZpLd27en8HcaMcBnM= X-Received: by 2002:a62:fb0a:: with SMTP id x10mr2521061pfm.179.1557381774503; Wed, 08 May 2019 23:02:54 -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.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 23:02:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 May 2019 23:02:24 -0700 Message-Id: <20190509060246.4031-6-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> 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::443 Subject: [Qemu-devel] [PATCH v2 05/27] target/hppa: 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 8 ++++---- target/hppa/cpu.c | 5 ++--- target/hppa/mem_helper.c | 22 +++++++++++++++++----- 3 files changed, 23 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 923346adb6..c1e0215e66 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -360,10 +360,10 @@ int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); void hppa_cpu_dump_state(CPUState *cs, FILE *f, int); -#ifdef CONFIG_USER_ONLY -int hppa_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, - int rw, int midx); -#else +bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); +#ifndef CONFIG_USER_ONLY int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, int type, hwaddr *pphys, int *pprot); extern const MemoryRegionOps hppa_io_eir_ops; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index e64f48581e..9717ea1798 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -163,9 +163,8 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) cc->synchronize_from_tb = hppa_cpu_synchronize_from_tb; cc->gdb_read_register = hppa_cpu_gdb_read_register; cc->gdb_write_register = hppa_cpu_gdb_write_register; -#ifdef CONFIG_USER_ONLY - cc->handle_mmu_fault = hppa_cpu_handle_mmu_fault; -#else + cc->tlb_fill = hppa_cpu_tlb_fill; +#ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug; dc->vmsd = &vmstate_hppa_cpu; #endif diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 77fb544838..5cee0c19b1 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -25,8 +25,9 @@ #include "trace.h" #ifdef CONFIG_USER_ONLY -int hppa_cpu_handle_mmu_fault(CPUState *cs, vaddr address, - int size, int rw, int mmu_idx) +bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) { HPPACPU *cpu = HPPA_CPU(cs); @@ -34,7 +35,7 @@ int hppa_cpu_handle_mmu_fault(CPUState *cs, vaddr address, which would affect si_code. */ cs->exception_index = EXCP_DMP; cpu->env.cr[CR_IOR] = address; - return 1; + cpu_loop_exit_restore(cs, retaddr); } #else static hppa_tlb_entry *hppa_find_tlb(CPUHPPAState *env, vaddr addr) @@ -213,8 +214,9 @@ hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) return excp == EXCP_DTLB_MISS ? -1 : phys; } -void tlb_fill(CPUState *cs, target_ulong addr, int size, - MMUAccessType type, int mmu_idx, uintptr_t retaddr) +bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, + MMUAccessType type, int mmu_idx, + bool probe, uintptr_t retaddr) { HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; @@ -236,6 +238,9 @@ void tlb_fill(CPUState *cs, target_ulong addr, int size, excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, &phys, &prot); if (unlikely(excp >= 0)) { + if (probe) { + return false; + } trace_hppa_tlb_fill_excp(env, addr, size, type, mmu_idx); /* Failure. Raise the indicated exception. */ cs->exception_index = excp; @@ -252,6 +257,13 @@ void tlb_fill(CPUState *cs, target_ulong addr, int size, /* Success! Store the translation into the QEMU TLB. */ tlb_set_page(cs, addr & TARGET_PAGE_MASK, phys & TARGET_PAGE_MASK, prot, mmu_idx, TARGET_PAGE_SIZE); + return true; +} + +void tlb_fill(CPUState *cs, target_ulong addr, int size, + MMUAccessType type, int mmu_idx, uintptr_t retaddr) +{ + hppa_cpu_tlb_fill(cs, addr, size, type, mmu_idx, false, retaddr); } /* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */