From patchwork Fri May 10 15:19:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163881 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp2526857ilr; Fri, 10 May 2019 08:33:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyB8lVZucdugh2HhfKbbXb6oQfbSbp5pAhtUgTmC5jsEEwvNlnci+p3XQ4alU3sqs5zdrDR X-Received: by 2002:a50:abe5:: with SMTP id u92mr6055256edc.164.1557502388649; Fri, 10 May 2019 08:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557502388; cv=none; d=google.com; s=arc-20160816; b=z375Ql2UkL0zox0fx8IrwnUra6k8L5nMfDfndmesLEoIOgx7MiSw8sNxmey0grnvmR UbawbRVbObvzN3G4eX71tOPTagpQiA7jvlWgh6+3hVQ7hFBJQRyVv4YSacnQ1ihgl5gt IkJiXcKy7SmozkQDHMme/+dQ32pdnfVjr1mdMtClneVHflrS2pYp0tYS5pbou4qTLAJT 86yVdCr90V/Nik5KJgb8zW2b60iBFTD4tvH+qGwOWWE4uK+W/WXG2yS8zoZDqK/pGNep IDSUEzy7zkk2KRTnG2coLJ0JJwsnWjpTolkG2NdEaUCrP0UBt2xm06RRE9LFcU743z64 XwmQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=DKsY8PvHhaNCkSB6Fb/0EblqCAuBrJBg6UNbTlsfMg6+XPjp1VllfHSrkJSCcKAlmI qXgVoTm3T2S8r9EZRC/NTy2aacxyVWQ56o9ISr3XnOWCoT8RG8KCWjMhY0VKVDG8Aqrw VGwBzkhGV8JNxsawN7T8XAI4o0bnK1WEF9bli58QpekklMPJCJYvzbNOK4Ryd258I058 mtlu8Q+ZsvE/rP+Pf3Erh5x0SuJgS7hMGkIab9mBFPdIwAM+xAwB9z2zPXqCLo8b+HIk 7bs9Q9K9gsWK0Y8yKu0md6m25bqksJr7wbxO/RBT+vevyPYYhd7H+RpJsfsJWwZf5YVa 8OJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NDxtRjIT; 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 hh8si1024181ejb.66.2019.05.10.08.33.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 10 May 2019 08:33:08 -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=NDxtRjIT; 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]:45164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7WF-0003HU-Gm for patch@linaro.org; Fri, 10 May 2019 11:33:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7JU-0007Rq-6u for qemu-devel@nongnu.org; Fri, 10 May 2019 11:19:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP7JS-0008Lg-Vv for qemu-devel@nongnu.org; Fri, 10 May 2019 11:19:56 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:41797) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hP7JS-0008JL-P1 for qemu-devel@nongnu.org; Fri, 10 May 2019 11:19:54 -0400 Received: by mail-pg1-x542.google.com with SMTP id z3so3174853pgp.8 for ; Fri, 10 May 2019 08:19:54 -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 :mime-version:content-transfer-encoding; bh=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=NDxtRjIT9OwOwhQuz62GbKxNx3/1UWV99hQDQbrbUl+wF85WhiunFo3gRQe5HTaM2z yaEKk8KC6PV2P/UGYI2RSFDhDZq75/roQ6mZuJJNRZc/XosJQzWWuuB0Wug6gKqc2mV0 8sJ8SM83s2wKVm1JrUy11/3lyp/0SdU+9XqUnoj+Hgn7EtwXAIexBd6m4pbyj/6TJ7tJ uovo/1e0mRAd3KOb8ZcG73XEE09pohPxEbE6HsRwnpPrGFRKOkf9cH9YIIXTRUQfdtyT ZR/q0DVxrRwMouujnEU7+bivGIx+lQfnYRq08TAKACRX9AWZ3JGqVxdQuparR3GUtozD ehzg== 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:mime-version:content-transfer-encoding; bh=w7l/Pbs/dkuyE6y60mYyZzngNGSZYjs+O6jEPehbb2U=; b=q09N78clsZDPD0PRmY7m5RgtdUJ2f5Fkwihl9+2wHU3HH7YS5Or21CoJ+WsdD7a5eb Ljp9XIS4rEXWGJtBPrYlX8XDUKUo3/gY7LN7gXGk4yq0I3/TbEsDX57f7K2xuYi6eTg7 6J8m/PzNsXFpBegQnYgB6drFVoivA/cVt9eA3NS2Ol94J6ZgDPdmj65lp8+q2NevxX4u cnjtU7ocqkOxQ1T2Bv6WExPzYrsao1L53s7XwrlNhX0cN9GF+dhxCxyqWhsxYKrwq+xl 8mwzP0uOUaIrX4W8FJTiLpYYn2u2qjbSJ682UenWeiXHyI6xoic+qVB2iT+IsjphMGSo 9JTA== X-Gm-Message-State: APjAAAXmJqtjHqtOAKk63EaBXokM/N9v5doALf622BlIOANavrJUPNmq GemwRpr7mNUkb7IDQ6yVep1L3xTq8qM= X-Received: by 2002:a63:4852:: with SMTP id x18mr980020pgk.14.1557501593469; Fri, 10 May 2019 08:19:53 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id 19sm5920517pgz.24.2019.05.10.08.19.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 08:19:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 08:19:22 -0700 Message-Id: <20190510151944.22981-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510151944.22981-1-richard.henderson@linaro.org> References: <20190510151944.22981-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::542 Subject: [Qemu-devel] [PULL 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: , Cc: peter.maydell@linaro.org 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. */