From patchwork Thu May 9 22:26:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163774 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp1576418ilr; Thu, 9 May 2019 15:38:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW636eXq/ZCltOFVeHNG9u0qYKB5+Gx4CCqRhNo3hoxTso4gC0xNFeMrdxJr3Tx9FySeZf X-Received: by 2002:a05:600c:24d0:: with SMTP id 16mr4340747wmu.21.1557441531548; Thu, 09 May 2019 15:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557441531; cv=none; d=google.com; s=arc-20160816; b=y+l/Iz5sRonNAbqja2ZdeY9QFjpX0EvRYDXZrbjNXy/SOD2YD+rJb+LFXv5vDmTFqt MjISEiYMmsdbzqegvbbw6X8S8qcMc3huNn3/JBnXeYCRF2/8nF4LhTT5+a9MUJwpQhAw ZuH55VK2W6iejIeIzD+DlBNhnzJFHirfwTFHWlGABjI8/PhJl61t5loxSetoLlszz+JS MiPpHOOquFHg6ZHpP2jPkMWBNO1SnaCpgX03Du3RSuvJc05BqtglWE52k5Gp+nlwYrN0 3nvPkKczY21m6qvFFEQHp0LbtWZpmVBgtvslGzpXlEBWla/0p8OkeRZ43WD50ckOJC34 oS7Q== 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=JOFCQgP5S2JrD2gUpJ9vr7Hoj9w8NiFC3+n7RY5rwwehlnhZXTA+JCkW3bxPX0J8kN gZmbmfs8Q9Z7NR/FofbWzSmcL5LterZXHoajo3cESkHWTWnXdadkIoVGBijddgnmOTzZ pYccDAOrTv+tglUtmk5G9o2KkafCTTUPrlhlhBAGVXhwDp/m367iQpSTGJFRjva2aX9q /8w7M34ZTpGbQYl0TkSIPp7CA3TmHOUYTPdfZNBE/ZkZXLGgrU3rhnQ9Y27BknBUbAPL +fA/5+JkszakhLUF0IWswf67sj21O9jD/ENTHvAi+Q5/OEqXeoRMVqPAYRYf8ErUhfzf 84Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TtW+NYND; 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 p123si2466793wmp.102.2019.05.09.15.38.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 09 May 2019 15:38:51 -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=TtW+NYND; 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]:33595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOrgg-0001xR-4Y for patch@linaro.org; Thu, 09 May 2019 18:38:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOrUx-0007aB-Bu for qemu-devel@nongnu.org; Thu, 09 May 2019 18:26:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOrUw-0005Qr-1c for qemu-devel@nongnu.org; Thu, 09 May 2019 18:26:43 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:39155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOrUv-0005P2-RY for qemu-devel@nongnu.org; Thu, 09 May 2019 18:26:41 -0400 Received: by mail-pg1-x544.google.com with SMTP id w22so1921338pgi.6 for ; Thu, 09 May 2019 15:26:41 -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=TtW+NYNDOszgF0iWYwepmGwixWdz2R6GPuo/Te+ipyW7AK4r89WXiwtAc2KhtLrZip GTK1dCsyCdQouNJSChFf+8eYhk6o3NSxm+oR7saVWTUzAejQO+sSIrRfoJJYKQEwDOn4 qN0Fkp6dYvuUUMez+S8MT4EGDbYBT/nBFV62IIbA06UvVbNFQ3MJQQ7n3Z1rW9CAmGbT 5fX22i/wtDuSl0jJSnMD8az7oKpslmFQExc4n1cf9R2dduW2+N79qoZl7bTs3MbEeYPw 6TeChUd8As8VZyIS2jyfLO3IxOMoR2UImr0r3lEmXMU8OSO/v2gpL8oGK3fMn8nJ47IA FKgg== 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=rCj+jnxloqnpyfrWWeBuN+B6/K43krilAr5Ai1LZVXGFU0IR+K/9F45sp62vvHE8wS JLOzFshRH9tDyQBIFBAbb8o+fzc6OnqZL7540gzxymfe8xqSdCI1g/ZFuSWUWUJD+/ri Ws2o5a82P4dC5hkBI5Q6jrx10Ne/Q0Qi6sWdnmFlI1kkLGBoCEXTB7ISeYyJ1Enn87UH xsN+1kuPscTckBoumRbqyCagFMZb731Sj4tWnxhy1RMPcwBBcLYeTAZjt/eCImmZTztw DERuKk1z/Mf7c3bKqX1etpxk+TmL07cF80wOY45G3/RmSFAVwGx04CVRcnSyWwbA5tvb ZrAg== X-Gm-Message-State: APjAAAVmGtUwqcYZ5AdMWGMoLxERTjP7krZCO/tkueusK7MdUQaLeNgu 01NjpYz2bwhyH2obAluGQHk0ZB60fh4= X-Received: by 2002:a63:2bc8:: with SMTP id r191mr8957557pgr.72.1557440800397; Thu, 09 May 2019 15:26:40 -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.26.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 15:26:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 9 May 2019 15:26:09 -0700 Message-Id: <20190509222631.14271-6-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> 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::544 Subject: [Qemu-devel] [PATCH v3 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. */